Thanks for the detailed response.
We are using:
spine-csharp runtime 4.2.37
spine-unity runtime 4.2.118
Spine URP Shaders package 4.2.49
We are using URP with a 3D Renderer.
After more investigation, we managed to solve the issue, but we are still unsure whether this is the correct/safest long-term approach or if there is something important we should take into account to avoid future incompatibilities.
To clarify the original problem:
The expected result was that some animations had their first frame keyed with a white tint (resetting a previous black tint flash), but no tint change was being applied at all from Spine keyframes. However, changing tint black directly from Unity code worked correctly.
So when I said “when the animation requires it”, I meant “when there are keyframes modifying tint black values inside Spine animations”.
The issue seems related to our custom shader not implementing the Spine tint black logic correctly.
Using the Spine 2D URP shader actually works correctly, even under a 3D Renderer setup.
What finally made it work in our shader was adding the following:
In the vertex shader:
#if defined(_TINT_BLACK_ON)
OUT.darkColor = half3(IN.tintBlackRG.r, IN.tintBlackRG.g, IN.tintBlackB.r) + (_Black.rgb * IN.color.a);
#endif
And in the fragment shader:
#if defined(_TINT_BLACK_ON)
texColor.rgb = fragTintedColor(texColor, IN.darkColor, IN.color, _Color.a, _Black.a);
texColor.rgb = texColor.a < 0.001 ? texColor.rgb : texColor.rgb / texColor.a;
#endif
Using these includes:
#include "Packages/com.esotericsoftware.spine.urp-shaders/Shaders/Include/SpineCoreShaders/Spine-Common.cginc"
#include "Packages/com.esotericsoftware.spine.urp-shaders/Shaders/Include/Spine-Common-URP.hlsl"
#include "Packages/com.esotericsoftware.spine.urp-shaders/Shaders/Include/SpineCoreShaders/Spine-Skeleton-Tint-Common.cginc"
Our concern now is mostly about compatibility/future-proofing.
Our shader is written in HLSL, but Spine’s tint support still depends on CG includes. As long as Unity keeps supporting CG includes this should probably be fine, but we are slightly worried about future Unity versions eventually dropping CG support entirely.
Also, using those CG includes in some specific passes can generate issues.
So mainly we would like to know:
Is this the intended/correct way to support Spine tint black in a custom URP shader?
Is there a more future-proof approach recommended by Spine for fully-HLSL custom shaders in URP?