Jump to content
  • Advertisement
Sign in to follow this  
Quat

Shadow Matrix Question

This topic is 2530 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

Hi,

I derived the shadow matrix for both parallel lights and point lights. They basically just implement a ray/plane intersection. There is one issue though I am having. Take for example a parallel light where the light rays aim in the direction (.707, -.707, 0) and the ground plane is (0, 1, 0, 0).

My shadow does not show up with this configuration. In the ray/plane intersection, there is the denominator dot(n, L), and in the matrix formula this gets written to the w-component so that the homogeneous divide does the division. However, for the above numbers,

dot(n,L) = -.707 = w

So I think negative w coordinates will be clipped and this is why my shadow does not show up. Do you agree?

Now the ray/plane intersection will give me the same intersection point if I use the opposite light direction (-.707, .707, 0) (the direction towards the light source), and this avoids a negative division.

dot(n,L) = .707 = w

This works and the shadow shows up correctly.

So in case anyone missed my question, I am just checking if my explanation of why (-.707, .707, 0) works and (.707, -.707, 0) does not work is correct.

Share this post


Link to post
Share on other sites
Advertisement
i dont know much about shadows in opengl but maybe it will help:

http://www.devmaster.net/articles/shadowprojection/


if it helped please give me a hint how to get a point where vector intersects a plane. i know its something with Ax+By+Cz=D or something but in not sure.

Share this post


Link to post
Share on other sites

i dont know much about shadows in opengl but maybe it will help:

http://www.devmaster...adowprojection/


if it helped please give me a hint how to get a point where vector intersects a plane. i know its something with Ax+By+Cz=D or something but in not sure.



If your vector intersects your plane at all it will intersect it in multiple(infinite) places, as a vector has no localized position, only direction. What you actually want to do is a ray with a plane.

@OP

your L in (dot(n,L) is a direction from the surface to the light, hence opposite of the actual light direction.

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!