EsotericSoftware / spine-runtimes

2D skeletal animation runtimes for Spine.
http://esotericsoftware.com/
Other
4.42k stars 2.92k forks source link

[unity] UI toolkit Premultiply Alpha issue #2634

Closed pjarnfelt closed 2 months ago

pjarnfelt commented 2 months ago

So it seems like the UI toolkit renderer has a problem with premultiply alpha. The black borders are showing up and the alpha is fading to black in UI toolkit and not in the canvas renderer or the in-game sprite renderer. Is this fixed in a later version? I haven't upgraded because we are not using Unity 6 preview version, but version 2023.2.

https://github.com/user-attachments/assets/2756a5d9-8108-4621-a0fd-8140aced71d9

https://github.com/user-attachments/assets/50aa05f7-8f2f-4454-a155-f9ed4495b508

Originally posted by @pjarnfelt in https://github.com/EsotericSoftware/spine-runtimes/issues/1943#issuecomment-2334074927

HaraldCsaszar commented 2 months ago

Unfortunately, premultiply-alpha (PMA) atlas textures are not supported due to limitations of the UI Toolkit VisualElement API, not allowing custom shaders. Please export your atlas textures as straight alpha to avoid artifacts. We've added a remark to the README.md file of the package.

Note that the requirement for Unity 6 was introduced just for a Unity serialization bugfix when your locale uses , instead of . as decimal separator. If you don't have this issue, you could still use the latest package. To then use the latest package with Unity 2023.2 instead of Unity 6, you can change the line in package.json from "unity": "6000.0", to "unity": "2023.2", Nevertheless, upgrading to Unity 6 would be the preferred solution.