Advanced Light Path Ray Length

Hi, I originally posted the following in the “Composing and Post Processing” folder, however I am starting to think this may require some coding to achieve. I have not spend time in the blender code base so I am wondering if what I want to do would be easy or hard to implement either by python scripts or modifying the source.

– Original Post –

I am trying to do a simulation of light transport throughout a scene. More specifically I want to render all of the photons (rays) that have traveled a specified amount of time (or equivalently distance). So basically I only want to render all of the rays that have traveled between a distance of x and y. The distance would be defined as the distance: light -> object -> camera; or, if there are multiple bounces: light -> object -> … -> object -> camera. I have been playing with the “Light Path” node’s “Ray Length” property but have been unsuccessful. It seems that the “ray length” only corresponds to a single ray, not the series of bounces the light takes from the lamp to camera.

Any help would be appreciated.