Merge branch 'sayyestoshadowmapoverlap' into 'master'

Remove allow shadow map overlap setting (#7939)

Closes #7939

See merge request OpenMW/openmw!4056
pull/3235/head
jvoisin 8 months ago
commit b770577623

@ -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";

@ -23,7 +23,6 @@ namespace Settings
makeClampSanitizerInt(1, 8) };
SettingValue<float> mMaximumShadowMapDistance{ mIndex, "Shadows", "maximum shadow map distance" };
SettingValue<float> mShadowFadeStart{ mIndex, "Shadows", "shadow fade start", makeClampSanitizerFloat(0, 1) };
SettingValue<bool> mAllowShadowMapOverlap{ mIndex, "Shadows", "allow shadow map overlap" };
SettingValue<float> mSplitPointUniformLogarithmicRatio{ mIndex, "Shadows",
"split point uniform logarithmic ratio", makeClampSanitizerFloat(0, 1) };
SettingValue<float> mSplitPointBias{ mIndex, "Shadows", "split point bias" };

@ -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
----------------

@ -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

@ -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
}
}

Loading…
Cancel
Save