Shadow volumes

Hi, I have an OpenGL app that I want to add shadows to. I have got it so that at any time I have an array of polygon objects that represent the shadow volumes (calculated for each light) but where do I go from here? How do I draw the scene so that anything whithin one of these volumes is darker? I’ve looked around the net for info, but haven’t found anything that seems to work.

Nvidia’s dev site has many many docs on this. Take a look at their infinite shadow volume paper. From reading that paper it didn’t take me long to understand this technique better and implement.


Shadows algho explaination for dummies. :stuck_out_tongue:

Imagine to have a SPHERE, then the stencil shadows works like :

  1. Pick a paper sheet.
  2. Roll it on the sphere to form a cylinder.
  3. Imagine this cylinder is the extrusion of the silouette of the sphere. (visible borders of the sphere seen from the light source).
  4. Then look at the paper cylinder from the camera point and imagine to draw only the visible side in a buffer (sides facing you).
  5. Now imagine to delete the old buffer using the hidden faces of the same cylinder.
  6. What still remains is in the buffer is exactly the shape of the shadow cast from the sphere.

Fill that shape with your preferred method…
using stencil buffer could be helpfull…

ok, ok, this is just really to have an idea on how it all works…