• 中文
  • Spine 以JSON方式导出的图片有黑边

  • Editado
Related Discussions
...

Hello! deactivate premultiply alpha in the texture packing settings to remove the black border.
你好! 在纹理包装设置中停用“预乘alpha”以删除黑色边框。

Could you tell us what engine/runtime you are using? Unity? cocos2dx? Unreal Engine? Something else?

你能告诉我们你正在使用什么引擎/运行时吗? 统一?cocos2dx? 虚幻引擎? 别的什么?

Huatimes escribió

I guess i know why, if i deactivate "premultiply alpha" in spine editor, then in unity i need check "Straight Alpha Texture" in material, right?

Yes, exactly. With premultiply alpha disabled, also make sure to enable Alpha is Transparency and sRGB (Color Texture) at the texture settings in Unity.
So to sum it up:

Spine export settings:
Disable Premultiply alpha, enable Bleed

Unity import settings:
Texture: Enable Alpha is Transparency and sRGB (Color Texture)

Material: Enable Straight alpha texture

Are you using Linear color space? You can check that in Project Settings - Player - Other Settings - Color Space. In Linear color space only the straight-alpha workflow is supported. If you use Linear color space, then premultiply-alpha will create incorrect results, which would explain the black lines.
The next unitypackage will provide warning messages when such incorrect combinations are detected.

I just thought it would be great to add a setting in the Unity Spine Preferences to quickly switch between workflows and have the settings automatically assigned correctly on import.
There is now an issue ticket here where you can subscribe to receive notifications on any updates:
https://github.com/EsotericSoftware/spine-runtimes/issues/1410

Bleed is independent of color space, it should be enabled when using straight alpha (Premultiply alpha disabled) textures.

Bleed affects the RGB part of pixels in semi-transparent areas, there it will "repeat" the RGB color of the closest opaque pixel, a bit like "smudging" color over into the transparent parts. E.g. have a texture of a green leaf with transparency at the outer parts, this will ensure that the 90% transparent green border pixel will still add 10% green to the scene, and not 10% black.


Above gif shows Spineboy's atlas texture in GIMP with
1) active alpha transparency
2) deactivated Bleed with deactivated transparency to show the rgb colors underneath
3) active Bleed with deactivated transparency to show the rgb colors underneath.

Note that most image editors already add such a 'bleed' region in transparent areas when exporting, nevertheless I would still recommend to enable it in the Spine export settings to be sure and to have a better basis when enabling mipmaps (where more pixels will be sampled at the border and combined to a single one).

2 meses más tarde