Convert Texture2D to EXR (HDRI)

1.3k views Asked by At

I am looking for a way to convert Texture2D directly to EXR format in byte array. I've done few research and this seems to be complicated than I thought.

Not really looking for a code since I don't have one. Just a suggestion on how to do this.

1

There are 1 answers

0
Programmer On BEST ANSWER

Unity 5.6 just got released and surprisingly, it has the API to perform this Texture2D to EXR conversion.

To convert Texture2D to EXR (HDR)

byte []exrBytes  = texture.EncodeToEXR();

To convert Texture2D to EXR (HDR) Compressed

byte[] exrBytes = texture.EncodeToEXR(Texture2D.EXRFlags.CompressZIP);  

More EXR encoding flags can be found here.