I'm using Ogre 1.10 and sometimes I gotta deal with quite a lot of point lights in my scene (max 48).
I'm doing it per-pixel, so currently I got a first pass on my materials to do ambient + directional light and then I got a second pass for each point-light like this:
The pixel-shader which belongs to this second pass and adds light from the different point lights isn't very expansive, but running it so many times can be...pass
{
illumination_stage per_light
iteration once_per_light point
max_lights 48
scene_blend add
..
}
I'm looking for ways to improve this, so:
1) Does Ogre actually sort out point-lights which are too far away from the mesh with the mentioned material set?
Or will the second pass be run with any point light in the scene? My scene can be rather large, and the point-light affected areas are rather small.
So for many meshes/entities in the scene a lot of point lights could be skipped (based on distance from pointlight<->mesh_bbox_center)...
However setting the MaximumRenderingDistnace on the Light itself isn't what I wanted (will be based on camera<->light distance)
2) Compute multiple point-lights in one pass
I could technically pass the parameters for at least 2 or more lights to the pixelshader at once and combine the computations in there, creating the same result with less executions of the pixelshader.
Is this possible somehow? Like adjust "iteration once_per_light point" so it's something like "iteration once_per_two_light point"
Any suggestions welcome, thanks.