Skip to main content

thumb|Click to enlarge

ETM - Editable Terrain Manager
Description

Real-time editable terrain manager 😊




Editable Terrain Manager

I needed to write a map editor for a strategy game project and therefore needed the possibility to deform and texture terrain in real-time in response to user input. Unfortunately, Ogre's terrain scene manager does not possess any editing capabilities, and so I created a fork, the Editable Terrain Scene Manager. With version 2, I rewrote the interface, and it became the Editable Terrain Manager - that's right, it's no longer a custom scene manager, rather an addon library which simply manages terrain. You can use it with any other scene manager in theory, though in practice I'd recommend the Octree scene manager.

You can get the latest version here: https://www.oddbeat.de/wiki/doku.php?id=etm

Overview

ETM is designed to be flexible, therefore there is no single terrain configuration file as you may be used from Ogre's TSM. Instead, you have to setup the terrain in code (unless, of course, you write your own config file loader).

ETM consists of two main components, the TerrainManager and the SplattingManager. The TerrainManager is the core of the library, it's in charge of creating and displaying terrain. For that purpose, you need to create a TerrainInfo object and pass it to TerrainManager's createTerrain function. The TerrainInfo object can be loaded from an Ogre::Image or from a raw data stream. It specifies the size and extents of the terrain. TerrainManager does not provide a standard material like Ogre's TSM does. You *always* need to provide TerrainManager with the material to use.
The SplattingManager, on the other hand, is more or less optional, but can be used to texture the terrain. Splatting is a technique where a couple of textures are rendered on top of each other based on alpha values in additional textures (which I call coverage or splatting maps). This allows for nice blends between different textures. What the SplattingManager does is manage those coverage maps and allow them to be edited in real-time. To actually make use of it, you need to use the coverage maps together with the splatting textures in a material which does the splatting.

Apart from the core components, there are a couple of convenience functions. The most notable is probably the one to create a lightmap with terrain shadows for your terrain. The calculation is pretty fast, it can definitely be used inside editors with real-time recalculation after deforms if your mapsize is moderate.

Features

  • Manages and displays heightmapped terrain just like Ogre's ETM
  • Allows real-time terrain deforming
  • Supports loading and saving of terrain heightmaps in image or raw format
  • Manages and edits coverage maps for texture splatting
  • Supports loading and saving of coverage maps from/to images
  • Lightning-fast lightmap generation function
  • Base texture generation
  • Terrain minimap creation function

Sample

The best way to learn how to use the Editable Terrain Manager library is to look at the sample provided with the sources. It contains basic editing and texturing functionality for terrain.

Image

Image

Image

Bindings for other languages

See also

  • Artifex Terra - Height map editor and painter for terrain (based on Editable Terrain Manager)