Sorry, i have misunderstood the last post of jwatte
I thought he was not thinking about the additive blending method but about a method which do not use stencil buffer (i have found a very short paper about it for PlaySation2 a long time ago, but i have never understood how they simulate the count of the volumes).
I will try to be clearer:
I can use shadow volume with the dark quad method.
I can use shadow volume with the additive blending method.
I am currently using the dark quad method, but i will modify my program to use the additive blending method.
I can render shadows from one or several omni-lights and directionnal lights in the same time.
I can render shadows from One spot light and several omni-lights and/or directinnal lights in the same time.
But , I cannot render shadows from several spot lights in the same time.
I cannot directly compute the shadow area (or enlightened area) from the spot light on the stencil buffer. Because I can’t cut my shadow volumes to disply them just in the cone of the spot.
With spot lights, shadows are inside and outside the spot area. We can find light and shadows in the spot light area (but we can also have lights without shadows or shadows without lights) and we can only find shadows out of the spot area.
My soultion for one spot is to:
_ Pre-compute shadows from an omni-light (in the same position as the spot light) in the stencil buffer and display it in the color buffer. The shadows are displayed in the entire screen.
_ Compute the spot light area on the stencil buffer. Clear the color buffer outside the spot light area (i display the scene without lights on it).
I must do that because i can update the color buffer when i want, and using several state of the stencil buffer. But i can’t write the omni-light shadow area on the stencil buffer and, after, modify the same stencil buffer to clear the unwanted enlightened area on the stencil buffer.
To display shadows from one spot light and sevaral omni-light and/or directinnal lights:
_ I render shadows from the spot light. In the color buffer, i have the scene with the spot light shadows inside and outside the spot area.
_ And after i render shadows from the other lights.
Because to render shadows from the spot light i need to render a second time some parts of the color buffer in order to clear unwanted enlightened areas. => To not erase the shadows from the other lights, i must render the shadows from spot ligh first.
What’s the problem with several spot lights?
_ With my method, i need to render a second time some parts of the color buffer in order to clear unwanted enlightened areas. If i do that for the second spot light, it will also clear shadow from the first spot light.
But you could…
_ Render the scene and shadows from omni-lights which would be in the same position as all the spot lights.
_ Compute the spot light areas from all spots on one stencil buffer.
_ Render the scene a second time, without shadows, outside all the spot light’s areas in order to clear unwanted enlightened area.
If two spot lights light the same area, the intensity of the light should be greater in it. And i can’t to that with the method above.