using proper normals during the SSAO pass

simple_math_single_header
Martin Felis 2018-04-05 14:36:00 +02:00
parent 39d2bb68f8
commit 37ffc2da1e
1 changed files with 4 additions and 2 deletions

View File

@ -21,10 +21,12 @@ out vec4 ioFragPosLightSpace;
void main() { void main() {
ioFragPosition = (uViewMatrix * uModelMatrix * inCoord).xyz; 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; ioFragTexCoords = inUV;
ioFragColor = inColor; ioFragColor = inColor;
ioFragPosLightSpace = uLightSpaceMatrix * uModelMatrix * inCoord; ioFragPosLightSpace = uLightSpaceMatrix * uModelMatrix * inCoord;
gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * inCoord; gl_Position = uProjectionMatrix * model_view_matrix * inCoord;
} }