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:
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....
shadow map appears from opposite direction (glsl)
1 reply to this topic
Members - Reputation: 126
Posted 13 September 2012 - 03:31 AM
stil no reply . 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?