[SoC] Final report
BELGACEM NEDJIMA
gb_nedjima at esi.dz
Mon Aug 31 05:38:29 PDT 2020
Hi,
As we reached the end of Google Summer of Code 2020. I present my final
report.
I really enjoyed being part of this project and I'm looking forward to
making more open source contributions in the future.
- *Title:* Improving QGIS 3D
- *Organization: *QGIS and OSGeo
- *Abstract: *
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. The project goal is to implement some
features for QGIS 3D viewer.
- *State of the project before GSoC:*
The 3D viewer of QGIS was introduced in QGIS 3.0 and implemented by my
mentor Martin Dobias. It has improved over the time and got new
functionalities, but when I used it for a brief time I noticed some missing
features I wanted to implement.
- *Work done before the GSoC coding period:*
- Setup of the development environment.
- Reading the QEP (QGIS Enhancement Proposal) of QGIS 3D.
- Understanding more about how the 3D side of QGIS is implemented.
- Made a small bug fix that got merged into the master branch (Github
commit)
- *Work done during GSoC:*
- *Texturing support*:
Previously, QGIS users could only use Phong shading as materials for
building geometries generated from vector layers. My goal was to make it
possible to add texture images to the geometry of buildings. I started by
reading the internal QGIS code and experimenting with Qt3D
internals. First
I experimented with just adding a texture on all triangles and got it
working.
screenshot of when I got textures working
<https://i.imgur.com/aqJD8yV.png>
Screenshot of the separation between walls and roofs
<https://imgur.com/OdlrvDo>
Then I moved on to the separation between walls and roofs, I solved
this problem by calculating the angle between each triangle’s normal and
the horizontal plane, if that angle is small enough we consider that the
triangle belongs to a wall, otherwise it’s a roof.
For how the user interacts with the texturing and provides different
texture for walls and roofs, I used the rule based rendering and added a
combo box from which the user can specify which facade to render (meaning
to render a wall or a roof). I also added some parameters to adjust the
scale of the texture and its rotation.
- *Directional lights:*
QGIS 3D already has support for point light. Since the two of them
are quite similar, implementing directional light was quite
straightforward
- *3D Scene export:*
For the blender export I made a custom .obj files exporter. My
implementation was quite tedious to implement because there were
different
types of layers and entities and I had to handle materials as well. I
relied on extracting geometry information from the vertex buffer and the
index buffer, making that work with DEM terrain, flat terrains and vector
layers. For the materials I used the .mtl specification to export colors
and textures. I added some UI to handle the resolution of texture and
terrain.
Here are some screenshots of what I was able to export:
- DEM terrain exported with .OBJ smoothing option on and off in
Blender: <https://imgur.com/Jkl9kfu>
- Vector layer export <https://imgur.com/LWBtHqf>
- Exporting terrain texture (Blender) <https://imgur.com/Rfm3PvB>
- Exporting terrain texture (MeshLab) <https://imgur.com/2MOmeYJ>
- Rule based rendering and material export
<https://imgur.com/uUDCgcg>
- *Skybox rendering:*
First I experimented with Qt3D skybox but found some difficulties
using it (there was a bug that was fixed in later releases) and it wasn’t
also extensible (for different types of skyboxes), then I copied the
implementation of the skybox entity from Qt3D and made it work.
I introduced 2 ways of providing skyboxes:
- 6 distinct faces for the skybox cube map: The user gives each
face of the skybox individually.
- 1 panoramic image: The user simply gives one panoramic image
(like an .HDR image form https://hdrihaven.com/) and the renderer
takes care of making the skybox.
- Some .gifs of the skybox in QGIS: gif image
<https://imgur.com/5Z8fUvm>, gif image 2
<https://imgur.com/fLS6vs9>
- *Shadow rendering (unfinished work):*
This was the hardest feature to implement and I couldn’t even finish
it in time without some visual artifacts.
Previously, I learned about some shadow rendering techniques and
shadow mapping was the technique I’m most familiar with, so after
discussing with mentors I decided to try and implement it.
To implement it, I first started with experimenting with Qt3D frame
graphs and converted an example implementation of shadow mapping provided
by Qt3D but made with QML. I made that implementation into a Github
repository. Then I started to port that implementation to QGIS by
making some post processing effects. After that I tried implementing the
shadow rendering but using a static light camera which resulted in a bad
shadow resolution. To try and fix that I calculated the view frustum in
world coordinates and used that to compute a bounding box that is used to
move the light camera to where the user is looking at. The
results were not
perfect but better than having the shadow being very low resolution. Also
in the shader, I made the shadows look soft using a technique called
percentage closer filtering.
Some screenshots of the shadow rendering: zoom out
<https://imgur.com/RWGM72e>, zoom in <https://imgur.com/hs6A8R2>
- *Weekly reports: *https://wiki.osgeo.org/wiki/Improving_qgis_3d
- *What is left to implement:*
- Finishing the shadow rendering implementation.
- Make point lights work with shadow rendering.
- Enhance python integration that didn’t have the time to complete.
- List of links to contribution I made related to the GSoC project:
- Small bug fix commit
<https://github.com/qgis/QGIS/commit/999ae580d3f788bde7726324e2ddf2f45a7b07de>
.
- Vector layer texturing PR <https://github.com/qgis/QGIS/pull/36981>.
- Directional lights PR <https://github.com/qgis/QGIS/pull/37016>.
- 3D scene export PR <https://github.com/qgis/QGIS/pull/37588>.
- Skybox rendering <https://github.com/qgis/QGIS/pull/38087>.
- Shadow rendering <https://github.com/qgis/QGIS/pull/38448>.
- Qt3D shadow mapping sample in pure C++ repository
<https://github.com/NEDJIMAbelgacem/Qt3D-shadow-maps-CPP>.
- QGIS improvements proposal
<https://docs.google.com/document/d/1HO1ASYm2Ik5UgMhnrADg9As5mbIsbA6unfumNAP_-Qk/edit?usp=sharing>
.
- *What's next: *I will try to implement new features and contribute
more features in QGIS whenever I have the time to. The community was great
and I loved working on the project.
Best regards,
--
Belgacem Nedjima
4th year computer science and engineering student.
https://github.com/NEDJIMAbelgacem
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/soc/attachments/20200831/cf640a33/attachment.html>
More information about the SoC
mailing list