Google Summer of Code 2020 : QGIS 3D Improvements

NOVEMBER 01, 2020 3d gsoc qgis

In this year Google Summer of Code (GSoC), multiple new features were added to QGIS 3D. Belgacem Nedjima as the student with Martin Dobias and Peter Petrik as the mentors have implemented the following features into the 3D viewer of QGIS:

Feature 1 : Textures support

Now it is possible to add textures to vector layer data (buildings) in the 3D viewer: To do that you need to go the vector layer properties and select Realistic Textured (Phong) shading mode and select the image to be displayed on the surfaces by providing an image file to the diffuse texture field. texture-support-UI You can adjust the scale of the image and its rotation from the texture scale and texture fields respectively. texture-support-preview There is a workaround to seperate roofs from walls using rule based rendering by adding 2 seperate rules and selecting which facet (roof or a wall) to display and select which rendered facade to be used and the shading setting for each rule. texture-support-walls-roofs-UI Results for seperating roofs and walls texture-support-walls-roofs-preview

Feature 2 : Directional lights

QGIS 3.16 adds support for directional lights that you can think of as the sun. The default light in QGIS 3.16 is now directional which makes the lighting of the whole scene better. To use directional lights, open the 3D configuration dialog and from the lights tab you can configure how many lights you use. If you select a directional light, you will see the new improved way to provide the direction of the light (Thanks to Vincent Cloarec for the UI improvements). directional-lights-UI

Feature 3 : Scene export as .obj file

In the 3D viewer there is a new tool to export the scene as a .obj file and visualize or edit it in other software like Blender or MeshLab. To export the scene, from the 3D viewer select the 3D object icon and you will see the following dialog: export-UI You can select the name of the .obj file and where to save it (you need to select a folder because you will have multiple files if you export textures or color informations). You can specify the resolution of the terrain in case you’re using a DEM as well as the resolution of the exported textures. Here is a view of what an exported scene that has multiple rendering rules looks like in MeshLab: export-meshlab-preview

Feature 4 : Skybox rendering

You can add a skybox to your scene from the 3D configuration dialog and selecting from the 2 skybox formats provided:

  • Panoramic Texture: One 360 image is used to generate the skybox
  • Distinct Faces: 6 different faces describing the cube map of the skybox skybox-panoramic skybox-distinct-faces The result of applying a skybox to the scene: skybox-preview

Feature 5 : Shadow rendering (beta)

Althought it might not work for everyone, shadow rendering was added as a technical preview in QGIS 3.16. To try shadows, you need to open the 3D configuration dialog and enable shadows from the Shadows tab. shadows-settings-menu You can experiment with the shadow rendering parameters if you want to decrease the visual artifacts and make the shadows look better in the scene. Here is how the shadows look like in our scene: shadows-preview

You may also like...

Mergin Maps, a field data collection app based on QGIS. Mergin Maps makes field work easy with its simple interface and cloud-based sync. Available on Android, iOS and Windows. Screenshots of the Mergin Maps mobile app for Field Data Collection
Get it on Google Play Get it on Apple store

Posted by Belgacem Nedjima