How do you deal with spotlights when you're done with the point lights?
Members - Reputation: 356
Posted 11 November 2012 - 12:33 PM
Crossbones+ - Reputation: 2747
Posted 11 November 2012 - 12:47 PM
- you may well draw them after your point lights in a separate pass or somehow integrate them so that your compute shader is able to handle them both.
- If you place your lights in a sorted array (the points lights are first and then followed by the spot lights), you may avoid branching a bit since you may just loop over the amount of each light type.
- For easy starter, math wise you may use your point light algorithm to draw spot lights, only thing you'll need to add is the required spot light direction and the inner and outer cone variables. Of course this way there is lots of unnecessary pixels processed.
- Even a point light can be behind you and have a radius of some hundred of meters. Culling spot lights exactly may be just a bit more demanding.
Edited by kauna, 12 November 2012 - 07:01 AM.