Search Unity

Alpha: Straight vs Premultiplied

Discussion in 'Wish List' started by col000r, Mar 2, 2009.

  1. col000r

    col000r

    Joined:
    Mar 27, 2008
    Posts:
    699
    Would it be possible to incorporate premultiplied alpha and let us choose between straight and premultiplied with color x on a per file basis?

    The reason why I think this would be good is this:

    If I save a PSD file with transparent background (no dedicated alpha channel, just a transparent background) Unity sees the correct alpha, but RGB is seen as premultiplied on white - which is a problem because Unity then interprets the file as if the RGB was straight! -> first row in the attached image, notice the halos!

    There's two solutions so far: create your own straight RGB + Alpha in photoshop or save as PNG. But both options are not as immediate and straightforward as having it work straight out of photoshop...


    PS: wrote two blog-posts while collecting my thoughts and experimenting, so some more superfluous details here and here
     

    Attached Files:

  2. faultymoose

    faultymoose

    Joined:
    Oct 1, 2010
    Posts:
    246
    Wanted to add a +1 to this. I'm working with a custom bitmap font with some shadow and glow effects, and the 'forced' non-premultiplied matte is driving me crazy :/
     
  3. ddeaco

    ddeaco

    Joined:
    Jan 17, 2012
    Posts:
    44
    Just came across this issue. Highly annoying. Cant believe this hasn't been fixed since 2009...

    Basically means psd import is useless in my project, now have to spend time exporting pngs for all UI graphics, HD and SD...

    I would class it as a bug rather than a wish.
     
  4. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
  5. MRCty

    MRCty

    Joined:
    May 24, 2012
    Posts:
    31
    Hello to all, I would bring my experience.
    I made 2D texture using Illustrator exporting in PNG with transparent background.
    I get some of them with white border inside Unity, depending from the image, but i found solution: before export, in Illustrator select all then convert all strokes to path using Object > Path > Outline path (I'm not sure about the command name because I'm using an Italian version of Illustrator at the moment).

    After conversion, export as usual in PNG and Unity will show it fine.
    I hope this can help someone.
    P.S. I use uncompressed texture for 2D of course.