Erika

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

Erikari
  • 帖子: 3131

Mario

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

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

Mario
  • 帖子: 3277

Harald

Huatimes 写道: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
BleedAlpha.PNG


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


Material: Enable Straight alpha texture
StraightAlphaMaterialSettings.PNG


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
您没有权限查看这个主题的附件。
头像
Harald

Harri
  • 帖子: 4459

Harald

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.

ColorBleed.gif

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).
您没有权限查看这个主题的附件。
头像
Harald

Harri
  • 帖子: 4459

Harald

For reference, to prevent further troubles:
There is now a section on correct Straight Alpha vs Premultiplied Alpha export and import settings in the updated spine-unity documentation pages here:
spine-unity Runtime Documentation: Advanced Premultiplied vs Straight Alpha Import
头像
Harald

Harri
  • 帖子: 4459


回到 中国Spine用户