Stencil Buffer Shadow Overlapping

I have 3 questions:
1.I have more than a single one light source. How to enable real look-like overlapping between shadows casting from different light sources.Maybe using glBlendFunc()?
(By the way how to make shadows from transparent objects)
2.Sometimes i am using stencil buffer for creating pseudo lighting from a spot light. How to make it to be attenuated?
3.I am also creating a dust effect room simply by drawing clipping volume from a lamp(pseudo light),but this volume goes through the different objects.How to stop the volume when it crosses another object.Maybe Depth Buffer can help?

  1. Clear the stencil between each light and project a light volume for each light individually to stencil test illumination true on your illumination pass not shadows on a shadow pass.
    Use glBlendFunc(GL_ONE, GL_ONE); for each light source contribution.

  2. Attenuate the illumination in the lighting pass. Use texture, math or whatever it takes.

  3. If I understand correctly, you need to stop the light volume when it intersects with an object. Investigate beam trees :slight_smile: