-
-
Notifications
You must be signed in to change notification settings - Fork 22.4k
BasisU: Use KTX2 format and add import options to configure encoder #105080
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
Conversation
22f6827
to
2b95936
Compare
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.
Needs testing, but agree with the feature proposal.
2b95936
to
74476b2
Compare
basisu v1.50.0 command line
|
I'm considering move these settings to texture import options that allow setting different compression params for different texture. Some extreme settings are not suitable for all textures. |
I think having per texture import settings makes sense. That's the first place I'd think to go to adjust quality for any other texture format in godot |
74476b2
to
ac27d61
Compare
ac27d61
to
1e58ec1
Compare
I think we should get together in a videoconference and review the design of the options. |
basisu v1.60 #103968 seems to be a great improvement and something is changed. The m_quality_level is renamed to m_etc1s_quality_level which explicitly indicates it doesn't affect uastc. So this param should be removed. Need retesting in v1.60. |
1e58ec1
to
416fee9
Compare
In basisu v1.60 I also get ~4x imporvement (5500 ms -> 1400 ms) for https://polyhaven.com/a/cambridge 4096x2048, no mipmaps. But for the images in #105080 (comment), it doesn't, instead it's slightly slower. The compressed size is exactly the same in v1.50 and v1.60. Compression speed may vary depending on the texture. |
ran into some mystical (probably linktime) problems with basisU on the web recently Any chance you've tested the new basisU version on a release build/export template for the web Guess I'm just hoping it'll magically fix it 😂 (probably not, but hey it's worth a shot) |
Unfortunately, this PR with basisu v1.60 doesn't fix #104497 when enabling
|
f3eda36
to
0f38ddb
Compare
I placed the basisu parameters in a struct to improve readability. And I'd like to enable zstd by default to actually make basisu disk size smaller as described in docs |
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.
There may be some confusion regarding how encoding speed is documented.
7f7c24e
to
635d9f5
Compare
In terms of UX, this adds a lot of import options when Basis Universal is chosen as a compression mode. It makes the already lengthy texture import options even longer. I'm thinking these should be project settings instead (like #104571 does). Are there situations where you want specific textures only to import faster, but still use VRAM compression (instead of Lossless or VRAM Uncompressed while you're iterating on an asset)? Maybe the UASTC level could be configurable per-texture, but that's probably the extent where I'd allow per-texture configuration. |
The effects of supercompression with different textures vary greatly as my previously test shows. Generally, you would want to use rdo and more aggressive compression for larger textures, but this is not suitable for all textures since it increase encoding times. In my opinion, adding these options is not a issue for UX, because they are grouped together and placed at the end, and they are only visible in the basisu mode. What I'm a bit concerned about is whether these options are stable. Not sure if these will change with future updates of basisu. Maybe we should only provide some presets regarding quality and size. By the way, Edit: ktx2 loader supports transcoding basisu textures, but not native srgb textures. basisu tool uses srgb by default. Just needs |
UASTC level mainly controls the quality and has little impact on the size (Higher quality even slightly increases the file size). I might prefer to only remain the "uastc level" and "rdo quality loss" in import options( and automatically disable rdo when the rdo quality loss is approximately 0), as the other options have a relatively small impact and the default values are fine. |
aaaae45
to
e33e82a
Compare
I agree with this, the level of aggressiveness with which RDO affects different textures highly varies depending on their type. For example, normal maps are highly sensitive to RDO, while artifacts on diffuse or ORM are much less noticeable. RDO also has the biggest influence on the resulting file size, so it makes sense for it to be exposed per-texture |
6503dee
to
0ac2594
Compare
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 on Android, it works as expected. Textures are properly compressed and transcoded to ETC2/ASTC formats
0ac2594
to
8b3f6f6
Compare
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 great!
8b3f6f6
to
237597b
Compare
Thanks! |
Implements and closes godotengine/godot-proposals#12165
Should fix #105012.
Different from proposal: the project settings have been changed to import options to better adjust individual texture compression.
This PR switchs the basis format to ktx2 format and adds import options that allow to enable zstd supercompression and Rate-Distortion Optimizated (RDO) to significantly reduce disk size of basisu textures.
Also adds the same settings for PortableCompressedTexture2D.