Search Unity

Update to Unity 5.1 = too bright GUI [EDIT: bug is back in 2019.1]

Discussion in 'Immediate Mode GUI (IMGUI)' started by manutoo, Jun 11, 2015.

  1. manutoo

    manutoo

    Joined:
    Jul 13, 2010
    Posts:
    524
    Hello,

    I just updated from Unity 5.0.1 to 5.1.0f3 and the whole GUI got way too bright !
    Whether using GUI.Box() or GUI.DrawTexture() the result is too bright. For the texture, it seems that removing the "Bypass sRGB sample" on importation (available when selecting "Advanced" texture type) fixes the issue.

    I'm using Deferred Legacy rendering, and Linear color space.

    All my GUI textures normally use "Legacy GUI" for texture type.

    Anyone else got this issue ?
     
    Last edited: Jun 11, 2015
  2. manutoo

    manutoo

    Joined:
    Jul 13, 2010
    Posts:
    524
    Switching to gamma color space "fixes" the issue...
    I tried with another project, much simpler than my current project, with the same effect on texture.

    My GUI.Box() fails because it uses a texture, but it seems that everything that doesn't use a texture is correctly displayed (GUI.Button(), etc.) .

    Am I supposed to change type & then uncheck "Bypass sRGB sample" on all my GUI textures ? o_O
     
  3. manutoo

    manutoo

    Joined:
    Jul 13, 2010
    Posts:
    524
    I filled a bug report => #703980 .
     
  4. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,085
    Kind of interesting. The same thing happens with NGUI if you try to use Linear color space. Not just in 5.1, but 5.0.x as well.
     
  5. manutoo

    manutoo

    Joined:
    Jul 13, 2010
    Posts:
    524
    Bug is still present in 5.1.0p1 (released yesterday).
     
  6. McDev02

    McDev02

    Joined:
    Nov 22, 2010
    Posts:
    664
    Same issue here, just wanted to make a report too.
    Can you share the link to the report? I can't find a way to search for IDs.

    Version is 5.1.0f3
     
  7. manutoo

    manutoo

    Joined:
    Jul 13, 2010
    Posts:
    524
    Glad to know I'm not the only one in this case !

    I'm not sure if I can share the link or not, as it leads to my bug account.
    But here the exact report :
     
  8. daisySa

    daisySa

    Joined:
    Dec 29, 2011
    Posts:
    341
    I have the same issue, also fixed by unchecking Bypass sRGB. At least there's a temporary workaround - thanks for filing a bug report.
     
  9. manutoo

    manutoo

    Joined:
    Jul 13, 2010
    Posts:
    524
    Still getting this issue with 5.1.1f1 released yesterday.
     
  10. manutoo

    manutoo

    Joined:
    Jul 13, 2010
    Posts:
    524
    And when building, everything gets too dark again ; I have to set the textures back to "Legacy GUI" to make them look normal again... :confused:

    So it's a very annoying bug, and I still didn't get any answer for my bug report...
     
  11. manutoo

    manutoo

    Joined:
    Jul 13, 2010
    Posts:
    524
    Still not fixed in 5.1.1p1 released yesterday... o_O
     
  12. McDev02

    McDev02

    Joined:
    Nov 22, 2010
    Posts:
    664
    Just recognized that it only happens in the editor, in a build it is fine.
     
  13. manutoo

    manutoo

    Joined:
    Jul 13, 2010
    Posts:
    524
  14. daisySa

    daisySa

    Joined:
    Dec 29, 2011
    Posts:
    341
    It's still happening in both the build and the editor in 2017.4.3 (LTS).
     
  15. fatboynotslim

    fatboynotslim

    Joined:
    Aug 19, 2013
    Posts:
    8
    Also present in 2018.3.0f2.

    Unfortunately the "bypass srgb" option is gone and has been replaced with an "sRGB" checkbox - and ticking or unticking it has no effect; the texture is still drawn too brightly in the gui. Whether as part of a button image, or using gui.drawtexture, it's too bright and no way to fix...

    Edit: Found a painful workaround.

    Use graphics.drawTexture instead. Colors will now be correct. The problem is, if you just do this during ongui, the texture will be drawn twice - once correctly, and once wierldy and hugely covering half the screen (well, that's what happened to me)

    To fix: Draw it during onGui, BUT only during the repaint event. Like this:

    public void OnGUI()
    {
    if (Event.current.type.Equals(EventType.Repaint))
    {
    Graphics.DrawTexture(new Rect(0, 0, 128, 128), aTexture);
    }
    }

    Now I get perfectly coloured, single instance textures.
     
    Last edited: Feb 11, 2019
  16. mowax74

    mowax74

    Joined:
    Mar 3, 2015
    Posts:
    97
    I also see the button textures way to bright in linear workflow. Some elements are gamma corrected from Unity, some not. Must be a bug, there is no working checkmark on the sprite to set it correctly.

    It's ridiculously stupid from Unity, that such a major bug is not getting fixed in kind of 5 years or even longer.
    What's the purpose of having the GUI-textures gamma corrected in linear workflow? Linear workflow is to get correct lighting when rendering. But since the GUI images are unlit no gamma correction is needed.

    People want to see the GUI images exactly like it is displayed in Photoshop. No fix, no tweak, no workaround.

    Have found a custom UI shader anyway, where you can set if the sprite image gamma should be corrected or not. But this should work out of the box, not via custom fix shader.
     
    ratking and daisySa like this.
  17. ratking

    ratking

    Joined:
    Feb 24, 2010
    Posts:
    350
    I updated a project from 2018.2 to 2018.4 and got the same problem. A lot of my legacy GUI buttons and panels are much too bright now. Unity, what is happening here?!
     
  18. manutoo

    manutoo

    Joined:
    Jul 13, 2010
    Posts:
    524
    @mowax74 & @ratking,
    the bug was fixed in Unity 5.6.

    I just just updated to 2019.1.8f1 and it's truly back ! :eek:

    Changing the texture mode to default to uncheck sRgb didn't help.

    Did you fill a bug report ?
     
  19. manutoo

    manutoo

    Joined:
    Jul 13, 2010
    Posts:
    524
    I just filled a bug report => #1168191 .
     
    daisySa likes this.
  20. mowax74

    mowax74

    Joined:
    Mar 3, 2015
    Posts:
    97
    Thanks for filling the bug report. We will see if this thing gets fixed.

    This bug was (re)introduced in Unity 2018.3. I could not imagine that unity stuff is not aware of it, since it's so obvious.

    We updated half a year ago from 2018.2 to 2018.3 and the first thing we realized when pressing the play button was this bug. Hard to believe that unity is not aware of this.
     
    ratking likes this.
  21. manutoo

    manutoo

    Joined:
    Jul 13, 2010
    Posts:
    524
    The bug report made its way to the Issue Tracker, you can vote for it : https://issuetracker.unity3d.com/is...ed-out-when-color-space-is-set-to-linear-mode .

    I just noticed 3 things :
    - in build, GUI.DrawTexture() produces the correct colors
    - in the Editor, the font color is also washed out and in build, the font color looks ok
    - in the Editor, Graphics.DrawTexture() looks correct, but in Build it gets too dark
     
  22. manutoo

    manutoo

    Joined:
    Jul 13, 2010
    Posts:
    524
    The issue has just been marked "By Design" ... Big big big face palm... :confused:

    If it was really by "design", the result shouldn't differ in the Editor and in the Build, nor from 1 unity version to the other... o_O

    Also, from the documentation linked in the Issue Tracker :

    https://docs.unity3d.com/Manual/LinearRendering-LinearTextures.html
    ====================
    Legacy GUI

    Rendering of elements of the Legacy GUI System is always done in gamma space. This means that for the legacy GUI system, Textures with their Texture Type set to Editor GUI and Legacy GUI do not have their gamma removed on import.

    ====================

    I work everyday with that bug, I'd really appreciate if the devs could actually fix it instead of posting links without reading what they state. :(
     
    Last edited: Jul 18, 2019
  23. manutoo

    manutoo

    Joined:
    Jul 13, 2010
    Posts:
    524
    Bug is active again... :p

    Reporting a bug to get it fixed is really harder than it should be... :confused: (I got another one on the slow motion track which still didn't pass the fogbugz gate after 10 days o_O )
     
  24. ratking

    ratking

    Joined:
    Feb 24, 2010
    Posts:
    350
    Yeah, Unity is doing some S***ty things recently. Ugh.
     
    manutoo likes this.
  25. manutoo

    manutoo

    Joined:
    Jul 13, 2010
    Posts:
    524
    The bug is now marked as "Fix In Review for 2019.3" (yeepee ?), but the "Resolution Note" talks again about how to set the textures for Linear & Gamma rendering ! (so not yeepee ?)

    This is not about the 3D World rendering, but about the Legacy GUI rendering which is always done in Gamma as stated in the linked page that dev posted, again, without reading it, again... >_<

    https://docs.unity3d.com/Manual/LinearRendering-LinearTextures.html =>
    This sounds more & more like dumb & dumber... :confused:
     
  26. manutoo

    manutoo

    Joined:
    Jul 13, 2010
    Posts:
    524
    Issue is active again and the note has disappeared... :p
     
    ratking likes this.
  27. manutoo

    manutoo

    Joined:
    Jul 13, 2010
    Posts:
    524
    It's back to "Fix In Review" but with a new note now, and even a tip to bypass the bug while waiting for the fix, so the previous note may have been forgotten to be deleted ! :D

    Here's the tip :
    So just do that :
    Code (CSharp):
    1. void OnGUI()
    2. {
    3.     #if UNITY_EDITOR
    4.     bool sRGBWriteBak = GL.sRGBWrite;
    5.     GL.sRGBWrite = false;
    6.     #endif
    7.  
    8.     //... Put Your Stuff Here ...
    9.  
    10.     #if UNITY_EDITOR
    11.     GL.sRGBWrite = sRGBWriteBak;
    12.     #endif
    13. }
    It's working for GUI.DrawTexture() & the font color, but then Graphics.DrawTexture() gets too dark. Maybe this one is by design, although it wasn't working like that in Unity 5.6, so once the fix will be live, I'll have to create & adapt my custom shaders used with Graphics.DrawTexture() if necessary.
     
  28. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    408
    still an issue to this day, the above fix works thanks @manutoo
     
    manutoo likes this.