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

Wrong background color with the same ClearColor on some machines #5809

Open
benfrankel opened this issue Aug 27, 2022 · 7 comments
Open

Wrong background color with the same ClearColor on some machines #5809

benfrankel opened this issue Aug 27, 2022 · 7 comments
Labels
A-Rendering Drawing game state to the screen A-Windowing Platform-agnostic interface layer to run your app in C-Bug An unexpected or incorrect behavior S-Needs-Investigation This issue requires detective work to figure out what's going wrong

Comments

@benfrankel
Copy link
Contributor

benfrankel commented Aug 27, 2022

Bevy version

0.8.1

Relevant system information

AdapterInfo { name: "Intel(R) UHD Graphics 610 (WHL GT1)", vendor: 32902, device: 16033, device_type: IntegratedGpu, backend: Vulkan }

What you did

App::new()
    .insert_resource(ClearColor(Color::rgb(0.5, 0.5, 0.5)))
    .add_plugins(DefaultPlugins)
    .run();

What went wrong

  • Expected #7f7f7f as the background color.
  • Saw #373737 as the background color.

Additional information

Notably, 0x37 == 55 == (0.5.powf(2.2) * 255).round(), so this issue might have something to do with gamma conversion.

On my other machine I see the correct background color #7f7f7f. Other machine's GPU:

AdapterInfo { name: "AMD RADV POLARIS10", vendor: 4098, device: 26591, device_type: DiscreteGpu, backend: Vulkan }

EDIT: Also notable that sprite colors manifest correctly on both machines. It's just the background color that's wrong.

@benfrankel benfrankel added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Aug 27, 2022
@Weibye Weibye added A-Rendering Drawing game state to the screen A-Windowing Platform-agnostic interface layer to run your app in S-Needs-Investigation This issue requires detective work to figure out what's going wrong and removed S-Needs-Triage This issue needs to be labelled labels Aug 27, 2022
@superdump
Copy link
Contributor

What operating system, and if Linux what display server, and what driver?

@benfrankel
Copy link
Contributor Author

benfrankel commented Sep 8, 2022

OS: Linux
Display server: X11
Driver: Intel's Vulkan mesa driver 22.1.3-1 (from here https://archlinux.org/packages/extra/x86_64/vulkan-intel/)

@tim-blackbird
Copy link
Contributor

That game has a lighting system, so it's the lack of a campfire causing the issue :)
As you can see, the entire scene is dark, including the trees.

@kristianmandrup
Copy link

I see. Thought as much. Worked fine in another game I'm just playing around trying to get to grips with Bevy. Thanks.

@spiderman-idog
Copy link

spiderman-idog commented Dec 4, 2022

Having the exact same issue here, only the background color is wrong. I'm also using Linux, using an Intel graphics card with a Mesa driver. I have a dedicated NVIDIA graphics card (I have a gaming laptop) on the same machine and it doesn't have the issue

Luckily, I've found a workaround: putting INTEL_DEBUG=nofc (taken from here, according to this, it turns off something called 'fast-clear') before the run command solves the issue for me.

This really seems to be sRGB conversion problem, converting the correct color to linear RGB (used this site to convert) gets it back to the wrong color that I was experiencing.

Seems to be related to gfx-rs/wgpu#1627, they seem to also have a couple of other similar issues.

@benfrankel could you try the workaround and say if it worked?

@rdbo
Copy link
Contributor

rdbo commented Feb 20, 2023

Having the exact same issue here, only the background color is wrong. I'm also using Linux, using an Intel graphics card with a Mesa driver. I have a dedicated NVIDIA graphics card (I have a gaming laptop) on the same machine and it doesn't have the issue

Luckily, I've found a workaround: putting INTEL_DEBUG=nofc (taken from here, according to this, it turns off something called 'fast-clear') before the run command solves the issue for me.

This really seems to be sRGB conversion problem, converting the correct color to linear RGB (used this site to convert) gets it back to the wrong color that I was experiencing.

Seems to be related to gfx-rs/wgpu#1627, they seem to also have a couple of other similar issues.

@benfrankel could you try the workaround and say if it worked?

I have the same issue on my machine (also Intel iGPU with Mesa driver, running X11 on Alpine Linux, bevy v0.9.1)
The INTEL_DEBUG=nofc workaround did fix it for me.

@rdbo
Copy link
Contributor

rdbo commented Feb 21, 2023

I found out that enabling the Msaa resource with samples: 1 also fixes this bug on Bevy 0.9.1:

App::new()
// ...
    .insert_resource(ClearColor(Color::rgb(0.1, 0.1, 0.1)))
    .insert_resource(Msaa { samples: 1 } )
// ...

Without MSAA and without INTEL_DEBUG=nofc (completely black background, aliased image edges):

bevy-no-msaa

With MSAA and without INTEL_DEBUG=nofc (background is the right color, image no longer aliased):

bevy-msaa

Without MSAA and with INTEL_DEBUG=nofc (same as with MSAA):

bevy-intel-nofc

I'm not sure what to make off of this information, but could help going towards the right direction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen A-Windowing Platform-agnostic interface layer to run your app in C-Bug An unexpected or incorrect behavior S-Needs-Investigation This issue requires detective work to figure out what's going wrong
Projects
None yet
Development

No branches or pull requests

7 participants