This topic is 2619 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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 on other sites
i dont know much about shadows in opengl but maybe it will help:

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 on other sites

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

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.

1. 1
2. 2
Rutin
19
3. 3
khawk
15
4. 4
5. 5
A4L
13

• 13
• 26
• 10
• 11
• 44
• ### Forum Statistics

• Total Topics
633744
• Total Posts
3013648
×