8
$\begingroup$

If I turn on "Branched Path Tracing" in Cycles/Render Properties/Sampling, then I can set the number of diffuse, glossy, transmission, AO, mesh light, subsurface and volume samples. What bothers me is that the minimum number of samples is for each of them one, and not zero. As far as I understand it, this forces me to waste rays on things I am not interested in.

For example, if I have no subsurface and volume scattering in my scene, then I should set these values to zero, right?

enter image description here

EDIT WITH MORE EXPLANATION: Also note that the number of subsurf rays is multiplied with the number of AA rays (as you can see bellow the controls in the "Total Samples"), so if I have 64 primary AA rays, then (as far as I understand) I am forced to use at least 64 subsurf rays, 64 volume rays etc, which is not so little, especially because I am interested in animations. And even if I do have subsurf materials, I might want to temporarily set the subsurf rays to zero in order to better understand their contribution or to save time while doing non-final renders.

enter image description here

$\endgroup$
  • 1
    $\begingroup$ AFAIK if you don't have any SSS in your scene, it can't render any SSS samples, so you're not wasting any time. If you want to disable all of a certain type of shader I think you'd have to manually unplug it in all your node trees. $\endgroup$ – PGmath Dec 2 '15 at 14:51
  • $\begingroup$ @PGmath This sounds plausible, although I still think it would be better if we could set it to 0. BTW in Arnold you can set these settings to 0. $\endgroup$ – lbalazscs Jan 3 '17 at 0:23
5
$\begingroup$

Cycles generates each sample type as different "images" which are then combined into the final render. Each of these passes can be made available in the render layer settings which can then be used within the compositor.

While cycles could be made to work with one or more of these passes being missing, there is no benefit to doing it. A simple scene with one sample of each pass can be rendered in less than a second. It is only when you are rendering with hundreds or thousands of samples that a pass adds any time to the render, having one sample of a type you don't use can only add less than a second to your render and the couple of MB that could be saved in memory use will not make a difference on any recent computer.

AA is Anti-Aliasing, it softens the edges to hide the jagged edges seen from sudden colour changes. 64 AA samples is high, the AA samples defines how many neighbouring pixels are used to determine the final pixel colour and as you noticed it multiplies the final sample count.

If you want to know the effect of each pass then enable them all in the render layers and mix them in the compositor where you can turn each on/off to see how they effect the final image. CGCookie has a fundamentals of compositing series that explains how to do this.

$\endgroup$
  • $\begingroup$ Sorry, I can't follow. If I have no subsurface materials in my scene, then the subsurf passes are black anyway, so why waste any rays on them? I don't want them to be missing, I want the black image to be calculated faster. Also note that I edited my question to explain that the minimum number of rays is actually higher than one. $\endgroup$ – lbalazscs Dec 2 '15 at 14:06
  • $\begingroup$ About the edited answer: I know what AA is, and I might need that high number for noise-free motion blur or depth of field. And I know that there are workarounds, but it bothers me that I cannot do it the easy way. I am considering creating a bug report for Blender, but I wanted to make sure that my understanding is correct. I upvoted your answer, but I cannot accept it as long as it does not answer my question: is there any real reason for enforcing a minimum number of rays? $\endgroup$ – lbalazscs Dec 2 '15 at 18:23
3
$\begingroup$

Path Tracing

When a camera ray hits a surface, it has a material at that position. The material is usually made of different Shaders that got mixed together. One ray will leave the surface. If you have a Mix Shader combining Diffuse and Glossy set to 0.5, there will be a 50% chance of sending a Diffuse ray and 50% chance of sending a Glossy ray. The direction the ray will take is also calculated randomly. With increased number of samples, these numbers will even out and create a smooth surface having 50% Glossy and 50% Diffuse. If the material doesn't contain a Transparent Shader, no transmission rays will be sent.

Branched Path Tracing

Let's say you have set Diffuse samples to 2 and Glossy to 4 and Transmission to 3 in your render settings. When the camera ray hits the surface, it will send out two Glossy rays (in the same random way as before) and four Diffuse rays. Their values will then be mixed together according to the Mix Shader. Since your material doesn't have a Transparent node, none of the six Transmission rays will be sent out, leaving the pass image black at that position. In the end, your Transmission Samples number won't affect render time on that specific material in a noticeable way.

Experiment

I set up a simple test scene with a Material having 50% red Diffuse and 50% white Glossy on all objects (a plane and the default cube).

With 1 sample for Diffuse, 8 for Glossy, 1 for the rest and 4 AA samples, it takes me 31 seconds to render. Setting all values except Diffuse and Glossy to 128, it renders for 32 seconds.

What would happen if we set the values to zero?

Let's say we set the amount of Transmission samples to zero. If our material is not transparent, the value can be set to any number, so setting it to zero doesn't make a difference. But what if our material contains, let's say, a Glass Shader?

Blender won't send any transmission rays but will need some values to calculate the final material color. This is the same as sending a ray and then killing it immediately. So we can assume, that the transmission ray would return a black value. The transmission pass image would remain black, as wished. The glass would probably look very ugly like some glossy mixed with black emission.

Why is 1 the minimum?

I don't know. To find out, find the developer who made this feature or worked on it and ask him. You can start your search here. Possible reasons could be (just me guessing):

  • Nobody thought it could be useful to someone, someday. Since having the ability to setting it to zero caused other problems (like, unexperienced users using it and getting black renders)
  • Technical reasons. Perhaps it is more complicated than that to handle missing passes
  • Time: Due to the reasons above it was not worth the effort implementing

Workaround

If you want to work around the issue and get the possibility to disable passes, I found two (relatively) simple ways. A doesn't speed up render time, but should at least be accurate if you don't use volumetrics; B speeds up rendering, but requires more work to make accurate.

A - Compositor Easy to set up, doesn't speed up render time. See here for how to combine them. Note, that you will have to separate the volumetric pass or you'll use the volumetrics if you are using them. Further information and node group download

B - Material node groups Create a node group per shader type that allows you to disable it by mixing it with an Emission shader. Here's the node group for a new Glass Shader:

enter image description here

Create a node group for each Shader you are using and use them all the time. By setting the mix factor to 0 or 1, you can enable or disable certain shaders. This will do almost the same as setting the samples count for this ray type to 0. The difference is that one works on a per ray-type basis, the other on a per-shader basis. If you want to remove only transmission rays from a Glass Shader, you'll need to create your own one using Glossy and Refraction shaders.

This method shouldn't increase render time normally because node groups and Mix nodes with fac 0 or 1 get optimized automatically during compilation. If you disable some shaders, computation will be faster because Emission Shaders are fast to compute.

$\endgroup$
  • $\begingroup$ Upvoted, because it is an interesting experiment, but not accepted, because I still don't understand why can't we set 0 as minimum number in order to disable a certain type of shader without messing with blending modes. But it is good to see that performance does not suffer because of the extra rays. $\endgroup$ – lbalazscs Jan 3 '17 at 12:37
  • $\begingroup$ I still haven't an answer to your question, but I added further information and some workarounds. $\endgroup$ – piegames Jan 3 '17 at 14:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.