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
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Is it possible to load a HDR Texture at run-time in Unity and convert it to a texture?

Discussion in 'Scripting' started by Ben-BearFish, May 18, 2015.

  1. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    I was interested in loading a HDR image (.exr or .hdr format) at run-time in Unity and was wondering if it was possible, and if so how to do it?

    I assume I'd load it from the Resource or StreamingAssets folder, but after that I'm not sure how'd I convert it to something Unity could use.

    My idea was to have a folder that can update/change the HDR image it has and then load those new HDR images at run-time.
     
  2. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    Any thoughts?
     
  3. ThomasCreate

    ThomasCreate

    Joined:
    Feb 23, 2015
    Posts:
    81
    Unity can load in HDR images by default; just load them as cubemaps.
     
  4. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    My emphasis was at run-time (Standalone Build), not just in the editor. But I guess based on what you said, I suppose I could load a resource from the Resource or StreamingAssets folder, and typecast it to a Cubemap. I was wondering if there was an alternative texture type that can use HDR in Unity besides Cubemaps.

    For instance, could I load an HDR on a normal Texture2D in my scene in Unity at run-time (Standalone Build)?
     
  5. ThomasCreate

    ThomasCreate

    Joined:
    Feb 23, 2015
    Posts:
    81
    I reckon you most likely can - what's stopping you from trying? :D
     
  6. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    Ok, looks like my next step is to figure out how to convert a Texture to a HDR in Unity at run-time (Standalone Build).
     
  7. rob_ice

    rob_ice

    Joined:
    Nov 11, 2016
    Posts:
    112
    Did you have any success with this? We are finding the HDR image values get clamped or altered and the hdri colour changes completely when we assign a newly created hdri at runtime.
     
  8. Caronte3D

    Caronte3D

    Joined:
    Sep 16, 2014
    Posts:
    43
    Still no way to save and load 64bits textures to a standard image format at runtime?