View Full Version : omni-directional shadow mapping & deferred shading

09-21-2007, 01:09 PM
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? :)

09-21-2007, 04:01 PM
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[0].xyz,gl_ModelViewMatrixTranspose[1].xyz,gl_ModelViewMatrixTranspose[2].xyz) * lightdir;