Improving qgis 3d

From OSGeo
Jump to navigation Jump to search

Introduction

QGIS 3D was introduced in QGIS 3.0 in 2018 and has been improved over the last 2 years. This is a continuation of last year’s summer of code project which was done by Ismail Sunni. I have a list of features I would like to implement that may be useful for QGIS users. You can find my original proposal here: QGIS 3D proposal

Features list

Displaying textured 3D models on the map:

Displaying 3D models in the 3D view is already implemented but textured models are not. So it would be a good idea to extend the existing implementation to work on textured 3D objects and maybe not only display the diffuse textures but also handle the object material as well (specular, ambient, shininess...). This feature will be implemented for the mesh layers and vector layers :

  • For mesh layers: We add the texturing to 3D models rendering, these textures will be supplied by the model.
  • For vector layers: The idea is to let users define textures for 3D geometries that represent buildings like specifying walls and roof textures, this can give us the option to define default textures for them too.

Exporting 3D scenes to common 3D formats :

Currently, we can only view 3D maps inside of QGIS. My work consists of using the Asset import library to export the 3D scene to a 3D format in order to do post-processing in advanced 3D software like Blender. This feature will open the conversation of adding Asset import library as a dependency in QGIS and will be discussed during the community bonding period. If adding the Asset import library wasn’t approved I can write a .OBJ models manager to export the 3D scenes. This feature should be implemented after textured 3D models feature to export the map in a consistent manner so that the exported scene looks the same inside QGIS 3D and other 3D software and also to have the option to export the textures along with the scene.

Implementing new 3D rendering techniques :

The idea is to make new rendering techniques for the 3D view, some of the rendering techniques I would like to implement are :

  • Rendering of the scene’s 3D objects as wireframes: This may help in debugging as it should work on the terrain and every other 3D rendered subject on the scene. For the mesh layer, it is already implemented but for the vector layer, I think it is necessary to do the same thing using the same shaders.
  • Directional lights: Currently QGIS 3D only supports point lights which is a bit unrealistic if we want to simulate a light source like the sun.
  • Skybox rendering: The idea is to extend the skybox rendering that is already implemented by Martin Dobias and give the user the ability to choose the skybox. The user should also be able to choose a single color instead of a textured skybox.
  • Shadow rendering: QGIS 3D has no support for shadow rendering at the moment. I will try to make shadows work with a directional light that represents the sun which will give us the ability to cast shadows according to the time given by the user (if we define directions in 3D it can become an accurate representation for the sun position). To make the implementation easier I will suggest making the shadow rendering work with a single directional light source (the sun).

Enabling the Python scripting API to work with a 3D view :

In QGIS there is a system to automatically generate python wrappers for C++ called sipify. I will try to make it so that the user can add 3D entities using python scripting.

Student's Biography

I am Belgacem Nedjima, a fourth year computer science and engineering student from Algeria. I am mostly interested in graphics programming and game engines and passionate about software engineering.

Timeline and progress

Here I will be writing weekly reports and updates about my GSoC project.

Before selection period

  • Making the proposal and sharing it with the community for reviews and suggestions
  • Setup the development environment.
  • Submit student's test.

Community Bonding

  • Projects announcement week (from 4th May untill 7th May) accomplished tasks:
    • Get introduced to the QGIS community.
    • Get in touch with the mentors and plan weekly meetings.
    • Read some of the developer manuals.
  • Part 1 of community bonding period (5 May - 16 May):
    • Start looking into some bugs to fix related to QGIS 3D.
    • Fixed small bug (link to github commit).
    • Started looking into the rendering architecture of QGIS 3D.
  • Part 2 of community bonding period (17 May - 25 May):
    • Making a plan for the implementation of various features.
    • Digging into the code base of QGIS 3D.
    • Discuss the implementation of texturing and the changes that will be made with mentors.
    • Defining the apparent issues with my current vision of the features's implementation.
    • Expanding my knowledge on shadow rendering and finding resources that may help with the implementation.
  • Part 3 of community bonding period (26 May - 1 Juin):
    • Reading the tessellation code used to generate triangles of building from polygons
    • Experimented with the Qt3DExtras::QDiffuseMapMaterial and explore alternatives. Unfortunately some of the alternatives are not available in the Qt version I use (Qt5.9).
    • Tried compiling QGIS with different Qt versions.
    • Added texture coordinates to the vertex buffer of QgsTessellatedPolygonGeometry.
    • Got the basic functionality of texturing buildings using 1 texture image working for some vector layer projects.
    • Link to screenshot of the texturing support working: vector layer texturing

Mentors

Martin Dobias

Peter Petrik