Working with QGIS 3D - Part 2

FEBRUARY 28, 2020 qgis qgis3d

In an earlier blog post, we looked into how to visualise rasters and terrains in QGIS 3D.

In this post, we will explore 3d vectors and how to view buildings and trees.

Data Sources

For the purpose of this blog post, we will be using

You can download all the dataset and final QGIS project from our Mergin service. Note that the DTM has been resized from 1m resolution to 5m. All of the datasets have been clipped to Luxembourg commune extent.

After styling the layers you should be able to see an image like the one below in your map view.

Options

3D Buildings

You can open a new 3D map window and set the DTM layer as your terrain as shown in the earlier blog post.

The other layer we want to view in 3D canvas is the building layer. To adjust the settings, you need to change the layer styling (by pressing F7 to open the styling panel):

Options

  • By default, the 3D rendering of vector layer is set to No symbol. Click on it and set it to Single symbol.

The buildings layer contain height information:

  • Change Altitude clamping to Absolute.
  • Change Altitude binding to Vertex.

In case, your building layer is not a 3D dataset, you can apply height and/or extrusion to be able to see them in 3D map view.

Culling mode helps rendering your scenes faster by not drawing certain features facing the camera. You can read more about culling modes here and here.

You can change Diffuse, Ambient, Specular and Shininess of the polygons using relevant widgets. These parameters are based on Phong reflection model.

Finally to better display the buildings, you can define the Edges.

You should be able to see a 3d scene similar to the one below:

Options

3D Points

Points can be displayed in 3D map view as different type of objects. In this example, we are going to display trees as combination of predefined shapes. You can extract tree points from the OpenStreetMap data (the osm_pois layer with filter: "fclass" LIKE 'tree').

For tree trunks, we can set the 3D properties as follows:

Options

The tree trunks are represented by a Cylinder shape. As you have noted, the Altitude clamping method for this layer is Relative.

For the tree top, we can duplicate the same tree layer in the layer panel and change the styling to be a Sphere shape. You will also need to set the Transformation for Y to e.g. 10, so that the spheres sit on top of the cylinders. For the example below, we have set the styling to be a mix of spheres and cones (Rule-based instead of Single symbol).

3D point renderer allows you to import 3d models supported by Open Asset Import Library.

Options

Fly-over animations

You can create animations of 3d scenes, by defining key frames. Click on the Animation icon from the 3D map view window. A new toolbar will appear at the bottom of your window.

Click on the green plus sign to add the timing of the key frames and then move the camera to a different location. You can then play the fly-over using different interpolation methods. Alternatively, you can export them as images and generate an animation outside QGIS.


Posted by Martin Dobias, Saber Razmjooei