Search Unity

Question X-Ray effect?

Discussion in 'Shader Graph' started by dgoyette, Jun 18, 2019.

  1. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,196
    Does Shader Graph support the ability to render objects that are obscured by other opaque objects? I was looking to implement an effect where the player can "see" certain objects, even if they're hidden behind other objects. This seems like something I might be able to do in a shader by adjusting the rendering pass, but I don't see an option in SG. I'm using 5.16 with Unity 2019.1.
     
  2. zhuchun

    zhuchun

    Joined:
    Aug 11, 2012
    Posts:
    433
    I guess you're looking for a transparent shader without depth-test? IIRC, if you enable distortion on the master node then a depth test check-box will popup, uncheck it will do the trick.
     
  3. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,196
    Thanks. I tried that, and you're right that it now draws the object on top of everything else. However, I think the distortion must be getting involved. As I get closer and further from the object, it dramatically changes color. I set the material's emission to be very bright green. When I'm close, it's green. As I get further away, it drops off to being grey. I can see it behind the wall, but it loses all color.

    I'll keep playing with it.

    38.png 46.png 55.png 75.png
     
  4. zhuchun

    zhuchun

    Joined:
    Aug 11, 2012
    Posts:
    433
    Oh, that was interesting, I didn't notice that since I was using it for screen color distortion. Maybe Unity would release an "original" depth-test option for shader graph someday.