Updated shadow shaders

This commit is contained in:
Brandon Mak 2023-03-04 23:12:12 +08:00
parent 13f28d6bdb
commit 73c5a0ff4a
4 changed files with 8 additions and 2 deletions

View File

@ -83,7 +83,7 @@ float CalcShadowValue (sampler2D shadowMap, vec4 worldSpaceFragPos, mat4 lightPV
return 0.0f; return 0.0f;
} }
else else
return 0.3f; return 1.0f;
// return step (fragPosLightPOV.z, ); // return step (fragPosLightPOV.z, );
} }

View File

@ -7,6 +7,12 @@ layout(location = 0) out vec4 shadowMap;
void main() void main()
{ {
float depth = gl_FragCoord.z;
float dx = dFdx(depth);
float dy = dFdy(depth);
float moment2 = depth * depth + 0.25f * (dx * dx + dy * dy);
// shadowMap = vec4 (0.0f, 0.0f, gl_FragCoord.z, 1.0f); // shadowMap = vec4 (0.0f, 0.0f, gl_FragCoord.z, 1.0f);
shadowMap = vec4 (gl_FragCoord.z, gl_FragCoord.z * gl_FragCoord.z, 0.0f, 1.0f); shadowMap = vec4 (gl_FragCoord.z, moment2, 0.0f, 1.0f);
} }