Huatimes

参考附件,Spine 以JSON方式导出的图片有黑边,请问这个该如何解决。
У вас нет необходимых прав для просмотра вложений в этом сообщении.
Huatimes
  • Сообщения: 5

Erikari

Hello! deactivate premultiply alpha in the texture packing settings to remove the black border.
你好! 在纹理包装设置中停用“预乘alpha”以删除黑色边框。
Аватара пользователя
Erikari

Erikari
  • Сообщения: 1917

Huatimes

你好,禁用“预乘alpha”后没有颜色的透明部分好像是花屏效果,这个怎么解决,谢谢。
Huatimes
  • Сообщения: 5

badlogic

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

你能告诉我们你正在使用什么引擎/运行时吗? 统一?cocos2dx? 虚幻引擎? 别的什么?
Аватара пользователя
badlogic

Mario
  • Сообщения: 1999

Huatimes

Hello,we are using Unity Engine, if I disable "premultiply", in unity it show like below in attachments:

---

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?
У вас нет необходимых прав для просмотра вложений в этом сообщении.
Huatimes
  • Сообщения: 5

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
  • Сообщения: 927

Huatimes

Thank you very much, and i want to know the meaning of the parm "Bleed", and whether i must check this option when i work in linear color space?
Huatimes
  • Сообщения: 5

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
  • Сообщения: 927

Huatimes

ok, i know, thank you very much again.
Huatimes
  • Сообщения: 5

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
  • Сообщения: 927


Вернуться в 中国Spine用户