“2.5D rendering is used to extrude polygons from their surrounding features, creating an illusion of depth in your map”
In this module we will examine the 2.5D renderer in QGIS and understand the basic options that can be used to specify how extrusion should take place.
Goal: To learn basic workflows behind working with the 2.5D renderer
You need to do the following tasks to achieve results like the example above :
Add the populates places layer from appendix1-naturalearth-data/ne.sqlite
Buffer the layer
Select the '2.5D' renderer for the buffer layer
Use an expression to set the height
Experiment with roof, wall colours
Check your results:
Your map looks similar to the image above
scale_linear( "pop_max" , 4645, 19028000, 2, 10)
scale_exp( "pop_max" , 4645, 19028000, 2, 10, 1.1)
In order to simulate perspective for extruded objects, an algorithm is used to compute the distance of each object from the top of the map. This distance is then used to render the objects, starting with those closest to the top of the map, ending with those closest to the bottom. You can view (and modify) this formula in the 'control feature rendering order' expression editor.
2.5D renderer uses a special symbol layer style called 'geometry_generator' to compute the extruded geometry for the 'walls' and 'roof' of the extruded polygon. You can use the geometry generator to do other cool stuff like buffering geometries on the fly.
If you change the renderer to single symbol renderer QGIS will create a number of symbol layers and preserve the 2.5D rendered style. You can use these symbol layers to manipulate the 2.5D rendering in fine-grained detail. You can also add additional geometry generator symbol layers to create effects like this:
One other important thing to note: 2.5D renderer uses two special layer variables to store the qgis_25d_angle and qgis_25d_height. If you try to copy the style from one layer to another, these values will NOT be copied, so you need to manually set them on the destination layer if needed.