Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug / Crash  ParticleShader won't compile in 2021.2
#1
Code:
Error building Player: Shader error in 'Obi/Particles': invalid subscript '_ShadowCoord' at line 100 (on d3d11)

Compiling Subshader: 0, Pass: ParticleFwdBase, Vertex program with DIRECTIONAL LIGHTPROBE_SH SHADOWS_SHADOWMASK STEREO_INSTANCING_ON
Platform defines: SHADER_API_DESKTOP UNITY_ENABLE_DETAIL_NORMALMAP UNITY_ENABLE_REFLECTION_BUFFERS UNITY_LIGHTMAP_FULL_HDR UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BLENDING UNITY_SPECCUBE_BOX_PROJECTION UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS
Disabled keywords: DIRLIGHTMAP_COMBINED DYNAMICLIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADER_API_GLES30 SHADOWS_SCREEN UNITY_ASTC_NORMALMAP_ENCODING UNITY_COLORSPACE_GAMMA UNITY_ENABLE_NATIVE_SHADOW_LOOKUPS UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER2 UNITY_HARDWARE_TIER3 UNITY_LIGHTMAP_DLDR_ENCODING UNITY_LIGHTMAP_RGBM_ENCODING UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_NO_DXT5nm UNITY_NO_FULL_STANDARD_SHADER UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 UNITY_PBS_USE_BRDF3 UNITY_PRETRANSFORM_TO_DISPLAY_ORIENTATION UNITY_UNIFIED_SHADER_PRECISION_MODEL UNITY_VIRTUAL_TEXTURING VERTEXLIGHT_ON

This error always occured when trying to build the proejct for the first time after launching the 2021.2 Editor, but since 14f1 it actually prevents you from building every time. Any idea what could be going wrong here?
Reply
#2
(07-03-2022, 11:41 AM)locque Wrote:
Code:
Error building Player: Shader error in 'Obi/Particles': invalid subscript '_ShadowCoord' at line 100 (on d3d11)

Compiling Subshader: 0, Pass: ParticleFwdBase, Vertex program with DIRECTIONAL LIGHTPROBE_SH SHADOWS_SHADOWMASK STEREO_INSTANCING_ON
Platform defines: SHADER_API_DESKTOP UNITY_ENABLE_DETAIL_NORMALMAP UNITY_ENABLE_REFLECTION_BUFFERS UNITY_LIGHTMAP_FULL_HDR UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BLENDING UNITY_SPECCUBE_BOX_PROJECTION UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS
Disabled keywords: DIRLIGHTMAP_COMBINED DYNAMICLIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADER_API_GLES30 SHADOWS_SCREEN UNITY_ASTC_NORMALMAP_ENCODING UNITY_COLORSPACE_GAMMA UNITY_ENABLE_NATIVE_SHADOW_LOOKUPS UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER2 UNITY_HARDWARE_TIER3 UNITY_LIGHTMAP_DLDR_ENCODING UNITY_LIGHTMAP_RGBM_ENCODING UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_NO_DXT5nm UNITY_NO_FULL_STANDARD_SHADER UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 UNITY_PBS_USE_BRDF3 UNITY_PRETRANSFORM_TO_DISPLAY_ORIENTATION UNITY_UNIFIED_SHADER_PRECISION_MODEL UNITY_VIRTUAL_TEXTURING VERTEXLIGHT_ON

This error always occured when trying to build the proejct for the first time after launching the 2021.2 Editor, but since 14f1 it actually prevents you from building every time. Any idea what could be going wrong here?

Line 100 in the particle shader is a Unity macro:
Code:
UNITY_LIGHT_ATTENUATION(atten,i,0);

and "_ShadowCoord" is an internal Unity variable.

As far as I know this macro is always defined by Unity, so no idea why it is complaining about its own macro definition. What are your lighting settings? What platform are you targeting?

Unless you're rendering particles directly, you should be able to replace line 100 in the shader with:
Code:
float atten = 1;

That will get rid of the error (and of particle shadows too!).
Reply
#3
Thanks, that's okay since I'm not using the particle shader anyways.

I'm targeting Windows. Here's my lighting / graphics setup, mostly the default builtin rp ultra settings with some SteamVR overrides: https://imgur.com/a/JiOTHae
Reply