11.2. 3D Map View

3D visualization support is offered through the 3D map view. You can create, manage and open 3D map views via View ► 3D Map Views ► menu:

  1. By clicking on new3DMap New 3D Map View you can create a new 3D map view. A floating and dockable QGIS panel will appear (see The 3D Map View dialog). It has the same extent and view as the 2D main map canvas and provides a set of navigation tools to turn the view into 3D.

  2. By clicking on Manage 3D Map Views you get in the 3D Map Views Manager. Here you get the ability to open, duplicate, remove and rename 3D map views.

  3. If you created one or more 3D map views, you see them listed in 3D Map Views. You can turn them on and off by clicking on. They will be saved by saving the project, even if they are turned off.

../../../_images/3dmapview.png

Fig. 11.23 The 3D Map View dialog

The following tools are provided at the top of the 3D map view panel:

  • pan Camera Control: moves the view, keeping the same angle and direction of the camera

  • zoomFullExtent Zoom Full: resizes the view to the whole layers’ extent, or the reference extent if set

  • 3dNavigation Toggle On-Screen Notification: shows/hides the navigation widget (that is meant to ease controlling of the map view)

  • identify Identify: returns information on the clicked point of the terrain or the clicked 3D feature(s) – More details at Identifying Features

  • measure Measurement Line: measures the horizontal distance between points

  • play Animations: shows/hides the animation player widget

  • sharingExport Export menu allows to export the scene to various formats:

    • saveMapAsImage Save as Image…: exports the current view to an image file format

    • 3d Export 3D Scene: exports the current view as a 3D scene (.obj file), allowing post-processing in applications like Blender… The terrain and vector features are exported as 3D objects. The export settings, overriding the layers properties or map view configuration, include:

      • Scene name and destination Folder

      • Terrain resolution

      • Terrain texture resolution

      • Model scale

      • checkbox Smooth edges

      • checkbox Export normals

      • checkbox Export textures

  • showPresets Set View Theme: Allows you to select the set of layers to display in the map view from predefined map themes.

  • The camera Camera menu helps you control relation between the 2D and 3D views:

    • Synchronize the views (2D map view follows 3D camera and/or 3D camera follows 2D Map view)

    • Show visible camera area in 2D map view

    • Set 3D scene on 2D map view: allows to clip the 3D scene and display only the terrain and features intersecting an extent drawn on the 2D map canvas. More options are available in the General configuration tab.

  • shadow Effects adds visual effects to the 3D rendering, such as showing shadows, eye dome lighting or ambient occlusion.

  • The options Options button opens the dialog to configure the 3D map view settings.

  • dock Dock 3D Map View: switch from docked widget to top level window

11.2.1. Scene Configuration

The 3D map view opens with some default settings you can customize. To do so, expand the options Options menu at the top of the 3D canvas panel and press the options Configure button to open the 3D configuration window.

In the 3D Configuration window there are various options to fine-tune the 3D scene:

11.2.1.1. General

../../../_images/3dmapconfiguration_general.png

Fig. 11.24 The 3D Map General Configuration dialog

Under the general General tab, you can:

  • Limit the 3D scene’s contents to a 2D map extent, using the spatial extent selector: terrain and features are clipped at the specified extent and only the parts falling within the extent are loaded in the scene. Elevation range of the terrain, mesh and pointcloud layers is also taken into account so that the camera is not positioned below the scene’s contents, particularly when using the terrain’s vertical scale setting to exaggerate the elevation differences.

    The set extent is also used as reference extent when pressing the zoomFullExtent Zoom full button in 3D map view.

  • Press checkbox Show in 2D map view to display in the main map canvas a rubberband corresponding to the current extent of the 3D scene.

11.2.1.2. Terrain

../../../_images/3dmapconfiguration_terrain.png

Fig. 11.25 The 3D Map Terrain Configuration dialog

  • Terrain: Before diving into the details, it is worth noting that the terrain in a 3D view is represented by a hierarchy of terrain tiles and as the camera moves closer to the terrain, existing tiles that do not have sufficient details are replaced by smaller tiles with more details. Each tile has mesh geometry derived from the elevation raster layer and texture from 2D map layers.

    • The elevation terrain Type can be:

    • Elevation: Raster or mesh layer to be used for generation of the terrain. The raster layer must contain a band that represents elevation. For a mesh layer, the Z values of the vertices are used.

    • Vertical scale: Scale factor for vertical axis. Increasing the scale will exaggerate the height of the landforms.

    • Tile resolution: How many samples from the terrain raster layer to use for each tile. A value of 16px means that the geometry of each tile will consist of 16x16 elevation samples. Higher numbers create more detailed terrain tiles at the expense of increased rendering complexity.

    • Skirt height: Sometimes it is possible to see small cracks between tiles of the terrain. Raising this value will add vertical walls (“skirts”) around terrain tiles to hide the cracks.

    • Offset: moves the terrain up or down, e.g. to adjust its elevation with respect to the ground level of other objects in the scene.

      This can be useful when there is a discrepancy between the height of the terrain and the height of layers in your scene (e.g. point clouds which use a relative vertical height only). In this case adjusting the terrain elevation manually to coincide with the elevation of objects in your scene can improve the navigation experience.

  • When a mesh layer is used as terrain, you can configure the Triangles settings (wireframe display, smooth triangles, level of detail) and the Rendering colors settings (as a uniform color or color ramp based). More details in the Mesh layer 3D properties section.

  • unchecked Terrain shading: Allows you to choose how the terrain should be rendered:

    • Shading disabled - terrain color is determined only from map texture

    • Shading enabled - terrain color is determined using Phong’s shading model, taking into account map texture, the terrain normal vector, scene light(s) and the terrain material’s Ambient and Specular colors and Shininess

11.2.1.3. Lights

From the Lights tab, press the symbologyAdd menu to add

  • up to eight Point lights: emits light in all directions, like a sphere of light filling an area. Objects closer to the light will be brighter, and objects further away will be darker. A point light has a set position (X, Y and Z), a Color, an Intensity and an Attenuation

  • up to four Directional lights: mimics the lighting that you would get from a giant flash light very far away from your objects, always centered and that never dies off (e.g. the sun). It emits parallel light rays in a single direction but the light reaches out into infinity. A directional light can be rotated given an Azimuth, have an Altitude, a Color and an Intensity.

../../../_images/3dmapconfiguration_lights.png

Fig. 11.26 The 3D Map Lights Configuration dialog

11.2.1.4. Effects

../../../_images/3dmapconfiguration_effects.png

Fig. 11.27 The 3D Map Effects Configuration dialog

  • Check unchecked Show shadows to display shadows within your scene, given:

    • a Directional light

    • a Shadow rendering maximum distance: to avoid rendering shadow of too distant objects, particularly when the camera looks up along the horizon

    • a Shadow bias: to avoid self-shadowing effects that could make some areas darker than others, due to differences between map sizes. The lower the better

    • a Shadow map resolution: to make shadows look sharper. It may result in less performance if the resolution parameter is too high.

  • unchecked Show Eye Dome Lighting (EDL): a post processing effect which enhances depth perception. Each pixel’s depth (distance off the camera) is compared to its neighboring pixels’ depth and gets highlighted according to that depth difference, making the edges stand out. Affects the whole scene and can be combined with Screen Space Ambient Occlusion. Following parameters can be controlled:

    • Lighting strength: increases the contrast, allowing for better depth perception

    • Lighting distance: represents the distance of the used pixels off the center pixel and has the effect of making edges thicker.

  • Add screen-space unchecked Ambient Occlusion (SSAO): a post processing effect which also enhances depth perception by applying a darker shading to areas which are less exposed to ambient lighting. Affects the whole scene and can be combined with Eye dome Lighting. Following parameters can be controlled:

    • Radius: how far we will reach to calculate ambient occlusion

    • Intensity: how strong the effect should be (higher values make things darker)

    • Occlusion threshold: how many neighboring points need to be occluded for the effect to appear (lower values than 50% will make the output darker, but possibly providing greater range of occlusion)

../../../_images/3dmap_edl_ssao.png

Fig. 11.28 Rendering Point clouds in 3D map using Eye Dome Lighting (EDL) and/or Screen-Space Ambient Occlusion (SSAO)

From top, left to right: No effect – SSAO only – EDL only – SSAO and EDL

11.2.1.5. Camera & Skybox

In this tab, you can control different parameters like camera, 3D axis, navigation synchronization and skybox.

../../../_images/3dmapconfiguration_camera.png

Fig. 11.29 The 3D Map Camera Configuration dialog

  • The Camera parameter group overrides some default camera settings made in the Settings ► Options ► 3D dialog.

  • Check unchecked Show 3D Axis to enable 3D axis tool. This parameter group allows to set the axis type and its position.

    • With the Coordinate Reference System type an orthogonal axis will be represented.

    • With the Cube type, a 3D cube will be represented. The cube faces can be used to change the camera view: for example, click on the north face to set the camera to see from the north.

Tip

Right-click the 3D axis to quickly set its position and type, and the camera view.

../../../_images/3dmapconfiguration_3daxis_menu.png

Fig. 11.30 The 3D Axis context menu

  • The Navigation Synchronization parameter group adds options to synchronize 2D view with 3D camera position or 3D camera position with 2D view or bi directional synchronization. The last option displays the extent visible from the 3D camera over the 2D map view.

  • Check unchecked Show skybox to enable skybox rendering in the scene. The skybox type can be:

    • Panoramic texture, with a single file providing sight on 360°

    • Distinct faces, with a texture file for each of the six sides of a box containing the scene

    Texture image files of the skybox can be files on the disk, remote URLs or embedded in the project (more details).

11.2.1.6. Advanced

../../../_images/3dmapconfiguration_advanced.png

Fig. 11.31 The 3D Map Advanced Configuration dialog

  • Map tile resolution: Width and height of the 2D map images used as textures for the terrain tiles. 256px means that each tile will be rendered into an image of 256x256 pixels. Higher numbers create more detailed terrain tiles at the expense of increased rendering complexity.

  • Max. screen error: Determines the threshold for swapping terrain tiles with more detailed ones (and vice versa) - i.e. how soon the 3D view will use higher quality tiles. Lower numbers mean more details in the scene at the expense of increased rendering complexity.

  • Max. ground error: The resolution of the terrain tiles at which dividing tiles into more detailed ones will stop (splitting them would not introduce any extra detail anyway). This value limits the depth of the hierarchy of tiles: lower values make the hierarchy deep, increasing rendering complexity.

  • Zoom levels: Shows the number of zoom levels (depends on the map tile resolution and max. ground error).

  • unchecked Show labels: Toggles map labels on/off

  • unchecked Show map tile info: Include border and tile numbers for the terrain tiles (useful for troubleshooting terrain issues)

  • unchecked Show bounding boxes: Show 3D bounding boxes of the terrain tiles (useful for troubleshooting terrain issues)

  • unchecked Show camera’s view center

  • unchecked Show camera’s rotation center

  • unchecked Show light sources: shows a sphere at light source origins, allowing easier repositioning and placement of light sources relative to the scene contents

  • unchecked Show frames per second (FPS)

  • unchecked Show debug overlay: visual overlay which displays some useful debugging and profiling information. This allows in particular to quickly see the frame graph and the scene graph.

  • unchecked Debug Shadow Map: renders the scene as a red-black image from the point of view of the light used for shadows (for troubleshooting). The widget is set with a proportional Size to the 3D map view’s, and docked in a Corner.

  • unchecked Debug Depth Map: renders the scene’s depth map as an image with nearer pixels being darker (for troubleshooting). The widget is set with a proportional Size to the 3D map view’s, and docked in a Corner.

11.2.3. Creating an animation

An animation is based on a set of keyframes - camera positions at particular times. To create an animation:

  1. Toggle on the play Animations tool, displaying the animation player widget

  2. Click the symbologyAdd Add keyframe button and enter a Keyframe time in seconds. The Keyframe combo box now displays the time set.

  3. Using the navigation tools, move the camera to the position to associate with the current keyframe time.

  4. Repeat the previous steps to add as many keyframes (with time and position) as necessary.

  5. Click the play button to preview the animation. QGIS will generate scenes using the camera positions/rotations at set times, and interpolating them in between these keyframes. Various Interpolation modes for animations are available (eg, linear, inQuad, outQuad, inCirc… – more details at https://doc.qt.io/qt-5/qeasingcurve.html#EasingFunction-typedef).

    The animation can also be previewed by moving the time slider. Keeping the Loop box checked will repeatedly run the animation while clicking play stops a running animation.

Click fileSave Export animation frames to generate a series of images representing the scene. Other than the filename Template and the Output directory, you can set the number of Frames per second, the Output width and Output height.

11.2.4. 3D vector layers

A vector layer with elevation values can be shown in the 3D map view by checking Enable 3D Renderer in the 3D View section of the vector layer properties. A number of options are available for controlling the rendering of the 3D vector layer.