When you use the zfail approch to render shadow volums and your light source get to close the poly, then the capped volume will collaps. How can I avoid that…???
I have read in nvidia docs that you are supposed to clip the volume some how, but I don’t understand how? If somene could give me a hint I would apprichiate that
You don’t need to clip if you use the “infinite shadow volumes” approach ( Cass & Kilgard ). Since you said “z-fail” and not “Carmack’s Reverse”, I guess you already know of this method.
If you’re not sure what to do to clip the shadows ( a special CSG operation between “infinite” shadow volumes and another object like an axis aligned box ), then I wouldn’t recommend it. There are quite a few potential problems that are hard to solve.
If you really want to try it, here are a few tips,
(1) Don’t clip shadow volume front faces.
(2) Projected back faces should be carved from the box.
(3) The silhouette quads are “infinite” until you clip them ( use rays, not line segments ).