Stencil-Shadow volumes is a technique to do shadow calculations in real-time. The general set-up goes like this.
Using the Z-buffer in this way has the same effect as tracing a ray from the far plane to the nearest fragment in your ambient pass. We trace from the far plane because there is always a possibility that you can clip your shadow volume at the near clip plane causing the stencil values to become incorrect. Tracing from the far plane has the same issue, i.e. we can clip a shadow volume on the far plane. But, the nice thing is that we can set the far-plane at infinity and thus eliminating the problem (we do not have the same amount of flexibilty with the near plane).
Stencil-Shadow volumes have some draw-backs though. The shadows tend to be hard and lend to aliasing (this is because of the simple yes/no stencil test during the lighting pass). Shadow volumes are typically 2x as much geometry as the original object (this can be a problem if your bottle-neck is how many polygons you are pushing to the card). You can only create shadow volumes for orientable-manifold surfaces (it has to be able to be culled correctly). The shadow volume quality is only as good as the tessalation on your original object (a blocky sphere will cause a blocky sphere shadow volume, and blocky sphere shadows).