This setup seems like it should work, but it doesn't.
the Z-buffer isn't really an image but a grid of distance values mapped from camera Use the PS: instead of the |
||||
|
The value outputted by the z pass is in absolute units, going from zero to however far the objects in the scene are. Thus it goes over the color ramp's range of values, and gives out the value that maps to full 1 in the ramp. You can fix this by adding a normalize node before the color ramp, or by multiplying it by some small value with a math node. The normalize scales the range from the smallest value to the largest to map into the 0-1 range, so the results of all objects change if you animate the furthest or closest object. A math node does not have that limitation and thus works better with animated scenes. |
||||
|