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.
2 Answers
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.
- 51,077
- 7
- 129
- 218
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.
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.
- 623
- 4
- 13
-
Can you share the .blend? I would like to test your use case and what it outputs. – Jaroslav Jerryno Novotny May 25 '16 at 16:24
-
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. – kivig May 25 '16 at 16:28
-
I did that and it doesn't work even remotely, that's why I am asking if I didn't miss anything. – Jaroslav Jerryno Novotny May 25 '16 at 16:37

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.
– kivig May 25 '16 at 11:51