Search Unity

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

Discussion in 'Shaders' started by aaronflippo, Oct 23, 2013.

  1. aaronflippo

    aaronflippo

    Joined:
    Jun 7, 2012
    Posts:
    45
    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:
    $Screen Shot 2013-10-23 at 1.17.45 PM.png

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

    moco2k

    Joined:
    Apr 29, 2015
    Posts:
    294
    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?
     

    Attached Files: