Skip to content

Commit 8945122

Browse files
committed
Intepret glTF colors as linear instead of sRGB (#6828)
# Objective Fixes #6827 ## Solution Use the `Color::rgba_linear` function instead of the `Color::rgba` function to correctly interpret colors from glTF files in the linear color space rather than the incorrect sRGB color space
1 parent 6ada356 commit 8945122

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

crates/bevy_gltf/src/loader.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ fn load_material(material: &Material, load_context: &mut LoadContext) -> Handle<
669669
load_context.set_labeled_asset(
670670
&material_label,
671671
LoadedAsset::new(StandardMaterial {
672-
base_color: Color::rgba(color[0], color[1], color[2], color[3]),
672+
base_color: Color::rgba_linear(color[0], color[1], color[2], color[3]),
673673
base_color_texture,
674674
perceptual_roughness: pbr.roughness_factor(),
675675
metallic: pbr.metallic_factor(),
@@ -682,7 +682,7 @@ fn load_material(material: &Material, load_context: &mut LoadContext) -> Handle<
682682
Some(Face::Back)
683683
},
684684
occlusion_texture,
685-
emissive: Color::rgba(emissive[0], emissive[1], emissive[2], 1.0),
685+
emissive: Color::rgb_linear(emissive[0], emissive[1], emissive[2]),
686686
emissive_texture,
687687
unlit: material.unlit(),
688688
alpha_mode: alpha_mode(material),

0 commit comments

Comments
 (0)