Jump to content
  • Advertisement
Sign in to follow this  
laeuchli

Shadow mapping problem

This topic is 4770 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to configure my shadow mapping matrix as outlined here(www.cs.uiowa.edu/~cwyman/classes/ fall04-22C151/handouts/shadowMap.pdf), although I'm using vertex and fragment programs instead of the fixed-function pipeline. Anyway, they say the Matrix should be S*P*L^-1*M, where S is the scale matrix, P is the projection matrix and L^-1*M is the modelview matrix from the light's PoV. So if I understand it right, if I save the modelview matrix of the light's PoV, I should be able to create the shadow mapping matrix from the following code: glMatrixMode(GL_TEXTURE); glLoadIdentity(); glTranslatef(0.5f, 0.5f, 0.5f); glScalef(0.5f, 0.5f, 0.5f); glMultMatrixf(Shadowmap->LightProjection.SinglecMatrix); glMultMatrixf(Shadowmap->LightMatrixPOV.SinglecMatrix); glMatrixMode(GL_MODELVIEW); .... However, this doesnt work. The shadows are applied in a way that doesnt look remotely correct. I've verifed that my depth texture is good, and I've tested that these matrixes are in fact the ones used to render the scene for the lights PoV. So either the problem is in the my shaders or in my matrix generation code. Does this matrix code look right? Thanks, Jesse

Share this post


Link to post
Share on other sites
Advertisement
Two things to check (both are in the receiver-pass):

1. are you using projective texture lookup? this is essential

2. your code assumes world-space coordinate inputs. is texgen configured that way?

Share this post


Link to post
Share on other sites

Heh.. I was just about to reply to your OPENGL-GAMEDEV-L post to say you would get more response here :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!