Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

GUI Texture colours are off.

Discussion in 'Immediate Mode GUI (IMGUI)' started by Mark Duffill, Jun 11, 2013.

  1. Mark Duffill

    Mark Duffill

    Joined:
    May 2, 2013
    Posts:
    21
    Hi,

    We are having colour repro issues, attached is example of the issue.

    We have a solid blue test image rgb(0,39,93), The asset thumb in the project panel is correct, in the preview pain its a bit darker and in game it is way off.

    We are using a GUITexture in game and you can see it is very noticeably wrong.

    We are using linear colour space, but the issue is still there with gamma colour space.

    Any suggestions on how to fix this as colour accuracy is very important to our project.

    Thanks
     

    Attached Files:

  2. Mark Duffill

    Mark Duffill

    Joined:
    May 2, 2013
    Posts:
    21
    Update: If I use GUI.DrawTexture in code and draw the image it appears colour correct but *only* if I switch to gamma colour space.

    Any way of working around this as we need linear space for image base lighting effects.

    Thanks
     
  3. Mark Duffill

    Mark Duffill

    Joined:
    May 2, 2013
    Posts:
    21
    Ah,

    Problem solved:

    http://docs.unity3d.com/Documentation/Manual/LinearLighting.html

    "..GUI and Linear Authored Textures

    When rendering Unity GUI we do not perform the rendering in linear space. This means that GUI textures should not have their gamma removed on read. This can be achieved in two ways.

    Set the texture type to GUI in the texture importer
    Check the 'Bypass sRGB Sampling' checkbox int the advanced texture importer

    It is also important that lookup textures and other textures which are authored to have their RGB values to mean something specific should bypass sRGB sampling.

    This will force the sampled texture to not have gamma removed before being used by the graphics hardware. This is also useful for other texture types such as masks where you wish the value that is passed to the shader to be the exact same value that is in the authored texture. .."
     
    Extelen1 likes this.