Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

multi_compile prePass

Discussion in 'Shaders' started by Phantomx, Apr 17, 2014.

  1. Phantomx

    Phantomx

    Joined:
    Oct 30, 2012
    Posts:
    202
    Hey,
    is it possible to exclude the whole prepass code with a #if statement?

    I tried something like this:

    Code (csharp):
    1.  
    2.         #if BRDF_OFF
    3.         inline fixed4 LightingHardSurface_PrePass (SurfaceOutput s, half4 light)
    4.         {
    5.  
    6.             fixed4 c;
    7.             c.rgb = fixed3(1,0,0);
    8.             c.a = s.Alpha;
    9.            
    10.             #if SPECULAR_ON
    11.             c.rgb += fixed3(0,1,0);
    12.             #endif
    13.            
    14.  
    15.             return c;
    16.         }
    17.         #endif
    18.  
    but it doesn't work, the shader doesn't take the prepass at all. Is there an other way?

    thanks!
     
    Last edited: Apr 17, 2014