Search Unity

UI alpha blending in linear colour space projects

Discussion in 'Unity UI (uGUI) & TextMesh Pro' started by angrypenguin, Jan 4, 2019.

  1. angrypenguin


    Dec 29, 2011
    I'm working on a project where Illustrator is being used for UI asset development. The project is in linear color space.

    For assets exported from Illustrator, colors seem to be fine but alpha blending does not give desired results. I've done most of my testing in GIMP, as I don't have direct access to an Illustrator license myself and GIMP gets identical results (mostly... see below).

    In this example image, both swatches are purely black rectangles with a gradient from 0 to 1 alpha. The top swatch is exported with a transparent background, the bottom one has a 100% white layer inserted underneath it before exporting. Both are then displayed in Unity as Sprites under a Canvas, with a 100% white sprite behind them.


    When snipped from Unity and then compared in gimp, the bottom swatch still perfectly matches what's in the GIMP viewport, the top one does not.

    If I switch the project to gamma color space then the top swatch changes to perfectly match the bottom swatch. However, we need to keep the project in linear colour space because of... well, basically the whole rest of the game that isn't the UI!

    I've tried the following:
    - In GIMP, switch the layer's composite blending from "perceptual" to "linear". This makes GIMP's display then match the top swatch. This would be an acceptable solution if I could find equivalent functionality in Illustrator for our graphic designer, but I can't.
    - I've tried using an import post-processor to convert the alpha between gamma/linear space (in both directions). Both change the results, but neither are right. I got the conversions straight from Unity's CG includes.
    - Un-checking "sRGB (Color Texture)" in the import settings gets the bottom swatch to look like the top. Again, this could be an acceptable solution if I could get Illustrator to match.
    - In Illustrator, trying a few different colour profile options. I've not managed to get desirable results, and don't think that's the problem anyway.

    Surely this is a known thing with a clear solution? We're happy to update our workflow accordingly, however this is outside of my area of expertise so I'm not sure where to look to correct things.

    If anyone could please point me in the right direction I'd really appreciate it!
    Poulpizator likes this.
  2. IcyHammer


    Dec 2, 2013
    There is actually no perfect solution for this issue at the moment, I've tried everything and after years bug still persists. I just hope that somebody will pick it up eventually and make it work.
    JoseConcha likes this.