Rendering a Depth Map

I can only find old threads regarding this question, so I’ll ask it here.

I render an image as OpenEXR, ensure “Zbuf” is checked, and I make sure “All Z” is checked in the “Layers” section of the “Render” panel. I go into the node editor and there’s a gray “Z” socket, but I’m not sure what to do from here. I plug the “Z” socket into an “Image” socket in a viewer node, but I just get an all-white image.

Can anyone tell me what I’m doing wrong?

Connect the ‘Z’ to a Map Value node, and connect that one to a Color Ramp node. Connect ‘image’ from the Color Ramp to the viewer.

Play with the map value Size and Offset. To start just set Size around 0.03

No dice. Still straight white BG. I’ve played with the size, offset, min, max–nothing. All I can get it to do is go from white to a shade of grey, to black.

All I’m trying to do is export a depth map for use in compositing in After Effects. I figured this would be easier than its turned out to be.

works for me. Hope this helps


depth.blend (424 KB)

@Sago: Got it, thanks! I double-checked your .blend file vs. mine, and I was making some dumb mistakes. All taken care of now!

@Atom: Thanks for the link; lots of great info there!