Is it possible to render smoke into the Z-Dpth pass? I did a setup following the advices found here but it renders only the domain as geometry no smoke.


You cannot get a Z-depth of a volumetric shader. You would have to somehow turn the volume into a mesh - and get a depth of those polygons.

An idea would be to give the smoke a color based on distance from camera - you can shade the volume almost solid with high density scatter shader - but that relies on external lighting. With emission shader the volume behaves additively resulting in incorrect depth-values (it's brighter than mesh at same depth). So there's no way to get the smoke's Z-depth other than meshifying it.

  • $\begingroup$ You can easily mix shaders for them to behave +/- correctly for Z. That is add_shader{Absorption(black,1), Emission(ray_length)}; And mix_shader that with nothing depending on density of volume needed. That way it doesn't get additive and any mostly opaque cloud should work that way just fine. The real problem is that ray length doesn't work for volumes. $\endgroup$ – kivig May 25 '16 at 11:51
  • $\begingroup$ @kivig It get's additive. Did you tried the setup? It cannot work because of reasons explained in the answer. $\endgroup$ – Jaroslav Jerryno Novotny May 25 '16 at 13:15

Yey! It seems I did it. You don't get precise z-depth, but at least you get depth gradient, which can be mapped to needed values after. I did it for a camera being inside volume. Otherwise you probably need to create additional outside volume to act as depth attenuation mist.

enter image description here

  • Emission+absorbtion create a non-additive "white".

  • Mix inputs original volume density (clouds smoke etc.)

  • Add absorption (this should probably be assigned to an external volume that includes everything visible), density adjusts depth of "z".

  • If you wish to keep it all in one scene, the last node is switch between original shader/z.

This of course is a workaround, so it might seem complicated for some, in which case I won't be able to guide step by step for every possible scenario. However it worked for me.

  • $\begingroup$ Can you share the .blend? I would like to test your use case and what it outputs. $\endgroup$ – Jaroslav Jerryno Novotny May 25 '16 at 16:24
  • $\begingroup$ In theory, but I'll probably forget. Atm I'm busy on a project which I can't post directly (nda). However the setup is not that complicated if you create a procedural cloud for instance and just add what's in the screenshot. $\endgroup$ – kivig May 25 '16 at 16:28
  • $\begingroup$ I did that and it doesn't work even remotely, that's why I am asking if I didn't miss anything. $\endgroup$ – Jaroslav Jerryno Novotny May 25 '16 at 16:37

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.