• RuntimesUnity
  • Unity 3D 2022.2 URP Forward+ renderer shader lighting bug

Hi,

Spine objects do not respond to point lights or spotlights when using Forward+ renderer in URP (only available in 2022.2 beta version I believe). Forward and Deferred seem to be working fine in this version. I can use Deferred for the time being but ideally I want to use Forward+ as it is giving best performance

Repro Steps:
1) Create new project and download Spine Unity runtimes and URP shaders
2) Open the "URP 3D Shaders scene" from Examples
3) Set the URP Asset in Project settings
4) Observe that the default Forward renderer seems to work fine
5) Change the renderer to Forward+
6) Point lights and spot lights no longer light up the spine objects

Related Discussions
...
25 gün sonra

Thanks for reporting and sorry for the troubles. I have created an issue ticket here:
https://github.com/EsotericSoftware/spine-runtimes/issues/2173
We will let you know once the URP Forward+ renderer is supported by the Spine URP shaders.


Forward+ render path is supported by lit Spine URP shaders (Universal Render Pipeline/Spine/Sprite and Universal Render Pipeline/Spine/Skeleton Lit) on both 4.1 and 4.2-beta branches.

New 4.1 and 4.2-beta Spine URP Shaders UPM packages are available for download here as usual:
spine-unity Download.

Please let us know if this fixes the issues on your end as well. Thanks again for reporting!

3 ay sonra
Harald yazdı

Thanks for reporting and sorry for the troubles. I have created an issue ticket here:
https://github.com/EsotericSoftware/spine-runtimes/issues/2173
We will let you know once the URP Forward+ renderer is supported by the Spine URP shaders.


Forward+ render path is supported by lit Spine URP shaders (Universal Render Pipeline/Spine/Sprite and Universal Render Pipeline/Spine/Skeleton Lit) on both 4.1 and 4.2-beta branches.

New 4.1 and 4.2-beta Spine URP Shaders UPM packages are available for download here as usual:
spine-unity Download.

Please let us know if this fixes the issues on your end as well. Thanks again for reporting!

After some more testing I still am getting incorrect results.

The blue light isn't lighting anything on Forward+, see screenshot

Can you confirm this is working/not working on your end? I have tried with both 4.1 and 4.2 and still getting incorrect results unfortunately - Any help is appreciated




An additional problem,

When creating a new project with 2022.2.2f1 (unsure if this happens in others) and I try repro this using original steps, using Spine 4.1 or 4.2 I get shader compiler errors when using Forward+ and pink textures

Shader error in 'Universal Render Pipeline/Spine/Sprite': undeclared identifier '_AdditionalLightsDirectionalCount' at (1)/Packages/com.esotericsoftware.spine.urp-shaders-4.1-2019.1/Shaders/Include/Spine-Sprite-ForwardPass-URP.hlsl(220) (on d3d11)

Compiling Subshader: 0, Pass: ForwardLit, Vertex program with _ADDITIONAL_LIGHT_SHADOWS _ALPHAPREMULTIPLY_VERTEX_ONLY _EMISSION _FIXED_NORMALS_VIEWSPACE _FORWARD_PLUS _MAIN_LIGHT_SHADOWS _NORMALMAP _RECEIVE_SHADOWS_OFF
Platform defines: SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA 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 FOG_EXP FOG_EXP2 FOG_LINEAR INSTANCING_ON LIGHTMAP_ON PIXELSNAP_ON SHADER_API_GLES30 UNITY_ASTC_NORMALMAP_ENCODING 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 _ADDITIONAL_LIGHTS _ADDITIONAL_LIGHTS_VERTEX _ADDITIVEBLEND _ADDITIVEBLEND_SOFT _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON _ALPHA_CLIP _COLOR_ADJUST _DIFFUSE_RAMP _FIXED_NORMALS_MODELSPACE _FIXED_NORMALS_MODELSPACE_BACKFACE _FIXED_NORMALS_VIEWSPACE_BACKFACE _FIXED_NORMALS_WORLDSPACE _FOG _FULLRANGE_HARD_RAMP _FULLRANGE_SOFT_RAMP _LIGHT_AFFECTS_ADDITIVE _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN _MIXED_LIGHTING_SUBTRACTIVE _MULTIPLYBLEND _MULTIPLYBLEND_X2 _OLD_HARD_RAMP _OLD_SOFT_RAMP _RIM_LIGHTING _SHADOWS_SOFT _SPECULAR _SPECULAR_GLOSSMAP _STRAIGHT_ALPHA_INPUT _TEXTURE_BLEND

5 gün sonra

Sorry for the troubles and thanks for reporting. This is indeed strange, I just updated to Unity 2022.2.0b16 (I don't see 2022.2.2f1 that you've mentioned above in the list of available versions) and received the same compile errors for some reasons. Something with render pipeline defines or include order must have changed so that it now does not include the definition of _AdditionalLightsDirectionalCount any longer. We will have a look at it and get back to you as soon as we've figured out what's going wrong.


We have just pushed a bugfix to both 4.1 and 4.2-beta branches. New URP Shaders UPM packages are available on the download page here as usual:
spine-unity Download
Please let us know if this now resolves your issues. Thanks again for reporting!

Harald yazdı

Sorry for the troubles and thanks for reporting. This is indeed strange, I just updated to Unity 2022.2.0b16 (I don't see 2022.2.2f1 that you've mentioned above in the list of available versions) and received the same compile errors for some reasons.

If something doesn't show up in the hub, you can also download Unity from this link: https://unity.com/releases/editor/archive Pressing the "Unity Hub" button in the linked page will download it via the Hub as well. Latest version as of posting is Unity 2022.2.5. it looks like latest available URP version for this Unity release is URP 14.0.6.

If you're only seeing beta versions for 2022.2, which is in tech stream, it's likely that your Unity Hub needs to be updated.

T.Fly() yazdı

If you're only seeing beta versions for 2022.2, which is in tech stream, it's likely that your Unity Hub needs to be updated.

Thanks very much for the hint, that was indeed the case, I should have checked that earlier!

Edit 1 I didn't realise I had to download 4.1 from Git, just checking again now
Edit 2 Sorry I have no idea how to import the updated 4.1 from Git. I found the correct branch and downloaded the directory to zip, and im trying to copy the contents of "spine-unity" (Assets etc) into the root directory of my empty project but I just get >300 errors

Please can you explain how to properly import this updated package or link a normal Unity package for it please, thank you


5 gün sonra

Edit 1 I didn't realise I had to download 4.1 from Git, just checking again now

You don't have to download anything via git if you don't want to. The download page contains direct links to packages.

Edit 2 Sorry I have no idea how to import the updated 4.1 from Git. I found the correct branch and downloaded the directory to zip, and im trying to copy the contents of "spine-unity" (Assets etc) into the root directory of my empty project but I just get >300 errors

The possible ways how to install spine-unity and the URP shaders package are documented in detail here:
http://esotericsoftware.com/spine-unity#Installation
http://esotericsoftware.com/spine-unity#Optional-Extension-UPM-Packages

You can also find a video showing installation of the Timeline UPM package here:

I'm still having problems with this unfortunately, the Skeleton Lit shader just won't compile with Forward+ Selected.

Unity: 2022.2.2f1
URP: 14.0.4

Btw, I noticed the download page doesn't actually seem to have an updated 4.1 or 4.2 runtime (updated 2023-01-11 for 4.1), its just the URP packages that seem updated, is that correct?

Repro:
1) Create new URP project in 2022.2.2f1
2) Install Spine 4.1 or 4.2 beta from Spine downloads page
3) Install matching URP shaders from downloads page, install via Package Manager
4) Open the "URP 3D Shaders scene" from Examples
5) Set the URP Asset in Project settings
6) Observe that the default Forward renderer seems to work fine
7) ENSURE you change the URP SO renderer to Forward+
8 ) Things might LOOK ok immediately, BUT! The Spine Skeleton Lit shader is actually not compiling properly. Select it from the URP shaders, Spine-SkeletonLit-URP and see the following error

Shader error in 'Universal Render Pipeline/Spine/Skeleton Lit': invalid subscript 'shadowedColor' at /Users/welky/Documents/_UnityProjects/Valor/Packages/com.esotericsoftware.spine.urp-shaders-4.1-2019.1/Shaders/Include/Spine-SkeletonLit-ForwardPass-URP.hlsl(173) (on d3d11)

Compiling Subshader: 0, Pass: ForwardLit, Vertex program with _ADDITIONAL_LIGHT_SHADOWS _FORWARD_PLUS _MAIN_LIGHT_SHADOWS _RECEIVE_SHADOWS_OFF
Platform defines: SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA 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: FOG_EXP FOG_EXP2 FOG_LINEAR INSTANCING_ON SHADER_API_GLES30 UNITY_ASTC_NORMALMAP_ENCODING 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 _ADDITIONAL_LIGHTS _ADDITIONAL_LIGHTS_VERTEX _DOUBLE_SIDED_LIGHTING _LIGHT_AFFECTS_ADDITIVE _MAIN_LIGHT_SHADOWS_CASCADE _MIXED_LIGHTING_SUBTRACTIVE _RECEIVE_SHADOWS _SHADOWS_SOFT _STRAIGHT_ALPHA_INPUT

For your convenience I have also uploaded a repro project just incase. You can download here:
https://www.dropbox.com/s/t95srgqr08xdy30/SpineRepro2022.zip?dl=0

Please can you confirm if its working in a fresh project for you or not working, as I'm really struggling to tell if I'm fundamentally doing something wrong.

Thank you for your time!

For your convenience I have also uploaded a repro project just incase. You can download here:

Unfortunately we could not reproduce your issue, your reproduction file does not contain your versions of the com.esotericsoftware.spine.urp-shaders package, which seems to be installed locally in /Users/welky/Documents/_UnityProjects/Valor/Packages/ as you can also see in your above error message:

Shader error in 'Universal Render Pipeline/Spine/Skeleton Lit': invalid subscript 'shadowedColor' at /Users/welky/Documents/_UnityProjects/Valor/Packages/com.esotericsoftware.spine.urp-shaders-4.1-2019.1/Shaders/Include/Spine-SkeletonLit-ForwardPass-URP.hlsl(173) (on d3d11)

When we download the latest 4.1 version of the com.esotericsoftware.spine.urp-shaders package from the download page, we receive no compile errors after changing settings to Forward+.

Please also note that you should not include the Library directory in reproduction project packages, since this only unnecessarily increases file size.

    Harald

    Apologies about the repro project, I have made a new one which includes the package correctly and no library folder

    https://www.dropbox.com/s/3xcnjbvqpwvyr88/My%20project%20%286%29.zip?dl=0

    Once opened, please navigate to Packages->com.esotericsoftware.spine.urp-shaders-4.1-2019.1->Shaders->Spine-SkeletonLit-URP to see if it has the shadowedColor error

    After trying multiple times in fresh project I always get the problem:

    Shader error in 'Universal Render Pipeline/Spine/Skeleton Lit': invalid subscript 'shadowedColor' at /Users/welky/Documents/_UnityProjects/Valor/Packages/com.esotericsoftware.spine.urp-shaders-4.1-2019.1/Shaders/Include/Spine-SkeletonLit-ForwardPass-URP.hlsl(173) (on d3d11)

    Is there any reason shadowedColor may be missing for me in my environment? Are you using d3d11 like I am according to the error?

    Thank you for your time

    Thanks for the additional reproduction project, we could now reproduce the issue! It has just been fixed via this commit on the 4.1 branch (will be merged to 4.2-beta soon). A new UPM package containing this bugfix will be published soon. Thanks for reporting!

    Harald

    Thanks so much Spine Team, seems to be working great now! Really, thanks so much for your efforts and patience with me on this issue. I'm now using Forward+ with Spine and that's amazing! Very happy to take advantage of Forward+ performance!

    One minor issue i noticed, for 2D "Orthographic" cameras, spotlights do not work with Forward+ in Game View (works fine in Scene view aslong as 2D isn't selected). Pointlights are fine, but spotlights don't seem to work. It works fine in Perspective view, which is what I'm using for my project, so doesn't affect me - just thought you should know anyway - not sure if it's a Unity problem or not or just an incorrect setting somewhere

    Anyway, thanks again!

    Thanks for your kind words, glad the issues are resolved now! And thanks for reporting.

    not sure if it's a Unity problem or not or just an incorrect setting somewhere

    This seems to be a limitation with Unity's render pipeline, you should receive a warning log message when switching the camera to orthographic reading:

    "Orthographic projection is not supported when using Forward+.
    UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)"