Search Unity

Question Srgb against storing raw temporary number value in render texture

Discussion in 'Shaders' started by neoshaman, Nov 8, 2022.

  1. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    Hello
    I want to do a lot of computing using the gpu shader (not compute) and storing intermediate number as 8bits texture data, how much srgb can get in the way and if so, how can I compensate to retrieve correct data?

    I have just a passing understanding of srgb being applied automatically somewhere along reading or writing of texture, but I don't understand exactly when:
    - the texture creation in a dcc vs by code
    - reading initial values from the texture by the shader (gpu or driver applying conversion?)
    - writing data to texture by rendering to the texture (data fitted back to srgb curve?)
    - the texture being displayed on screen (data correct, but visually fitted for the screen?)
     
  2. burningmime

    burningmime

    Joined:
    Jan 25, 2014
    Posts:
    845
    If it's a render texture, you choose the format. You can decide if you want it sRGB or not.
     
  3. burningmime

    burningmime

    Joined:
    Jan 25, 2014
    Posts:
    845
    Yes, this is where it's applied if the texture is sRGB. But when you create the texture, just create it non-sRGB.
     
  4. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493