Shadow mapping problem

Started by
1 comment, last by zppz 18 years, 8 months ago
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
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?

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

This topic is closed to new replies.

Advertisement