Shadow Volumes multiple lights?

Shadow Volumes multiple lights? Is this possible?

Any tutorials, examples?
i need it using glsl because I’m clipping my scene with glsl discard funtion and don’t want to produce shadows when doing this.

Any ideas? Or other implementation other than Shadow Volumes that can have multiple lights, and cast shadows off every wall or object?

This is really getting to me.

This is what the game Doom 3 did, so that’s a working example that proves it’s possible. The Doom 3 source code is open source and available on Github at https://github.com/id-Software/DOOM-3, but be aware that it uses older assembly shaders rather than GLSL. A more recent refresh of the code is also available at GitHub - id-Software/DOOM-3-BFG: Doom 3 BFG Edition that does use GLSL.

The basic algorithm is:

  • Clear the scene to black.
  • Do a depth-only pre-pass of all objects.
  • Enable additive blending (glBlendFunc (GL_ONE, GL_ONE)).
  • For each light:
  • Figure which objects are in the light’s radius.
  • Draw shadow volumes to stencil buffer.
  • Draw lit objects.

So in other words it’s a multi-pass algorithm, with each light being an extra pass. If that sounds like excessive overhead, remember that a 2004 game did it on 2004 hardware.