diff --git a/components/sceneutil/shadow.cpp b/components/sceneutil/shadow.cpp index 0d68ccaa0fe..1d5e5d6209c 100644 --- a/components/sceneutil/shadow.cpp +++ b/components/sceneutil/shadow.cpp @@ -74,10 +74,7 @@ namespace SceneUtil else mShadowTechnique->disableFrontFaceCulling(); - if (settings.mAllowShadowMapOverlap) - mShadowSettings->setMultipleShadowMapHint(osgShadow::ShadowSettings::CASCADED); - else - mShadowSettings->setMultipleShadowMapHint(osgShadow::ShadowSettings::PARALLEL_SPLIT); + mShadowSettings->setMultipleShadowMapHint(osgShadow::ShadowSettings::CASCADED); if (settings.mEnableDebugHud) mShadowTechnique->enableDebugHUD(); @@ -161,8 +158,6 @@ namespace SceneUtil definesWithShadows["shadow_texture_unit_list"] = definesWithShadows["shadow_texture_unit_list"].substr( 0, definesWithShadows["shadow_texture_unit_list"].length() - 1); - definesWithShadows["shadowMapsOverlap"] = settings.mAllowShadowMapOverlap ? "1" : "0"; - definesWithShadows["useShadowDebugOverlay"] = settings.mEnableDebugOverlay ? "1" : "0"; // switch this to reading settings if it's ever exposed to the user @@ -186,8 +181,6 @@ namespace SceneUtil definesWithoutShadows["shadow_texture_unit_list"] = ""; - definesWithoutShadows["shadowMapsOverlap"] = "0"; - definesWithoutShadows["useShadowDebugOverlay"] = "0"; definesWithoutShadows["perspectiveShadowMaps"] = "0"; diff --git a/components/settings/categories/shadows.hpp b/components/settings/categories/shadows.hpp index 0da6f649c49..b6349dfd440 100644 --- a/components/settings/categories/shadows.hpp +++ b/components/settings/categories/shadows.hpp @@ -23,7 +23,6 @@ namespace Settings makeClampSanitizerInt(1, 8) }; SettingValue mMaximumShadowMapDistance{ mIndex, "Shadows", "maximum shadow map distance" }; SettingValue mShadowFadeStart{ mIndex, "Shadows", "shadow fade start", makeClampSanitizerFloat(0, 1) }; - SettingValue mAllowShadowMapOverlap{ mIndex, "Shadows", "allow shadow map overlap" }; SettingValue mSplitPointUniformLogarithmicRatio{ mIndex, "Shadows", "split point uniform logarithmic ratio", makeClampSanitizerFloat(0, 1) }; SettingValue mSplitPointBias{ mIndex, "Shadows", "split point bias" }; diff --git a/docs/source/reference/modding/settings/shadows.rst b/docs/source/reference/modding/settings/shadows.rst index c7f7958edd1..e5a99eee4c4 100644 --- a/docs/source/reference/modding/settings/shadows.rst +++ b/docs/source/reference/modding/settings/shadows.rst @@ -55,17 +55,6 @@ This setting has no effect if the maximum shadow map distance is non-positive (i This setting can be controlled in the Settings tab of the launcher. -allow shadow map overlap ------------------------- - -:Type: boolean -:Range: True/False -:Default: True - -If true, allow shadow maps to overlap. -Counter-intuitively, will produce much better results when the light is behind the camera. -When enabled, OpenMW uses Cascaded Shadow Maps and when disabled, it uses Parallel Split Shadow Maps. - enable debug hud ---------------- diff --git a/files/settings-default.cfg b/files/settings-default.cfg index 10c25bb4304..bf824e8c0b9 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -1016,9 +1016,6 @@ maximum shadow map distance = 8192 # Fraction of the maximum distance at which shadows begin to gradually fade away. shadow fade start = 0.9 -# If true, allow shadow maps to overlap. Counter-intuitively, will produce better results when the light is behind the camera. When enabled, OpenMW uses Cascaded Shadow Maps and when disabled, it uses Parallel Split Shadow Maps. -allow shadow map overlap = true - # Indirectly controls where to split the shadow map(s). Values closer to 1.0 bring more detail closer to the camera (potentially excessively so), and values closer to 0.0 spread it more evenly across the whole viewing distance. 0.5 is recommended for most viewing distances by the original Parallel Split Shadow Maps paper, but this does not take into account use of a Light Space Perspective transformation, so other values may be preferable. If some of the terms used here go over your head, you might not want to change this, especially not without reading the associated papers first. When "allow shadow map overlap" is combined with a higher-than-default viewing distance, values closer to 1.0 will prevent nearby shadows losing a lot of quality. split point uniform logarithmic ratio = 0.5 diff --git a/files/shaders/compatibility/shadows_fragment.glsl b/files/shaders/compatibility/shadows_fragment.glsl index 2945edff3dc..3c7a37a1628 100644 --- a/files/shaders/compatibility/shadows_fragment.glsl +++ b/files/shaders/compatibility/shadows_fragment.glsl @@ -22,31 +22,25 @@ float unshadowedLightRatio(float distance) if (fade == 1.0) return shadowing; #endif - #if @shadowMapsOverlap - bool doneShadows = false; - @foreach shadow_texture_unit_index @shadow_texture_unit_list - if (!doneShadows) - { - vec3 shadowXYZ = shadowSpaceCoords@shadow_texture_unit_index.xyz / shadowSpaceCoords@shadow_texture_unit_index.w; + bool doneShadows = false; + @foreach shadow_texture_unit_index @shadow_texture_unit_list + if (!doneShadows) + { + vec3 shadowXYZ = shadowSpaceCoords@shadow_texture_unit_index.xyz / shadowSpaceCoords@shadow_texture_unit_index.w; #if @perspectiveShadowMaps - vec3 shadowRegionXYZ = shadowRegionCoords@shadow_texture_unit_index.xyz / shadowRegionCoords@shadow_texture_unit_index.w; + vec3 shadowRegionXYZ = shadowRegionCoords@shadow_texture_unit_index.xyz / shadowRegionCoords@shadow_texture_unit_index.w; #endif - if (all(lessThan(shadowXYZ.xy, vec2(1.0, 1.0))) && all(greaterThan(shadowXYZ.xy, vec2(0.0, 0.0)))) - { - shadowing = min(shadow2DProj(shadowTexture@shadow_texture_unit_index, shadowSpaceCoords@shadow_texture_unit_index).r, shadowing); + if (all(lessThan(shadowXYZ.xy, vec2(1.0, 1.0))) && all(greaterThan(shadowXYZ.xy, vec2(0.0, 0.0)))) + { + shadowing = min(shadow2DProj(shadowTexture@shadow_texture_unit_index, shadowSpaceCoords@shadow_texture_unit_index).r, shadowing); - doneShadows = all(lessThan(shadowXYZ, vec3(0.95, 0.95, 1.0))) && all(greaterThan(shadowXYZ, vec3(0.05, 0.05, 0.0))); + doneShadows = all(lessThan(shadowXYZ, vec3(0.95, 0.95, 1.0))) && all(greaterThan(shadowXYZ, vec3(0.05, 0.05, 0.0))); #if @perspectiveShadowMaps - doneShadows = doneShadows && all(lessThan(shadowRegionXYZ, vec3(1.0, 1.0, 1.0))) && all(greaterThan(shadowRegionXYZ.xy, vec2(-1.0, -1.0))); + doneShadows = doneShadows && all(lessThan(shadowRegionXYZ, vec3(1.0, 1.0, 1.0))) && all(greaterThan(shadowRegionXYZ.xy, vec2(-1.0, -1.0))); #endif - } } - @endforeach - #else - @foreach shadow_texture_unit_index @shadow_texture_unit_list - shadowing = min(shadow2DProj(shadowTexture@shadow_texture_unit_index, shadowSpaceCoords@shadow_texture_unit_index).r, shadowing); - @endforeach - #endif + } + @endforeach #if @limitShadowMapDistance shadowing = mix(shadowing, 1.0, fade); #endif @@ -84,4 +78,4 @@ void applyShadowDebugOverlay() } @endforeach #endif // SHADOWS -} \ No newline at end of file +}