Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

(2018.1.3)(shaderForge) invalid subscript _ShadowCoord d3d11

Discussion in 'Shaders' started by bugaj, Jan 22, 2019.

  1. bugaj

    bugaj

    Joined:
    Jun 28, 2015
    Posts:
    41
    Forward, baked lights, single pass stereo. shared depth buffer
    im working on older project in my company, using shaders made with shader forge, and imported into 2018.1.3 i have constant compiler issue with two of them. They show :

    Shader error in 'Shader Forge/Porcelain_shd': invalid subscript '_ShadowCoord' at line 136 (on d3d11)

    Compiling Vertex program with UNITY_PASS_FORWARDBASE DIRECTIONAL LIGHTMAP_ON DYNAMICLIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADOWS_SHADOWMASK DIRLIGHTMAP_OFF
    Platform defines: 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 UNITY_LIGHTMAP_RGBM_ENCODING

    Shader error in 'Shader Forge/Gloves_shd': invalid subscript '_ShadowCoord' at line 97 (on d3d11)

    Compiling Vertex program with UNITY_PASS_FORWARDBASE DIRECTIONAL LIGHTMAP_ON DYNAMICLIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADOWS_SHADOWMASK DIRLIGHTMAP_OFF
    Platform defines: 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 UNITY_LIGHTMAP_RGBM_ENCODING
    When i recompile one of them in shader forge, it makes the other magenta(compile issues)
     
  2. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    1,835
    Are those shaders using SHADOW_COORD or UNITY_SHADOW_COORD macros?
     
  3. bugaj

    bugaj

    Joined:
    Jun 28, 2015
    Posts:
    41
    They are made with shader forge, so i cannot be sure. They dont use that function in shader forge editor.. But i assume they have to since that error is there. I can upload shaders here if that would help
     
  4. bugaj

    bugaj

    Joined:
    Jun 28, 2015
    Posts:
    41
  5. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    1,835
    Yeah, they use LIGHTING_COORD, which is an old macro from Unity 4.x...
    Is it possible to update to a newer Unity version for you? It's fixed in 2018.2 and newer. :)
     
  6. bugaj

    bugaj

    Joined:
    Jun 28, 2015
    Posts:
    41
    So i have to download newer version of shader forge? That asset is deprecated since the release of shader graph(which i cant use without changing pipeline, which is impossible for me at this stage)
     
  7. bugaj

    bugaj

    Joined:
    Jun 28, 2015
    Posts:
    41
    I cant update to newer unity version unfortunatelly, its to much work for the reest of my team. i can only upgrade my packages and plugins
     
  8. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    1,835
    Try replacing LIGHTING_COORD -> UNITY_LIGHTING_COORD, TRANSFER_VERTEX_TO_FRAGMENT -> UNITY_TRANSFER_LIGHTING manually.
    If this doesn't help, your solutions are either to upgrade to 2018.2 or later or use a different shader.
    This bug was fixed in 2018.2, but not in 2018.1.
     
  9. bugaj

    bugaj

    Joined:
    Jun 28, 2015
    Posts:
    41
    didnt worked Shader error in not enough actual parameters for macro 'UNITY_TRANSFER_LIGHTING' undeclared identifier 'UNITY_TRANSFER_LIGHTING' at line 103 (on d3d11)
     
  10. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    1,835
    The second parameter for this macro is the UV channel from VertexInput that has light map UVs.
    In your case it's `v.texcoord1`.
     
unityunity