From 37ffc2da1e98b873ea7c36ded1db3d3499b8abae Mon Sep 17 00:00:00 2001 From: Martin Felis Date: Thu, 5 Apr 2018 14:36:00 +0200 Subject: [PATCH] using proper normals during the SSAO pass --- data/shaders/vs_default.glsl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/data/shaders/vs_default.glsl b/data/shaders/vs_default.glsl index 4434d9c..8428b21 100644 --- a/data/shaders/vs_default.glsl +++ b/data/shaders/vs_default.glsl @@ -21,10 +21,12 @@ out vec4 ioFragPosLightSpace; void main() { ioFragPosition = (uViewMatrix * uModelMatrix * inCoord).xyz; - ioFragNormal = transpose(inverse(mat3(uModelMatrix))) * inNormal; + + mat4 model_view_matrix = uViewMatrix * uModelMatrix; + ioFragNormal = transpose(inverse(mat3(model_view_matrix))) * inNormal; ioFragTexCoords = inUV; ioFragColor = inColor; ioFragPosLightSpace = uLightSpaceMatrix * uModelMatrix * inCoord; - gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * inCoord; + gl_Position = uProjectionMatrix * model_view_matrix * inCoord; }