Implemented shadows. Light components can enable shadows through editor. #406
|
@ -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, );
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
|
@ -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);
|
||||
}
|
Binary file not shown.
Loading…
Reference in New Issue