Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Sky and ground need distinct background colors #2190

Closed
1ec5 opened this issue Aug 27, 2015 · 13 comments
Closed

Sky and ground need distinct background colors #2190

1ec5 opened this issue Aug 27, 2015 · 13 comments
Labels
archived Archived because of inactivity Core The cross-platform C++ core, aka mbgl feature MapKit parity For feature parity with MapKit on iOS or macOS rendering

Comments

@1ec5
Copy link
Contributor

1ec5 commented Aug 27, 2015

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:

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.

/ref #119, #1210
/cc @ansis @incanus

@1ec5 1ec5 added the feature label Aug 27, 2015
@incanus
Copy link
Contributor

incanus commented Aug 27, 2015

Do you see this happening at the platform level @1ec5? Like, could this just be a subview of the MGLMapView behind the GLKView?

@1ec5
Copy link
Contributor Author

1ec5 commented Aug 27, 2015

The GLKView draws inside its entire bounds, doesn’t it?

@incanus
Copy link
Contributor

incanus commented Aug 27, 2015

Yes, but we might be able to make part of it transparent? Not sure.

@ljbade
Copy link
Contributor

ljbade commented Aug 28, 2015

Shouldn't this be styleable, e.g. night vs daytime maps

@1ec5 1ec5 added the MapKit parity For feature parity with MapKit on iOS or macOS label Aug 22, 2016
@pveugen pveugen self-assigned this Nov 4, 2016
@1ec5
Copy link
Contributor Author

1ec5 commented 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
Copy link
Contributor Author

1ec5 commented Nov 4, 2016

we’d like to use a limit that varies by zoom level (altitude) for consistency with MapKit

#6908

@1ec5
Copy link
Contributor Author

1ec5 commented Nov 4, 2016

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
Copy link

mdakram commented Aug 3, 2017

Any update on this?

@ansis
Copy link
Contributor

ansis commented 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 stale bot added the archived Archived because of inactivity label Nov 4, 2018
@stale
Copy link

stale bot commented 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.

@stale stale bot closed this as completed Dec 2, 2018
@astojilj astojilj reopened this Dec 12, 2019
@stale stale bot removed the archived Archived because of inactivity label Dec 12, 2019
@astojilj
Copy link
Contributor

Dependent on mapbox/mapbox-gl-js#8975.

@stale stale bot added the archived Archived because of inactivity label Jun 9, 2020
@stale
Copy link

stale bot commented 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.

@stale stale bot closed this as completed Jun 9, 2020
@Higuy8000
Copy link

Higuy8000 commented 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: sky

I 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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived Archived because of inactivity Core The cross-platform C++ core, aka mbgl feature MapKit parity For feature parity with MapKit on iOS or macOS rendering
Projects
None yet
Development

No branches or pull requests

9 participants