Creating terrains using heightmaps.
Terrains are most often used in open landscape based mutli/single shooter 3d games. There is a huge league of software to create the required terrain for your game. Many 3d modeling tools like Maya/3dsmax etc. allow users to pull/push certain vertices and create a decent looking terrain which can be later on ported to your gaming engine for use.
As I see it , we need to create random terrains for levels and the game designer can find it really tough to generate them on the fly…
The best way to go about creating terrains is to make use of height maps (We used http://www.bundysoft.com/L3DT/ to create height map, this is something that works for us). L3DT is easy to use software and allows you to create/modify terrains on the fly with easy steps. P.s: read the doc on L3DT on how to create heightmap for the terrain.
Let us now go about creating a terrain out of the bitmap that we got. Again, steps we shall follow :) !!
1. Create a heightmap image using L3DT application, export it as bmp.
2. Import the image into Director 11 as a cast member.
3. Read the pixels in the bitmap image and store it in a matrix say matrix_heightmap[][].
4. Parse the matrix_heightmap[][] matrix and create a 3d mesh out of it.
5. Create a terrain descriptor using
createterraindesc(terrain_matrix, friction, restitution)
6. Create the terrain with the descriptor created above using
createTerrain(t_name,t_desc,position,orientation,row_scale,col_scale,heightScale)
You can download the sample file here which explains the creation of terrains in detail. ( requires adobe Director 11 and Ageia physx Extra).
Buy us a coffee mug !