How to use DOF / Z pass to mask AO in an outdoor scene

Hi,

How can I use the the Z pass to mask the AO pass only to objects near the camera?

Thanks

Using a normalized depth with a color ramp you can mask in z, them multiply the AO pass. Also works using mist pass and it’s better on very large scenes.

Depth:

Mist:

1 Like

Thank you. How do you mix it back into the final without multiplying the background / darkening? That’s the crux where im stuck. I want to apply AO pass to outdoor scenes, but every which way i go about it it the background is darkened

Invert the color ramp in that setup and change mix mode to Screen. Then you multiply over your final image. Think about the math, if you have a pixel of value 1,1,1 multiplied by any other, nothing will happen. For a pixel of any lower value than 1 multiplied by any other one, the final output will be a darkened pixel.

2 Likes

Thank you. I think I got it. Does this look right to you?

Looks great. Keep it up! I believe you’re adding the mist pass to build atmospheric, you could also use a low density volume linked to a noise texture to be a more organic atmosphere.

Thanks. For some reason the math wasn’t mathing. I read up how screen works. I still don’t fully understand why it works, but I think I’m starting to get it. I understand we’re multiplying by 1,1,1 at the beginning. I think if there was a text descriptor of the math operation happening that would be helpful on the nodes. Like a tooltip or something.

Yes, I use volumetrics sometimes. I have high poly scenes (lots of plants, even though they are linked instances). I find the mist pass + compositor to be less heavy on render times.

Thanks!

1 Like