Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ Cargo.lock
# Bevy Assets
assets/**/*.meta
crates/bevy_asset/imported_assets
imported_assets
examples/asset/processing/imported_assets
/imported_assets
.web-asset-cache
examples/large_scenes/bistro/assets/*
examples/large_scenes/caldera_hotel/assets/*
Expand Down
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -429,10 +429,10 @@ trace_tracy_memory = ["bevy_internal/trace_tracy_memory"]
trace = ["bevy_internal/trace", "dep:tracing"]

# Basis Universal compressed texture support
basis-universal = ["bevy_internal/basis-universal"]
basis_universal = ["bevy_internal/basis_universal"]

# Enables compressed KTX2 UASTC texture output on the asset processor
compressed_image_saver = ["bevy_internal/compressed_image_saver"]
# Basis Universal saver and asset processor
basis_universal_saver = ["bevy_internal/basis_universal_saver"]

# BMP image format support
bmp = ["bevy_internal/bmp"]
Expand Down
37 changes: 37 additions & 0 deletions _release-content/migration-guides/basis_universal_improve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: "Basis Universal update and improvement"
pull_requests: [23672]
---

Previously bevy used [basis-universal-rs](https://github.com/aclysma/basis-universal-rs) for basis universal support, including `.basis` and ktx2 UASTC texture
loading and `CompressedImageSaver`. However it doesn't support web and uses relatively outdated Basis Universal v1.16.

Now bevy uses [`basisu_c_sys`](https://docs.rs/basisu_c_sys/latest/basisu_c_sys) which is basis universal v2.10 and supports all the basis universal formats (ETC1S, UASTC, ASTC and XUASTC) and `wasm32-unknown-unknown` on web.

`ImageFormat::Basis` is removed. `CompressedImageSaver` is replaced by `BasisuSaver`/`BasisuProcessor` which is not added by `ImagePlugin` automatically. Also the `basis-universal` cargo feature is renamed to `basis_universal`, `compressed_image_saver` is replaced by `basis_universal_saver`.

If you are using `.basis` files, it's recommended to re-compress your textures to `.ktx2` format with basisu tool. Basis universal textures will be handled as `ImageFormat::Ktx2` if `basis_universal` feature is enabled.

To use the `BasisuProcessor`, enable `basis_universal_saver` feature and add `BasisUniversalProcessorPlugin`:

```rs
use bevy::image::BasisUniversalProcessorPlugin;
use bevy::prelude::*;

fn main() {
App::new()
.add_plugins((
DefaultPlugins
.set(bevy::log::LogPlugin {
filter: "bevy_image=debug,bevy_asset=debug,wgpu=warn".to_string(),
..Default::default()
})
.set(AssetPlugin {
mode: AssetMode::Processed,
..Default::default()
}),
BasisUniversalProcessorPlugin::default(),
))
.run();
}
```
15 changes: 8 additions & 7 deletions crates/bevy_image/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ default = ["bevy_reflect"]
bevy_reflect = ["bevy_math/bevy_reflect"]

# Image formats
basis-universal = ["dep:basis-universal"]
bmp = ["image/bmp"]
dds = ["ddsfile"]
exr = ["image/exr"]
Expand Down Expand Up @@ -44,9 +43,8 @@ zstd = []
zstd_rust = ["zstd", "dep:ruzstd"]
# Binding to zstd C implementation (faster)
zstd_c = ["zstd", "dep:zstd"]

# Enables compressed KTX2 UASTC texture output on the asset processor
compressed_image_saver = ["basis-universal"]
basis_universal = ["ktx2", "dep:basisu_c_sys"]
basis_universal_saver = ["basis_universal", "basisu_c_sys/encoder"]

[dependencies]
# bevy
Expand Down Expand Up @@ -75,7 +73,6 @@ wgpu-types = { version = "29.0.1", default-features = false, features = [
] }
serde = { version = "1", features = ["derive"] }
thiserror = { version = "2", default-features = false }
futures-lite = "2.0.1"
guillotiere = "0.6.0"
rectangle-pack = "0.4"
ddsfile = { version = "0.5.2", optional = true }
Expand All @@ -84,10 +81,14 @@ ktx2 = { version = "0.4.0", optional = true }
flate2 = { version = "1.0.22", optional = true }
zstd = { version = "0.13.3", optional = true }
ruzstd = { version = "0.8.0", optional = true }
# For transcoding of UASTC/ETC1S universal formats, and for .basis file support
basis-universal = { version = "0.3.0", optional = true }
tracing = { version = "0.1", default-features = false, features = ["std"] }
half = { version = "2.4.1" }
basisu_c_sys = { version = "0.6.1", default-features = false, features = [
"extra",
"serde",
], optional = true }
bevy_log = { version = "0.19.0-dev", path = "../bevy_log", default-features = false }
bevy_tasks = { version = "0.19.0-dev", path = "../bevy_tasks", default-features = false }

[dev-dependencies]
bevy_ecs = { path = "../bevy_ecs", version = "0.19.0-dev" }
Expand Down
169 changes: 0 additions & 169 deletions crates/bevy_image/src/basis.rs

This file was deleted.

Loading