diff options
Diffstat (limited to 'gfx/gl/shaders')
-rw-r--r-- | gfx/gl/shaders/directionalLight.fs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gfx/gl/shaders/directionalLight.fs b/gfx/gl/shaders/directionalLight.fs index c49bb8d..24457b8 100644 --- a/gfx/gl/shaders/directionalLight.fs +++ b/gfx/gl/shaders/directionalLight.fs @@ -19,18 +19,18 @@ uniform uint lightViewProjectionCount; const vec3 e1 = vec3(0, 0, 0), e2 = vec3(1, 1, 1); - float +float insideShadowCube(vec3 v) { const vec3 s = step(e1, v) - step(e2, v); return s.x * s.y * s.z; } - float +float isShaded(vec4 Position) { for (uint m = 0u; m < lightViewProjectionCount; m++) { - const vec3 PositionInLightSpace = (lightViewProjection[m] * Position).xyz * .5 + .5; + const vec3 PositionInLightSpace = (lightViewProjection[m] * Position).xyz; const float inside = insideShadowCube(PositionInLightSpace); if (inside > 0) { const float lightSpaceDepth = texture(shadowMap, vec3(PositionInLightSpace.xy, m)).r; @@ -40,7 +40,7 @@ isShaded(vec4 Position) return 0; } - void +void main() { const vec4 Position = vec4(texture(gPosition, TexCoords).xyz - lightPoint, 1); |