Alpha Issues

Unity being able to read PSD files is great! But not so much if you’re using transparency, since then all files end up as Premultiplied with White, yet they are treated as Straight RGB by Unity…

Look at the first row here:

Broken… Here’s 2 ways to fix this:

  • Create your own straight RGB + alpha channel. The simplest (slightly hackish) way to do this is the following:
    1. Flatten everything (make sure you have no background layer), Select Pixels (Cmd+LMB on the layer thumb), switch to Channels, create New Channel, fill with black, deselect, invert.
    2. switch back to the layers palette, duplicate your layer about 50 times until pretty much every pixel that’s not black in the alpha is opaque here. fill the background in any color you like, it won’t matter… (unless this is for a texture that will be mipmapped… in that case choose the color wisely or use something like the (free) Flaming Pear Solidify A Filter in Photoshop to fill the gaps…)
  • Save for Web and Devices as PNG – this will save it Straight, will look right in Unity
Bookmark the permalink. Follow any comments here with the RSS feed for this post. Trackbacks are closed, but you can post a comment.


    Hanford on March 3, 2009 at 03:08 | Permalink

    cool post, I’ve been experimenting with textures from photoshop as well.

    One quick comment: in your steps you say “flatten everything”. If you use Photoshop’s Flatten, it will create a background with no transparency. I believe you want the “merge visible” command, which is in the Layers open menu.

    col000r on March 5, 2009 at 09:02 | Permalink

    true, thanks for the clarification! I just do Cmd+Alt+A to select all layers and Cmd+E to flatten ..ah.. merge them…

Post a Comment

Your email is never published nor shared. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>