Skip to main content
History: Terrain Howto
View published page
Source of version: 13
(current)
There are two main terrain methods available to be used with Ogre - static meshes and ((-Height Map|height maps)). See also ((SceneManagersFAQ)) and ((DCC Tools|#World design|World design)) for related information. {maketoc} !!Static Meshes Static ((-mesh|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 ((-texture|textures)) (ie materials). * Export the scene as ((DotScene|.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 {IMG(src="img/wiki_up/Terrain_texture_heightmap.jpg",thumb="y",button="y", rel="box[g]",width="250")}{IMG} ((-Height Map|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. The ((Terrain Scene Manager)) and ((Paging Scene Manager)) can be used with heightmaps. TODO - add other scene managers. 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|Vertex)) displacement * Horizon culling * Dynamic texturing * Deformation * texture coordinates sharing across pages * Vertex program based morphing between ((-lod|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|#Terrain generation)). !!Collisions 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. So either: * Use the same heightmap image that the terrain uses and build your ((-trimesh|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|OgreOde)) does. ''Written by monster in forum in May 2005. If it is not up to date, please correct.'' __Note:__ In Ogre 1.8 the old ''Terrain Scene Manager'' will be removed and replaced by a new Terrain System. In the forum is a code for implementing terrain collision with ((OgreNewt)) by building up a TreeCollision. ([http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=1819&start=40|look here]) --- Alias: (alias(TerrainHowto))
Search by Tags
Search Wiki by Freetags
Latest Changes
Projects using OGRE
Building Your Projects With CMake
Compiled API Reference
Overlay Editor
Introduction - JaJDoo Shader Guide - Basics
RT Shader System
RapidXML Dotscene Loader
One Function Ogre
One Function Ogre
...more
Search
Find
Online Users
156 online users
OGRE Wiki
Support and community documentation for Ogre3D
Ogre Forums
ogre3d.org
Log in
Username
Password
CapsLock is on.
Remember me (for 1 year)
Log in