This is a method I’ve developed for very fast lighting of many diffuse-only lights.
The method works as follows:
- Lights’ positions and parameters are gathered
- List of areas that are going to be lit is generated
- Some points are marked as critical lighting points
- For each critical point, a light probe is calculated by integrating all the lights that has an effect on that point
- Light probes are then transformed into 3rd-order SH and sent to the GPU
- These probes are then used in the lighting shader, alongside with other pre-calculated ambient probes
In the image bellow, each small cube represent a light source with a unique color. The lighting is calculated for the sphere.
As you can see, most of the work is done on the CPU, and can be done in parallel on a separate thread. It’s also suitable for the PS3’s SPUs. The image above is taken from a PS3 running the lighting on 2 SPUs.