Can we compress .exr files?

Got an .exr file that is 60mb+ in build, compression is ticked and size capped to 2048x2048 but in the export it is still huge, source file is only 11.7mb


image.png

Original Post on Discord

by user 103054507105067008

EXRs can not be compressed at the moment

What format would you recommend as an alternative for HDR skybox?

by user 103054507105067008

Or should I just stick with .exr and try to squash down the size via the native resolution of the .exr?

by user 103054507105067008

Its a skybox? You can then just set the SkyboxExportSettings too for a smaller cubemap in the exported glb
image.png

Trying now

by user 103054507105067008

That helps, but why does the .exr size go from 11mb to 60mb+ in the export?

by user 103054507105067008

Does the exporter change the compression type?

by user 103054507105067008

No, we’re just using the EXR methods from Unity

I believe EXR can use RLE (lossless compression) optionally, maybe Unity doesn’t do that. Good point

Generally what happens is that the cubemap is baked on export - so even if you just have a single EXR in there as cubemap we re-encode the result in a specific resolution.

That has the advantage that when you use rotation, tint, custom shaders, etc. you always end up with a correctly baked result.

Theoretically we could detect “Rob is using the default skybox shader with no tint and no rotation” and then pass through the texture

Any way also to make that texture size smaller or more efficient would be useful too especially if the original texture looks great at 4k at 4mb when in the export it is like 32mb~ I am finding

by user 103054507105067008

Or as you say, just use the raw texture if not altered

by user 103054507105067008

RLE compression creates huge file sizes. Can we use dwaa or dwab for the smaller sizes of .exr?

by user 103054507105067008

I assume some workaround would be to use a .dll or .exe like toKTX to compress the EXR after using the Unity methods

by user 103054507105067008

If you find a tool that can do that feel free to let us know, happy to integrate
The “good” way would probably be using BC6H compressed cubemaps, or ASTC in ktx2

Willing to test out either if you guys did implement that too, will look around for sure as its part of the standard https://openexr.readthedocs.io/en/latest/ReadingAndWritingImageFiles.html#compression

by user 103054507105067008

Did you want a repro of my project with that .exr file?

by user 103054507105067008