Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Configuring the MapRenderer

Brian Kircher edited this page Aug 30, 2019 · 33 revisions

Credentials

A valid Bing Maps Key is required for the MapRenderer to stream and render data.

See Getting started for information on how to signup for a key.

MapRenderer-APISettings

Once a valid key has been provided, the map will render in the editor as well, unless the Show Map Data in Editor option has been disabled.

Location and zoom level

The view of the map can be configured in the Location foldout.

MapRenderer-Location

The Center is the geolocation where the map is currently focused, represented as a latitude and longitude in degrees.

The ZoomLevel is the area of the map that is visible. Lower zoom levels correspond to zooming out, higher zoom levels correspond to zooming in.

The map uses a web Mercator projection.

Map dimensions

The size of the map in Unity's world space can be configured in the layout section.

MapRenderer-Layout

These sizes are specified in local space. For convenience, the sizes scaled to Unity's world space are displayed in the editor as well.

Map dimensions = 1x1, height = 0.4 Map dimensions = 1x3, height = 0.1

A note on performance

Larger map dimensions will require more data to be downloaded and rendered. This will affect the overall performance of the app. It is recommended to stay with the default settings or smaller, or only increase the map dimensions on devices that are capable. Regardless, the map dimensions are clamped to a maximum size.

Render settings

The visuals of the map can be configured in the render settings.

MapRenderer-Render

Like a MeshRenderer, the MapRenderer can be configured to cast and/or receive shadows.

The side of the map, referred to as the clipping volume wall, will be visible by default. If this visual is not necessary for your scenario, it can be disabled to prevent the additional rendering overhead.

The color of the map edge can also be customized in the render settings.

Shadows and clipping volume wall enabled Shadows and clipping volume wall disabled.

Custom materials and shaders

It is possible to replace the material used for either the terrain or the clipping volume wall.

When doing this, it is recommended to make a copy of the base shaders, which are imported as part of the NuGet package under lib\unity\map\Resources. Use the copies made of these shaders as the starting point for new materials.

For reference, shaders are checked into the repro here.

Importantly, the ENABLE_ELEVATION_TEXTURE keyword used by the shaders will need to be maintained. Certain draw calls for the terrain require an elevation texture while others do not.

Copyrights

In order to properly attribute the map data providers, applications are required to display the copyright text specified by the MapRenderer. This copyright text may change based on the current view of the map.

By default, the MapRenderer will display the copyright text automatically.



The color and font used for the default copyright display can be customized.

MapRenderer-CopyrightOptions

If the default placement of the copyright text displayed by the MapRenderer is unacceptable, it can be disabled and the text can be displayed manually by retrieving the copyright text string from the MapRenderer’s Copyright property and rendering it with a TextMesh or TextMeshPro component. The copyright text must be displayed in a conspicuous manner, near in proximity to the map.


Clone this wiki locally