Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Converting material shaders from Gamma to Linear colour space

Discussion in 'Shaders' started by eco_bach, Mar 22, 2017.

  1. eco_bach

    eco_bach

    Joined:
    Jul 8, 2013
    Posts:
    1,601
    I have a package of material shaders that look correct in Gamma space but not in Linear space.

    My question is>
    To make shaders work in Linear space is it a LOT of work or a simple change to the shader code?
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,329
    It kind of depends on the shader, and why exactly it isn't looking right. Depending on the shader the issue might be as simple as changing the sRGB settings on the input textures. More likely though it will require going through the shader and finding the proper place to convert to and from "gamma space" via LinearToGammaSpace() and GammaToLinearSpace() functions.
     
  3. eco_bach

    eco_bach

    Joined:
    Jul 8, 2013
    Posts:
    1,601
    Thanks. In general though I'm guessing the shaders should 'look better' ie have better dynamic range and take advantage of the linear pipeline