FX/Glass/Stained BumpDistort issue with fog, and a fix

We had an issue with the BumpDistort shader in a particular particle effect, where, as the object got further from the camera, it seemed that a slight haze appeared. It seems this is an issue only when there’s fog in the scene.

See this example - up close the distortion is working fine - at a distance, the ugly artefact shows up:

I made a small tweak at line 19, simply turning off fog in the pass that grabs the color:

SubShader {
Fog { Mode Off }
// This pass grabs the screen behind the object into a texture.
// We can access the result in the next pass as _GrabTexture
GrabPass {

Name “BASE”
Tags { “LightMode” = “Always” }
}

Anyway, this seems to fix it for me, and I thought I’d share!

I’m using Unity 2017.1.0f3 with the latest version of this shader. I use it to create heat distortion above fires and I encouter artifacts when using this shader together with fog as shown in the attached picture. Unfortunately, the fix does not work for me.

Does anyone have an idea how ot solve this?

3155899--240027--shaderFog.JPG