-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Added WebP
image format support
#8220
Conversation
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
Thanks! Could you run this command and commit the modified file? |
Sure! I added the documentation with that command |
Do we normally note when features depend on C/C++ libraries? That may be useful information for users to understand when there is no wasm support. It looks like the webp feature in the image crate depends on a C library. |
It only uses |
Also, this supersedes #2600, as the other pull request imports a C library and uses an old asset-loading system. |
@KernelFreeze Note that your comment regarding "reduced memory usage" would only potentially apply while in the process of loading the image. Once it's loaded it will be stored in ram and vram raw and uncompressed. To reduce ram and vram usage a GPU compressed format should be used. (like KTX2 files with BCn compression for example) I do however believe this is a worthwhile feature. Thanks for working on it! |
Objective
WebP is a modern image format developed by Google that offers a significant reduction in file size compared to other image formats such as PNG and JPEG, while still maintaining good image quality. This makes it particularly useful for games with large numbers of images, such as those with high-quality textures or detailed sprites, where file size and loading times can have a significant impact on performance.
By adding support for WebP images in Bevy, game developers using this engine can now take advantage of this modern image format and reduce the memory usage and loading times of their games. This improvement can ultimately result in a better gaming experience for players.
In summary, the objective of adding WebP image format support in Bevy is to enable game developers to use a modern image format that provides better compression rates and smaller file sizes, resulting in faster loading times and reduced memory usage for their games.
Solution
To add support for WebP images in Bevy, this pull request leverages the existing
image
crate support for WebP. This implementation is easily integrated into the existing Bevy asset-loading system. To maintain compatibility with existing Bevy projects, WebP image support is disabled by default, and developers can enable it by adding a feature flag to their project'sCargo.toml
file. With this feature, Bevy becomes even more versatile for game developers and provides a valuable addition to the game engine.Changelog
Migration Guide
To enable WebP image support in your Bevy project, add the following line to your project's Cargo.toml file: