Search Unity

Custom SurfaceOutput

Discussion in 'Shaders' started by jameszhao00, Nov 30, 2010.

  1. jameszhao00

    jameszhao00

    Joined:
    Nov 30, 2010
    Posts:
    4
    Hi,

    At the moment, I have a surface shader, and a lighting function.

    I need to pass additional information to the lighting function, so I made a custom SurfaceOutput.

    Code (csharp):
    1. struct CustomSurfaceOutput
    2.         {
    3.             half3 Albedo;
    4.             half3 Normal;
    5.             half3 Emission;
    6.             half3 SpecularNormal; //custom
    7.             half Specular;
    8.             half Gloss;
    9.             half Alpha;
    10.                         //half2 RadianceMapUv; //outta space :(
    11.         };
    However, I've gotten to the point where I can't stuff any additional attributes into this struct (Unity keeps complaining about "Scannot locate suitable resource to bind parameter "blah blah"). Is there some way to add arbitrary data to this struct?

    PS.
    This space limitation might be created by gbuffer limitations in the deferred lighting model. If this is indeed the case, can I disable shader generation for deferred lighting or something?
     
    Last edited: Nov 30, 2010
  2. jameszhao00

    jameszhao00

    Joined:
    Nov 30, 2010
    Posts:
    4
    any ideas?
     
  3. juicyMeatBall

    juicyMeatBall

    Joined:
    Jul 11, 2013
    Posts:
    1
    i need a custom SurfaceOutput too
     
  4. mouurusai

    mouurusai

    Joined:
    Dec 2, 2011
    Posts:
    350
    It's should work, try post your shader here.
     
    Last edited: Aug 30, 2013