joewdavies / geoblender

Tutorials for making 3D-looking maps with Blender and QGIS
1.54k stars 96 forks source link
blender gis maps qgis

Shaded relief maps in blender

Tutorial

This guide will help you prepare DEM data using QGIS in order to render 3D looking shaded-relief maps in Blender.

Tweet me your finished maps, and feel free to ask any questions! Twitter URL


Requirements

For this tutorial i used the following software:

I will be going through the whole process, using Wales as my area of interest.

Table of Contents

  1. Prepare the DEM
  2. Prepare blender scene
  3. Plug the DEM into the plane
  4. Add modifier
  5. Add colour
  6. Add mask (optional)

Step 1: Prepare the DEM

Scene settings

Lighting settings

I wont go into detail as to why I've chosen these values, but for a more in-depth explanation on lighting shaded relief maps in blender check out this tutorial. Feel free to play around with these values once we've done our first render.

Camera settings

Finally, we need to set our camera to how we want it. To do this, select the camera object in the object collection (top right) then set the following values:

If the camera is too zoomed-in, adjust the focal length property (when using a perspective camera) or the orthographic scale (when using an orthographic camera). You can also adjust the Z position of the camera. For playing around with different camera angles I suggest switching to the '3D viewport' editor type and moving the camera by hand (see screenshot below).

Step 3 : Plug the DEM into the plane

image

Step 4 : Add modifier

If you render the image now (render > render image or F12) you should get something like this:

Which is not what we want (blender is not deforming the plane 'in 3D' it is just showing a 2D hillshade).

To change this lets add a modifier:

Now press F12 to render again and you should end up with something like this:

Step 5 : Add colour!

In order to add colour we can add a colour ramp which will use our DEM to determine the colour of each pixel.

Play around with the colours and their positions on the ramp to make cool renders.

Extra: Mask for AOI

If you are using a colour ramp with your DEM then you probably want to distinguish between features such as land and sea. This can be accomplished using a mask. Here I will briefly explain how I do this.

Step 1 : Rasterize vector polygon of AOI in QGIS (raster > conversion > rasterize) with the following options:

input layer: your vector polygon
value to burn: 1
output units : pixels
width resolution : width of final DEM tif in pixels
height resolution : height of final DEM tif in pixels
output extent: same extent as our final DEM tif
no data value: -1
output data type: byte

Step 2: Save the generated raster as a rendered image (export > saveas > outputmode = rendered image).

Step 3 : Open output raster in irfranView (or your preferred image editor), save as png > select black area as transparent color. (this is just how I do it, as long as you can use the alpha channel of the image to distinguish between your AOI and areas outside it then thats fine).

Step 4 : Use in blender to differentiate AOI from non-AOI areas. Here is an example of using a different colour input for areas inside and outside the mask:

💡 Tip: you can also use this mask to artificially 'raise' your area of interest (as I did with the map of Greece). Just use a 'math' node connected to the DEM as the color1 input of a 'mix' node and color2 as the DEM, then use the mask as the Fac of the mix node. The result of this mix node is then plugged into the displacement node (see screenshot below).

End

I hope you enjoyed the tutorial and you've managed to make a cool map!

"Buy Me A Coffee"