Graphics rendering modes
In this topic
Graphics layers and overlays can be rendered in a map or scene view using one of two rendering modes: dynamic or static. The rendering mode most appropriate for your graphics depends on a few factors, and making the right choice can significantly improve performance and provide a better user experience.
RenderingMode property is exposed on both the
GraphicsOverlay classes. You can set this property to one of two values:
<layers:GraphicsLayer ID="VehicleTrackingGraphics" RenderingMode="Dynamic"/> <layers:GraphicsLayer ID="CustomerLocationGraphics" RenderingMode="Static"/>
Dynamic rendering leverages the graphics processing unit (GPU) to render graphics. The amount of graphics processing that can be handled is directly tied to the processing power and memory available for the GPU. Dynamic rendering is well suited for animation and ensures that graphics are updated while navigation operations are running. As the user pans or zooms, for example, the graphics will update their display immediately (without waiting for navigation to complete, in other words). Dynamic rendering provides a smoother display experience for the user but can cause decreased performance when working with a large number of graphics.
Static rendering relies on the system central processing unit (CPU) and system memory rather than on GPU resources. Graphics that are rendered in static mode are not immediately updated while the user pans or zooms the display. Instead, the graphics are updated only after navigation is complete. This allows you to display a large number of graphics without a performance penalty during navigation but produces a less polished graphic display.
Static rendering of graphics can be CPU and memory intensive, which can impact device battery life.
Alignment properties related to graphic display are ignored when the rendering mode of a graphics layer or overlay is set to static. Symbols align with the map or scene view regardless of the value of
AngleAlignment. If the view rotates, for example, the symbols will follow the orientation of the view and not the screen regardless of the value of the
Rendering in 3D
Rendering in a scene (in three dimensions, in other words) has some unique challenges. Understanding how dynamic and static rendering affect three-dimensional graphic display can help you decide which mode is most appropriate for particular graphics in your scene. Dynamic rendering in three dimensions is especially resource-intensive and may degrade performance. Static rendering, on the other hand, has limitations that affect three-dimensional display.
Drawing graphics relative to the surface
For display in a scene, there are three options for how elevation (z-values) will be used to position a graphic. The following list describes the available values for a graphic layer or overlay
- Draped—The elevation (z-value) for a point, line, or polygon graphic is ignored. Graphics appear draped on the surface of the globe, like a sheet.
- Absolute—Elevation of each graphic is calculated from sea level, regardless of the terrain elevation at the x,y locations of the graphics.
- Relative—Elevation of each graphic is calculated relative to the terrain elevation at the x,y location. This simply adds the graphic's z-value to the elevation at the surface.
To display graphics using the
Draped elevation mode, you can use either dynamic or static rendering. Only dynamic rendering, however, supports
Relative mode. If graphics are rendered in static mode, they are always draped on the surface, regardless of the value assigned to the elevation mode property. The following image shows two graphics layers with the elevation mode set to absolute. Only the dynamic layer (red) supports this placement option and applies the z values for the graphics.
If graphics are updated frequently, either by moving their geographic position (x, y, z coordinates) or changing symbol properties (color, size, style, and so on), dynamic rendering is better suited to display them. For display in a scene, static rendering requires that graphics are created for every level of detail. If graphics are updated, therefore, the scene tiles will be recreated at all levels and may cause the display to flash as they are being generated.
When graphics are rendered in a scene in static mode, the size of the symbol is determined for each tile in the underlying base map. The size of graphic symbols (line width, for example) is determined based on the level of detail for each tile. Symbol size for the same graphic may vary, therefore, between tiles displayed in the scene. This may produce an inconsistent symbol across tile boundaries, as shown in the following image:
Choosing a rendering mode
It's important to remember that a rendering mode is applied to individual graphics layers and graphics overlays. In other words, you do not need to choose a single rendering mode for all graphics in your map or scene view. It's perfectly acceptable, for example, to have some layers in your view render in static mode while others in the same view render dynamically. This gives you the flexibility to define the right rendering mode for each set of graphics in your view, and to organize your graphics accordingly.
Based on the preceding descriptions of static and dynamic rendering modes, the following guidelines can be used to choose a rendering mode for a graphics layer or overlay. See the Performance considerations topic for more information about how rendering affects performance.
When to use dynamic rendering
Dynamic rendering provides the best graphic display at the expense of less efficient use of resources. You should choose dynamic graphic rendering in the following situations:
- Crisp display of graphics while navigating the map or scene is important. In static mode, graphic display is stretched as zooming occurs.
- Symbols must be consistent across tile boundaries when displayed in a scene.
- Graphics are frequently updated on the display (change position or symbol, for example).
- You need to display z-coordinate values (altitude, for example) for a set of graphics. When rendered in static mode, graphics are draped on the scene surface regardless of the value you provide for surface placement.
- Symbols, such as text or pictures, for a set of graphics must be aligned to the screen. If you need to rotate the map or scene view without rotating graphic symbols, you must use dynamic rendering mode.
- The performance of dynamic rendering of your graphics is acceptable. If you are not drawing a large number of graphics (or complicated geometry) and are confident that the target devices for your app will perform well, dynamic rendering mode provides a better experience for the user.
When to use static rendering
Static rendering provides the most efficient rendering of graphics at the expense of quality of display (especially crispness of symbols while navigation occurs). You should choose static rendering in the following situations:
- Performance is an issue. If you are drawing a large number of graphics in a layer or overlay (or complicated geometry) and are not confident that the target devices for your app will perform well when displaying your graphics, static rendering mode will draw using less resources.
- A somewhat rough display of graphics while navigating the map or scene is an acceptable trade off. Dynamic mode produces a much more polished display as zooming occurs, but it is not as efficient.
- The potential for inconsistent symbol size across tile boundaries in a scene is acceptable.
- Graphics are not updated frequently (do not change position or symbol, for example).
- You don't need to display z-coordinate values (altitude, for example) for a set of graphics in a scene. When rendered in static mode, graphics are draped on the scene surface regardless of the value you provide for surface placement.