-
Notifications
You must be signed in to change notification settings - Fork 77
Terrain
Our terrain is based on the clipmapping technique, both for the geometry as well as the texturing. The main purpose of clipmapping is to visualize huge sets of data within limited memory. This is achieved by forming concentric rings, centered around the viewer, with each ring representing a coarser mipmap level as you move out from the centre. Each ring is a clipped view against it's corresponding mipmap data, and updated with new data as the viewer moves.
More info and images coming
Original papers on the clipmap techniques (with feature lists):
- Optimal rendering throughput: The terrain clipmap consists of a small number of meshes which is very GPU friendly, while still maintaining great LOD. The texture clipmapping is done entirely in a shader.
- Visual continuity: Inter-level transition regions provide spatial and temporal continuity for both geometry and texture.
- Steady rendering The rendering rate is nearly constant since the tessellation complexity is independent of local terrain roughness.
- Graceful degradation: When the viewer is moving quickly, and the loading/update can't keep up with the movement, the terrain is automatically throttled, by dropping high resolution clipmap levels temporarily.
We extend on these technologies in a number of ways:
- Multi-threaded loading Adding multi-threaded loading/streaming of data in the background, to allow for slow loading data for example from a server or through procedural generation, without choking the CPU or rendering fluidity.
- Cache: A tile cache that removes the need to constantly request new data as the viewer moves around.
- Multiple sources: Ability to use multiple sources of data, for mixing low resolution data with smaller patches of high resolution data.
- Modifications: Real-time modifications of the terrain/texture.
- Texture formats Texture data can be in different texture formats, on a per source level, by adding filters to transform the data on the fly. Filters already exists for Luminance8, RGB8 etc.
- AWT shapes: An implementation of a TextureSource that allows you to use AWT drawing functionality to draw shapes to a texture clipmap.
- Picking: Fast triangle level picking with optional normal result.
- Transformations: The terrain can be transformed in any way without affecting rendering, picking and other operations. (For example rotating for z-up)
The terrain API consists of the core implementation and a set of interfaces for implementing bindings against new data sources. Ardor3D will provide a number of premade bindings to common data sources, like normal textures, heightmap arrays or loading over http. There is a good chance though that you will want to add your own binding. This is done though these interfaces:
- TerrainDataProvider: Main hook into a data provider. Serves up a valid Terrain/Texture source that works with the specific type of data needed. Also knows which maps that are available.
- TerrainSource: Delivers terrain configuration for geometry clipmap setup. Acts as the source of data for the terrain tile cache. Reports on valid or invalid tiles to be marked for update.
- TextureSource: Delivers texture configuration for texture clipmap setup. Acts as the source of data for the texture tile cache. Reports on valid or invalid tiles to be marked for update.
The whole terrain, gridcache and other classes can be wired up manually, but there is also a utility class that does this for you, TerrainBuilder. The terrainbuilder takes a TerrainDataProvider and a Camera, sets everything up and returns a Terrain that can be added to your scenegraph directly. See all the terrain examples for how it's used.
Lots more info to come here