I have a custom shader that uses 15 sampler2d. In Unity 5.5 the shader was working perfectly however since updating to Unity 5.6 I am getting the following error:

maximum ps_4_0 sampler register index (16) exceeded at line (on d3d11)

Compiling Fragment program with POINT

It appears that the update has added some new samplers. The only Unity post I have found on this is an issue ticket here: https://issuetracker.unity3d.com/issues/regression-5-dot-4-rtp-rtp-terrain-shader-rendering-is-broken-after-upgrading-project-to-5-dot-4

The instructions however are quite unclear and although they do mention that the custom shaders need to be changed manually to accommodate the new samplers, it's unclear exactly how this needs to be done in the shader code. I have tried to add the various suggested #define and #undefine tags as suggested, but the surface of my model is still pink and the error isn't fixed.

Any suggestions how to fix this?

  • \$\begingroup\$ Without seeing the shader itself there's not much we can do (even if we do see the shader, there aren't many people here who use both 5.6 and shaders, so testing would be harder). I suggest opening a new ticket on Unity and I'll might be of some help if you post the shader (not an expert but I've dabbled in shaders). \$\endgroup\$ Apr 14, 2017 at 13:43
  • \$\begingroup\$ In the shader code, how can I disable UNITY_SPECCUBE_BLENDING and UNITY_LIGHT_PROBE_PROXY_VOLUME? I cannot find documentation on this. \$\endgroup\$
    – FrontEnd
    Apr 15, 2017 at 11:25
  • \$\begingroup\$ I'd assume something like UNITY_SPECCUBE_BLENDING = false; but I don't really know because I didn't dig too hard into shaders. I know that Unity shader documentation is really lacking though, you might have to do some trial and error on that front. \$\endgroup\$ Apr 15, 2017 at 12:34
  • \$\begingroup\$ Yeah unfortunately that causes an error. I have tried the following but it didn't seem to have any effect: CGINCLUDE #if defined(UNITY_SPECCUBE_BLENDING) #undef UNITY_SPECCUBE_BLENDING #define UNITY_SPECCUBE_BLENDING 0 #endif ENDCG \$\endgroup\$
    – FrontEnd
    Apr 17, 2017 at 5:46
  • \$\begingroup\$ @FrontEnd Have you found a root cause eventually? I seem to have the exact same issue. \$\endgroup\$ Feb 2, 2018 at 17:32


You must log in to answer this question.

Browse other questions tagged .