Difference between revisions of "QGIS 3D Animations"

From Tuflow
Jump to navigation Jump to search
 
(20 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<span style="color:#FF0000">
 
<font size = 18>Page Under Construction</font>
 
</span>
 
 
 
=Introduction=
 
=Introduction=
This page explains how to make a 3D animation using QGIS. QGIS version 3.38.3 has been used for this example.
+
This page outlines the process for creating a 3D animation using QGIS. QGIS version 3.34.1 has been used for this example.
  
==Data Required==
+
==Required Data==
As a minimum you will need:<br>
+
To create a 3D animation in QGIS, the following files are required as a minimum:<br>
* Digital Elevation Model (DEM)/TIN; and
+
* Digital Elevation Model (DEM) or TIN; and
 
* 2D Model Results.
 
* 2D Model Results.
  
The DEM and 2D results for Tutorial Module 1 are used in this example. The complete model is available from [[Tutorial_Introduction | Tutorial Introduction]].
+
'''Note:''' Additional files may also be used to enhance the animation. <br>
 +
 
 +
This example uses the DEM and 2D results from <u>[[Tutorial_M01 |Tutorial Module 1]]</u>. The complete model is available from <u>[[Tutorial_Introduction | Tutorial Introduction]]</u>.
 
<br>
 
<br>
  
==Set Up QGIS Workspace==
+
=Method=
The following steps demonstrate how to display the water level (_h) datasets, these steps may equally be followed using other datasets you may have.
+
==Configure the QGIS Workspace==
 +
Configure the QGIS workspace and display the depth (d) datasets. The same process can be followed for other output datasets.
 
<ol>
 
<ol>
<li>Load the '''DEM.tif''' into the QGIS workspace </li><br>
+
<li>Load the '''DEM.tif''' into the QGIS workspace.
<li>Load the 2D results dataset using the '''M01_5m_001.xmdf''' results file located in the '''TUFLOW\results\''' folder using the TUFLOW Viewer. For more details on loading map outputs, refer to [[TUFLOW_Viewer_-_Load_Results_-_Map_Outputs | TUFLOW Viewer - Load Results - Map Outputs]]. </li><br>
+
<li>Open the TUFLOW Viewer from the TUFLOW plugin toolbar: <br>
<li>Select 'Depth' results to display in the workspace and change map styling to your preference. In this example, the 'blues' colour ramp has been selected and the temporal bar has been moved to show depth results near the peak of the event. For more details on map styling, refer to [[TUFLOW_Viewer_-_Map_Outputs_-_Styling_Scalar_Types | TUFLOW Viewer - Map Outputs - Styling Scalar Types]]. </li>
+
<br>
 +
[[File:tuflow_plugin_tuflow_viewer.png]]<br>
 +
<br>
 +
<li> 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 <u>[[TUFLOW_Viewer_-_Load_Results_-_Map_Outputs | TUFLOW Viewer - Load Results - Map Outputs]].</u>
 +
<li>Click on a scalar dataset 'Depth' under the Result Type in the TUFLOW Viewer 'Map Outputs' list.
 +
<li>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. <br>
 +
'''Note:''' For more details on map styling, please refer to <u>[[TUFLOW_Viewer_-_Map_Outputs_-_Styling_Scalar_Types | TUFLOW Viewer - Map Outputs - Styling Scalar Types]].</u><br>
 +
<br>
 +
[[File: QGIS_3D_Animation_Load_Results_01.png]]<br>
 +
<br>
 
</ol>
 
</ol>
<br>The QGIS workspace should look similar to below:  <br>
 
[[File:QGIS 3D ani 1.png||800px]]
 
 
  
==Configure DEM in 3D Map View==  
+
==Configure DEM in 3D Map View==
 +
Create a new 3D map view and configure the DEM to display as a 3D Mesh.
 
<ol>
 
<ol>
<li> Create a new 3D map view under <i> View >> 3D Views >> New 3D Map View</i>: <br>
+
<li> In the top dropdown menu options, go to View > 3D Map Views > New 3D Map View.<br>
[[File:New 3d mapview.jpg||500px]]<br>
+
<br>
The following 3D Map View window will appear: <br>
+
[[File: QGIS_3D_Animation_Configure_DEM_01.png]]<br>
[[File:3d mapview window.png]]<br><br>
+
<br>
</li>
+
<li> The following 3D Map View window will open: <br>
 
+
<br>
<li>Within the 3D Map View window, configure the DEM to display as a 3D mesh:  
+
[[File: QGIS_3D_Animation_Configure_DEM_02.png]]<br>
* Use the ''Zoom Full'' tool [[File:Zoom full icon.png]] to center the map view onto the DEM  
+
<br>
* Click ''Settings [[File:Settings icon.png]] > Terrain tab''  
+
<li>Configure the DEM to display as a 3D mesh:  
* Within the Terrain tab, enable the following settings:  
+
* Select 'Zoom Full' [[File:Zoom full icon.png]] to center the map view on to the DEM.
 +
* Select 'Options' [[File: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  
 
** Type: Mesh  
 
** Elevation: M01_5m_001
 
** Elevation: M01_5m_001
** Smooth triangles enabled
+
** Tick on 'Smooth triangles'
** Render style: Color Ramp Shader  
+
** Rendering style: Color Ramp Shader  
** Color ramp: Greys >> Invert Color Ramp
+
** Color ramp: Greys >> Invert Color Ramp <br>
** Click OK  
+
** Click OK <br>
[[File:3d DEM config.png|800px]]
+
<br>
</li><br>
+
[[File: QGIS_3D_Animation_Configure_DEM_03.png]]<br>
 
+
<br>
The figure below demonstrates the resultant 3D surface. For more details on navigating within the 3D map view, refer to [https://docs.qgis.org/3.34/en/docs/user_manual/map_views/3d_map_view.html#navigation-options QGIS Documentation - 3D Map View, Navigation Options]
+
<li>The 3D Map View now displays the 3D surface:<br>
 +
'''Note:''' For more information on navigating within the 3D map view, please refer to <u>[https://docs.qgis.org/3.34/en/docs/user_manual/map_views/3d_map_view.html#navigation-options QGIS Documentation - 3D Map View, Navigation Options].</u>
 +
<br>
 +
<br>
 +
[[File: qgis_3d_animation_configure_dem_04a.png]]<br>
 
<br>
 
<br>
[[File:3d mapview DEM.png|400px]]
 
 
 
</ol>
 
</ol>
  
==Load Results in 3D Map View==  
+
==Load Results in 3D Map View==
The following steps demonstrates how to load the maximum water level results in the 3D Map View.  
+
Load the maximum depth results in to the 3D Map View.  
 
<ol>
 
<ol>
<li> Open Layer Properties of the Results Mesh Layer, by right-clicking the layer in the Layers Panel and selecting "Properties..." <br>
+
<li>In the QGIS Layers panel, right click the results layer and select 'Properties...'<br>
[[File:Open layer properties.png]] </li><br>
+
<br>
<li> Navigate to the 3D View Panel within the Layer Properties window, and enable the following settings:  
+
[[File: QGIS_3D_Animation_Add_Results_01.png]]<br>
* Enable 3D Renderer
+
<br>
* Enable Smooth Triangles
+
<li>In the 3D View tab, enable the following settings (leave all other settings as default):
* Dataset group for vertical value: "Water Level/Maximums"
+
* Tick on 'Enable 3D Renderer'
 +
* Tick on 'Smooth Triangles'
 +
* Dataset group for vertical value: Depth/Maximums
 
* Rendering style: "2D Contour Color Ramp Shader"  
 
* Rendering style: "2D Contour Color Ramp Shader"  
* Click OK  
+
* Click OK <br>
[[File:Results 3DView settings.png|none]]
+
<br>
 +
[[File: QGIS_3D_Animation_Add_Results_02.png]]<br>
 +
<br>
 +
<li> Open the 3D Map View to view the 3D depth results and terrain.
 +
<br>
 +
[[File:3Dview results.png]]<br>
 +
<br>
 +
'''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.
 +
</ol>
  
 +
==Create a 3D Animation==
 +
A 3D animation is based on a set of keyframes (camera positions at certain times). To create an animation:
 +
<ol>
 +
<li>In the 3D Map View, toggle on the 'Animations' tool [[File: QGIS_3D_Animation_animation_button_01.png|20px]]. This opens the following widget:<br>
 +
<br>
 +
[[File: QGIS_3D_Animation_player_widget_01.png]]<br>
 +
<br>
 +
<li>Click 'Add Keyframe' [[File: QGIS_3D_Animation_add_keyframe_button_01.png]] and enter a time in seconds. This will add the time to the Keyframe dropdown box:<br>
 +
<br>
 +
[[File: QGIS_3D_Animation_keyframe_dropdown_box_01.png]]<br>
 +
<br>
 +
<li>Use the navigation tools to move the 3D map to the desired position for the current keyframe time.
 +
<li>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.
 +
<li>To preview the animation, click 'Play', or use the timeslider.
 +
</ol>
  
Note, the "2D Contour Colour Ramp Shader" rendering style option sets the symbology of the results to replicate the current symbology in the current 2D map view.
+
For more information on 3D animations, please refer to <u>[https://docs.qgis.org/3.34/en/docs/user_manual/map_views/3d_map_view.html#creating-an-animation QGIS Documentation - Creating an animation]</u>.
 
 
<li> Open the 3D Map view window to view the 3D Water Level results and terrain
 
[[File:3Dview results.png|none]]
 
 
 
</li><br>
 
  
==Creating an animation==  
+
=Additional Resources=  
To create an animation, refer to instructions listed on the QGIS website: [https://docs.qgis.org/3.34/en/docs/user_manual/map_views/3d_map_view.html#creating-an-animation Creating an animation]
+
The Qgis2threejs plugin can also be used to create a 3D map view and animation. For more details, see <u>[https://minorua.github.io/Qgis2threejs/docs/ Qgis2threejs Plugin Document]</u>
  
 
<br>
 
<br>

Latest revision as of 10:06, 27 January 2025

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