From c17773306cfd699008adcd5751bfb2a36df85640 Mon Sep 17 00:00:00 2001 From: Robert Beckebans Date: Fri, 16 May 2014 21:50:49 +0200 Subject: [PATCH] Revert "Changed r_useShadowMapping 1: medium+faster, 2: high quality" This reverts commit 87b0040f922f56b8fdfc0390768b5107986af584. Conflicts: neo/renderer/RenderSystem_init.cpp neo/renderer/tr_backend_draw.cpp neo/renderer/tr_local.h --- README.txt | 7 +------ base/renderprogs/interactionSM.pixel | 4 ++-- .../menus/MenuScreen_Shell_SystemOptions.cpp | 10 +++------- neo/renderer/RenderSystem_init.cpp | 3 ++- neo/renderer/tr_backend_draw.cpp | 19 +++++++------------ neo/renderer/tr_local.h | 1 + 6 files changed, 16 insertions(+), 28 deletions(-) diff --git a/README.txt b/README.txt index 72d90daf..4f0081f6 100644 --- a/README.txt +++ b/README.txt @@ -273,9 +273,6 @@ __________________________________________ scene on a GTX 660 ti OC) however I defaulted it to 16 taps so the shadows look really good which should give you stable 100 fps on todays hardware (2014). - The shadow filtering algorithm is based on Carmack's research which was - released in the original Doom 3 GPL release draw_exp.cpp. - - Changed light interaction shaders to use Half-Lambert lighting like in Half-Life 2 to make the game less dark. https://developer.valvesoftware.com/wiki/Half_Lambert @@ -285,9 +282,7 @@ ___________________________________________________ 9) CONSOLE VARIABLES __________________________________________ -r_useShadowMapping 0: Use oldschool hard stencil shadows - 1: Use soft shadow mapping medium quality - 2: Use soft shadow mapping high quality +r_useShadowMapping 1 - Use soft shadow mapping instead of hard stencil shadows ___________________________________________________ diff --git a/base/renderprogs/interactionSM.pixel b/base/renderprogs/interactionSM.pixel index 2dc7b3ac..9e95b3ea 100644 --- a/base/renderprogs/interactionSM.pixel +++ b/base/renderprogs/interactionSM.pixel @@ -272,14 +272,14 @@ void main( PS_IN fragment, out PS_OUT result ) float stepSize = 1.0 / numSamples; float4 jitterTC = ( fragment.position * rpScreenCorrectionFactor ) + rpJitterTexOffset; - float4 random = tex2D( samp6, jitterTC.xy ) * PI;// * rpJitterTexScale; + float4 random = tex2D( samp6, jitterTC.xy ) * PI; //float4 random = fragment.position; float2 rot; rot.x = cos( random.x ); rot.y = sin( random.x ); - float shadowTexelSize = rpScreenCorrectionFactor.z * 3.0; + float shadowTexelSize = rpScreenCorrectionFactor.z * rpJitterTexScale; for( int i = 0; i < numSamples; i++ ) { float2 jitter = poissonDisk[i]; diff --git a/neo/d3xp/menus/MenuScreen_Shell_SystemOptions.cpp b/neo/d3xp/menus/MenuScreen_Shell_SystemOptions.cpp index e2c665b9..5ff9d1a6 100644 --- a/neo/d3xp/menus/MenuScreen_Shell_SystemOptions.cpp +++ b/neo/d3xp/menus/MenuScreen_Shell_SystemOptions.cpp @@ -514,8 +514,8 @@ void idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings::AdjustFi // RB begin case SYSTEM_FIELD_SHADOWMAPPING: { - static const int numValues = 3; - static const int values[numValues] = { 0, 1, 2 }; + static const int numValues = 2; + static const int values[numValues] = { 0, 1 }; r_useShadowMapping.SetInteger( AdjustOption( r_useShadowMapping.GetInteger(), values, numValues, adjustAmount ) ); break; } @@ -609,11 +609,7 @@ idSWFScriptVar idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings case SYSTEM_FIELD_SHADOWMAPPING: if( r_useShadowMapping.GetInteger() == 1 ) { - return "Medium"; - } - else if( r_useShadowMapping.GetInteger() == 2 ) - { - return "High"; + return "#str_swf_enabled"; } else { diff --git a/neo/renderer/RenderSystem_init.cpp b/neo/renderer/RenderSystem_init.cpp index 3dbe155b..9e5c42a4 100644 --- a/neo/renderer/RenderSystem_init.cpp +++ b/neo/renderer/RenderSystem_init.cpp @@ -218,13 +218,14 @@ idCVar stereoRender_deGhost( "stereoRender_deGhost", "0.05", CVAR_FLOAT | CVAR_A idCVar r_useVirtualScreenResolution( "r_useVirtualScreenResolution", "1", CVAR_RENDERER | CVAR_BOOL | CVAR_ARCHIVE, "do 2D rendering at 640x480 and stretch to the current resolution" ); // RB: shadow mapping parameters -idCVar r_useShadowMapping( "r_useShadowMapping", "2", CVAR_RENDERER | CVAR_ARCHIVE | CVAR_INTEGER, "0 = stencil shadows, 1 = medium quality soft shadow mapping, 2 = high quality soft shadow mapping" ); +idCVar r_useShadowMapping( "r_useShadowMapping", "1", CVAR_RENDERER | CVAR_ARCHIVE | CVAR_INTEGER, "use shadow mapping instead of stencil shadows" ); idCVar r_shadowMapFrustumFOV( "r_shadowMapFrustumFOV", "92", CVAR_RENDERER | CVAR_FLOAT, "oversize FOV for point light side matching" ); idCVar r_shadowMapSingleSide( "r_shadowMapSingleSide", "-1", CVAR_RENDERER | CVAR_INTEGER, "only draw a single side (0-5) of point lights" ); idCVar r_shadowMapImageSize( "r_shadowMapImageSize", "1024", CVAR_RENDERER | CVAR_INTEGER, "", 128, 2048 ); idCVar r_shadowMapJitterScale( "r_shadowMapJitterScale", "0.006", CVAR_RENDERER | CVAR_FLOAT, "scale factor for jitter offset" ); idCVar r_shadowMapBiasScale( "r_shadowMapBiasScale", "0.0001", CVAR_RENDERER | CVAR_FLOAT, "scale factor for jitter bias" ); idCVar r_shadowMapRandomizeJitter( "r_shadowMapRandomizeJitter", "1", CVAR_RENDERER | CVAR_BOOL, "randomly offset jitter texture each draw" ); +idCVar r_shadowMapSamples( "r_shadowMapSamples", "1", CVAR_RENDERER | CVAR_INTEGER, "0, 1, 4, or 16" ); idCVar r_shadowMapSplits( "r_shadowMapSplits", "3", CVAR_RENDERER | CVAR_INTEGER, "number of splits for cascaded shadow mapping with parallel lights", 0, 4 ); idCVar r_shadowMapSplitWeight( "r_shadowMapSplitWeight", "0.9", CVAR_RENDERER | CVAR_FLOAT, "" ); idCVar r_shadowMapLodScale( "r_shadowMapLodScale", "1.4", CVAR_RENDERER | CVAR_FLOAT, "" ); diff --git a/neo/renderer/tr_backend_draw.cpp b/neo/renderer/tr_backend_draw.cpp index fd25cb7f..943433f6 100644 --- a/neo/renderer/tr_backend_draw.cpp +++ b/neo/renderer/tr_backend_draw.cpp @@ -1275,14 +1275,7 @@ static void RB_RenderInteractions( const drawSurf_t* surfList, const viewLight_t // default high quality float jitterSampleScale = 1.0f; - float shadowMapSamples = 16.0f; - - if( r_useShadowMapping.GetInteger() == 1 ) - { - // medium quality - jitterSampleScale = 0.8f; - shadowMapSamples = 1.0f; - } + float shadowMapSamples = r_shadowMapSamples.GetInteger(); // screen power of two correction factor float screenCorrectionParm[4]; @@ -1369,15 +1362,17 @@ static void RB_RenderInteractions( const drawSurf_t* surfList, const viewLight_t // texture 6 will be the jitter texture for soft shadowing GL_SelectTexture( INTERACTION_TEXUNIT_JITTER ); - if( r_useShadowMapping.GetInteger() == 1 ) + if( r_shadowMapSamples.GetInteger() == 16 ) + { + globalImages->jitterImage16->Bind(); + } + else if( r_shadowMapSamples.GetInteger() == 4 ) { - // medium quality globalImages->jitterImage1->Bind(); } else { - // high quality - globalImages->jitterImage16->Bind(); + globalImages->jitterImage1->Bind(); } } diff --git a/neo/renderer/tr_local.h b/neo/renderer/tr_local.h index 4f4ecb46..f6e7e7f3 100644 --- a/neo/renderer/tr_local.h +++ b/neo/renderer/tr_local.h @@ -1062,6 +1062,7 @@ extern idCVar r_shadowMapImageSize; extern idCVar r_shadowMapJitterScale; extern idCVar r_shadowMapBiasScale; extern idCVar r_shadowMapRandomizeJitter; +extern idCVar r_shadowMapSamples; extern idCVar r_shadowMapSplits; extern idCVar r_shadowMapSplitWeight; extern idCVar r_shadowMapLodScale;