I’d like to develop a mobile app to browse HDR image files saved at persistentDataPath. So I want to read the HDR image files to load to texture2D, but have failed it. Please help me to solve this problem. “.hdr” or “.exr”, either hdr format as a source is OK for me.
I tried using LoadRawTextureData but unity says “UnityException: LoadRawTextureData: not enough data provided (will result in overread).”.
string path = Path.Combine(Application.persistentDataPath,“test.exr”);
if (File.Exists(path)){
byte[ ] hdr_byte = File.ReadAllBytes(path);
hdr_tex = new Texture2D(2048, 2048, TextureFormat.RGBAFloat, false);
hdr_tex.LoadRawTextureData(hdr_byte);
hdr_tex.Apply();
myrenderer.material.mainTexture = hdr_tex;
}