-
Notifications
You must be signed in to change notification settings - Fork 10
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
Outline rendering glitches in wasm #19
Comments
The effect you're seeing is Z-fighting between the outline and the stencil. Since the fix for gfx-rs/naga#14, bevy_mod_outline uses a depth offset to separate the outline and stencil. For some reason, the required separation is much larger in WebGL than the native back-ends. I'm still investigating. |
The issue is, due to gfx-rs/wgpu#4553, the floating point error in the depth values is much bigger with the WebGL backend than non-OpenGL backends, requiring a much bigger depth bias. I've added a GL-specific workaround to bevy_mod_outline which avoids the increased floating point error at the cost of some performance. Released in 0.4.2. |
Wow I had a feeling the fix was tricky but didn't think it would require this depth of digging. |
Hi there! Unfortunately it seems like this issue has cropped up again (or maybe my particular hardware setup is just immune to the previous fix). I forked this locally and was able to fix the issue by increasing the offset to a cartoonishly large amount, which doesn't seem to have introduced any negative side effects. (I can email you before & after screenshots if that would be helpful.) This is the change I made: bevy_mod_outline/src/outline.wgsl Line 111 in 3740766
out.normalized_depth = 10.0 + 0.5 * (out_z / clip_pos.w); Would be happy to open a PR if you'd like to incorporate it, but no hard feelings if you'd prefer to try a more robust solution or wait for an upstream fix from wgpu. |
@dannymcgee I've opened a new issue, #26, for what I believe is the same issue you're experiencing. Please let me know if the screenshot on that issue resembles what you're seeing. |
Sorry I missed your update last week @komadori. Yes, that is exactly what I was seeing — thanks for the quick response! |
Hi and thanks for the great crate!
We are using the crate for our application, we insert a
Flat
SetOutlineDepth
component and show the outline when the mouse is hovering.While this looks great on a desktop (Linux, AMD64, integrated GPU with Vulkan) build:
desktop_view.webm
It looks very odd on wasm:
wasm_view.webm
The code is exactly the same, do you have any idea what might be happening?
The text was updated successfully, but these errors were encountered: