- Modifié
Transparent images muddied in atlas
I've just started working with images that have a lot of transparency in them, and upon exporting I noticed something really off about the atlases. As you can see in the screenshot below, the image on the right is the original. The one on the left is in the atlas, and it has this bizarre transparent black base. Is this a thing I can change?
It looks like you exported the atlas using premultiplied alpha. You can change that setting in the texture atlas export dialog, though there's no need if the runtime you use (Unity, cocos2d-x, etc.) supports premultiplied alpha. See this page for info on texture atlas packing Texture Packing - Spine User Guide: Settings
I think this will be an interesting read for you: Premultiply Alpha
tl;dr:
It's called "premultiplied alpha". It's an alternate way of rendering with some benefits (which you may not need).
Most image editing/preview programs don't support previewing premultiplied alpha so it looks like it gets more black as it gets more transparent.
If you use premultiplied alpha rendering, it will render correctly in-game.
Just to close the loop, I've finally gotten confirmation from a dev that yes, our runtime does make use of premultiplied alpha. Thank you for posting the in-depth explanation as it's good to understand this as fully as I can!