You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Sky and ground need distinct background colors #2190
The perspective view being added in #2116 and #2159 will constrain the pitch to 90° (at least at the mbgl level). MGLMapView currently constrains it further to 60° to avoid showing the horizon, but we’d like to use a limit that varies by zoom level (altitude) for consistency with MapKit. At the lowest altitude, about 7 stories up, MapKit shows an idyllic blue sky:
By contrast, Mapbox GL uses the background color, which for most maps will be similar to the ground color. It should be possible to style a second background color that represents the “room in which the map is floating”, so to speak.
A common workaround seen in navigation applications is to fake the presence of a sky by overlaying a view with a linear gradient from opaque blue at the top to clear at the bottom. However, the effect is artificial at best, because it violates the user’s sense of horizon.
Another workaround, more common in games, is to simulate poor visibility with a fog effect. It’s basically the same as the previous workaround, except using opaque gray and a steeper gradient. Neither of these workarounds will work once we have 3D extrusion (#6745), because the extruded geometries will be truncated at the simulated horizon.
As @incanus indicated in #2190 (comment), it may be possible to make MGLMapView’s layer non-opaque, taking advantage of #3096, then place a view with the desired background color behind the MGLMapView. However, this would have to happen on a per-application basis, because styles themselves can have transparent backgrounds for other reasons.
it may be possible to make MGLMapView’s layer non-opaque, taking advantage of #3096, then place a view with the desired background color behind the MGLMapView
No, that won’t work, because – as I originally described above – the sky and ground are rendered using the same background style layer. If you make the background style layer transparent and slide a blue view beneath the map view, the ground becomes blue too.
@mdakram nope, we haven't fixed the things blocking us from allowing the map to be pitched far enough to have the sky show (level-of-detail loading, antialiasing issues, etc).
Activity
incanus commentedon Aug 27, 2015
Do you see this happening at the platform level @1ec5? Like, could this just be a subview of the
MGLMapViewbehind theGLKView?1ec5 commentedon Aug 27, 2015
The GLKView draws inside its entire bounds, doesn’t it?
incanus commentedon Aug 27, 2015
Yes, but we might be able to make part of it transparent? Not sure.
ljbade commentedon Aug 28, 2015
Shouldn't this be styleable, e.g. night vs daytime maps
1ec5 commentedon Nov 4, 2016
A common workaround seen in navigation applications is to fake the presence of a sky by overlaying a view with a linear gradient from opaque blue at the top to clear at the bottom. However, the effect is artificial at best, because it violates the user’s sense of horizon.
Another workaround, more common in games, is to simulate poor visibility with a fog effect. It’s basically the same as the previous workaround, except using opaque gray and a steeper gradient. Neither of these workarounds will work once we have 3D extrusion (#6745), because the extruded geometries will be truncated at the simulated horizon.
As @incanus indicated in #2190 (comment), it may be possible to make MGLMapView’s layer non-opaque, taking advantage of #3096, then place a view with the desired background color behind the MGLMapView. However, this would have to happen on a per-application basis, because styles themselves can have transparent backgrounds for other reasons.
1ec5 commentedon Nov 4, 2016
#6908
1ec5 commentedon Nov 4, 2016
No, that won’t work, because – as I originally described above – the sky and ground are rendered using the same background style layer. If you make the background style layer transparent and slide a blue view beneath the map view, the ground becomes blue too.
mdakram commentedon Aug 3, 2017
Any update on this?
ansis commentedon Sep 11, 2017
@mdakram nope, we haven't fixed the things blocking us from allowing the map to be pitched far enough to have the sky show (level-of-detail loading, antialiasing issues, etc).
stale commentedon Dec 2, 2018
This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.
astojilj commentedon Dec 12, 2019
Dependent on mapbox/mapbox-gl-js#8975.
stale commentedon Jun 9, 2020
This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.
Higuy8000 commentedon May 11, 2021
Is this still an issue?
I tried adding a sky layer, which seems like the general type of thing for this, but I get the following error:
map_->addLayer({ {"id", "sky"}, {"type", "sky"} }, "background);but it returns the error
Unable to add layer: Unsupported layer type! Null factory for type: skyI can set a background color just fine before my raster map tiles, but this does not affect the area of the screen "off the map".
Using with Qt 5.15. I just want to set the color of the background past the map when you pitch up/see past the horizon.