-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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 label clipping by switching to layer-by-layer rendering #1727
Conversation
a9d5c45
to
d3deffb
Compare
There's still a chunk of work to be done here but rendering is already so much smoother than |
Oh wow, wtf. |
😮 |
When I did a similar thing for the earcut branch, it was much easier to manually look through the old PR bit by bit and enter the changes manually on a fresh master-based branch. Rebasing is hell on very outdated branches, and even if you end up making it work, there's still a lot of broken stuff usually. |
55c6178
to
1eb900c
Compare
It looks like symbol render order (namely, overlapping symbols within the same layer) is going different with layer-by-layer rendering. This might be acceptable for our users but is not acceptable for |
Symbols should be z-ordered by y coordinate. AFAIK, both gl-js and native (which already uses layer-by-layer rendering) agree on this currently; if this PR changes the ordering in gl-js, it's probably a bug. |
2529bac
to
4106989
Compare
db9f830
to
b8f057b
Compare
UPDATE: nope 👎 |
b0446ce
to
7e467ea
Compare
Interesting clue on the disappearing fills: rendering all fills during the "translucent" pass fixes almost all of the fill test cases. |
I think I'm onto something -- not rendering |
While I still can't reproduce the exact rendering errors that I'm seeing in headless-gl, I have stumbled across a test case that produces seemingly-related wrong behavior in the browser. These two styles render exactly the same, even though their layer order is reversed. {
"version": 8,
"sources": {
"mapbox": {
"type": "vector",
"url": "mapbox://mapbox.mapbox-streets-v6"
}
},
"layers": [{
"id": "background",
"type": "background",
"paint": {
"background-color": "red"
}
},
{
"id": "water",
"type": "fill",
"source": "mapbox",
"source-layer": "water",
"paint": {
"fill-color": "blue",
"fill-antialias": false
}
}]
} {
"version": 8,
"sources": {
"mapbox": {
"type": "vector",
"url": "mapbox://mapbox.mapbox-streets-v6"
}
},
"layers": [{
"id": "water",
"type": "fill",
"source": "mapbox",
"source-layer": "water",
"paint": {
"fill-color": "blue",
"fill-antialias": false
}, {
"id": "background",
"type": "background",
"paint": {
"background-color": "red"
}
}]
} |
171a425
to
81f653b
Compare
only 25 failing test-suite tests ❗ |
Before optimization, FPS perf seems pretty good
|
8b1c671
to
d2f8e39
Compare
9ff71c8
to
7715e51
Compare
This is ready for some serious 👀 @mourner @jfirebaugh @ansis @tmcw @kkaefer. |
If you want to follow the full commit history, it begins at #1197 |
@@ -81,7 +81,7 @@ function Bucket(options) { | |||
* @private | |||
*/ | |||
Bucket.prototype.addFeatures = function() { | |||
for (var i = 0; i < this.features.length; i++) { | |||
for (var i = this.features.length - 1; i >= 0; i--) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the iteration order reversed here (and in LineBucket
)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we are using the gl.ONE_MINUS_DST_ALPHA
blending function, features are effectively rendered in reverse order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. Native does not work this way. It iterates forward.
If this is affecting rendering there must be some other difference between native and JS that is reversed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will spend some more time trying to understand this, I don't have an immediate explanation. This is what I had to do to make test-suite pass 😬
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This reversal might lead to some rendering bugs. While rendering order is reversed during translucent passes, it is in the expected order during opaque passes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reverse iteration here makes the rendered order of features more similar to the previous rendered order, but that previous order was arbitrary. I think it should be safe to remove this and update the render tests.
The reversal made rendering more similar to previous rendering but the previous order was completely arbitrary.
squashed, rebased and merged in #1886 |
cc @mourner @jfirebaugh @ansis @kkaefer
fixes #757
Remaining Tasks