If you haven't done so already, be sure to visit the Wiki Portal to read about how the wiki works. Especially the Ogre Wiki Overview page.
There are two main terrain methods available to be used with Ogre - static meshes and height maps.
Static meshes allow more freedom with terrain as you can have overhangs. You will need to implement collision detection however if you wish to have entities interact correctly with the terrain.
Can be used with octree scene manager.
Ogre Files you need :
- .scene : shows the location and properties of the landscape nodes
- .material(s) : for materials used by landscape
- .mesh : actual landscape mesh
Typical content creation process (using octopus exporter as example)
- Create terrain mesh using modelling program
- Attach required textures (ie materials).
- Export the scene as .scene file.
- Export the mesh in XML format
- Mesh XML file serialized into .mesh format (by OgreXmlConverter).
- Materials (textures) exported as .material.
TO DO - .scene processing/using these in an application.
Heightmaps)) are more limiting in that you cannot have overhangs in the terrain. For further terrain details such as bridges for example - you will need to add these as meshes on top of the height map. If you wish to have a cave you would need to leave a hole in the height map in order place meshes later at the appropriate locations.
Heightmaps are better suited for large maps and can be further optimised by using the paging scene manager.
These scene managers provide an optimized getHeight function which allows entities to be easily snapped to the terrain. There would still need to be further collision code implemented for any terrain related meshes on the landscape.
Others advantages comes from advanced use of heightmap configuration :
- Faster Loading and smaller disk size
- Vertex displacement
- Horizon culling
- Dynamic texturing
- texture coordinates sharing across pages
- Vertex program based morphing between LOD levels
Typical content creation process of a heightmap :
- Create height map using a height map editor. 8 bits or 16 bits height maps are supported. Important: The image format must be saved in monochrome mode - height maps in RGB mode (24bit) will throw an exception.
- Create necessary terrain coloring textures : Terrain Scene Manager needs to 2 textures (Detail is 8 bits gray noise & Color that is usually 24 bits, but you can provide any custom material you want). Paging Scene Manager has multiples combination of texturing up to 4 textures (grass, sand etc.) mixed at the same time, using 4 splatting texture ( 8 bits images )
- If using Paging Scene Manager - preprocess height map through map splitter to split heightmaps in pages, and generate color and splatting textures.
Heightmaps and textures can be generated randomly by several programs. Look to DCC Tools.
With terrains of meshes it's easy. Look e.g. the OgreNewt examples in the Ogre SDK.
With heightmap terrains it's difficult:
The (old) terrain scene managers typically don't just use normal meshes. If they did they wouldn't be specialised terrain scene managers, they'd just be normal scene managers displaying a load of meshes. They use all sorts of fancy LOD and morphing algorithms (or something like that) to provide performance optimisations for huge terrains.
It's not just as simple as getting the meshes that the terrain uses, because it probably doesn't use any.
- Use the same heightmap image that the terrain uses and build your trimesh? manually from that.
- Query the heights of the terrain at many many points using a ray query and use that to build your terrain trimesh.
- Use the ray scene query on the fly with a specialised terrain collider, like what OgreOde does.
Written by monster in forum in May 2005. If it is not up to date, please correct.
In Ogre 1.8 the old Terrain Scene Manager will be removed and replaced by a new Terrain System.
The content on this page is licensed under the terms of the Creative Commons Attribution-ShareAlike License.
As an exception, any source code contributed within the content is released into the Public Domain.