j3d.org Code

Package org.j3d.terrain

Generalised utility classes for all terrain culling algorithms.


Interface Summary
FreeFormTerrainData A source of terrain data that has no fixed requirements for its access.
StaticTerrainData Terrain data that represents a static collection of information.
TerrainData This class provides a generic interface to the terrain dataset.
TextureTileGenerator Generator for supplying instances of texture objects as tiles for large-scale terrains.
TiledTerrainData Representatoin of data source that holds its data in tiles.

Class Summary
AbstractFreeFormTerrainData Abstract representation of free-form terrain data.
AbstractStaticTerrainData An abstract representation of the base functionality for a TerrainData implementation.
AbstractTerrainData An abstract representation of the base functionality for a TerrainData implementation.
AbstractTiledTerrainData An abstract representation of the base functionality for a TerrainData implementation.
Landscape Representation of a piece of rendered terrain data.

Package org.j3d.terrain Description

Generalised utility classes for all terrain culling algorithms.

The aim of this package is to provide an abstract representation of any landscape rendering system. They all operate on a set of basic principles of a basic change in detail dependent on the viewer position, encapsulation of terrain information and the view information. While this package does not provide any hints to the implementation of a particular algorithm, it can be used to represent all of them in a general sense. Each algorithm extends this basic package with their own specific code.

Implementing a terrain rendering algorithm

In order to implement a new algorithm, your attention is focussed on two classes in this package - TerrainData and Landscape. The former is used to represent the raw data of the terrain in a generic sense, it is based on a regular grid structure. The later is access point for adding the terrain into the scene graph. Renderable items go in here.

Raw terrain information you probably don't need to implement most of the time. The repository codebase also includes a number of loaders for different file formats as well as a generalised implementation of the TerrainData class that works with these loaders. For most simple cases, you should not need to do anything more. For more information on this code, have a look at the org.j3d.loaders package.

To implement a specific algorithm (eg ROAM) you would extend the Landscape class and implement the Landscape.setView(javax.vecmath.Tuple3f, javax.vecmath.Vector3f) method. Every time that the user's viewpoint changes, you will be notified by this method (assuming that you have implemented a navigation system that calls it!). That means you should perform any culling/LOD and update the scene graph at this point. This will be called at most once per frame. As this class extends the Java3D BranchGroup interface, it means that all your geometry of the scene should be added to this class.

Coordinate Systems

There are multiple coordinate systems within the terrain rendering package and they don't all match. Apart from the traditional 3D graphics system, there is is the grid of the height values provided through the TerrainData interface. For some cases, where the height values cover a very large area, we may manage the terrain grid in larger chunks called tiles. Tiles also have their own coordinate system, which is overlaid on height values, as shown below.

Because terrain data may be effectively endless, both tile and grid systems will allow negative coordinates. This matches with map of the earth coordinate systems where you have an origin and then values positive and negative relative to that (eg UTM).


The code in this package is based on the original work by Paul Byrne of Sun Microsystems.

j3d.org Code

Latest Info from http://code.j3d.org/
Copyright © 2001 - j3d.org