godot icon indicating copy to clipboard operation
godot copied to clipboard

BasisU: Update to 1.50.0 and add HDR support

Open BlueCube3310 opened this issue 1 year ago • 6 comments

Updates BasisUniversal to 1.50.0 and adds support for transcoding to BC6/ASTC HDR 4x4 RGB. If neither format is supported, the image gets decompressed to RGB9E5.

TODO:

  • [x] Apply previous patches,
  • [x] Use Godot's tinyexr,
  • [x] Remove unused dependencies (qoi, tinydds)
  • [x] Tune the settings to minimize the compression time,
  • [x] Clean up the code,
  • [x] Make the multiples-of-4 padding code account for RGBAF,
  • [x] Do quality comparisons

Quality: Image: https://polyhaven.com/a/empty_play_room

BasisU vs. Betsy (diff) Basisu vs. Original (diff)
vsbetsy basisu

BlueCube3310 avatar Sep 28 '24 10:09 BlueCube3310

I think this is more or less complete, on an optimized Windows editor build it adds ~250kb, this should be minimized by #85321.

The only big issue are the compression times, on an optimized build it takes ~21s to compress an 8k HDRi without mipmaps with the default settings. The latest push uses the 'fastest' preset which I haven't tested yet, so that may have improved a bit.

BlueCube3310 avatar Sep 29 '24 08:09 BlueCube3310

17 seconds sounds like our previous times without gpu compute, not sure how much we can squeeze to make it faster.

fire avatar Sep 29 '24 09:09 fire

CVTT would take about 60-70s for the same task, so this is about 3x faster (though obviously still not desired)

Edit: It now takes ~15s, so changing the settings actually results in some improvement.

Edit2: Verbose mode now prints the encoding/transcoding times.

BlueCube3310 avatar Sep 29 '24 09:09 BlueCube3310

There are three missing items on the list left to go!

  • [ ] Remove unused dependencies (qoi, tinydds)
  • [ ] Tune the settings to minimize the compression time,
  • [ ] Do quality comparisons

fire avatar Oct 03 '24 19:10 fire

I don't think the performance can get any better (without SSE4/AVX), since the lowest settings are already used. Quality-wise, it's comparable to Betsy. Transcoding to ASTC should be nearly instant (BasisU HDR is just ASTC), so slowdowns are not expected on mobile. BC6 is slightly slower, though not really noticeable on Desktop hardware.

BlueCube3310 avatar Oct 04 '24 14:10 BlueCube3310

Regarding QOI support, we have #91263 so if it gets approved we could consider re-enabling support for that, if it's deemed useful.

BasisU's image loaders are never used anyway, nor are they exposed to the user; this would only simplify the patches.

BlueCube3310 avatar Oct 04 '24 21:10 BlueCube3310

Thanks!

Repiteo avatar Oct 14 '24 19:10 Repiteo