View Full Version : any news on zdepht rendering for fluids

03 March 2010, 03:03 PM
hi everyone!

I was just curious if there are any news on fluid rendering according z-depth. I was never able to get any z-depth out of fluids. okay there is this workaround with converting fluids to polys but seriously that's not efficient nor accurate! so is there any way to render usable z-depth?


03 March 2010, 09:29 AM
The most promising way of doing this is to use some input in the fluids color grid. Cache your sim, render the beauty and then put a ramp(planar projected) into the color input and render with an ambient light. The less transparent your fluid is the better it works. For more precision you could write an expression and calculate the distance between camera and each voxel but that's going to be slow. If done as a plugin command it would be much faster. Hope that gets you along.

03 March 2010, 02:43 PM

yes I thought of an expression as well but as you mentioned would be really slow. the projection method I've never tried so thanks for this one.
I was just hoping that there would be some build-in method for zdepth render because the issue was raised 5 years ago (if you check the cgtalk entries).

thanks for your input.

03 March 2010, 08:08 PM
i think when you render with maya's software renderer to IFF and check Z channel it does render it but I am not sure. Please confirm.

03 March 2010, 09:30 AM
just turning on zdepht with maya software didn't work for me.

03 March 2010, 07:43 PM
Fluid depth output is still not fixed.

It is possible to get the fluid to appear in zdepth (maya sw only) by making the camera depthtype = nearest visible. In voxels where the fluid is over the transparency threshold it will set the depth. However the depth that appears is the front of the rayspan, which will is the near face of the fluid cube. One is still better converting to poly, in my opinion.

Note that if you use a texture projection method you will need to use volumeSamplesOverride to resolve the texture projection inside the fluid.

Another technique might be to position a volume light at the eye and scale it to the desired depth. Use the light's color range ramp to control the color dropoff with distance. You could perhaps encode depth as "hue" with this ramp then ignore value differences( due to transparency of the fluid ) when extracting the depth from the image. An advantage with using a light is that it will accurately evaluate in depth while a shading network texture requires one use volumeSamplesOverride.


03 March 2010, 07:52 AM
thanks for the advice! will check out these options and see which works best.

CGTalk Moderation
03 March 2010, 07:52 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.