From NeoAxis 3D Engine Wiki
|Language:||English • Russian||Status:||Approved|
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.
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.
To configure the terrain manager, select HeightmapTerrainManager in the object list and click Configure in the property window.
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.
Then, a confirmation window appears asking you to confirm that you want to create the specified area. Click Yes.
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.
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.
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.
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.
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.
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.
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.
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.
|Components||List of attached components.|
|LogicClass||Reference to the Logic Editor class. Read more about how to work with the Logic Editor class.|
|Tags||User defined information. Defined as key — value pairs. It is used for user's needs.|
|Type||Object type. It can not be changed.|
|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.
|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.
|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.|