stencil shadows infinite extrusion

Started by
9 comments, last by tguen_03 12 years, 2 months ago
Thanks for your reply Eric.
I finally got it. I didn't consider the hardware which will create the correct vertice if clipping is needed because
-w_c <= z_c <= w_c is not fulfilled.

For people who are curious, here is my solution:

The hardware will find the last Vertice V_l in the direction given by a vector v = (x,y,z,0) starting from a Vertice V_o which is in the view frustrum and will take this Vertice to create the primitive. The Vertice V_l will have a positive w coordinate if v is pointing to the camera, since only then -w_c <= z_c <= w_c can be fulfilled, thus allowing the found point to have a negative z coordinate after the projective division. The Vertice V_l is found by interpolating the values of x,y,z,w on the line from P*V_o and P*v, where P is the projection matrix. The x,y,z values can be interpolated linearly, while the w coordinate gets interpolated by interpolating its reciprocal linearly because it stores the depth. The last Point on the line fullfiling
-w_c <= x_c <= w_c
-w_c <= y_c <= w_c
-w_c <= z_c <= w_c
is then taken.
As a result the extrusion in clipspace is not like in my sketches, but rather like in viewspace and thus correctly done.
I hope its correct what i just wrote : )

Thanks again Eric for your patience and helping me to solve my problem.

This topic is closed to new replies.

Advertisement