You are on page 1of 16

11/28/2020 Shaded relief with BlenderGIS, part 2 – The Wandering Cartographer

The Wandering Cartographer

Thoughts about mapping, history, language, travel, mathematics…

Shaded relief with BlenderGIS, part 2

Morgan Hite  Uncategorized November 14, 2014April 4, 2017 5 Minutes


With the DEM read in, we’re now ready to adjust the many parameters in Blender which determine
what we’ll get. Here again is the overall procedure (mentioned in the previous post
(h ps://wanderingcartographer.wordpress.com/2014/11/14/shaded-relief-with-blendergis-part-1/)) .
We’re now at step 5.

1. Select the Cycles Renderer


2. Read in the DEM as DEM
3. Create new material
4. Adjust Z scaling
5. Create and adjust the georef camera
6. Correct final pixel dimensions to match the input DEM
7. Adjust lamp location and properties
8. Test render
9. Adjust final parameters
10. Render

Create and adjust the georef camera

With the plane selected, go to the the (new) GIS tab on the left, and, under BlenderGIS, click
Georender.

https://wanderingcartographer.wordpress.com/2014/11/14/shaded-relief-with-blendergis-part-2/ 1/16
11/28/2020 Shaded relief with BlenderGIS, part 2 – The Wandering Cartographer

This creates a camera at an appropriate distance above the plane. It will appear in the tree of objects
(upper right) as “Georef cam”. It has been placed high enough (Z value of 16791) that it is above the
highest point on the plane surface. Note that it is important to have set your Z scaling before creating the
Georef cam.

If you look at the camera’s Object Data>Lens, you’ll see that BlenderGIS has automatically set it to
Orthographic. It’s a good idea to note the camera’s clipping Start and End, because you may have to
adjust these later.

https://wanderingcartographer.wordpress.com/2014/11/14/shaded-relief-with-blendergis-part-2/ 2/16
11/28/2020 Shaded relief with BlenderGIS, part 2 – The Wandering Cartographer

As well, if you check out the Scene’s Scene panel, you will see that the current camera has been set to
this new Georef cam.

(h ps://wanderingcartographer.files.wordpress.com/2014/11/georefcamset.jpg)

Correct final pixel dimensions to match the input DEM

If you go to the Render tab, under Dimensions>Resolution you can see the pixel dimensions of the final
image as suggested by BlenderGIS. In this case, as I noted before, one cell has been dropped in each
dimension, so it is 5029 x 3276.

https://wanderingcartographer.wordpress.com/2014/11/14/shaded-relief-with-blendergis-part-2/ 3/16
11/28/2020 Shaded relief with BlenderGIS, part 2 – The Wandering Cartographer

I correct these to the actual values (5030 x 3277, in this case) so that the dimensions of my final image
match the DEM. That way I can pair the TFW world file with the image created by Blender, and read it
into QGIS georeferenced.

While I’m at it, I’ll set the Resolution percentage to 25%. This way I can get a test image without doing a
full render. While I’m here on the Render tab, I’ll go to the Light Paths panel and set it to Limited Global
Illumination.

https://wanderingcartographer.wordpress.com/2014/11/14/shaded-relief-with-blendergis-part-2/ 4/16
11/28/2020 Shaded relief with BlenderGIS, part 2 – The Wandering Cartographer

(h ps://wanderingcartographer.files.wordpress.com/2014/11/limitedglobal.jpg)Now we’ll check that all


elevations in the DEM are visible to the camera. Pop into Camera Ortho view (Numpad 0 while the
mouse is over the 3D View). You are looking for black faces where the higher parts of the DEM have
been cut off. It can look something like this:

https://wanderingcartographer.wordpress.com/2014/11/14/shaded-relief-with-blendergis-part-2/ 5/16
11/28/2020 Shaded relief with BlenderGIS, part 2 – The Wandering Cartographer

(h ps://wanderingcartographer.files.wordpress.com/2014/11/orthoview1.jpg)BlenderGIS was updated in


December 2014 to place the Georef Cam high enough so that this typically does not happen (Thanks!),
but I’ll still discuss what to do in case you do encounter it. This could happen if you, say,

create the Georef cam before you increase Z scaling on the DEM.
create the Georef cam at a time when the View number in the Subsurf modifier is low (e.g., 6). In this
case the displacement is quite generalized; the Georef cam will be placed high enough to clear it, but
not the actual high points that pop out when you render at 11.

What’s happening here is that the camera only “sees” objects that fall between the Start and End clip
distances we noted a few steps back. The Start and End are measured from the camera outward (or
down, in this case).

Specifically, in the image above, I had a camera at 11,706m, with a Clip Start of 0.5 m, and a Clip End of
8011.5 m. If you do the math, you’ll see that this means that the maximum elevation at which it can see
objects is 11,705.5 (that’s 11,706 – 0.5). The minimum elevation at which it can see objects is 3694.5 (that’s
11,706 – 8011.5). Our DEM originally contained elevations from 739 to 2379, but now we’ve scaled it up
5 times, so its minimum is 3695 (= 739 x 5) and its maximum is 11,895 (= 2379 x 5). The black patches are
the elevations that are higher than 11,705.5 m.

If I do a test render with these se ings I’ll get the image below; I’ve circled the black patches where the
highest peaks were cut off.

https://wanderingcartographer.wordpress.com/2014/11/14/shaded-relief-with-blendergis-part-2/ 6/16
11/28/2020 Shaded relief with BlenderGIS, part 2 – The Wandering Cartographer

(h ps://wanderingcartographer.files.wordpress.com/2014/11/srtm_2_3_cutoff_render.jpg)

In this case we need to raise the camera to just above the max value in the DEM, and then adjust the Clip
Start and End distances to encompass the whole DEM. Since the DEM ranges from 3695 to 11,895, let’s
put the camera at 11, 896, leave Start at 0.5, and set End to 8201.5.

(h ps://wanderingcartographer.files.wordpress.com/2014/11/clipdistancesset.jpg)

Adjust lamp location and properties

This does not differ in any way from what you would do with the Subdivide method. Set the Lamp to
Sun, and click Use Nodes. I like a sun size of 1, Cast Shadows checked, and a Strength of 4.

https://wanderingcartographer.wordpress.com/2014/11/14/shaded-relief-with-blendergis-part-2/ 7/16
11/28/2020 Shaded relief with BlenderGIS, part 2 – The Wandering Cartographer

Then change to the Lamp’s Object tab, Transform section, and set its X, Y and Z Rotation. In this case I
want an elevation of 40°and an azimuth of 337.5°, so I choose X=0, Y=40, and Z=112.5. Remember that
Blender measures the sun azimuth counterclockwise from East.

(h ps://wanderingcartographer.files.wordpress.com/2014/11/lampse ings2.jpg)

Test Render

Hit F12 to see a test render at 25%. It should look grainy but basically correct.

https://wanderingcartographer.wordpress.com/2014/11/14/shaded-relief-with-blendergis-part-2/ 8/16
11/28/2020 Shaded relief with BlenderGIS, part 2 – The Wandering Cartographer

(h ps://wanderingcartographer.files.wordpress.com/2014/11/test_render_25.png)

Final adjustments

At this point you can play with:

lamp rotation, strength, size


Z scaling on the model
the Render number under the Subsurf modifier on your plane

When you’re ready to go,

On the Render tab>Dimensions, raise the Resolution from 25% to 100%


On the Render tab>Sampling set the Samples Render number to 200. This high sampling number
makes the rendering process take a long time, but it’s worth it. Check out this comparison of the
same scene rendered with sampling 200 (left) vs sampling 90 (right):

https://wanderingcartographer.wordpress.com/2014/11/14/shaded-relief-with-blendergis-part-2/ 9/16
11/28/2020 Shaded relief with BlenderGIS, part 2 – The Wandering Cartographer

(h ps://wanderingcartographer.files.wordpress.com/2014/11/render_90_vs_render_200.jpg)

Note the noise in the shadows when sampling only 90 times (right image) as opposed to 200 times (left image).

On the Render tab>Output, set the image type to TIFF (if you want to pair it with a pre-existing TFW
after you render)
Save your session to a .blend file using File>Save As…

Render

Two options here. One is that you can hit F12 and go out for coffee. When it’s done, hit F3 to save.

https://wanderingcartographer.wordpress.com/2014/11/14/shaded-relief-with-blendergis-part-2/ 10/16
11/28/2020 Shaded relief with BlenderGIS, part 2 – The Wandering Cartographer

(h ps://wanderingcartographer.files.wordpress.com/2014/11/hillshade_subdiv_2_30001.jpg)Or, you can


close Blender and render that .blend file you just saved from the command line. This saves the GUI
rendering, and so it takes less time — you might get 10-40% off the regular render time.

Let’s say your .blend file is called tile_4_4.blend. The command line to render it would be

/path/to/blender -b tile_4_4.blend -o hillshade_4_4.tif -F TIFF -f 1

The switches are:

-b run in background (no-GUI) mode


-o the output filename
-f 1 render just one frame.

Pulling the result back into QGIS

https://wanderingcartographer.wordpress.com/2014/11/14/shaded-relief-with-blendergis-part-2/ 11/16
11/28/2020 Shaded relief with BlenderGIS, part 2 – The Wandering Cartographer

Let’s say you have saved the rendered image as hillshade.tif. Rename a copy of the world file you
created way back at the beginning to hillshade.tfw.

QGIS should be happy to read in hillshade.tif now as raster data, although it will probably ask for the
CRS. (You know the CRS because you specified it when you re-projected the DEM, and when you read it
into Blender.)

It works quite well in QGIS to set the Blend Mode of the hillshade to Multiply, and then overlay it with
layers representing vegetation or elevation.

The shadows can be thunderingly deep in these hillshades…

…so it can be good to display them with increased brightness and decreased contrast.

Tagged:
Blender,
Cartography
https://wanderingcartographer.wordpress.com/2014/11/14/shaded-relief-with-blendergis-part-2/ 12/16
11/28/2020 Shaded relief with BlenderGIS, part 2 – The Wandering Cartographer

Published by Morgan Hite

Cartographer, writer, former wilderness instructor. View all posts by Morgan Hite

13 thoughts on “Shaded relief with BlenderGIS, part 2”

Pingback: Shaded relief with BlenderGIS, part 1 | The Wandering Cartographer


Oliverjack says:
May 4, 2016 at 2:03 am
Hi

Very useful! Thanks!


Do you have a quick way to crop the tiles before pu ing them together?

OJ

Reply
Morgan Hite says:
May 5, 2016 at 11:04 am
Hi OJ,

No, I do not crop the tiles before pu ing them back together. Sometimes they look quite good if
you just overlap them. If they do not look good, then I make them semi-transparent on the east
and south edges using gdalwarp’s -cblend switch.

-Morgan

Reply
Claudiu Onea says:
December 9, 2017 at 10:41 pm
Hi Morgan. I tried you method too and I found it awesome. But in my render some pa ern
can be seen. Like a mesh.

Morgan Hite says:


December 10, 2017 at 12:53 pm
Hi Claudiu,
If you are seeing a mesh, perhaps the DEM you are using is too coarse? What is the resolution
(cell size), and what are the pixel dimensions of the DEM?
– Morgan

Claudiu says:
December 10, 2017 at 11:01 pm

https://wanderingcartographer.wordpress.com/2014/11/14/shaded-relief-with-blendergis-part-2/ 13/16
11/28/2020 Shaded relief with BlenderGIS, part 2 – The Wandering Cartographer

Hi Morgan,
I am using DEMs which I got from NASA’s Earth Explorer-SRTM Void Filled which I constantly use
when I make my hillshades (in Global Mapper+Photoshop) and had no problem with it. I clipped it
using Global Mapper at 20m and 2241X1708 and exported it as GeoTiff (16bit integer). The “native”
resolution of the DEM is 1 arc second.
I really want to move from classic hillshades to 3D rendering which is far more visually a ractive.
Thanks for the reply and i hope you can help me.
-Claudiu

Reply
Morgan Hite says:
December 12, 2017 at 11:59 am
Hi Claudiu,
That sounds like the right data resolution and image size! Could you email me the final result so I
can see? (morgan@hesperus-wild.org)

Reply
Rutger says:
April 17, 2018 at 5:28 am
Hey,

Did you ever resolve this issue? I think I’m experiencing something similar. For me it seems to be
related to the “Subdivision Surface” modifier. If I change the algorithm from “Simple” to
“Catmull-Clark” the pa ern changes, gets worse and more chaotic.

When using the “Simple” algorithm it shows as a regular grid, having dark stripes on bright
slopes and light stripes on dark slopes. Almost as if there is a row/column every x pixels for
which the slope is taken as horizontal instead of the actual terrain.

@Morgan, thanks for this tutorial, its very helpful and well wri en.

Regards,
Rutger

Reply
Andreas says:
July 18, 2019 at 12:33 pm
Thanks for this great tutorial, it was indeed extremely helpful and well wri en. It still works the
same way in the new Blender 2.8 (RC1).

Reply
Vijay Ramesh says:
August 20, 2019 at 1:07 pm
Hi Morgan,

I am currently having an issue with the new raster not georeferenced right. The raster is si ing
almost 1 degree north of where it originally is from. Any suggestions?

Reply
Morgan Hite says:
August 21, 2019 at 10:06 am
https://wanderingcartographer.wordpress.com/2014/11/14/shaded-relief-with-blendergis-part-2/ 14/16
11/28/2020 Shaded relief with BlenderGIS, part 2 – The Wandering Cartographer

Hi Vijay,
Wow, that’s quite strange! What is the source of your raster? Is it a geotiff? I wonder if you have
told Blender the wrong projection when you read it in.

Also, I am in the process of updating the tutorial for Blender 2.8 and the corresponding updated
BlenderGIS package. I do recommenced upgrading to this version of Blender.

Reply
Vijay Ramesh says:
August 21, 2019 at 10:13 am
Thanks for the immediate response Morgan. I believe I am using version 2.8 and the right
projected CRS (In fact, the original Geotiff that I use after exporting either from QGIS or R ‘sits
in the right place’ – if I may say so). Happy to send you a .blend file, if you have the time to
take a peek.

Morgan Hite says:


August 21, 2019 at 10:56 am
Yes, do send me you .blend file. I’d be interested in taking a look. It would be good to have the
original geotiff too, so I could look at that in QGIS. morgan@hesperus-wild.org

Reply

Create a free website or blog at WordPress.com.

https://wanderingcartographer.wordpress.com/2014/11/14/shaded-relief-with-blendergis-part-2/ 15/16
11/28/2020 Shaded relief with BlenderGIS, part 2 – The Wandering Cartographer

https://wanderingcartographer.wordpress.com/2014/11/14/shaded-relief-with-blendergis-part-2/ 16/16

You might also like