Search Unity

[SOLVED] Multi-Pass Shader and Ocean shader issue with Edge and Depth! Please help.

Discussion in 'Shaders' started by markashburner, Apr 5, 2020.

  1. markashburner

    markashburner

    Joined:
    Aug 14, 2015
    Posts:
    212
    Hi I have a custom made terrain shader that combines the terrain and atmosphere together in one shader using two passes.
    I am creating an ocean shader with Amplify Shader editor at the moment and I noticed my edge detection in my ocean shader is not working on my custom written shader that I use for my terrain, it works on all other standard Unity materials though. It does work on my own custom made shader but only when I apply the shader to the material in the Editor inspector window while the game is running. It's a really weird and annoying bug because I managed to get it to work by
    setting Cull and ZWrite to Off in the Pass. But it only works when I apply my custom made shader to the material in the inspector window while running.

    Here is my shader code for the Atmosphere pass that was conflicting with my ocean shader from Amplify Shader Editor.

    Code (CSharp):
    1.     // ----------------------------------------------------
    2.         // --- SCATTERING PASS --------------------------------
    3.         // ----------------------------------------------------
    4.    
    5.         Pass{
    6.             Blend SrcAlpha OneMinusSrcAlpha, One One
    7.             Cull Off
    8.             Lighting Off
    9.             Offset -0.1, 0
    10.             ZWrite Off
     
    Last edited: Apr 5, 2020
  2. markashburner

    markashburner

    Joined:
    Aug 14, 2015
    Posts:
    212
    I realised that on the material the render que was set to 3000 as transparent. Changing it back to geometry 2000 worked.