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

Too many texture interpolators (when there aren't too many interpolators)?

Discussion in 'Shaders' started by ambershee, Oct 8, 2013.

  1. ambershee

    ambershee

    Joined:
    Oct 8, 2013
    Posts:
    10
    Hi guys!

    I'm getting the fairly common 'too many interpolators' error message when trying to get a relatively simple shader working. I'm using #pragma target 4.0 as I'm only targeting Dx11 hardware and it should be more than adequate.

    My struct looks like as follows:

    Code (csharp):
    1.         struct MySurfaceOutput
    2.         {
    3.             half3 Albedo;
    4.             half3 Gloss;
    5.             half3 FlakeGloss;
    6.             half Specular;
    7.             half FlakeSpecular;
    8.             half3 Normal;
    9.             half3 Emission;
    10.         }; 
    Which as you can see only adds one additional texture interpolator (and one scalar). What else can throw this error message?

    Thanks,

    Luke
     
  2. Farfarer

    Farfarer

    Joined:
    Aug 17, 2010
    Posts:
    2,249
    DX11 is 5.0, not 4.0.

    But you might look to combine the specular and flakespecular variables?

    half2 Specular; // .r is Specular, .g is FlakeSpecular ?
     
  3. ambershee

    ambershee

    Joined:
    Oct 8, 2013
    Posts:
    10
    Hi Farfarer - Dx11 is indeed shader model 5, but 4 should be adequate!

    You're right that I can combine those two terms, although I shouldn't think it'll make much difference at this point and the shader is still in development - it might change later down the line anyway (I can worry about those kinds of optimisations a little later down the line).
     
    Last edited: Oct 8, 2013
  4. Farfarer

    Farfarer

    Joined:
    Aug 17, 2010
    Posts:
    2,249
    I think the full compliment of variables in that struct (the default SurfaceOutput that Unity uses) allows for 2 more to be added. Mostly I've had to end up packing a lot of things together into a single variable if I want to get anything through it.
     
  5. ambershee

    ambershee

    Joined:
    Oct 8, 2013
    Posts:
    10
    I gave packing them both into a single Half2 a try, but it's still not working. This should be possible - something I'm not aware of must be tripping it and throwing that error message :/