Advertisement

opengl shadow mapping

Started by January 21, 2015 01:01 AM
0 comments, last by NumberXaero 10 years ago

I'm currently learning how to do shadow mapping from online tutorials. As far as I know, this technique involves

two passes from shader. The first one is from light's view, and store the final image into a depth texture, in which

all pixels are actually just floating point of depth. The second pass is from camera's view using normal method.

The part I don't understand is why the technique compares these two final images with their depth values. Since

the cameras' angles (camera's and light's) are different, how can they be compared?

During the second pass the depths are created from projecting the vertices into lights pov, then the comparision is made.

So say theres some point A, and the light can see it (so the depth lands in the shadow map). Behind it theres another point B, and the camera can see it, but the light cant (say the triangle A belongs to is blocking B from being seen in the lights pov).

When B is projected into the lights pov in the second pass, it generates a second depth, larger (further away) then the one stored by A, B must be in shadow, because its behind A, B depth is larger for the lights pov (say the triangle A belongs to casts a shadow on B).

Without getting too complicated and drawing pictures thats the best I can do.

This topic is closed to new replies.

Advertisement