Search Unity

Feedback Disabling clamping for HDR textures

Discussion in 'Editor & General Support' started by CarlLee, Mar 19, 2019.

  1. CarlLee

    CarlLee

    Joined:
    Mar 4, 2015
    Posts:
    8
    Feature request: it would be nice if there's an option in texture importer to disable clamping between 0 and 1 for hdr textures even if current color space is gamma. For example, I have a custom height map generated for rendering terrains, which is in EXR format. I'm targeting mobile devices, so I have to choose gamma color space, but Unity clamps my values to 0 and 1, which makes it unusable.
     
  2. MSplitz-PsychoK

    MSplitz-PsychoK

    Joined:
    May 16, 2015
    Posts:
    1,278
    You can select the texture in the assets folder and set the "Wrap Mode" to "Repeat" in the inspector. If you can't select it because it gets generated at runtime, you can call
    myTexture.WrapMode = TextureWrapMode.Repeat;
     
  3. CarlLee

    CarlLee

    Joined:
    Mar 4, 2015
    Posts:
    8
    I'm talking about Unity changing my values in my EXR texture into numbers between 0 and 1, but I need negative values for my shader to work. It's heightmap data used for water rendering.
     
  4. CarlLee

    CarlLee

    Joined:
    Mar 4, 2015
    Posts:
    8
    I'm currently using a bug to prevent Unity clamping my values:
    1. Change color space in player setting to Linear
    2. Uncheck Auto Graphics API
    3. Check Auto Graphics API
    4. Change color space back to Gamma

    You'll see all HDR textures being reimported without values being clamped. It would be really nice if the editor gives me an option to uncheck "clamp between 0 and 1" in texture import options instead of using this bug.
     
    a436t4ataf likes this.
  5. zachlindblad

    zachlindblad

    Joined:
    Sep 29, 2016
    Posts:
    39
    Just reviving an old topic because debugging why my loaded textures had incorrect values took up most of my day. It's very strange unity has built in methods to export to EXR, a format that seems purpose built for HDR, if on import it's going to throw away all values above and below the 0 to 1 range.