for omni-directional shadow mapping, i had used the vertex position in world space to calculate the direction vector for textureCube(). now with deferred shading, all i’ve got left is the vertex position in camera space. i thought it’d be no problem if i pass the light’s position in camera space as well, but the camera’s orientation seems to interfere. any suggestions?
Use the the inverse of gl_NormalMatrix could be used to project the direction from the modelviewspace into worldspace.
Because there is no gl_NormalMatrixTranspose you should use something like that:
vec3 lightdir_ws = mat3(gl_ModelViewMatrixTranspose.xyz,gl_ModelViewMatrixTranspose.xyz,gl_ModelViewMatrixTranspose.xyz) * lightdir;
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.