• Editor
  • Unity/Spine - Alpha Over Alpha Problem

  • Đã chỉnh sửa
Related Discussions
...

Hi,

I tried to find something about it in the forum but i couldn't find anything.
i have an object which has a glowing texture which fades the alpha from 0% to 100%.
the fading texture is above an another texture. And when the fading texture is at halve of the alpha it seems to getting dark in unity but not in Spine.

I tried tif vs jpg because i read something about Pre-Multiplied Alpha or something but
that didn't work ether.

I'll get Mitch on the batmobile, he should be able to help out 🙂

Mitch, you're up.

Just for diagnosis' sake, can you show us what shader you're using for the Material? And also the png's import settings in Unity?
I'm not sure if Spine Editor itself uses PMA. But if it does, and you're using PMA too with the Spine/Skeleton shader in Spine-Unity, theoretically, they should look the same.

There's likely no reason to use .tif though.

In my experience you shouldn't animate the alpha of a Glow texture. You should use a black background and put the glow on top of it and set it to Additive in the Spine slot* properties. When you want to glow/unglow it, animate the Color from White to Black rather than the Alpha. This plays nicer with additive blending. I have no idea what Spine is doing to make it look "Right".


Hình ảnh bị xóa do không hỗ trợ HTTPS. | Vẫn hiển thị

The fireball has no alpha in its texture what so ever; black background with stuff painted on top.

Hình ảnh bị xóa do không hỗ trợ HTTPS. | Vẫn hiển thị

This is what the exported atlas' alpha looks like for the mage.

Comparison with a glowyball instead

Hình ảnh bị xóa do không hỗ trợ HTTPS. | Vẫn hiển thị


Glowyball source

Hình ảnh bị xóa do không hỗ trợ HTTPS. | Vẫn hiển thị

And my regular workflow for making glowballs.
http://www.xdtech.net/spine/Greenball.psd

Spine just uses PMA and proper blending. 🙂

Additive will often look nice, but it depends on the background. The glow will look great on a black background, but you won't be able to see much on a brighter background.

Replace your glow ball image with a huge cow image and see if it fades like you expect.

Hình ảnh bị xóa do không hỗ trợ HTTPS. | Vẫn hiển thị

Huge cow image solves everything 🙂

Hình ảnh bị xóa do không hỗ trợ HTTPS. | Vẫn hiển thị

Let's be brovines.

thaaanks for all the help!

we use spine with tk2d in unity could that be the problem?

i tried out the additive solution but in unity i can add only one shader so the glow doesn't show up or the whole thing glows. Or is there a way to add two shader? or is it because we use tk2d?

import settings and material/shader:

Bah, no one says "TK2D" until after I post lol.

Anyway...

Make sure you have TK2D Premultiply Alpha checked

Hình ảnh bị xóa do không hỗ trợ HTTPS. | Vẫn hiển thị

And you can use the Spine Skeleton shader. The TK2D shaders don't use the same methods as the Spine editor so if the goal is to keep everything looking the same, you should use the provided shaders 🙂

Hình ảnh bị xóa do không hỗ trợ HTTPS. | Vẫn hiển thị

PS:
I just updated the TK2D runtimes to be more in-line with the Spine-Unity ones.

They're available here and on Git.
http://www.esotericsoftware.com/files/r ... itypackage
There are a couple bugs, make sure when you create a SkeletonDataAsset that you assign the tk2dSpriteCollectionData before the JSON or it will have a bad day.

Awesoooome! it worked! thanksss!

nimao đã viết

Awesoooome! it worked! thanksss!

:handshake: