Smooth blending of post process depth fog

Hey there. I’m working on a marshland location of an open-world game. I needed to add some localised fog, as the exponential height and atmospheric fogs are seemingly global. So I went the post processing route.

I got the material looking quite nice and it works perfectly apart from blending it. I use several post process volumes in the map, and the rest of the map is not meant to be nearly as foggy as this area, but whenever I blend between the unbound global post process volume and the one in marshlands with the depth fog, the fog intensity jumps up.

In other words, if the blending weight of the fog post process material is between 0 and 1, the opacity of the fog is much higher than if the blending weight was at 1.

Is there a way to fix that through materials or is there perhaps a different way to blend the volumes? Or perhaps there’s an entirely different way to have relatively cheap, localised fog?

I know this is an old post but it’s the first thing that comes up on google and I thought I’d share my solution on v5.3

First you create a Master Material for your post process effect and then use a Material Instance on your Post process Volume with adjustable parameters for your fog color (Vector Param) and Lerp Alpha (Scalar Param).

Now, to use the Lerp Alpha parameter you’ve made, at the end of your Material function create a Lerp connecting A to PostProcessInput0 and B to the rest of your Material Function and use your Scalar Parameter as the lerps alpha - This part is vital, the Lerp Alpha parameter must be set to 0 and your Fog Color Vector Parameter must be set to the exact color you wish to have the fog.

Then simply go to your Material Instance and set the Lerp Alpha to 1 and it should now blend perfectly.

Not entirely sure why it works this way but the blending seems to revert a Material Instance back to the Master Materials base parameter values, therefore setting up the base values as completely invisible and to the color you wish it to fade out of will give you a perfect transistion between Fog and No Fog. Hope this helps people!