In this tutorial we create an outdoor scene in Irrlicht with the built in terrain rendering.
DOWNLOAD THE DEMO AND SOURCE CODE
Irrlicht is a very versatile 3D engine, being able to display indoor and outdoor scenes with ease. Here we will create a terrain scene node to display an outdoor scene.
ApplicationManager.h / ApplicationManager.cpp
As before, we define several constant values that will determine how the terrain is displayed.
The terrain will be created using 3 bitmaps: the heightmap, the base terrain texture, and a detail map.
The height map is a black and white image where the height of the terrain is measured by the brightness of each pixel. This essentially means that white areas make mountains, and black areas make valleys. This is used to create the mesh that will represent the terrain.
Onto this terrain mesh we will add the base terrain texture. This material stretches across the entire terrain.
Typically the base material will not have enough detail when the camera is right up close. This is becoming less of an issue as PC’s get more and more memory. However, we can add some detail to the terrain material by repeating a detail texture across the surface of the terrain. This detail map is usually a non-descript image that looks like the bumps and cracks you’d find on the ground. The TERRAIN_DETAIL_SCALE constant defines how many times this image is repeated across the surface.
Because the terrain is quite large (as you would expect) we use the default values for the speed of the FPS camera (as opposed to slowing is down as we have for the last few tutorials). We also want to set it slightly above the surface of the terrain initially, and to make sure the furthest edges of the terrain can be seen we increase the cameras far value.
Next we create the terrain itself by calling the ISceneManager addTerrainSceneNode function. We only supply the height map at this point, as the default parameters are fine for our basic terrain.
By default the height of the terrain (i.e. the y value of the points painted in white in the height map) are way too high, so we scale the terrain to make it look more natural.
The terrain material is shaded before it is rendered by Irrlicht. I have used a program called T2 to create a terrain material that has shadows “baked in”. Because of this we don’t want the terrain to be lit by Irrlicht, which means we have to disable the lighting.
The two materials, the base material and the detail map, are then added to the terrain. We then tell Irrlicht that the second material layer is a detail map, and scale it so that it is repeated across the surface of the terrain.

In this article I introduce you to the series, Specifiers in C++....
In this article I introduce you to a tutorial series titled, Some Features of C++ Entities....
C++ is a computer language I want to teach in these tutorials. C++ is a very developed language...
In C++ an array is a set of consecutive objects of the same type, in memory. We see how to crea...
A database is a set of related tables. This is part 1, division 1 of a series I have on databas...
In this tutorial we add mouse interactivity to the scene....
In this tutorial we allow the view of the isometric scene to be moved with the mouse....
In this tutorial we show the height of an isometric object by adding a shadow....
In this tutorial we modify the appearance of the isometric cube at runtime....
In this tutorial we add some animated isometric boxes to the scene....