-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BasisU: Update to 1.50.0 and add HDR support #97582
Conversation
ffb5eee
to
170ca0b
Compare
b630f76
to
cf4b3d6
Compare
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. |
17 seconds sounds like our previous times without gpu compute, not sure how much we can squeeze to make it faster. |
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. |
cf4b3d6
to
5a1bc94
Compare
There are three missing items on the list left to go!
|
5a1bc94
to
b3e2c54
Compare
I don't think the performance can get any better (without SSE4/AVX), since the lowest settings are already used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally, it works as expected.
Optimized, stripped Linux x86_64 editor binary size is about 300 KB larger (this is with #85321 taken into account). Release export template is 86 KB larger.
Benchmark
Performance on LDR texture imports seems to be roughly identical. Here's an exercept on a few 4K textures:
Before
EditorFileSystem: "res://blue_metal_plate_disp_4k.jpg" import took 439 ms.
EditorFileSystem: "res://blue_metal_plate_diff_4k.jpg" import took 1094 ms.
EditorFileSystem: "res://blue_metal_plate_arm_4k.jpg" import took 1438 ms.
EditorFileSystem: "res://blue_metal_plate_nor_gl_4k.jpg" import took 1495 ms.
After
BasisU: Encoding a 4096x4096 image with 12 mipmaps took 371 ms.
EditorFileSystem: "res://blue_metal_plate_disp_4k.jpg" import took 449 ms.
BasisU: Encoding a 4096x4096 image with 12 mipmaps took 776 ms.
EditorFileSystem: "res://blue_metal_plate_diff_4k.jpg" import took 1157 ms.
BasisU: Encoding a 4096x4096 image with 12 mipmaps took 828 ms.
EditorFileSystem: "res://blue_metal_plate_arm_4k.jpg" import took 1256 ms.
BasisU: Encoding a 4096x4096 image with 12 mipmaps took 1193 ms.
EditorFileSystem: "res://blue_metal_plate_nor_gl_4k.jpg" import took 1503 ms.
Quality
Click to view at full size. Texture size was limited to 1024 on import to make the difference more noticeable.
Lossless | VRAM Compressed Low Quality |
---|---|
VRAM Compressed High Quality | Basis Universal |
---|---|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, just missing this diff for vendoring instructions:
diff --git a/thirdparty/README.md b/thirdparty/README.md
index c9a0cefb05..bbf4bcecb7 100644
--- a/thirdparty/README.md
+++ b/thirdparty/README.md
@@ -64,7 +64,8 @@ Files extracted from upstream source:
Files extracted from upstream source:
-- `encoder/` and `transcoder/` folders, minus `jpgd.{cpp,h}`
+- `encoder/` and `transcoder/` folders, with the following files removed from `encoder`:
+ `jpgd.{cpp,h}`, `3rdparty/{qoi.h,tinydds.h,tinyexr.cpp,tinyexr.h}`
- `LICENSE`
Applied upstream PR https://github.com/BinomialLLC/basis_universal/pull/344 to
Regarding QOI support, we have #91263 so if it gets approved we could consider re-enabling support for that, if it's deemed useful.
b3e2c54
to
09037ce
Compare
BasisU's image loaders are never used anyway, nor are they exposed to the user; this would only simplify the patches. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes to modules/basis_universal look good to me!
09037ce
to
200ed09
Compare
Thanks! |
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:
Quality:
Image: https://polyhaven.com/a/empty_play_room