Looking for a usable solution for Z-pass aliasing i'm trying to render a small video of a city in fog using the cycles engine. The main problem is, i need physically accurate fog. In order to achieve that i'm using the distance of a pixel from the camera to the object calculated by the Z-Pass. But the Z-Pass has no anti aliasing so the end result has a lot of jagged edges. I have already searched for a solution.
The options were:


Switch to blender internal render because it has FSAA (Full Sample Anti Aliasing)

I have tried that and the option does what i need, but i started using cycles and switching to blender internal render
at this stage requires a lot of material work to be redone. 
Use super sampling and down scale after the rendering.

This does work but has some side effects. In order to achieve good results i need to render 16 times more Pixels.
In theory i can also reduce the rendering samples per pixel by that factor, so the workload should stay the same.
But it doesn't, this correlation is not linear. It takes considerable more time to render the bigger picture. 
5120 x 4096 with 9 samples takes 4m53s and a 1280 x 1024 px frame with 144 samples takes just 3m39s. Which doesn't sound like a lot, but if you need 2400 frames, it does add up.
Also the super sampled result has a lot more noise and is noticeably darker as well.
Use mist pass.

Sadly, i had no success extracting the distance information from the mist pass and wasn't able to get it to work 
in my application.


Does anyone have any suggestions?
Use this shader as an override for all your materials in Render layers and render a perfect Z-depth pass that is pixel-perfect anti-aliased like your final render:





It shades the geometry based on distance from camera and renders fast (only 1 emission shader, you can omit the black emission).

It is basically similar to the mist past, but let's you do more magic for example with transparency if you need.