Forum Discussion

xrdyne2's avatar
xrdyne2
Copper Contributor
Oct 10, 2023

Shader error in 'Universal Render Pipeline/Terrain/Lit': maximum ps_5_0 sampler register index (16)

 

Looks like LightCookieInput shader from URP is breaking some of the rules in the build for mesh.

How do i fix this im not a unity pro

 

 

Error building Player: Shader error in 'Universal Render Pipeline/Terrain/Lit': maximum ps_5_0 sampler register index (16) exceeded at /org/cadtounity/Mesh-Toolkit-Unity/Mesh101/Library/PackageCache/com.unity.render-pipelines.universal@14.0.8/ShaderLibrary/LightCookie/LightCookieInput.hlsl(9) (on gles)

 

 

Compiling Subshader: 0, Pass: ForwardLit, Vertex program with DIRLIGHTMAP_COMBINED DYNAMICLIGHTMAP_ON FOG_EXP2 _ADDITIONAL_LIGHTS _ALPHATEST_ON _LIGHT_COOKIES _NORMALMAP _REFLECTION_PROBE_BLENDING _TERRAIN_INSTANCED_PERPIXEL_NORMAL
Platform defines: SHADER_API_MOBILE UNITY_ASTC_NORMALMAP_ENCODING UNITY_COLORSPACE_GAMMA UNITY_ENABLE_REFLECTION_BUFFERS UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_LIGHTMAP_DLDR_ENCODING UNITY_NO_CUBEMAP_ARRAY UNITY_NO_FULL_STANDARD_SHADER UNITY_NO_RGBM UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF3
Disabled keywords: FOG_EXP FOG_LINEAR INSTANCING_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADER_API_GLES30 SHADOWS_SHADOWMASK UNITY_ENABLE_DETAIL_NORMALMAP UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER2 UNITY_HARDWARE_TIER3 UNITY_LIGHTMAP_FULL_HDR UNITY_LIGHTMAP_RGBM_ENCODING UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_NO_DXT5nm UNITY_PBS_USE_BRDF1 UNITY_PBS_USE_BRDF2 UNITY_PRETRANSFORM_TO_DISPLAY_ORIENTATION UNITY_SPECCUBE_BLENDING UNITY_SPECCUBE_BOX_PROJECTION UNITY_UNIFIED_SHADER_PRECISION_MODEL UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_VIRTUAL_TEXTURING _ADDITIONAL_LIGHTS_VERTEX _FORWARD_PLUS _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN

  • Hi xrdyne2, unfortunately this is a Unity limitation and not one imposed by Microsoft Mesh. The terrain material (and in turn shader) is using too many texture samplers. Some platforms can't sample more than 16 textures in a single shader. Note texture samplers != number of textures necessarily, but when authoring shaders this is often the case.

    There are a few ways to fix this, you might be able to disable some of the rendering features on your terrain to strip out shader features and reduce texture utilization. Or, you can try using a different terrain shader, or author your own terrain shader.

Resources