Simple terrain meshes using the Displace Modifier in Blender [VIDEO]

Although making a terrain is generally regarded as being the most problematic asset to produce for game related projects, it need not be. Using the "Displace" modifier in Blender provides a quick way to create terrain meshes so long as a few ground rules are followed.

The following video tutorial runs through the basic process, making a simple terrain in Blender.

Making a 'Heightmap' ^

The defining characteristics of a terrain are determined through the use of a special image. Called a "Heightmap", this image uses 'black', 'white' and 'grey' to represent the lowest and highest peeks possible in a mesh, with 'grey' being a variable in between the two. In practice this might mean being able to create a terrain that has a 'floor' and 'peek' (cliff top) with a graduated ramp between the two. Generally speaking heightmap dimensions should conform to the Power of Two rule irrespective as to the size and/or dimensions of either the mesh to be deformed or the amount of area that's actually needed. Ideally heightmaps should also be saved using an uncompressed or 'loss less' format to avoid potential issues that may occur due to compression artifacts.

Design note: jpg images tends to display compression artifacts that manifest as lines and blocks (depending on the level and type of compression) that can be incorrectly interpreted by Blender as being legitimate tonal values for deforming a terrain. This needs to be avoided where-ever possible.

The physical size of a heightmap is not as important as tonal variances contained within, so although an image can be of reasonable size relative to normal texture creation, terrains typically being much, much larger objects mean an image matching the size of a mesh will more-than-likely be impractical. There is no real need therefore to make heightmaps larger than 512x512 pixels in 'height x width'.

Grey-scale image used to displace mesh

The heightmap used to deform the terrain is a simple image with 'black', 'white' and 'grey' representing various levels of mesh deformation - 'white' the highest, 'black' the lowest and 'grey' variations in between

Scene set-up, adding a Plain ^

The basic principle behind making a terrain using a heightmap is to use said texture as a means to deform a suitable prepared mesh. This is done using the "Displace" modifier.

First use "Shift+A" to add a "Plane" (delete the cube, "Del") - "Add: Mesh » Plane". Select the mesh and "Tab" into 'Edit' mode, "Select All", "A" and on the right-hand side, click the "Subdivide" button in the ToolShelf 'six' times. Press "Tab" again and exit 'Edit' mode. This should result in an object which consists of approximately 4096 faces.

Create & assign a Material ^

Next, click the "Material" properties button on the left and either add a "+ New" entry or use one that already exists by clicking the "Browse Material to be linked" button directly under the 'Material List' - select "0 Material" as shown, this is/was the default material assigned to the default cube. Once created, click the "Textures" property button and again add a "+ New" entry, or as before select a pre-existing slot - click the "Browse Texture to be linked" button directly under the 'Texture List' and select "0 Tex".

Design note: the "0" in front of both the Material and Texture name when using a pre-existing reference is indicative of there not being any 'Users' for those items, i.e. they have yet to be (re)assigned to anything (mesh).

Then change "Type:" to "Image or Movie", "Coordinate:" to "UV" (in the "Mapping" sub-section) and then finally in the "Image" sub-section click the "Open" button to find and load in the heightmap via the "File Browser" - select the file and click "Open Image". With the material then set-up, make sure it's assigned to the mesh by selecting the Object and then the Material itself from the "Browse Material to be linked" button in Material properties (directly under the 'Material List').

Modifiers and displacing a mesh ^

The next step is to deform the mesh using the heightmap. In 'Object' mode, select the subdivided plane and click the "Object Modifiers" properties button, click "Add Modifier" and select "Displace" from the list. A new set of options appears. In the "Texture:" sub-section click the "Browse Texture to be linked" button (checker icon) and select the materials 'Texture' slot from the list, in this instance "Tex". On doing so the mesh will immediately update in the 3DView showing the appropriate levels of displacement relative to the heightmaps 'black/grey/white' tonal variations.

Design note: the heightmap image itself cannot be assigned directly, hence the need to set up a proper, if basic, Material.

To reduce or increase the displacement value, change "Strength:" as appropriate - higher for more displacement, lower for less. Once happy with the degree of displacement, click "Apply" to 'make real' the changes.

Misc. Scene information ^

Once the desired detail has been produced, the mesh then needs to be optimised using the "Decimate" modifier and then finally UVW mapped and textured in a way that's appropriate for the destination technology - this can mean simply mapping a single image to the entire mesh or unwrapping using a more complex approach that's determined by the game engine or technology the terrain mesh is for.