Skip to content

Commit 228e7aa

Browse files
authored
Add support for KHR_materials_emissive_strength (#9553)
# Objective - Fix blender gltf imports with emissive materials - Progress towards #5178 ## Solution - Upgrade to gltf-rs 1.3 supporiting [KHR_materials_emissive_strength](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_materials_emissive_strength/README.md) --- ## Changelog - GLTF files using `emissiveStrength` (such as those exported by blender) are now supported ## Migration Guide - The GLTF asset loader will now factor in `emissiveStrength` when converting to Bevy's `StandardMaterial::emissive`. Blender will export emissive materials using this field. Remove the field from your GLTF files or manually modify your materials post-asset-load to match how Bevy would load these files in previous versions.
1 parent f813831 commit 228e7aa

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

crates/bevy_gltf/Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ bevy_tasks = { path = "../bevy_tasks", version = "0.12.0-dev" }
2828
bevy_utils = { path = "../bevy_utils", version = "0.12.0-dev" }
2929

3030
# other
31-
gltf = { version = "1.0.0", default-features = false, features = [
31+
gltf = { version = "1.3.0", default-features = false, features = [
3232
"KHR_lights_punctual",
3333
"KHR_materials_unlit",
34+
"KHR_materials_emissive_strength",
3435
"extras",
3536
"names",
3637
"utils",

crates/bevy_gltf/src/loader.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,8 @@ fn load_material(material: &Material, load_context: &mut LoadContext) -> Handle<
678678
Some(Face::Back)
679679
},
680680
occlusion_texture,
681-
emissive: Color::rgb_linear(emissive[0], emissive[1], emissive[2]),
681+
emissive: Color::rgb_linear(emissive[0], emissive[1], emissive[2])
682+
* material.emissive_strength().unwrap_or(1.0),
682683
emissive_texture,
683684
unlit: material.unlit(),
684685
alpha_mode: alpha_mode(material),

0 commit comments

Comments
 (0)