Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

glTF scene loader uses wrong color space #6827

Closed
BigWingBeat opened this issue Dec 2, 2022 · 0 comments
Closed

glTF scene loader uses wrong color space #6827

BigWingBeat opened this issue Dec 2, 2022 · 0 comments
Labels
A-Assets Load files from disk to use for things like images, models, and sounds A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior

Comments

@BigWingBeat
Copy link
Contributor

Bevy version

0.9.1

What you did

Loaded a glTF scene

use bevy::prelude::*;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_startup_system(load_scene)
        .run()
}

fn load_scene(mut commands: Commands, assets: Res<AssetServer>) {
    commands.spawn(SceneBundle {
        scene: assets.load("repro.gltf#Scene0"),
        ..Default::default()
    });
}

What went wrong

The colors of all of the models were different than they were in Blender:

Blender:
cyan-blender
Bevy:
cyan-bevy
Blender:
grey-blender
Bevy:
grey-bevy
Blender:
lime-blender
Bevy:
lime-bevy

Additional information

Bevy's glTF loader interprets colors in the sRGB color space, which is incorrect - glTF mandates that colors be specified in linear color space.

Initially I assumed that Bevy was correct and Blender was at fault, but this was disproved shortly after I reported it as a bug in Blender.

@BigWingBeat BigWingBeat added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Dec 2, 2022
@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen A-Assets Load files from disk to use for things like images, models, and sounds and removed S-Needs-Triage This issue needs to be labelled labels Dec 2, 2022
@bors bors bot closed this as completed in 8945122 Dec 4, 2022
ickshonpe pushed a commit to ickshonpe/bevy that referenced this issue Dec 6, 2022
# 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
alradish pushed a commit to alradish/bevy that referenced this issue Jan 22, 2023
# 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
ItsDoot pushed a commit to ItsDoot/bevy that referenced this issue Feb 1, 2023
# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Assets Load files from disk to use for things like images, models, and sounds A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants