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

Sky and ground need distinct background colors #2190

Closed

Description

@1ec5

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

Activity

  1. incanus commented on Aug 27, 2015

    @incanus
    Contributor

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

  2. 1ec5 commented on Aug 27, 2015

    @1ec5
    ContributorAuthor

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

  3. incanus commented on Aug 27, 2015

    @incanus
    Contributor

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

  4. ljbade commented on Aug 28, 2015

    @ljbade
    Contributor

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

  5. added
    MapKit parity
    on Aug 22, 2016
  6. self-assigned this
    on Nov 4, 2016
  7. 1ec5 commented on Nov 4, 2016

    @1ec5
    ContributorAuthor

    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.

  8. 1ec5 commented on Nov 4, 2016

    @1ec5
    ContributorAuthor

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

    #6908

  9. 1ec5 commented on Nov 4, 2016

    @1ec5
    ContributorAuthor

    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.

  10. added
    Core
    on May 30, 2017
  11. mdakram commented on Aug 3, 2017

    @mdakram

    Any update on this?

  12. ansis commented on Sep 11, 2017

    @ansis
    Contributor

    @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).

  13. added
    archived
    on Nov 4, 2018
  14. stale commented on Dec 2, 2018

    @stale

    This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

  15. removed
    archived
    on Dec 12, 2019
  16. astojilj commented on Dec 12, 2019

    @astojilj
    Contributor
  17. added
    archived
    on Jun 9, 2020
  18. stale commented on Jun 9, 2020

    @stale

    This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

  19. Higuy8000 commented on May 11, 2021

    @Higuy8000

    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 join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CoreMapKit parityarchivedfeaturerendering

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions