Suppose I am rendering a smoking torus from above in Cycles:

(at laughably bad resolution, of course, but that's not the point)

enter image description here

Cycles spends a lot of time rendering the empty space, even though the density is 0 (and therefore, the volume should have no effect on light). I don't quite know why Cycles has to think so much.

In fact, the render times can be almost halved (from 11 min to 6 min) by using an old BI trick and masking empty parts of the volume with a shadeless object (which can be made here).

enter image description here

This is fine for simple test renders, but now I'd like to make actual scenes with smoke and fire in them, and obviously my little masking trick won't work because there are objects behind the smoke that can't be masked. (Also, shrinking the domain is not an option)

How can I optimize scenes with large empty volumetric sections?

  • $\begingroup$ Could you not group the smoke and mask on a separate render layer? $\endgroup$ – Todd McIntosh Jun 30 '15 at 19:11
  • $\begingroup$ @ToddMcIntosh I can't. :( I'm rendering fire, and I need the fire to actually light the scene. $\endgroup$ – PythonNut Jun 30 '15 at 19:14
  • 1
    $\begingroup$ Could you fake the bounce lighting with lamps with animated emission? $\endgroup$ – Todd McIntosh Jun 30 '15 at 19:15
  • $\begingroup$ @ToddMcIntosh sorry, nope. I probably could if the scene weren't so specific, but the fire is right up against a plane, and you can clearly see its shape... I'd rather not approximate if I can help it. $\endgroup$ – PythonNut Jun 30 '15 at 19:17

It's actually quite similar in Cycles and seems to speed up renderings as well (which indicates there is still room for optimization in Cycles volume rendering).

So with a basic setup: enter image description here

You get result (~16 seconds): enter image description here

Now add a Shader Mix Node and use Density as a Mix factor: enter image description here

With current Cycles algorithms you can leave the second slot unconnected - it just tells Cycles to compute volume rays for areas that are masked by density with a value greater than 0.5 (screen shows the reverse of that, but it's the same if you connect Volume shader in second slot and use converter math node 'Greather than', which would be more intuitive, I guess).

Now the result of this little tweak: enter image description here Time almost halves! But there are very crisp edges - you can tweak that with changing the converter math node value to a very low number (which would tell cycles to leave out only area with density values close to zero: enter image description here

And the result: enter image description here

Still reasonable improvement over the original render time and nearly the same visual effect.

  • $\begingroup$ I don't know who you are, or what your credentials you have. I don't know whether you're a good person or bad. But I do know that you are a GOD DAM HERO Kilbee. This little trick has just knocked 8 minutes off each frame on a 200 frame explosion. I seriously Effing love you !! $\endgroup$ – Rich Dec 5 '16 at 1:43

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.