Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Compile error : Invalid subscript _ShadowCoord
#1
Hi,

I am using Obi Rope and when I compile my project, it fails. I get a total of 4 errors, all of which are related to shaders. I could not solve it or find any resource online to solve it. Below are my errors. I am not going to post the code since you already have it. Please reply soon as possible I am on a tight deadline and have already spent quite sometime trying to solve this but to no avail. Thank you.

Error 1:

Shader error in 'Obi/Particles': invalid subscript '_ShadowCoord' at line 82 (on d3d9)

Compiling Vertex program with DIRECTIONAL LIGHTMAP_ON SHADOWS_SHADOWMASK
Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP

Error 2:

Shader error in 'Obi/Particles': invalid subscript '_ShadowCoord' at line 82 (on d3d11)

Compiling Vertex program with DIRECTIONAL LIGHTMAP_ON SHADOWS_SHADOWMASK
Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME

Error 3:

Shader error in 'Obi/Simple Particles': invalid subscript '_ShadowCoord' at line 68 (on d3d9)

Compiling Vertex program with DIRECTIONAL SHADOWS_SHADOWMASK
Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP

Error 4:

Shader error in 'Obi/Simple Particles': invalid subscript '_ShadowCoord' at line 68 (on d3d11)

Compiling Vertex program with DIRECTIONAL SHADOWS_SHADOWMASK
Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME
Reply
#2
(15-01-2018, 04:37 AM)Kumsan Wrote: Hi,

I am using Obi Rope and when I compile my project, it fails. I get a total of 4 errors, all of which are related to shaders. I could not solve it or find any resource online to solve it. Below are my errors. I am not going to post the code since you already have it. Please reply soon as possible I am on a tight deadline and have already spent quite sometime trying to solve this but to no avail. Thank you.

Error 1:

Shader error in 'Obi/Particles': invalid subscript '_ShadowCoord' at line 82 (on d3d9)

Compiling Vertex program with DIRECTIONAL LIGHTMAP_ON SHADOWS_SHADOWMASK
Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP

Error 2:

Shader error in 'Obi/Particles': invalid subscript '_ShadowCoord' at line 82 (on d3d11)

Compiling Vertex program with DIRECTIONAL LIGHTMAP_ON SHADOWS_SHADOWMASK
Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME

Error 3:

Shader error in 'Obi/Simple Particles': invalid subscript '_ShadowCoord' at line 68 (on d3d9)

Compiling Vertex program with DIRECTIONAL SHADOWS_SHADOWMASK
Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP

Error 4:

Shader error in 'Obi/Simple Particles': invalid subscript '_ShadowCoord' at line 68 (on d3d11)

Compiling Vertex program with DIRECTIONAL SHADOWS_SHADOWMASK
Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME

Hi there,

Which Unity/Obi versions are you using?

Edit: tested with 5.6.5, 2017.2 and 2017.3, cannot reproduce it. Can you give more details? (target platform, OS you're running, etc)

thanks!
Reply
#3
Hi Jose,

Thank you for the reply. I am using Unity 2017.2.0p4 and my obi version is 3.2. When I click on the error message on the console, it goes to ParticleShader.shader and line 82 is this : UNITY_LIGHT_ATTENUATION(atten,i,0);   . Thank you


Regards,

Kumaresan
Reply
#4
(16-01-2018, 02:58 AM)Kumsan Wrote: Hi Jose,

Thank you for the reply. I am using Unity 2017.2.0p4 and my obi version is 3.2. When I click on the error message on the console, it goes to ParticleShader.shader and line 82 is this : UNITY_LIGHT_ATTENUATION(atten,i,0);   . Thank you


Regards,

Kumaresan

Hi,

I think I found the culprit.

It only happens to me when using "shadowmask" lighting mode in the light mapper.

To correct the issue, add the "nolightmap" shader compilation option in these two places:

- Obi/Resources/ObiMaterials/ParticleShader.shader, line 20 should look like this:
#pragma multi_compile_fwdbase nolightmap

- Obi/Resources/ObiMaterials/SimpleParticleShader.shader, again line 20 should look the same:
#pragma multi_compile_fwdbase nolightmap
Also remove line 68, since attenuation is not being used.

These changes should allow the shaders to compile under shadowmask lighting, since particles in the ObiParticleRenderer are always dynamic and cannot benefit from lightmaps (moreover, they are only used for visualization/debugging) it's best to remove lightmap support from their shader. Let me know how it works for you!

cheers,
Reply