-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Fix z-fighting on overlapping fills within the same layer #3320
Comments
This looks like the GL JS equivalent of mapbox/mapbox-gl-native#6604. |
Yes, also happening for me in 0.26.0 with Chrome 54.0.2840.71.They are jagged during moves and also while static. |
I'm experiencing the same when the map is tilted: The map is here: test map. The water polygons are based on the standard layers. |
Any news here? Everything looks great until you pitch the map. I hope feature rendering order won't become random when this gets fixed. |
For some reason, translucent fill layers are currently drawn with the depth mask enabled (i.e. writing to the depth buffer during the translucent phase), which is inconsistent with every other layer type. If that's merely an accident, then we can disable the depth mask and fix this issue for translucent fill layers. I don't see any render test failures when doing so (well, there's one, but it's incidental and we'd fix it by just updating the fixture). This wouldn't fully fix the problem -- opaque fill layers with a color that varies via a data-driven property, like in #3702, would still z-fight. |
@jfirebaugh Thanks for diving in this issue! I guess in most cases color is data-driven because there is "visually no" z-fighting when color of overlapping features is the same. |
It would be more difficult to fix this for data-driven color. The solution would have to involve one of the general techniques for solving z-fighting like adjusting the depth buffer precision (I think we already use the max though), adjusting the near/far clipping planes, using logarithmic depth buffering, or actually perturbing the z-coordinates of co-planar fill triangles in a way that doesn't affect the visual result other than fixing the fighting. Those would all be medium to large sized research projects. |
It turns out that the fix in #5206 will resolve this issue for all kinds of fill layers. 🎉 |
Really great news!
And
in Chrome. The former is quite a strange one but the latter seems to be related. |
mapbox-gl-js version: 0.25.1
Steps to Trigger Behavior
Expected Behavior
The fill layers should stay smooth
Actual Behavior
The fill layers flicker as the pitch changes and looks jagged when it's not moving. This happens in at least Chrome, Firefox and Safari
https://jsfiddle.net/tgecho/brhb9wng/

The text was updated successfully, but these errors were encountered: