# Adaptative ray bounces in Cycles

Sometimes, in order to avoid noise and render faster, I set the bounces to 0. The problem is that I don't get any reflection on water, glass, etc. I know that some nodes provide tests to stop a ray (like "is camera ray"). Can I get the best of both worlds: reflection but no noise?

I thought of controlling how many bounces a light path makes with nodes or python depending on what kind of materials it hits. Like get +1 bounce if glossy or so.

What about using settings like this:

In Render settings → Light Paths → Bounces?

As mentioned by sambler,
This is also possible per shader with nodes, but only in development versions newer than r58776. This feature will be available in 2.69:

We have a global (Total Max, Diffuse/Glossy/Transmission max) control for bounces. It would be useful to add a ray depth control for shaders. This way, we can specify if a certain shader should only do 2 bounces for example. This can help with performance and noise a bit. Maybe this option could also be added to lamps, so we can set lamps to only do 0 or 1 bounce, and act only as a fill light for example.

To control bounces per material with the light path node you could use a setup like this:

Where the highlighted value is the number of bounces for this material to be sampled (negative values will not sample it at all, letting rays straight through).

To show this, take the following render (Suzanne has the above node setup with a value of 2)

As you can see, Suzanne only appears in direct reflections (the pedestals "farther down" are empty).

• This was added to svn about a month ago (Ray Depth output from Light Path node) so is in any recent svn builds and will be in 2.69 when released. You also have a Ray Length output which is "Distance travelled by the light ray from the last bounce or camera" if you want to adjust reflections based on distance. – sambler Sep 5 '13 at 8:27
• @gandalf3 could you please give some information/examples on how to use the new Ray Depth information to limit bounces? I get only black materials when trying to use it. – matali Mar 12 '14 at 9:16
• @matali Updated answer. – gandalf3 Mar 14 '14 at 8:06