Ray Depth

Thomas Dinges’ GSoC has shown some pretty awesome results for us Cycles fans, my favourites so far being the Wavelength converter and Separate/Combine HSV nodes (finally right?), but those are fairly simple additions.

The real magic comes in with the Ray Depth output of the Light Path node. The potential of this is pretty awesome, allowing control of what is shown or calculated on which light bounces. This could be used to get rid of some pesky fire flies, reduce noise from having many sources of light, or simply to have some fun:

2013-07-18_21-13-12Here is a slightly orangy sphere, but on the first light bounce it becomes really pink, and on the third suddenly it’s green!

Pointless yeah, but like I said, potential!

After some initial tests, it seems it doesn’t really give all that much of a speed up in render time (in fact in some cases it was slightly slower, but only slightly), but used properly I think it could help reduce noise quite significantly. For example, in a well lit room with a thousand candles: the candles don’t really need any of their light to bounce, direct light only would be fine. But any other sources of light probably still need a couple bounces to fill the whole room.

When it’s merged to trunk, expect another post with some proper documentation on how and where to use it :)

If you’re super eager to use it right now, just use a Math node on Greater Than or Less Than (depending on the use) to get a mask of how many bounces are needed – for example have a mix shader with Glossy on top and a Diffuse on the bottom with the Ray Depth and a Greater Than 1.9 to have a glossy material that is seen as a diffuse one after two bounces (It’ll look pretty much the same, but with potentially less fireflies). And yeah Thomas agrees that we need an “Equal To” mode in the Math node ;)