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 - {@link org.j3d.terrain.TerrainData} and {@link org.j3d.terrain.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 {@link org.j3d.loaders} package.

To implement a specific algorithm (eg ROAM) you would extend the {@link org.j3d.terrain.Landscape} class and implement the {@link org.j3d.terrain.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 {@link javax.media.j3d.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 {@link org.j3d.terrain.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).

Acknowledgements

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