-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
MSAA Changes colors and adds borders around sprites #419
Comments
Hmm, I can't reproduce this under Windows 10 x64 with a AMD R9 390. Could you test this https://github.com/gfx-rs/wgpu-rs/tree/master/examples/msaa-line? Change the MSAA level with the left and right arrow key and see if the problem is also present there. |
@julhe No, it doesn't happen there |
Another test on Win10 with an GTX 1060: It getting blurrier doesn't make too much sense imo as the sprite itself should be directly on a pixel edge (and isn't Msaa meant to make things crisp?) Another weird thing is the background. It is set to Am I understanding this correctly? |
As @StarArawn mentioned on discord, the weird multisampling behavior might be related to: gfx-rs/wgpu#725. I think we should treat this issue as scoped to that problem. A little bit of blurriness is to be expected with MSAA. It makes jagged edges crisper by taking multiple samples and blending them together (which is the literal definition of a blur operation). This makes jagged edges crisper, but it can make already straight lines a little bit blurry. I do think we have another issue though. I also get the same "incorrect color" results on my computer (linux, proprietary nvidia drivers). I'm pretty sure the incorrect "base" colors are related to bevy rendering with the srgb color space. I have a feeling we aren't doing a proper conversion here. The math certainly lines up with improper color handling. Desired linear color value: 0.5 So by using an SRGB->Linear conversion before rendering, we get the expected output. I'm pretty sure we're locked into an SRGB swap chain, so we might need to do these conversions internally. |
As a followup, loaded images do use the correct colors (and also use the SRGB image type), so I think the fix to the "base color" problem is it convert the |
@cart I understand that some things might get a bit more blurry, but it also adds a discolored edge to sprites which it imo should not do |
@TheNeikos hmm yeah thats not desirable. I'm honestly uncertain if thats a bevy issue, a wgpu issue, or a general MSAA issue. |
Fully agree that this is just gfx-rs/wgpu#725. It manifests exactly as the photos show; borked srgb conversion of the background plus bad MSAA. It's been a long-standing issue with intel (at least on linux), and just needs to be worked around at some layer. |
gfx-rs/wgpu#725 is apparently fixed since wgpu 0.11. Anyone affected still able to reproduce with bevy main? |
I think its probably safe to close this for now and then re-open if this resurfaces. |
When setting a
Msaa
level above 1 sample the color changes:Msaa 1:
Msaa 2:
Msaa 4:
Code:
My platform is Linux with an NVIDIA Corporation GP107GLM [Quadro P620] GPU
The text was updated successfully, but these errors were encountered: