CompressedImageSaver revamp redux#24223
Conversation
… into compressed-image-saver3
| >>("png"); | ||
| >>(crate::CompressedImageSaver::default().into()); | ||
|
|
||
| for file_extension in ["png", "jpeg", "jpg"] { |
There was a problem hiding this comment.
hdr, exr images can be compressed too. I'd like to make this configurable like:
There was a problem hiding this comment.
Let's leave that for a followup. Rn exr and hdr textures go through an entirely separate image loader, so processing them would be a little complicated.
There was a problem hiding this comment.
At least ImageLoader::SUPPORTED_FILE_EXTENSIONS can be used by the processor.
| } | ||
| // ASTC has no dedicated 2-channel block format; all ASTC blocks are | ||
| // RGBA-shaped. Since `compressed_image_saver` writes 2-component normal maps | ||
| // when using the ASTC backend, assume ASTC normal maps are 2-component. |
There was a problem hiding this comment.
This code smells.
Astc from users isn't necessarily 2 components, and what about Bc7?
There was a problem hiding this comment.
BC7 is 3 channel, not 2 channel.
We're assuming ASTC normal maps are all two channel, because that's what bevy's own asset processor will produce. This should be fine for 99% of users.
There was a problem hiding this comment.
BC7 is 4 channels, too. Using less channels can help with compression but VRAM usage doesn't reduce.
There was a problem hiding this comment.
VRAM does reduce with less channels?
But also it's irrelevant for this code. If you use BC7 normal maps, it'll work fine, because StandardMaterialFlags::TWO_COMPONENT_NORMAL_MAP won't get set.
There was a problem hiding this comment.
Does BC7 normal map benefit from 2-components, too?
There was a problem hiding this comment.
Note the shader is wrong for Astc normal map.
Astc recommends to store normal map as rrrg, but our shader samples .rg, not .ga
(Actually Astc can store 3 components normal, just less precise ARM-software/astc-encoder#278)
There was a problem hiding this comment.
Astc recommends to store normal map as rrrg, but our shader samples .rg, not .ga
We don't use rrrg, we do rg01.
| /// edges. See the field docs for details. | ||
| #[derive(TypePath, Default)] | ||
| #[expect(clippy::doc_markdown, reason = "clippy does not like unquoted BCn")] | ||
| pub struct CompressedImageSaver { |
There was a problem hiding this comment.
I still dislike wrapping two saver in one and making ctt saver and basisu saver exclusive:
- Each AssetSaver should be independent. Both ctt saver and basisu saver can be used by plugins.
- Asset processor is exclusive for the same file but users can choose the processor by meta file.
I think ctt and basisu should be split into two processors.
Redo of #23567 but with: