anti-aliasing the z value?

I’ve been trying to figure out a way of anti-aliasing the z render pass. the normal image you get for the z render pass isn’t anti-aliased, and thats okay for dof effects because you are blurring the image anyway. sadly for other effects the z pass is useless. I was trying to use it to change the saturation based on the distance from the camera, and I got some very poor results.

Does anyone know of an easy way to get and anti-aliased z render pass?

Z is provided on a pixel-by-pixel basis. So you can do your own oversampling by rendering at 4x and then scaling down 1/4 to give you OSA 4.

Or you can convert the Z to a BW image via MapValue, which internally will be 32 bits, blur it, and then remap it back up the original value range.

Or you can do a difference on both images, mask them and mix the desired parts.

Oh, there’s no need to do it like that. The material nodes provide all the tools you need. Kitsu was kind enough to point out this mind bending effect with transparency by distance but you can adjust his methods to suit your own needs. See here:

http://blenderartists.org/forum/showthread.php?t=97692&highlight=transparency

This is top quality stuff!

OMG! kitsu is an f’ing genius. that is a perfect solution. Thanks for the link RamboBaby.

That’s the same thing I thought when he showed us how. If you like that you might like this too, courtesy of Conz3D:

http://blenderartists.org/forum/showthread.php?t=97077&highlight=shader

yeah, I read that a while ago, but conz3d hadn’t sorted the whole thing out yet… that is pretty cool. I’m not sure what to use a cavity shader for but I’m sure there are many ways it could be applied. that thread kinda opened my eyes to a few new ideas.