Implemented shadows. Light components can enable shadows through editor. #406

Merged
Xenosas1337 merged 7 commits from SP3-1-Rendering into main 2023-03-08 14:17:15 +08:00
4 changed files with 8 additions and 2 deletions
Showing only changes of commit 73c5a0ff4a - Show all commits

View File

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

View File

@ -7,6 +7,12 @@ layout(location = 0) out vec4 shadowMap;
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 (gl_FragCoord.z, gl_FragCoord.z * gl_FragCoord.z, 0.0f, 1.0f);
shadowMap = vec4 (gl_FragCoord.z, moment2, 0.0f, 1.0f);
}