QGIS 3D Animations

From Tuflow
Jump to navigation Jump to search

Introduction

This page outlines the process for creating a 3D animation using QGIS. QGIS version 3.34.1 has been used for this example.

Required Data

To create a 3D animation in QGIS, the following files are required as a minimum:

  • Digital Elevation Model (DEM) or TIN; and
  • 2D Model Results.

Note: Additional files may also be used to enhance the animation.

This example uses the DEM and 2D results from Tutorial Module 1. The complete model is available from Tutorial Introduction.

Method

Configure the QGIS Workspace

Configure the QGIS workspace and display the depth (d) datasets. The same process can be followed for other output datasets.

  1. Load the DEM.tif into the QGIS workspace.
  2. Open the TUFLOW Viewer from the TUFLOW plugin toolbar:

    Tuflow plugin tuflow viewer.png

  3. Open the 2D model results. Go to 'File' > 'Load Results - Map Outputs' from the TUFLOW Viewer menu options and navigate to the *.xmdf results file (e.g. TUFLOW\results\M01_5m_001.xmdf). For more information on loading map outputs, please refer to TUFLOW Viewer - Load Results - Map Outputs.
  4. Click on a scalar dataset 'Depth' under the Result Type in the TUFLOW Viewer 'Map Outputs' list.
  5. Update the map styling as desired. In this example, the 'Blues' colour ramp has been selected and the temporal bar has been adjusted to show depth results near the peak of the event.
    Note: For more details on map styling, please refer to TUFLOW Viewer - Map Outputs - Styling Scalar Types.

    QGIS 3D Animation Load Results 01.png

Configure DEM in 3D Map View

Create a new 3D map view and configure the DEM to display as a 3D Mesh.

  1. In the top dropdown menu options, go to View > 3D Map Views > New 3D Map View.

    QGIS 3D Animation Configure DEM 01.png

  2. The following 3D Map View window will open:

    QGIS 3D Animation Configure DEM 02.png

  3. Configure the DEM to display as a 3D mesh:
    • Select 'Zoom Full' Zoom full icon.png to center the map view on to the DEM.
    • Select 'Options' Settings icon.png > 'Configure'. A '3D Configuration' window will open. Select the 'Terrain' tab and enable the following settings (leave all other settings as default):
      • Type: Mesh
      • Elevation: M01_5m_001
      • Tick on 'Smooth triangles'
      • Rendering style: Color Ramp Shader
      • Color ramp: Greys >> Invert Color Ramp
      • Click OK

    QGIS 3D Animation Configure DEM 03.png

  4. The 3D Map View now displays the 3D surface:
    Note: For more information on navigating within the 3D map view, please refer to QGIS Documentation - 3D Map View, Navigation Options.

    Qgis 3d animation configure dem 04a.png

Load Results in 3D Map View

Load the maximum depth results in to the 3D Map View.

  1. In the QGIS Layers panel, right click the results layer and select 'Properties...'

    QGIS 3D Animation Add Results 01.png

  2. In the 3D View tab, enable the following settings (leave all other settings as default):
    • Tick on 'Enable 3D Renderer'
    • Tick on 'Smooth Triangles'
    • Dataset group for vertical value: Depth/Maximums
    • Rendering style: "2D Contour Color Ramp Shader"
    • Click OK

    QGIS 3D Animation Add Results 02.png

  3. Open the 3D Map View to view the 3D depth results and terrain.
    3Dview results.png

    Note: The "2D Contour Color Ramp Shader" rendering style option sets the symbology of the results to replicate the symbology in the current 2D map view. For this example, the depth results in the 3D map view reflects the depth map output symbology.

Create a 3D Animation

A 3D animation is based on a set of keyframes (camera positions at certain times). To create an animation:

  1. In the 3D Map View, toggle on the 'Animations' tool QGIS 3D Animation animation button 01.png. This opens the following widget:

    QGIS 3D Animation player widget 01.png

  2. Click 'Add Keyframe' QGIS 3D Animation add keyframe button 01.png and enter a time in seconds. This will add the time to the Keyframe dropdown box:

    QGIS 3D Animation keyframe dropdown box 01.png

  3. Use the navigation tools to move the 3D map to the desired position for the current keyframe time.
  4. Repeat steps 2 and 3 to add as many keyframes as required. QGIS will generate scenes using the 3D map's positions/rotations at set times, and it will interpolate them in between the keyframes.
  5. To preview the animation, click 'Play', or use the timeslider.

For more information on 3D animations, please refer to QGIS Documentation - Creating an animation.

Additional Resources

The Qgis2threejs plugin can also be used to create a 3D map view and animation. For more details, see Qgis2threejs Plugin Document


Up
Go-up.png Back to QGIS Tips And Tricks