Why Z-pass doesn't have antialias?

Hi guys, when i give my Z-pass a map value and a ramp color in the node compositor, the result show me a silouette without antialias, too much jagged that is quite unusable for everything.

Why Z-depth is so jagged in blender? Thank you.

Although its probably not the best thing to do, I slightly blur the zbuffer after the ramp color adjustment step. This removes a lot of visual artifacts.

afaik, z is on a pixel-for-pixel basis, and each indicates the distance that pixel is from the camera. Anti-Aliasing in this case does not make sense, since Z is factual information and is not meant to make a pleasing picture. You can blur to introduce some averaging and, in effect, beveling some edges. You can also render at like 2x the resolution and scale down, which is a kind of homebrew AA done by your image display software.

you can also in the output tab turn on : Save buffers and then full sample

this will make these pases Antialiased , of course they will take longer to render , most of the times is not necesare to do this, as PapaSmurf said, but if you are running into problems with the defocus node it might help doing this and also changing form disk to cubic or any other ;D

thank you guys, i’m going a bit further and explain in a better way.
the issue i face is about z-combine. i need to use the z-buffer to composite my render layers in the final image without having to render everything in one titanic pass. The problem is when i use z-depth to combine layers the outline between one layer and the other is simply ugly due to the jagged z-buffer outline.

the final image is simply not acceptable and looks very horrible. i plan to use z-buffer for DOF too and i think in that case this is not a problem, but in the way i try to use those at the moment they are ugly.

i tried to save buffers and enable FSA but either they don’t work or i’m not able to benefit from that.

DO you need to use the zcombine node to composite your render layers? I’d suggest using a mix node or alpha over node as they behave much better and do not show the artifacts you are observing.

Don’t mix an anti-aliased image with a z-buffer. AA just blurs some pixels, and those pixels need to be the color of whatever object is at that distance. Instead, mix them native, and then FSA or home-brew AA the final result. iirc, FSA was designed to fix this.

voilà, this is my scene:


i have one object (A) half surrounding another obj (B). A is on level 1 and B is on level 2 for render pass needs.
If i use mix or alpha over i lost some part of A object, marked red in fig. it’s true they do a better job but my scene is incorrect.

if i use z-combine my scene is geometrically correct but visually ugly because of the jagged z-depth needed in order to let z-combine node to compute the geometry right.

sorry, i think i didn’t understood. my image is ANTIaliased but my z-depth is aliased and it introduce an horrible jagged look to my render. if i mix my objects natively (do you mean in the same render level?) i would see render time increase exponentially if only my ram could manage such a lot of datas.

Study the “render passes” manual-sections carefully. Those diagrams, e.g. in http://wiki.blender.org/index.php/Manual/Render_Passes, should give you a lot of good ideas.

The main thing here is that you do have to watch out for things like “anti-aliasing,” or (generally speaking) any other such “differences” that may occur between the various things you’re trying to composite together. If one thing is blurred while the other is sharp, etc., it’s just going to look awful. But there might be something simple … like the good ol’ “blur box,” that you can use to get an acceptable result.

Nothing has to be “perfect,” especially if it’s moving or not seen for a long time on-cam. In fact, it can be utterly fake. Star Wars Episode One actually shipped to movie theatres with colored Q-tips standing-in for a crowd in the podracer sequence. No one noticed.

Z has no antialias in every 3d program, software renders or hardware renders…

interesting… i’ll dig that infos. but it seems to not resolve my issue so far.

considering it has to manage antialiased image and jagged z-buffer, is the z-combine node a bit useless?

I believe FSAA was developed to solve specifically this problem.
I’ve done a quick test of FSAA and it all looks fine to me.
I’ve never used it before, however, so I could well be doing something wrong.


fsaa.blend (156 KB)


I belive 3DSMax does allow you to apply anti-alias to a z-buffer. It is in their video post section.

It solves AA issues among all depth buffer AND alpha channel effects. This is particularly noticible in alpha channels when creating some type of matte or other as you don’t end up with an intersection left from ANY osa alpha matte edge because the mattes are the last thing to be calculated from multiple angles within a series of images rather than being precalculated into a single image. OSA always leaves these matte edge artifacts while FSA never leaves them. You can even mix and match depth buffers with alpha channels without penalty via FSA.

If you use Blender to render 3D files AND use it’s compositor to alter them via matting techniques then FSA is MANDATORY for optimum results.

your file works as a charm, i have to dig into mine to make it working as your does. thank you!
and very good to have the ability to enable FSA in blender!!!

There is more than one solution available to almost any problem. The best solutions are usually those that happen “in post,” after the 3D-rendering of the component parts is completed. This actually means that many of the things you’d normally do during the render, such as object-wise anti-aliasing, specifically must not occur at that time. They have to occur once, and therefore “at the appropriate point in the overall pipeline.”

Fortunately, the render-pipeline in Blender has a lot of that stuff for you. Example: “Z-mask rendering.”

Only problem sometimes is… just how much time do you have? Lots of neat things can be done if you don’t mind the fact that your renders just got four or eight times longer than before. If that is a problem, sometimes you have to start looking around for “good enough.”