Simple terrain mesh using the Displace Modifier in Blender 2.49 [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 2.49.
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 artefacts.
Design note: jpg images tends to display compression artefacts 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 512×512 pixels in ‘height x width’.
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 Setup, Mesh & Materials
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 add a "Plane" to the scene (remove the cube if desired, "Del") using "Shift+A" to open the "Add" menu, selecting "Mesh » Plane" from the available options. In ‘Edit‘ mode ("Tab"), "Select All", "A" and "Subdivide" the mesh a number of times (‘six’ is shown in the video’). Exit ‘Edit’ mode ("Tab"). Click the "Shading" ("F5") button to add a new, or use a pre-existing material. Click the "Texture" button ("F6") and add a new, or use a pre-existing slot, note the name used for this ("Tex" is shown in the tutorial). Change "Texture Type:" to "Image" and click the "Load" button to open the file browser; find the asset to be used (the heightmap for in this tutorial for example), select it and click "Select Image". On doing this Blender will return to the Texture slot with the new image in place (should be displayed in the ‘Preview’ pane).
With the material set-up, assign it to the mesh by selecting the Object and then the material via "Material" properties – in the "Link to Object" panel, click the "Browses existing choices or adds NEW" drop-down menu and select the slot previously created.
Modifiers & Displacing a Mesh
The next step is to deform the mesh using the texture. In ‘Object’ mode, select the subdivided plane and then click "Editing" buttons ("F9"). Find the "Modifiers" panel and click the "Add Modifier" button. From the list select "Displace". A new set of properties will appear. Here, in the "Texture:" property, add the name given to the Texture slot previously created, in this instance that’s "Tex". On pressing "Enter" the mesh will deform based on the ‘black‘, ‘white‘ and ‘grey‘ values present in the heightmap image. To reduce or increase the deformation 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 to the mesh.
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.