Maxwell Render has a feature called Multilight, where the integrator keeps track of which emitter contributed how much to the scene, so that lights can be dimmed or brightened without re-rendering. As far as I'm aware, this feature does not exist in Blender.
If you wanted to implement Multilight in Blender, you would need to keep track of the different emitters' contributions in the integrator. So to any ray is associated a series of numbers indicating the contributions per light, and afterwards these extra numbers are available to the compositor (so that the different contributions can be mixed and matched however needed).
My question is not about Multilight, but rather about a more general problem:
Is it possible (and if so, how) to associate in Cycles' integrator to every ray some extra piece of information, process it on every bounce, and have the result available in the compositor?
The Multilight case is an example of this, but here are two others:
- calculate for every ray the total distance it has traveled from camera to emitter
- keep track of how many times a ray has hit a certain object
For the first of these, I'm aware of the Ray length socket in the Light path input node, but I don't see how to keep track of all these things along an entire ray.