Add toggleable shadow debug overlay.

pull/541/head
AnyOldName3 7 years ago
parent 9df59720e4
commit 85aba2e1da

@ -101,6 +101,11 @@ namespace SceneUtil
else
definesWithShadows["shadowMapsOverlap"] = "0";
if (Settings::Manager::getBool("enable debug overlay", "Shadows"))
definesWithShadows["useShadowDebugOverlay"] = "1";
else
definesWithShadows["useShadowDebugOverlay"] = "0";
return definesWithShadows;
}
@ -112,6 +117,8 @@ namespace SceneUtil
definesWithShadows["shadowMapsOverlap"] = "0";
definesWithShadows["useShadowDebugOverlay"] = "0";
return definesWithShadows;
}
void ShadowManager::enableIndoorMode()

@ -49,6 +49,16 @@ enable debug hud
Enable or disable the debug hud to see what the shadow map(s) contain.
This setting is only recommended for developers, bug reporting and advanced users performing fine-tuning of shadow settings.
enable debug overlay
----------------
:Type: boolean
:Range: True/False
:Default: False
Enable or disable the debug overlay to see the area covered by each shadow map.
This setting is only recommended for developers, bug reporting and advanced users performing fine-tuning of shadow settings.
compute tight scene bounds
--------------------------

@ -530,6 +530,8 @@ split point uniform logarithmic ratio = 0.5
split point bias = 0.0
# Enable the debug hud to see what the shadow map(s) contain.
enable debug hud = false
# Enable the debug overlay to see where each shadow map affects.
enable debug overlay = false
# Attempt to better use the shadow map by making them cover a smaller area. Especially helpful when looking downwards with a high viewing distance. The performance impact of this may be very large.
compute tight scene bounds = false
# How large to make the shadow map(s). Higher values increase GPU load, but can produce better-looking results. Power-of-two values may turn out to be faster on some GPU/driver combinations.

@ -155,4 +155,6 @@ void main()
float fogValue = clamp((depth - gl_Fog.start) * gl_Fog.scale, 0.0, 1.0);
gl_FragData[0].xyz = mix(gl_FragData[0].xyz, gl_Fog.color.xyz, fogValue);
applyShadowDebugOverlay();
}

@ -33,4 +33,31 @@ float unshadowedLightRatio()
#endif
#endif // SHADOWS
return shadowing;
}
void applyShadowDebugOverlay()
{
#if SHADOWS && @useShadowDebugOverlay
bool doneOverlay = false;
float colourIndex = 0.0;
@foreach shadow_texture_unit_index @shadow_texture_unit_list
if (!doneOverlay)
{
vec2 shadowXY = shadowSpaceCoords@shadow_texture_unit_index.xy / shadowSpaceCoords@shadow_texture_unit_index.w;
if (all(lessThan(shadowXY, vec2(1.0, 1.0))) && all(greaterThan(shadowXY, vec2(0.0, 0.0))))
{
colourIndex = mod(@shadow_texture_unit_index.0, 3.0);
if (colourIndex < 1.0)
gl_FragData[0].x += 0.1;
else if (colourIndex < 2.0)
gl_FragData[0].y += 0.1;
else
gl_FragData[0].z += 0.1;
if (all(lessThan(shadowXY, vec2(0.95, 0.95))) && all(greaterThan(shadowXY, vec2(0.05, 0.05))))
doneOverlay = true;
}
}
@endforeach
#endif // SHADOWS
}

@ -86,4 +86,6 @@ void main()
float fogValue = clamp((depth - gl_Fog.start) * gl_Fog.scale, 0.0, 1.0);
gl_FragData[0].xyz = mix(gl_FragData[0].xyz, gl_Fog.color.xyz, fogValue);
applyShadowDebugOverlay();
}

@ -280,4 +280,6 @@ void main(void)
#else
gl_FragData[0].w = clamp(fresnel*6.0 + specular, 0.0, 1.0); //clamp(fresnel*2.0 + specular, 0.0, 1.0);
#endif
applyShadowDebugOverlay();
}

Loading…
Cancel
Save