The height maps as introduced in version 2.2 allow us to change the topography based on the luminance values in a bitmap. The principle is simplicity itself. The color in our texture image (picture) is defined by 3 color components, Red, Green and Blue. Each of these components can have a value from 0 (none) to 255 (max). Some images also have additional components but we are only concerned with the color.
The height map feature lines up the picture with the terrain polygons as if you are looking straight down from directly above the landscape. It finds the pixels that correspond with each point in the triangles that make up the terrain. It looks at the color in this pixel, and adds up the color components. This value is then divided by 765 (the maximum value possible, 255+255+255). This results in a range from 0.0 to 1.0 based on the “luminance” of the pixel.
When you define the terrain you enter a “height”. This value is multiplied by the luminance value in the height map to get the adjusted height of the terrain at each point. So if the pixel is black (0,0,0) the height is multiplied by (0+0+0)/765 = 0.0, or no height. If the pixel is a perfect red, the height is multiplied by (255+0+0)/765 = 0.3333 of the max height. If the pixel is perfect white (255,255,255) the height is multiplied by (255+255+255)/765 = 1.0 of the max height.
For the Battlefield Maze example, we created an image of a maze type of puzzle in a paint program. This image has only 2 colors, black and white. We created a rectangular terrain and used the image to control the height of the points in the triangles that make up the terrain. The result makes for an interesting field to fly in.
You can modify the terrain in several ways to gain experience in using height maps. After loading the field, right click on the terrain object and select “Terrain Edit”. Notice that “Circular” is turned off, so we will make a rectangular terrain. The length and width are set for 7200. The “F” is selected, so this is feet, or 1.36 miles on each side. The “Height” is set to 500 feet. “Noise” and “Local Z Flat” are set to 0.0, so they will remain constant (they still have an effect, even when at 0.0, but it does not vary based on the point’s position).
These are self evident in their impact, but two of the other variables and features, “Valleys <=> Peaks” and “Midridge” require a little play to understand enough to use.
“Valleys <=> Peaks” is set to 1.0. This is a second modifier that allows you to move the positive values of the terrain up and down from the origin. Values that are black (0 height) will not be affected. You can change the value, then click “Make/Modify” to see the effect. You can explore this by trying various values. Change it to -1.0. Notice that the high parts are now depressed. Does this make sense to you? To use the feature for your own terrains, just try values until you get the result you are after.
“Midridge” is off in this terrain. If you turn it on and click “Make/Modify” you’ll see what this feature does. Try it with the “Smooth” and the “Sharp” option on, and again with neither of these on. Midridge works in combination with, and has a similar affect to the “Local Z Flat” option, except “Local Z Flat” only modifies the center of the terrain, while “Midridge” modifies both the center and the outer edge of the terrain.
Notice that the terrain has X and Y Divisions of 36. This tells the terrain tool how much resolution to use for the terrain. In this case the terrain will have 36*36*2 = 2592 triangles. You can use a higher or lower resolution if you like, but make sure you have a graphics card that is powerful enough to render the terrain in real time during the flying routines. NOTICE that if you change the resolution, the terrain tool will delete the current terrain and create a new one. This means you will lose the current texture mapping. If you do this you will have to reapply the texture map after you finish making your new terrain. Don’t be afraid to try it. If you don’t like your changes, you can always close the file without saving it, then reload the original file. (To reapply the texture map, right click on the new terrain object and select “Surface Properties”. Go to the “Texture” tab. Scroll to the texture you want to use and select it. Now click the “Projection” button. Select “Projection” then “Z Projection”. The texture will be applied in exactly the same position as is used for the height map.)
I hope the Height Map feature as well as the terrain tool in general is now a little clearer to use.
You can download the Battlefield Maze flying field now at this download page.
Good Digital Modeling
Sunday Flyer Software