Skip to content
Merged
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
6 changes: 3 additions & 3 deletions crates/bevy_pbr/src/gltf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ impl GltfExtensionHandler for GltfExtensionHandlerPbr {
fn on_root(&mut self, load_context: &mut LoadContext<'_>, _gltf: &gltf::Gltf) {
// create the `StandardMaterial` for the glTF `DefaultMaterial` so
// it can be accessed when meshes don't have materials.
let std_label = format!("{}#std", GltfAssetLabel::DefaultMaterial);
let std_label = format!("{}/std", GltfAssetLabel::DefaultMaterial);

load_context.add_labeled_asset(
std_label,
Expand All @@ -119,7 +119,7 @@ impl GltfExtensionHandler for GltfExtensionHandlerPbr {
material_asset: &GltfMaterial,
material_label: &str,
) {
let std_label = format!("{}#std", material_label);
let std_label = format!("{}/std", material_label);

load_context.add_labeled_asset(
std_label,
Expand All @@ -136,7 +136,7 @@ impl GltfExtensionHandler for GltfExtensionHandlerPbr {
entity: &mut EntityWorldMut,
material_label: &str,
) {
let std_label = format!("{}#std", material_label);
let std_label = format!("{}/std", material_label);
let handle = load_context.get_label_handle::<StandardMaterial>(std_label);

entity.insert(MeshMaterial3d(handle));
Expand Down
14 changes: 14 additions & 0 deletions release-content/migration-guides/gltf_pbr.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@ pull_requests: [22569]

Previously, `bevy_gltf` depended on `bevy_pbr`. This meant scene definition was tightly coupled to rendering. This dependency has been inverted, to allow `bevy_gltf` to function without any of the rendering stack present.

In 0.18, loading a material sub-asset would return a `Handle<StandardMaterial>`.

```rs
let handle: Handle<StandardMaterial> = asset_server.load("models/animated/Fox.glb#Material0");
```

In 0.19, loading a material sub-asset loads a `GltfMaterial` to accurately represent the data in the glTF file.
To load the `StandardMaterial`, use the `/std` suffix when the `bevy_pbr` feature is turned on (the feature is on by default).

```rs
let handle: Handle<GltfMaterial> = asset_server.load("models/animated/Fox.glb#Material0");
let handle_std: Handle<StandardMaterial> = asset_server.load("models/animated/Fox.glb#Material0/std");
```

You can disable PBR rendering by initializing `PbrPlugin` as so:

```rs
Expand Down
Loading