Sign in to follow this  
solinent

Modelview matrix and shadow mapping

Recommended Posts

I have a very simple problem that I know how to fix. However, I want to know how most people do it. I have a shadow map generated in light space. To do this, I create two light matrices, projection and view. Projection contains gluPerspective call, and view contains the gluLookAt call from the light's perspective. I have a car in camera space. To get it to camera space, there's a camera projection matrix, and a modelview matrix that contains a gluLookAt call, and additional glRotate/Translate calls in order to get it into the right position. Finally, I combine the two light matrices into a texture matrix and then bias it into the 0-1 range for shadow mapping. (Call this the shadow matrix) This works fine for models that are untransformed (models for which the camera modelview matrix doesn't get glTranlsate/Rotate 'ed). I need the point in both camera space, and light space. However, the problem is that I have added ad gluLookAt call to the camera modelview matrix, which not only translates the vertices, but changes the view (like expected). But I want to change the view for just the light matrix (multiply the light view matrix by just the camera model matrix). Really, the model matrix doesn't belong to the camera, it converts into world coords. In order to do this, I need to seperate the view and model matrices. Either that, or for every glTranslate/Rotate call I also update the relevant texture matrix (I doubt there's an automatic gl way to update two matrices). So how should I go about doing this. I can supply code if needed. How do YOU guys do shadow mapping via glsl shaders?

Share this post


Link to post
Share on other sites
I can simplify my situation: I have the modelview matrix and the view matrix, how shall I get the model matrix?

IE. How do I reverse the effect of the view matrix.

(Sorry I wrote the OP very tired).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this