-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
CompressedImageSaver revamp #23567
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
Merged
alice-i-cecile
merged 43 commits into
bevyengine:main
from
JMS55:compressed-image-saver2
May 4, 2026
Merged
CompressedImageSaver revamp #23567
Changes from 35 commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
f28892c
WIP
JMS55 18cfdbb
add todo
JMS55 ef98abd
WIP
JMS55 ad31db5
Disable selector RDO for linear, based on tune_for_normal_maps
JMS55 a0d8313
WIP
JMS55 23f25b2
Misc
JMS55 bd2ed87
WIP
JMS55 fa171ae
Assert
JMS55 c2454e1
WIP
JMS55 73d0687
Merge commit '842fa5c4559303edbd1774013bc0f3d0dd529799' into compress…
JMS55 108518d
Merge commit '6dc30ca38789a1023df17649198b006e1df9cf5c' into compress…
JMS55 542d427
WIP
JMS55 a027777
Add TODO
JMS55 f1346ba
Misc
JMS55 48f9c44
Docs
JMS55 5b90771
Fix docs
JMS55 f92fb42
ASTC support
JMS55 8b721de
Docs
JMS55 f71c585
Feedback
JMS55 595ebf4
Doc tweaks
JMS55 3978fbf
Typo
JMS55 5f0f2b2
Use BC6H for rgba16float
JMS55 6e1255c
Zstd supercompression
JMS55 31f74f4
Use published versions
JMS55 41c550a
Migration
JMS55 bd7dcc2
Merge branch 'main' into compressed-image-saver2
JMS55 f036f14
Merge commit '489818930b7ec268455fe371b3c5b0fb1c0c46c3' into compress…
JMS55 cf1c4a7
Fix merge
JMS55 ff2024a
Fixes
JMS55 277c7bc
Fix grayscale conversion
JMS55 7ad83ba
Bugfix
JMS55 996d8a5
Add example
JMS55 e19d6ab
Merge branch 'main' into compressed-image-saver2
JMS55 975526e
Update release notes for CompressedImageSaver
JMS55 a8f0e0d
Build templated pages
JMS55 83470c1
Split processor up
JMS55 6fdfc8f
Clippy
JMS55 3b28d93
User-configurable alpha modes, clippy
JMS55 d7295c2
Clippy
JMS55 2a7c4bb
Clippy I hate you
JMS55 2a6d7d5
Require zstd
JMS55 ba11f5b
Alpha mode rename
JMS55 5e2b49a
Merge branch 'main' into compressed-image-saver2
JMS55 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
_release-content/migration-guides/compressed_image_saver.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| --- | ||
| title: "`CompressedImageSaver` improvements" | ||
| pull_requests: [23567] | ||
| --- | ||
|
alice-i-cecile marked this conversation as resolved.
|
||
|
|
||
| The `compressed_image_saver` Cargo feature has been reworked. The old behavior (Basis Universal UASTC compression) has been moved to a new feature called `compressed_image_saver_universal`, and the `compressed_image_saver` feature now uses the `ctt` library to compress textures into BCn (desktop) or ASTC (mobile) formats instead. | ||
|
|
||
| If you were using the `compressed_image_saver` feature and want to keep the previous Basis Universal behavior, rename the feature in your `Cargo.toml`: | ||
|
|
||
| ```toml | ||
| # Before | ||
| bevy = { version = "0.18", features = ["compressed_image_saver"] } | ||
|
|
||
| # After (keeps old Basis Universal behavior) | ||
| bevy = { version = "0.19", features = ["compressed_image_saver_universal"] } | ||
| ``` | ||
|
|
||
| Alternatively, keep using `compressed_image_saver` to get the new BCn/ASTC compression backend. This produces higher-quality output and supports a wider range of input formats, but does not support all platforms in a single file like UASTC does. We recommend sticking to `compressed_image_saver_universal` when targeting the web. | ||
|
|
||
| `CompressedImageSaverError` has a new variant `CompressionFailed`. If you were matching exhaustively on this enum, add a branch for it. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| --- | ||
| title: CompressedImageSaver Improvements | ||
| authors: ["@JMS55", "@cwfitzgerald"] | ||
| pull_requests: [23567] | ||
| --- | ||
|
|
||
| Bevy's `CompressedImageSaver` asset processor has been significantly upgraded with a new compression backend powered by the [`ctt`](https://github.com/cwfitzgerald/ctt) library. | ||
|
|
||
| The new `compressed_image_saver` feature compresses textures into BCn formats (for desktop GPUs) or ASTC formats (for mobile GPUs), producing higher-quality output than the previous Basis Universal approach. The compressor automatically selects the best output format based on the input texture's channel count and type — for example, single-channel textures get BC4, HDR textures get BC6H, and standard RGBA textures get BC7. | ||
|
|
||
| Try out the new `compressed_image_saver` example to see it in action. | ||
|
|
||
| ## Automatic Mipmap Generation | ||
|
|
||
| No more manually generating mipmaps! The new backend automatically produces a full mip chain during compression. This means less aliasing when textures are viewed at a distance and better GPU cache utilization — all for free, just by running your textures through the asset processor. | ||
|
|
||
| ## ASTC for Mobile | ||
|
|
||
| To target mobile GPUs, set the `BEVY_COMPRESSED_IMAGE_SAVER_ASTC` environment variable with your desired block size (e.g. `4x4`, `6x6`, `8x8`). Larger blocks give smaller files at the cost of quality. All 14 ASTC block sizes are supported. | ||
|
|
||
| ## Basis Universal is Still Available | ||
|
|
||
| The previous Basis Universal compression behavior has been moved to the `compressed_image_saver_universal` feature. This remains the best choice for cross-platform distribution (including WebGPU), since UASTC can be transcoded at load time to whatever format the target GPU supports. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions
16
assets/textures/GroundSand005/GroundSand005_COL_2K.jpg.meta
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| ( | ||
| meta_format_version: "1.0", | ||
| asset: Process( | ||
| processor: "LoadTransformAndSave<ImageLoader, IdentityAssetTransformer<Image>, CompressedImageSaver>", | ||
| settings: ( | ||
| loader_settings: ( | ||
| format: FromExtension, | ||
| is_srgb: true, | ||
| sampler: Default, | ||
| asset_usage: ("RENDER_WORLD"), | ||
| ), | ||
| transformer_settings: (), | ||
| saver_settings: (), | ||
| ), | ||
| ), | ||
| ) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions
17
assets/textures/GroundSand005/GroundSand005_DISP_2K.jpg.meta
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| ( | ||
| meta_format_version: "1.0", | ||
| asset: Process( | ||
| processor: "LoadTransformAndSave<ImageLoader, IdentityAssetTransformer<Image>, CompressedImageSaver>", | ||
| settings: ( | ||
| loader_settings: ( | ||
| format: FromExtension, | ||
| is_srgb: false, | ||
| sampler: Default, | ||
| asset_usage: ("RENDER_WORLD"), | ||
| texture_format: Some("r8unorm"), | ||
| ), | ||
| transformer_settings: (), | ||
| saver_settings: (), | ||
| ), | ||
| ), | ||
| ) |
|
JMS55 marked this conversation as resolved.
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions
16
assets/textures/GroundSand005/GroundSand005_NRM_2K.jpg.meta
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| ( | ||
| meta_format_version: "1.0", | ||
| asset: Process( | ||
| processor: "LoadTransformAndSave<ImageLoader, IdentityAssetTransformer<Image>, CompressedImageSaver>", | ||
| settings: ( | ||
| loader_settings: ( | ||
| format: FromExtension, | ||
| is_srgb: false, | ||
| sampler: Default, | ||
| asset_usage: ("RENDER_WORLD"), | ||
| ), | ||
| transformer_settings: (), | ||
| saver_settings: (), | ||
| ), | ||
| ), | ||
| ) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions
16
assets/textures/GroundSand005/GroundSand005_ORM_2K.png.meta
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| ( | ||
| meta_format_version: "1.0", | ||
| asset: Process( | ||
| processor: "LoadTransformAndSave<ImageLoader, IdentityAssetTransformer<Image>, CompressedImageSaver>", | ||
| settings: ( | ||
| loader_settings: ( | ||
| format: FromExtension, | ||
| is_srgb: false, | ||
| sampler: Default, | ||
| asset_usage: ("RENDER_WORLD"), | ||
| ), | ||
| transformer_settings: (), | ||
| saver_settings: (), | ||
| ), | ||
| ), | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| https://www.poliigon.com/texture/rippled-wet-sand-texture/6997 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think we could remove this now that we don't auto generate meta files, but let's not do that in this PR.