Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

Help Wanted Surface shader modifying the depth...

Discussion in 'Shaders' started by LightStriker, Feb 13, 2021.

  1. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,662
    We have implemented a surface PBR relief shader that works with our lighting system.

    So far, it works rather well.

    But one thing that would push the lighting to the next level would be if the relief could be written in the ZBuffer.

    Is there anyway to modify the ZBuffer from a surface shader?

    If not, I know it's possible from a normal fragment shader. But I have no idea how to package a fragment with a surface and have two passes properly.
     
  2. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,662
    Nevermind... I ended up using the GBuffer0 Alpha (Occlusion) with the GBuffer2 Alpha (Unused but horribly low precision) as a bit switch.
     
unityunity