Previous Chapter: Blender Basics
As I mentioned earlier, Blender is like a virtual photography studio. We’ve got our camera, our light source, and the object we want to take pictures of. Let’s take each of these three pieces one at a time, starting with the last one: the thing we want to photograph. Our goal here is to generate a 3D model of our terrain within Blender, so that eventually, when we’ve positioned the light source and camera correctly, we can capture a relief image.
So, where does the terrain model come from? Well, we’re going to make a plane in Blender, then deform it according to our heightmap file (that greyscale terrain image), making some parts of the plane higher or lower based on what the heightmap says. First, though, we need to start with a clean slate. Get rid of all the various meshes you made (including the default cube), so that you’ve got a blank scene with just a camera and a light source. You can also just restart Blender and delete the default cube. Remember, you can delete an object by selecting it and hitting the Delete key. Hitting X also works.
Next up, let’s add in a plane mesh by hitting Shift-A and choosing Mesh → Plane. As before, it’ll appear wherever we last had our 3D cursor.
Let’s move the plane to the center of our coordinate grid (it’ll make lining things up easier later on). Select the plane, then go over to the Properties panel. This time, select the tab with the icon that looks like an orange square; this will take you to the Object Properties. Among other things, you’ll see info on the XYZ coordinates of the plane under Location.
You can change these numbers (and thus move the plane) by clicking in the center of each. If you click on the triangles on the sides of a number, you’ll end up incrementing/decrementing it. Change each number to zero, and watch the plane move to a more convenient location.
While we’re here, there’s one other thing we want to change: the aspect ratio of the plane. I can stretch it in one direction or another by entering numbers in the X and Y fields of the Scale just to the right of the Location fields. We need the plane to match the aspect ratio of our heightmap. Right now it’s a square (though it might look like a rectangle, depending on perspective distortion and the angle you view it from), and that’s really only good if we’ve got a square heightmap (which perhaps you do). The one I’m using in this tutorial, though, is 2000px wide and 2800px tall. I could plug in 2000 for the X and 2800 for the Y value of the Scale, but if I do that, the plane will become huge and fill the whole screen. Let’s do something more manageable and just plug in 2 for the X and 2.8 for the Y value. The actual numbers don’t matter much, just so long as their ratio matches the heightmap. Plug in whatever numbers work for your own heightmap if you’re using your own.
Setting up a Material
Ok, so now we’ve got our plane in the right position and it’s the right size; it’s time for things to get really complicated. When I write tutorials, it’s important to me that I don’t just offer you a step-by-step list of “click here, type there.” I prefer to try give you an explanation as to why you’re doing these things. So, let’s take a moment learn a little more about 3D modeling.
In the real world, substances such as wood, stone, glass, etc. look different from each other because they have different colors, different surface textures, different roughnesses, etc. Blender is designed to simulate these variations by letting us assign different material properties to our objects. This is a big contributor to the realism of 3D models: the rendering engine calculates the scatter & bounce of light differently for different objects based on the properties they’ve been assigned. Each object in Blender is made of what the system calls a material. Materials are just collections of properties that tell Blender how light should interact with the object — basically, what sort of real-world substance the object should pretend to be made from.
As our next step, we need to assign a material to our plane, so that it’s made from something. Right now it’s not really made of anything, so the system is, by default, giving it a dull grey appearance. If you render the scene, you’ll see what I mean.
To set up a new material, let’s start by looking at the plane’s Material Properties. Make sure your plane is selected, and then click on the little icon that looks sort of like a sphere with a checkerboard pattern on it, on the Properties panel.
Here, in Material Properties, we see that the plane has no material. It’s not really made from anything, and right now the only reason we can see it on our renders is because Blender has filled it in with some default material. Let’s change that by hitting the New button.
Blender creates a new material for you called “Material.001” or somesuch. You can call it whatever you’d like, if you want to put in a new name. In any case, some properties of this material should now appear in the window. For now we actually just want to keep the default settings here, but, again, I am strong believer in the “understand what’s going on” model of tutorial vs. the “click this and things will just work” model, so let’s have a quick look at what we’re seeing.
The Surface option for the material says “Principled BSDF,” which is the name of a type of shader. We don’t really need to get into those much here (again, we’re just scratching the surface of what Blender can do), but basically it tells Blender how light should bounce off this object. If you click on that Surface menu, you’ll notice there are lots of other shaders there. Glossy ones, glass ones, hair ones, etc. Each represents a different way (a different set of mathematical models) for light to scatter off an object. For making our shaded relief, we’re going to stick with the default Principled BSDF (that stands for bidirectional scattering distribution function, if you’re curious). We don’t need to make our shaded relief terrain out of glass or velvet (once we’re all done you can come back and give it a try: it’ll look interesting, but it generally won’t be very cartographically useful).
There are a lot of options for this shader: roughness, sheen, color, etc. Changing these is what produces different surface appearances, causing an object to look like it’s made from water, wood, skin, etc. But, right now we only have a really basic flat plane, and so if you change anything, you might not really see much of a different in the rendered image. A little later on, once we’ve got our terrain loaded in, we’ll come back to this and mess around, but for now let’s just leave things in the default settings.
Displacing the Plane
Blender materials don’t just describe an object’s color, or whether light should interact with it like it’s made from glossy paper or from velvet. Materials can also have displacements — basically, bumps in the surface. And this is where we can turn our simple plane into a 3D terrain model: we’re going to tell Blender that we want our material to be bumpy, and those bumps are going to form the shape of our terrain.
The left side of your screen, where you see your plane and the other elements in your 3D scene, is called the 3D Viewport. We can change this window to show other Blender modules. Click the icon on at the top-left of the 3D Viewport, which looks like a perspective grid with a sphere on it. Then, switch to the Shader Editor by choosing from the menu.
The 3D Viewport is gone and replaced with a different type of workspace, the Shader Editor. Now, make sure your plane is selected (remember, you can use the Outliner on the right side of the program to select things). Once you’ve got your plane selected, if you’ve applied the material correctly, you should see something like this:
This is a little diagram that shows how our material works. You can zoom and pan just like in the 3D view, if you’d like to adjust what you’re seeing, and you can also click and drag objects to move them around. Right now it looks like we have a Principled BSDF shader with a light grey color. This is exactly where we left things in the Material Properties panel, and in fact this little box shows all the same options and settings. It’s just another way of looking at the same information. This box is a node, and notice the line showing that it is plugged into the Surface of our final Material Output, meaning it’s what’s being used to determine the plane’s surface appearance and its light-scattering properties. Notice that our material output also has an option for us to plug in something that will give the surface a Displacement. This is where we will add our bumpiness. From the top menu bar, choose Add → Texture → Image Texture. A new box will appear in our shader editor. Place it wherever you like, and remember you can move it around later by clicking and dragging.
In Blender terms, a texture is an image or a simple pattern that gets applied to a material to change its appearance. We could use textures to change an object’s color, for example: I could load in a little photo of a wood grain and use it as a repeating texture to cause my plane to look like it’s made of wood. Maybe you’ve done stuff like this in Photoshop or other image editing programs before. But Blender can also use textures to bumpify (to use a John Nelson sort of word) our plane. So that’s what we’ll do.
We need to first load in our heightmap. Click the Open button in the Image Texture box. You’ll can then browse around until you find and select your heightmap. Once you’ve got it loaded in, you should see its name appear. You might want to click and drag on the edge of the Image Texture box in order to make it bigger.
Now, let’s plug this thing in. Click on the dot on the right side of the box that says Color and then drag over to the dot on the Material Output box that says Displacement. They’ll connect. We’ve now told Blender that it should look at the color (lightness or darkness in this case) of our heightmap and use that to determine where our plane’s bumps should be higher or lower.
While we’re here, let’s tweak one other setting. Click on Linear and change it to Smart. This changes the interpolation of the texture to be a little nicer-looking. Your heightmap may need to be resized/resampled a bit to fit the size of your final rendered image, and this just tells Blender how to do it. If you’ve used Photoshop or ArcMap to resample things, you’ve seen similar settings to these.
Now, let’s render the image and have a look at how bumpy our plane has gotten!
Now it’s starting to look like terrain. However, as satisfying it may be to look at, it’s all built on a lie. Earlier on, I said the idea here is to get Blender to deform out plane and make parts of it higher or lower, to create terrain. However, right now Blender is only simulating displacement using a technique called bump mapping. It’s faster to calculate, but it’s not as realistic. Blender is using a quick, simple calculation to give an appearance of depth, but the bumps aren’t real: they don’t cast shadows, and light doesn’t bounce off them. It’s just some discolorations on the plane. We still need to make some adjustments to get Blender to do a true displacement instead of a simulated one. The terrain we have looks OK now, but it will look a lot better once we get Blender to do the real thing.
We’re asking Blender to look at our heightmap and use it to apply bumps and valleys to our plane. However, our plane right now is far too simple for that to work. It’s made up of only four vertices.
These vertices are the actual things which Blender moves up and down to make those bumps and variations in the terrain. So, right now, all that Blender could do is nudge the corners of our plane a bit. There are no vertices in the middle of the plane for it to adjust. Ideally, this plane would be made up of a sea of many thousands of vertices, each of which could be adjusted up and down to create the terrain.
We were still able to do a simulated relief using a bump map because Blender didn’t care about how many vertices were there — it just painted some light and dark pixels on our plane, rather than actually warping the plane. But if we’re going to actually displace it, we need to make the plane more detailed and complex. First, make sure it’s selected. Then, go back over to the Properties Panel and click on the blue wrench icon to bring up the Modifier Properties. From the dropdown, choose Add Modifier → Subdivision Surface.
The Subdivision Surface modifier (“subsurf,” as it is often called) tells Blender to increase the detail level of a simple object. This involves subdividing objects to add more vertices, and can also involve smoothing or rounding. Modelers use this tool heavily: it lets them make complex, curved shapes while only having to draw simple meshes.
In our case, we’re going to simply use it to cut our plane up into a bunch of tiny pieces so that it has more vertices, which means we’ve got more places for our heightmap to make bumps.
First off, make sure Simple is selected. There are a couple of algorithms for subdividing things, and this is the one we want. The Catmull-Clark algorithm will make the edges of your plane start to round off, and we don’t want that.
Next, check the box for Adaptive. This tells Blender that, instead of dividing the plane up by a set amount, it should decide how much to divide the plane based on where more detail is needed. It will look at how big of a relief image you’re going to generate and how far away different areas are from the camera (once we eventually put it in the right spot, directly overhead), and then decide how much detail each part of the terrain needs. It’s pretty clever. If you don’t see the Adaptive option, make sure you turned on the Experimental features in the previous part of the tutorial.
Though you may be tempted to, there is no need to click the Apply button. In fact, you shouldn’t. This subsurf modifier is a non-destructive filter; perhaps you’ve seen things like this in Illustrator, Photoshop, etc. It’s not actually changing the plane right now: it’s still really just made of four vertices. Instead, Blender will subdivide the plane up at render time, and then only temporarily. Hitting Apply will permanently subdivide the plane up into thousands of vertices. This will slow your computer down and make your saved file sizes much larger. It will also make rendering slower. And it won’t let Blender adaptively determine where more or less detail is needed. So, in sum, let’s leave it be. We’ll keep our plane very simple and easy to use, only temporarily making it complex when it’s time to do the render.
Now that the plane has been subdivided many thousands of times, Blender can start actually displace it up and down, once we tell it to. So, let’s tell it to.
First, we need to add a node to our material. Make sure your plane is still selected, and then go over to the Shader Editor. From the top menu bar, choose Add → Vector → Displacement.
Now, we need to connect this correctly. Connect the Color of Image Texture into the Height of the Displacement node. Then, connect the Displacement output of the node into the Displacement input of the Material. This is telling Blender: look at the color (light or dark) of the image, turn that into a displacement, and use it to warp the plane.
If you render right now, you’ll notice nothing has changed much. One more setting remains: we need to tell Blender to stop bump mapping and start displacing. We’ve subdivided the plane and we’ve plugged in a displacement node, but Blender doesn’t really make use of any of this stuff until we actually tell it to. With the plane selected, head back over to the Material Properties by clicking on that checkered sphere icon again. At the very bottom of the panel, there are some Settings options. You may need to click on the word Settings to get them to appear (and you may want to collapse the Surface options so that you don’t have to scroll down so far). The Displacement option will be set to Bump Only. Change it to Displacement Only, instead.
We’ve now turned off bump mapping and told Blender to start actually displacing the plane, using the subdivisions we created and the texture we plugged in. If you render the image, you’ll notice that it takes a lot longer — though true displacement is more realistic, it takes much more calculation than the simple simulated bump mapping. You’ll also notice that the terrain is comically exaggerated.
Setting aside the crazy elevation, notice how, this time, the terrain is actually in true 3D. Notice, for example, how the edges of the plane aren’t straight lines anymore. As the terrain becomes higher and lower, the edges go up and down. Before, when we were doing bump mapping, Blender was just putting some light and dark areas on a flat surface to make it seem like it was bumpy. Now that we’ve fixed the setting, the terrain is actually bumpy.
By changing the Scale parameter on the Displacement node, you can make the final render less crazy. Since our lighting isn’t set up yet and our camera is in the wrong position, we don’t really know what the final shaded relief will look like, so we don’t know yet what the best setting will be. So, let’s leave the Scale parameter for later.
Next thing to adjust here: notice the weird thin sliver of terrain at the top left of the rendered image? The terrain is nearly flat, and then suddenly spikes. Blender is taking your heightmap and trying to wrap it around the edge of the plane just a little bit. Basically, it’ll take a little sliver of the terrain from the bottom of the image and put it on the top, or from the right and put it on the left, etc. Let’s fix that. In the Shader Editor, look again at the Image Texture node. Where it says Repeat, choose Extend from the menu. This tells Blender that you don’t want your image to be a tiled, repeating pattern, but instead to stretch from edge to edge on the plane.
Now when you render, the edge should be “clean,” (though everything’s still pretty spiky).
Fun with Materials
Hey, have you saved lately? Make sure to do that.
Now that we no longer have a boring flat plane, we can go back to our Principled BSDF shader and mess with its settings. By changing the various sliders, you can make the terrain respond to light differently. For example, if you change the Transmission to 1, and the Transmission Roughness to 0.5 now your terrain is made of glass.
In truth, most of these settings won’t be useful for doing relief, so this part is just for fun (though if you want to go beyond simply doing shaded relief in Blender, and start rendering grass, water, dirt, etc., some of these settings could be useful). When you’re done messing around, I recommend you choose the following settings:
These are mostly the defaults, except I increased the roughness and reduced the specular, so that our material has a matte surface. I also darkened the base color a little bit. I recommend setting the R, G, and B values to 0.6. Shaded relief only works if we have both shadows (areas darker than our base) and highlights (areas lighter than our base), so we need our base color to be dark enough that it can brighten noticeably when lit up. You might try making the base color even darker. You can also go back and change these settings later on.
So, let’s briefly recap our efforts up to this point:
- We made a plane mesh.
- We told Blender that the plane is composed of a grey material.
- We told Blender to subdivide our plane into many, many pieces, so that it had lots of vertices to move up and down.
- We told Blender to displace the plane according to our heightmap.
With that, we’re done messing around with the plane for a while, and it’s time to tend to other parts of our photography studio.
Next Chapter: The Camera