Skip to content

Commit

Permalink
Intepret glTF colors as linear instead of sRGB (bevyengine#6828)
Browse files Browse the repository at this point in the history
# Objective

Fixes bevyengine#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
  • Loading branch information
BigWingBeat authored and ickshonpe committed Dec 6, 2022
1 parent 208b004 commit 8318ab4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/bevy_gltf/src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ fn load_material(material: &Material, load_context: &mut LoadContext) -> Handle<
load_context.set_labeled_asset(
&material_label,
LoadedAsset::new(StandardMaterial {
base_color: Color::rgba(color[0], color[1], color[2], color[3]),
base_color: Color::rgba_linear(color[0], color[1], color[2], color[3]),
base_color_texture,
perceptual_roughness: pbr.roughness_factor(),
metallic: pbr.metallic_factor(),
Expand All @@ -682,7 +682,7 @@ fn load_material(material: &Material, load_context: &mut LoadContext) -> Handle<
Some(Face::Back)
},
occlusion_texture,
emissive: Color::rgba(emissive[0], emissive[1], emissive[2], 1.0),
emissive: Color::rgb_linear(emissive[0], emissive[1], emissive[2]),
emissive_texture,
unlit: material.unlit(),
alpha_mode: alpha_mode(material),
Expand Down

0 comments on commit 8318ab4

Please sign in to comment.