My goal is to render a time-of-flight(ToF) image from a given scene- I want each of the rendered pixel value, to be the length of the photon traveled from the light source to camera. (or average of travel length if many photons are arrived at the same pixel).

I found a post here doing similar thing. Although I have basic knowledge of python, I'm fairly new to blender(and its interface or API) and couldn't find where to start.

So, are render modifications stated (in first paragraph) possible in vanilla blender? If yes, which code should I modify, or how can I even find and access the code?

  • $\begingroup$ Total ray length is possible in Cycles - but is wuite complicated. See blender.stackexchange.com/a/91760/29586 $\endgroup$ Oct 22, 2018 at 19:22
  • $\begingroup$ That is a neat workaround, Sedman. However as I understood, the trick can't be used when 1) there are 4+ types of surfaces in the scene; 2) the average path length is needed, rather than the shortest(-ish) path; 3) the ray is expected to hit the same object multiple times. Cycles doesn't help these cases, does it? $\endgroup$
    – s_br_m
    Oct 22, 2018 at 19:48
  • $\begingroup$ That method can effectively handle any number of materials - you just need to create a material for each one (eg, one for refractionwith IOR of 1.45, one with IOR of 1.33, one that’s part glossy, part diffuse, etc. Also, it will handle multiple bounces onto the same object - that doesn’t cause a problem. The ‘average’ length is an issue as it does skew the result towards the shortest rays. You could potentially adjust the calculation to include weighting to compensate - or render multiple times with successive total bounces and combine to extract each ray segment to analyse each bounce $\endgroup$ Oct 22, 2018 at 20:10


You must log in to answer this question.

Browse other questions tagged .