shadow map appears from opposite direction (glsl)

Started by
0 comments, last by kod 11 years, 8 months ago
Hey,
I've been trying to implement shadow mapping in my project. Most of it is working as it should, that means the depth texture generation is about right and shadow coordinates are saved in the texture matrix to be accessed in the shader. As a base I've used the tutorial at http://fabiensanglard.net/shadowmapping/index.php

I had some trouble to get it working but basically now the code is very similar to the one in the tutorial. I even use the same texture units, etc. I can post some code later if it matters. Now here is the result I got:

shot0015.png

What do you see here: The white plane is my terrain/ground. On the left of it there is a textured sphere sunk in the ground. Red sphere on the left is my light source directed towards the sphere. The Shadow that is generated looks about right but it is on the opposite direction of the sphere that it should be.

I've read some forum posts and other tutorials and some of them talk about the generation of an inverted camera matrix. Now I've already tried that and the result was absolutely wrong or did not work in the slightest way. Also I'm not really sure if my problem is a result from that. And then again I'm wondering why there is no such inversion in the tutorial. It would be great if someone was able to enlight me about this....
Advertisement
stil no reply :D. Wouldn't there be the possibility to "flip" the shadow coordinates that I save in the texture matrix? I'm not that fit in matrix math though. I tried to manipulate the bias matrix that performs coordinate transformation to the texture coordinate space but the result was not as planned. Any ideas?

This topic is closed to new replies.

Advertisement