1
$\begingroup$

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:

  1. 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.

  2. 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.

  3. 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?

$\endgroup$
2
$\begingroup$

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:

enter image description here

enter image description here

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.

| improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ Can you give a little information about what causes the problem and how that other answer solves it? This is basically a "link-only answer" so far. $\endgroup$ – Matt May 20 '16 at 15:43
1
$\begingroup$

My simple solution based on https://blender.stackexchange.com/a/53003/26896 answer.

Logarithmic depth shader

Render result example

| improve this answer | |
$\endgroup$
0
$\begingroup$

I remember having this problem. It actually brought our project to a halt :-( I wish I'd seen this fix before. From BlenderArtists RamboBaby says:

Yes, enable the "Save Buffers" option on the Output tab (F10) then enable the button that appears next to it labeled "FullSample". Any time you change the values of any nodes the render result will default back to the first sample of the FSA buffer sequence so you'll need to SHIFT+R ("Read saved FullSample Layers") with your cursor hovering in the nodes window in order to see the result updated as a smooth antialiased pass.

| improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ This is very old information and you should verify it, because it does not work today. $\endgroup$ – Jaroslav Jerryno Novotny May 20 '16 at 15:36
  • $\begingroup$ :-( I thought it mentioned a current version of Blender, but I must have imagined that... $\endgroup$ – Matt May 20 '16 at 15:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.