Render out z-buffer using nodes?

Hi,

I’m trying to use composite nodes to render out the z-buffer of a scene. I attach the z output on the render layer node to the image input on the composite node, but all that renders is a blank whate image. Does anyone know how to make this work?

Thanks.

try attaching a curves node and adjusting that. You have to give it an idea for the “scale” of the Z value.

This is really messed up. I tried using curves, and the only way I could make any difference at all was to click the black level color and type 0.99999998 into the V feild (Even though it was so close to 1, it displayed it as 1) . Then, everything turned pitch black. If I turned it lower by any amount, no matter how small, it turned white again.

Attachments


Okay, I’m going to post the .blend.

I’d really appreciate it if someone could get this to work.

Attachments

mountains.blend (944 KB)

use a 32 bit format like Radience HDR. Z is a number between 0 and +infinity, where each “pixel” is a number representing the distance between the object in that pixel and the camera. see the wiki tutorial on Fake DOF using the Z buffer for an example of how to process the Z buffer. Additionally, see the wiki on the Z-combine node and map value node.

Thanks, now I got it to work.:slight_smile:

But I’ve got another problem, how can I half the brightness of every pixel? I can use an RGB curves node and have the curve intersect the right edge of the box only halfway to the top, and this mostly works, but pure whites don’t change.

Edit: Never mind, I figured it out.

C’mon, laser… don’t “leave it at that!” Have mercy upon the many Googlers who will stumble-upon this thread, and tell them both “what you did” and, in the second part, “what you ‘figured out.’”

Forum threads have a lifespan of many years. In other words, “you have an audience.” Bring threads to closure. Thanks in advance.

Well,my solution wouldn’t work in most instances, but it just happened to work for me.
My problem was that whan the image you are subtracting is lighter than the image you’re subtracting from, it will be pure black, regardless of any variation in the original images. By reducing the amount that was subtracred, I thought I could show some of those “negative” values, but I found out that the divide operation worked just fine for me.

Also, I have one last question. Is there some way of combining nodes to be able to apply some sort of edge-preserving blur? What I mean is something that will blur between similarly colored pixels, but as the transition gets sharper, It will blur less?

If not, I’ll just have to call this donee for now.