render z buffer

Is there any way in Blender to render the Z Buffer as a greyscale image? I would like to do some post DOF in combustion…

I did a search & all I could find was that blender didnt render a zbuffer when fields were turned on, is this true also?

There’s probably a better way to do this, but the way I do it is: change all the materials to pure white shadeless, no transparency, no textures, ZTransp off, so when you render you just get patches of white where the objects are.
Then set the world to pure black.
Then, still in world buttons, turn on mist, set it to Lin, set the Start to just in front of the closest object to the camera and End just behind the furthest.
When you render that, the closest objects should appear white and the furthest black.
I know it’s long-winded but it works, and it would also work if fields were turned on. It also works for animations which is helpful.

You could do it with a sequencer plugin, but i don’t know if there is one, it would be easy to write (i’ll write one and post it soon).

No problem to render the zbuffer:

Use the sequenzer-plugin called showzbuf:

http://www-users.cs.umn.edu/~mein/blender/plugins/sequence/showzbuf/index.html

a little example I’ve made just for fun :stuck_out_tongue: :

1.) Monkey Pic:
http://www.olafarnold.com/monkey.jpg
2.) Rendered ZBuffer:
http://www.olafarnold.com/zbuffer.jpg
3.) Screenshot:
http://www.olafarnold.com/screenshot2.jpg

Thanks guys, I’ll try the mist one in the meantime, I’m using 2.26 & I dont think sequence plugins work in this version (aside from the fact that I’ve never used the sequence editor before, I wondered what that button was! :slight_smile: ) but I’ll definately investigate that option as well, Thanks!

By the looks of that image, the Z-buffer output isnt antialiased is it?

It is not a good idea to anti-alias a heightmap, though with the mist method you can if you want to (you can’t with the plugin method), as the pixels that are half on the shape and hence half the shade will appear half the height in whatever program you use to work with the heightmap.

fer sure, antialiased z-buffers can give some screwy DOF in post :slight_smile: While we are (sort of) on the subject, can Blender output a velocity map?