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

Difference in rendering on windows, linux and macOS #5295

Open
lucasmerlin opened this issue Oct 22, 2024 · 3 comments
Open

Difference in rendering on windows, linux and macOS #5295

lucasmerlin opened this issue Oct 22, 2024 · 3 comments
Labels
bug Something is broken egui-wgpu visuals Renderings / graphics releated

Comments

@lucasmerlin
Copy link
Collaborator

It seems like there are some minor rendering differences between the different egui_wgpu backends. I don't think this is a general problem and I doubt that it's possible to avoid these differences, but I want to document the findings somewhere.
These differences currently cause the snapshots tests to fail on windows and linux, but we should be able to increase the dify threshold until the tests run through.
Visually the images are the same, I couldn't spot any difference when flipping back and forth between snapshots rendered by the different platforms.

Here is an example diff (the snapshot was rendered on MacOS and the diff on linux):

widget_gallery diff

It seems like the difference is mostly on outlines of text and shapes, maybe related to anti aliasing or feathering?

More diffs

Bezier demo (snapshot on macos and diff on linux)

image

Widget gallery diff (this time the diff was rendered on windows):

image

Widget gallery snapshot from windows:

image

Widget gallery snapshot from macOS:

widget_gallery new

Setting the threshold to 0.6 seems to fix all tests except for the bezier demo on linux which seems to need a threshold of 2.1.

Shoutout to @fluxxcode who helped me test this on the different platforms

@lucasmerlin lucasmerlin added bug Something is broken visuals Renderings / graphics releated egui-wgpu labels Oct 22, 2024
@Wumpf
Copy link
Collaborator

Wumpf commented Oct 23, 2024

For texture sampling in particular this is pretty much expected since different hardware (sometimes even different via driver or driver settings) texture filtering is implemented subtly different. This is mostly due to differences in how they're optimized - texture units typically don't filter in f32 but in their origin format.

Afaik it used to be also a problem with rasterization itself, but with DX11 came more strict rasterization rules, although iirc that can still be a problem with mobile hardware sometimes and when dealing with old GL drivers.

@Wumpf
Copy link
Collaborator

Wumpf commented Oct 23, 2024

Failed to find an article on the general rendering difference between gpu - you'd think someone looked into this deeper at some point 🤔. It's mostly a thing I experienced when working with other screenshot comparision tests, tons of things are always subtly different between the vendors, sometimes even drivers.

However, I dug up this great article from iq where he describes the difference between manual and hardware bilinear filtering (which in his particular usecase makes a huge difference) https://iquilezles.org/articles/hwinterpolation/

@Wumpf
Copy link
Collaborator

Wumpf commented Oct 23, 2024

Since egui/eframes's gpu rendering portion is intentionally very limited, texture filtering might be close to the only source of discrepancies. But I'd be surprised if a manual filter would get rid of differences entirely

emilk pushed a commit that referenced this issue Oct 23, 2024
* Related to #5295 
* [x] I have followed the instructions in the PR template
hacknus pushed a commit to hacknus/egui that referenced this issue Oct 30, 2024
* Related to emilk#5295 
* [x] I have followed the instructions in the PR template
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken egui-wgpu visuals Renderings / graphics releated
Projects
None yet
Development

No branches or pull requests

2 participants