trinee

Hey guys! we decided to move from spine 4.0.1 to newest version and we are having a lot of issues in the images (specially FX) when using the unpacking feature.

I'll link some examples of what is going on when unpacking all the old atlases:



There's any way to fix this?

Thank you!
User avatar
trinee
Posts: 20

Erikari

I think you were using premultiply alpha on the images, unfortunately you can't reverse this operation:
unpack atlas with premultiply alpha

EDIT:
you can, scroll down to download Pharan's Photoshop action! :D
User avatar
Erikari

Erikari
Posts: 695

trinee

Oh jeez... okay. So next time, before exporting, should we uncheck premultiply? check Bleed instead?

Not sure if this would effect in someway the results ingame. Thanks Erikari :)
User avatar
trinee
Posts: 20

Erikari

Premultiply alpha is good in terms of game performance, but it's also irreversible unfortunately s: don't you have a copy of the original files before being packed?
User avatar
Erikari

Erikari
Posts: 695

trinee

sadly not :(
User avatar
trinee
Posts: 20

Pharan

It's not totally irreversible.
It's just destructive/lossy; with typical 32-bit RGBA encoding, you're not likely to get precisely the original colors back in pixels that weren't fully opaque, which are the edges, or any semitransparent or glowy bits. So you could reverse PMA to some extent, but it's still a better if you have the original source files. Maybe not noticeably better, but better.

As for popular programs that have a one-click option to reverse premultiply alpha.... I don't know any. You could probably ninja layers and blend modes in photoshop to do the math for you.
A programmer who can do pixel pushy things can do it easily:

The PMA operation (literally pre-multiplying the alpha) is:
r = r * a
g = g * a
b = b * a
a = a
So the reverse is:
r = r / a
g = g / a
b = b / a
a = a
(making sure to set the color to 0 if a is 0, because you can't divide by 0)
Nate did mention he wanted to add the feature to Spine "with a warning". Tracker is linked in that linked topic.

---

Actually, you know what? It wasn't hard to do in Photoshop.
Basically clipping mask a copy of the transparency/alpha channel to the original image, and set it to Divide blend mode.
You could just as easily do it in CSP or some other art program that has those same features.

Here are some Actions.
Attachments
PMA Tools.zip
(546 Bytes) Downloaded 14 times
User avatar
Pharan

Pharan
Posts: 4492

Erikari

Your actions worked like charm! O: I'm so glad I was wrong about this XD
amazing!
User avatar
Erikari

Erikari
Posts: 695

trinee

Pharan wrote:It's not totally irreversible.
Actually, you know what? It wasn't hard to do in Photoshop.
Basically clipping mask a copy of the transparency/alpha channel to the original image, and set it to Divide blend mode.
You could just as easily do it in CSP or some other art program that has those same features.

Here are some Actions.
Thank you Pharan! We already finished with all the FX. In some of them we did something similar, in others we just decided to redo all the effect.

Last question, is this black shadow normal in the atlas when importing with PMA? then in Unity it will look okay, like we see in spine project/png images? We didn't try yet, I'm just curious. :p
User avatar
trinee
Posts: 20

Nate

Yep, a normal image viewer will show the image with a black shadow, but the game toolkit will show it correctly.
User avatar
Nate

Nate
Posts: 7625

trinee

yeah! it worked. Thank you all :) :heart:
User avatar
trinee
Posts: 20

Pharan

You can read more about it here if you're curious: Premultiplied alpha guide
User avatar
Pharan

Pharan
Posts: 4492


Return to Editor