View Full Version : Depth Pass (Z-Buffer) from Blender, is that possible?

07 July 2003, 08:30 PM
I am looking for a way of saving the Z-Buffer information from a render into an image, in order to use it for composing later. I now Blender can save Alfa information into the image if you choose the right format. Regarding the Z-buffer there is the option to save to IRIX+Zbuffer.... but I have yet to find a program that can read that output. Does anyone knows of an usable way to get the Z information from a Blender render?

*** If you don't understand what I'm talking about, here is a quote from a Maya tutorial speaking about the same issue.

Depth Pass - Z-depth can be rendered as a separate pass to allow for a variety of results in post. One can use Z-depth to add depth-of-field and fog to an element. It can also be used to allow a compositing package to know where one object on a layer is in relation to another object on another layer. Therefore if you had a sphere in the middle of a torus where some of the sphere is behind and some in front of the torus, you could render the objects separately and still composite them successfully.

Z-depth is a single channel image, being limited to 256 shades of gray in a standard 8-bit/channel image. It is common to render a depth pass as a 16-bit image to increase the value range and accuracy within a z-depth image.

The gray values within a depth pass represent distance from the camera where white is near and black is far. The range in Maya units that this represents is based on the rendered camera's clipping planes. Therefore you can increase accuracy by using near/far clipping planes which are as close to the objects in your scene as possible while not clipping them off. It is very important, however, to use the same clipping plane values for each rendered layer.

and the full tutorial is here:

07 July 2003, 12:19 PM
I've been looking for an easy way to do this too. I've suggested allowing the user to include it as a fourth channel in a targa file, but received on real response. It seems that this would be an easy thing for a coder to do.

There is a z-buffer export plugin, somewhere, but I haven't bothered fighting with plugs in the last couple versions of Blender.

07 July 2003, 05:18 PM
I asked the same question on elYsiun and Theeth gave me an easy way to do it without using plug-ins.

you can also do that by rendering to Black and White with a black mist with the Quad option starting at the camera's clip start and ending at clip end.

... and regarding the plug-in, MadMesh said:

You have to experiment with the clipstart and clipend of your camera to get the best results. A clipstart of 0.01 works well for me, any higher value like 0.1 give very odd results in the z-buffer. But i think that depends on the scene.

the plug-in is here:

07 July 2003, 06:03 PM
Also, the plug-in only works on 2.23 or lower versions of Blender.

It was never upgraded for the newer versions.


CGTalk Moderation
01 January 2006, 03:00 PM
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.