-
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
Full screen symbol flicker on pitched map with text-translate #6363
Comments
I put in a fix for behavior very similar to this in #6060 (I just saw the behavior as I was testing, this is different from #6041 which was the main object of that PR): mapbox-gl-js/src/shaders/collision_circle.vertex.glsl Lines 20 to 23 in e0da3b3
In that case, what was happening was that for a long vertically-oriented label, the perspective ratio was calculated based on the anchor, but the actual circle was well above the anchor. So when the anchor was way below the screen, the circle would get a giant perspective ratio, and since it was closer to the viewport it was able to actually expand to fill the viewport. In this case, I think what's happening is that the translation is getting exaggerated for anchor points that are well below the bottom of the viewport, because mapbox-gl-js/src/render/draw_symbol.js Lines 112 to 117 in e0da3b3
I just looked back to my discussion with @ansis about this in January, and found this prophetic quote:
I think the best fix may be just to clamp the perspective ratio every time we generate it in a shader. It's a weird kind of late-stage fix, but it has the advantage of being easy to reason about. |
This fixes issue #6363, but also guards against a class of bugs: We previously relied on the assumption that the perspective ratio was calculated with the same anchor point as the item we were drawing. If that assumption was violated, it was possible for overzoomed items far outside of the viewport to grow larger faster than they moved away from the viewport. They could eventually grow large enough to cover the viewport entirely, causing brief "flashes" during map animations. This commit does _not_ clamp the perspective ratios on the CPU side, to avoid extra work in the inner loop of very performance sensitive collision/projection code. On the collision side, anything far outside of the viewport should be collided/ignored anyway, and on the projection side, we have a filter requiring that the anchor of the label be within the viewport before the projection logic begins.
This fixes issue #6363, but also guards against a class of bugs: We previously relied on the assumption that the perspective ratio was calculated with the same anchor point as the item we were drawing. If that assumption was violated, it was possible for overzoomed items far outside of the viewport to grow larger faster than they moved away from the viewport. They could eventually grow large enough to cover the viewport entirely, causing brief "flashes" during map animations. This commit does _not_ clamp the perspective ratios on the CPU side, to avoid extra work in the inner loop of very performance sensitive collision/projection code. On the collision side, anything far outside of the viewport should be collided/ignored anyway, and on the projection side, we have a filter requiring that the anchor of the label be within the viewport before the projection logic begins.
Fixed in #11487. |
http://jsbin.com/hinivotoqi/edit?html,output
Rotate / pan / zoom enough (mostly rotating), and you should see full-screen flashes the same color as the text. The presence of the
text-translate
property seems to be key -- without it, I haven't been able to reproduce any flickering.cc @malwoodsantoro @ChrisLoer
The text was updated successfully, but these errors were encountered: