• RuntimesUnity
  • Color issue with using custom material for spine skeleton

Hi, I'm trying to use a custom material to add some extra overlaping texture onto the original spine animation, which is using URP shader graph in uinty.
But then I realize, if the animation has keyed some alpha change, there's color difference, (more like alpha) between SkeletonRendererCustomMaterials on and off. It's like the original renderer has made some white color amend, like below:

My shader graph was quite simple, it basicly just render the original texture.

what should I do next in order to achieve what I described?
Or is using custom material the right way? I wound know >_<

Related Discussions
...
  • Изменено

When using custom materials with Spine skeletons in Unity, especially with URP and Shader Graph, it's important to ensure that your shader correctly handles the alpha and color blending. The issue you're experiencing with color differences when using SkeletonRendererCustomMaterials might be due to how the alpha is being processed in your shader.

To address this, you should ensure that your shader multiplies the vertex color (which includes alpha) with the texture color. This is crucial for maintaining the correct transparency and color blending. If your shader is not handling premultiplied alpha (PMA) correctly, you might see unexpected results. You can refer to the documentation on writing your own shaders for Spine here to ensure your shader is set up correctly. Additionally, make sure that your material settings match the export settings from Spine, particularly regarding the alpha workflow (Straight vs. PMA).

If you are using a straight alpha workflow, ensure that the Straight Alpha Texture option is enabled on your material. If your shader is intended to work with PMA, you might need to adjust the blend mode to Premultiply in your Shader Graph.

@Hivon_P Spinebot is correct, most likely you're not handling premultiplied alpha (PMA) correctly. Note that you could also disable Advanced - PMA Vertex Color at your SkeletonAnimation component, however it would be best to support PMA correctly in your shader graph shader.

Links to the relevant documentation sections:
https://esotericsoftware.com/spine-unity-rendering#Shader-Graph
https://esotericsoftware.com/spine-unity-rendering#Writing-your-own-shaders

  • Hivon_P ответили на это сообщение.

    Harald Thanks for replying. This is exactly the problem, I've made some changes to my shader graph and it works like a charm.

    @Hivon_P Great to hear, thanks for getting back to us!