Jump to content

  • Log In with Google      Sign In   
  • Create Account

shadow map appears from opposite direction (glsl)


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 kod   Members   -  Reputation: 126

Like
0Likes
Like

Posted 11 September 2012 - 02:50 AM

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:

Posted Image

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....

Sponsor:

#2 kod   Members   -  Reputation: 126

Like
0Likes
Like

Posted 13 September 2012 - 03:31 AM

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?




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS