• RuntimesUnity
  • custom shader graph not working for spine asset

Hey,
So i have created a custom 2D dissolve effect shader for changing saturation color from black and white to color with edge color effect.
so i tried applying this shader graph to my spine asset it works fine in unity, but it get invisible during build.
I'm using StraightAlphaPreset for it since we're working on linear Color Render Space. (Attached screenshot for it)


I'm new to spine 2D environment
Any help would be appreciable.

Related Discussions
...
  • تم التحرير

To address the issue of your custom shader graph not working for a Spine asset during build, despite working fine in Unity, it's important to ensure that your shader is fully compatible with the Spine runtime and Unity's build process. Since you're using a StraightAlphaPreset and working in a linear Color Render Space, here are a few considerations and steps you can take:

  1. Verify Shader Compatibility: Ensure that your custom shader graph is compatible with the Spine-Unity runtime. Spine-Unity has specific requirements for shaders to work correctly with Spine animations, especially regarding the handling of alpha and premultiplied alpha textures.

  2. Straight Alpha Workflow: Since you're using a straight alpha workflow, make sure that your Spine assets are exported with the straight alpha workflow enabled. This involves disabling premultiply alpha during the export from Spine. More details can be found in the Spine-Unity documentation: Premultiplied vs Straight Alpha Export


Added settings too as per documentation

can you tell me or can you tell me where i can find specific requirements for shaders for spine-unity ?

    @kwandhre Sorry to hear you're still having troubles! While I noticed that in your ShaderGraph screenshot, at the left you have Blend Mode Premultiply active, this should not be the cause of your actual issue of nothing showing up in the build.

    In general the Spine skeleton components just use a normal MeshRenderer (at SkeletonAnimation and SkeletonMecanim) or CanvasRenderer (at SkeletonGraphic). Did you try assigning the same Material at a normal quad or cube GameObject MeshRenderer?

    Which of the three skeleton components (SkeletonAnimation, ..) are you using?

      kwandhre can you tell me or can you tell me where i can find specific requirements for shaders for spine-unity ?

      The documentation can be found here:
      https://esotericsoftware.com/spine-unity#Writing-your-own-shaders
      According to the description, I doubt however that the problem lies with anything specific to Spine skeleton renderer requirements. The documentation mainly covers how things like PMA, vertex color and tint black should be handled in your shader, which all will not turn your skeleton invisible in builds if handled incorrectly.

      Harald Hey , so i'm using SkeletonAnimation. And yes i did tried same material to 3d cube it worked fine. Adding screenshot of the export settings which i did from Spine to Unity and mesh cube which i have added.


      @kwandhre Thanks for sharing your settings. There is nothing obviously wrong with them. Could you please send us a minimal Unity project which still shows this issue? You can send it as a zip package to contact@esotericsoftware.com, briefly mentioning the forum thread URL so that we know the context. Then we can have a look at what's going wrong.