9
$\begingroup$

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.

$\endgroup$
0

2 Answers 2

7
$\begingroup$

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.

$\endgroup$
2
  • $\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
    Commented May 25, 2016 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$ Commented May 25, 2016 at 13:15
1
$\begingroup$

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.

$\endgroup$
3
  • $\begingroup$ Can you share the .blend? I would like to test your use case and what it outputs. $\endgroup$ Commented May 25, 2016 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
    Commented May 25, 2016 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$ Commented May 25, 2016 at 16:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .