is a program for building height map from landscape mesh.
Video: https://www.youtube.com/watch?feature=player_detailpage&v=dYNsxpnVMaw. (quality 720p and fit to full frame).
Or avi file (72 Mb). (XVid codec).
The mesh can be present of any text file.
The file should contain data on the grid: the vertices, normals. The file also needs to be a description of the landscape of the triangles (vertex indices).
UV coordinates will be built automatically.
Game map is a structure that contains a lot of data, one of which is a height map. Height map is a regular grid, each cell contains the height at that point.
Map is divided into regions (tiles). Tiling allows you stretch a unique texture on the map. Also, it optimizes the pathfinding, physics, AI on the game map.
Height map consists of chunks of heights. Map tiles have references (id) to these chunks. Some tiles may have the same reference to a chunk of heights,
if the terrain mesh of tile is the same. This saves memory.
Mesh of the landscape does not have to be regular. But it should be a regular on the borders of tiles.
In the picture you can see the 4 quads (top view). They are regular and are the same size. But inside the quad grid can be any.
This can be done in the 3ds Max is easy.
The mesh file is the any text file. It's very simple: land.txt.
In this file section
"MeshDeclarations" describes count of vertices and polygons.
Section "SubMesh" describes vertex positions.
Section "Indices" describes the polygons (triangles) - indices of the vertices in triangle.
Section "Normals" describes the vertex normals.
Texture coordinates (uv) are automatically generated. For tile range is 0..1. Also uvs reflected on neighboring tiles for seamless texturing of the terrain.
You can use my exporter for 3DS Max or upload their own terrain mesh from any 3D modeling program.
You can download demo MapCreator. (900Kb).
MapCreator saves the
height map as an array of bytes. It may be words, dwords if you get source
Befor array there is the header. In the header are size of map, tile size, height step etc.
The demo does not store the height map.
The source code is
C++ project for VisualStudio2008.
The source code demonstrates the creation DX10 application, creation game map, load terrain mesh, load texture,
calculation height map, creation tiles, save height map, save tiles layout.