Documentation/Entity Types/Base/HeightmapTerrainManager.type

From NeoAxis 3D Engine Wiki

Jump to: navigation, search
Go to higher level



HeightmapTerrainManager allows creating large size terrains in the Map Editor. Spacious terrains are split onto smaller parts to build a grid of the specified size. The required parts of the terrain are loaded into memory from the disk and are saved to the disk from memory automatically. Each grid element of the large size terrain is a HeightmapTerrain type object. We recommend using it in all cases when you don't need a large map.

HeightmapTerrainManager 01.jpg

Working with the Terrain Manager


To add a terrain manager onto the map, select the Base\Types\Terrain\HeightmapTerrainManager type in the object creatin window (Object Creation). Then left-click in the workspace of the editor.

HeightmapTerrainManager 02.jpg


To configure the terrain manager, select HeightmapTerrainManager in the object list and click Configure in the property window.

HeightmapTerrainManager 03.jpg

In the manager window you should specify the grid area of the large terrain. The area is specified with address of the top left (From) and bottom right (To) cells. Typically, the starting cell is 0 0, and the ending one sets the size of the terrain. Since the To field specifies an address, it should be equal to H-1 V-1, where H is the number of horizontal cells and V is the number of vertical cells. After specifying the area, click the Create button.

HeightmapTerrainManager 04.jpg

Then, a confirmation window appears asking you to confirm that you want to create the specified area. Click Yes.

HeightmapTerrainManager 05.jpg

Further, the terrain manager offers to automatically generate the height map. If you want to configure the height map manually from scratch, answer No here.

HeightmapTerrainManager 06.jpg

Terrain area generation may take significant time depending on its size.

To remove parts of the terrain, select them in the workspace and click the Delete button.

HeightmapTerrainManager 07.jpg

Updating layers

The terrain is painted layer by layer. The Layers property of the terrain manager allows you to manage layers. If parts of the terrain are already generated, you have to update this property every time layers are changed in the layer manager. Click the Update Layers button right below the manager properties to do this.

To learn more about terrain painting refer to HeightmapTerrain.

HeightmapTerrainManager 10.jpg

Editing the height map

The HeightmapTerrainManager itself isn't responsible for editing the height map of the terrain. For this, there are parts of the terrain represented by HeightmapTerrain type objects. Editing the height map of a terrain is throughly covered in this section.

The terrain manager provides convenient selection of a terrain in the map editor. Use the Select Terrain button for this.

HeightmapTerrainManager 08.jpg

Then, you can select the given part of the terrain in the workspace of the map editor. To cancel terrain part selection, click the Select Terrain button again.

HeightmapTerrainManager 09.jpg


Generating height maps and terrain painting is often more convenient when a third-party tool is used. HeightmapTerrainManager can import data created in such third-party utilities.

A wide list of software to create terrains can be found here.

To import a terrain, open the terrain manager menu using the Configure button in the properties window. In the opened window click the Import button.

HeightmapTerrainManager 11.jpg

You can specify the following parameters in the import window:

  • Source directory — a folder that holds data to import,
  • Import heights — import height maps,
  • Import paint layer — import paint layer of the terrain,
  • paint conversion format.
HeightmapTerrainManager 12.jpg

Heigh and painting data are usually split to files. File names contain the address of the given part of the terrain — horizontal and vertical coordinates. Naming convention of height maps and paintings is specified in the File naming boxes, below the corresponding checkboxes.

For instance, the following name format can be specified output_%x_%y.r32. Where%x is a horizontal coordinate of this part of the terrain, %y is a vertical coordinate. Height map file named output_3_4.r32 is loaded by the terrain manager to the cell 3 4.

After painting is imported, terrain textures can be converted to DDS or PNG formats. There are corresponding options in the dropdown below. To retain the original texture format, select Save original source format.

The terrain manager supports importing of the following formats:

  • 32-bit RAW float (r32) for height maps,
  • BMP and PNG for paintings.
Imported terrains often needs a height multiplier. It can be specified in the HeightMultiplier property of the Geometry property group in the terrain manager. Typical value of 1000 often fits well.
When importing, the first painting layer (Layers) will be automaticall created or replaced.

To start importing, click the Import button. The Close button closes the window.


Special terrain properties are split onto 4 groups: class HeightmapTerrainManager, General, Geometry, Painting, Physics.

Title Description
class Entity
Components List of attached components.
LogicClass Reference to the Logic Editor class. Read more about how to work with the Logic Editor class.
Name Object name.
Tags User defined information. Defined as keyvalue pairs. It is used for user's needs.
Type Object type. It can not be changed.
class HeightmapTerrainManager
CameraDistanceToLoad Camera distance required to load sectors. Specified by a formula. The FarDistance parameter in the formula is the far section distance of the camera plane.
CameraDistanceToLoadImmediately Camera distance to load sectors without background loading. In other words, starting from what distance the sectors must be loaded immediately. Specified by a formula. The FarDistance parameter in the formula is the far section distance of the camera plane.
CameraDistanceToUnload Camera distance to unload sectors. Specified by a formula. The FarDistance parameter in the formula is the far section distance of the camera plane.
MaxLoadedSectorsAtSameTime Maximum number of sectors loaded simultaneously.
MaxTimeToLongTimeNotUpdatedCameras Maximum lifespan of an inactive camera. The scene may contain several cameras, but often only few of them are used simultaneously. This parameter sets the maximum time span after which the camera is considered inactive. Parts of the terrain visible only by an inactive camera ar eunloaded from memory.
AllowVertexTextureFetchOptimization Enable/disable special optimization of terrain rendering. This optimization reduces the amount of memory used by several times.
HeightmapSize Terrain grid size. The bigger this value, the more detailed the terrain is.
HorizontalSize Horizontal size of the terrain.
LODSettings A group of properties to configure levels of detail.
  • Enabled allows to turn off levels of detail completely.
  • LodLevelDistances sets the formula to calculate levels of detail. You can set an arbitrary formula. The "level" parameter is the level of detail taking values of 0, 1, 2, 3 and so on. The result of the formual is a distance a certain level od detail switch to the next one. By default: "100 + level * 200".
  • MaxCount — maximum number of levels of detail.
  • MorphAreaPercent sets the transition width between levels of detail. The default value is 0.3, that is 30% of the distance between two levels.
  • ShowLevels allows estimating distribution of levels of detail (debug property).
Position Position of the terrain on the map.
TileSize Size of a tile. A tile is a group of terrain cells rendered as a whole. For example, a 16x16 tile is 256 cells rendered together. If at least one cell of the tile is visible, the engine renders all of them. Also note that maximum of 5 layers can be put to any one tile. Therefore, maps where more than 5 layers would be painted on the same tile, tiles should be smaller. The exact value of this parameter is subject to the map optimization.
VerticalSize Naximum height in meters. Terrain cannot get higher than this parameter. It is crucial to configure it before editing HeightmapTerrain, otherwise heights of elevations and lowlands will be altered on every change of this parameter.
Visible Show or hide the terrain.
AmbientOcclusion A group of properties to configure and calculate Ambient Occlusion.
  • Blur — is blur applied to the texture after calculation.
  • Enabled allows turning Ambient Occlusion on/off.
  • IterationCount — number of calculation iterations. The higher the number, the better is the quality and the longer does calculation take.
  • Power — intensity of the AO effect.
  • RayLength — calculation ray length. Influences softness of the obtained result.
  • Size — texture size.
CastDynamicShadows Turn on/off terrain shadows. If True is selected, the terrain casts shadows.
DetailMapDistance Visibility radius of detailed textures in layers. If the camera is closer to the terrain than the given value, the detailed texture is used. If the camera is distant from the terrain more than the given value, the detailed textures are not applied to the terrain.
Layers The list of terrain layers. Layers are used to paint the terrain. You can read more about editing the list of layers in this section.
MasksSize Pixel size for the purpose of painting. Higher values mean more detailed/graduated dithering of layers sharper painting.
ReceiveStaticShadows Take into account terrain geometry when calculating static lighting. You can read more about static lighting here.
RenderQueueGroup Render queue of this terrain relative to other objects.
SimpleRendering Turn on/off simple rendering mode. In this mode normal maps, glares and shadows. This mode improves performance. It can be used, for example, to generate water reflections.
Collision Turn on/off collision detection of objects and the terrain.
CollisionHeightfieldThickness Thickness of a body to compute terrain physics. Only applicable to PhysX.
CollisionMaterialName Terrain surface type. Can take one of four values: Metal, Wood, Rubber, Ice. This parameter influences physical bodies interaction properties.