Class Diagrams for Trees3D


More on Terrain Generation

A great source for terrain generation information is the Virtual Terrain Project (http://www.vterrain.org), which has sections on elevation models, ground detail, rendering, data sources and formats, scenery, software tools, and plants.

GameDev.net has a collection of good articles about landscape modeling at http://www.gamedev.net/reference/list.asp?categoryid=45#88.

DEM and Terrain Generation

Though my focus is on gaming, terrain creation is used by simulation and GIS applications. A popular file format for geographic data is the Digital Elevation Model (DEM), which represents grids of regularly spaced elevation values. The USGS produces five primary types of DEM data, which represent different levels of geographical detail: 7.5-minute DEM, 30-minute DEM, 1-degree DEM, 7.5-minute Alaska DEM, and 15-minute Alaska DEM. Here are some useful DEM links:

  • http://www.cis.ksu.edu/~dha5446/topoweb/demtutorial.html

  • http://www.vterrain.org/Elevation/dem.html

  • http://edcwww.cr.usgs.gov/products/elevation/dem.html

Terragen can understand various USGS and NASA file formats when used in conjunction with plug-ins and/or other terrain-based applications, such as 3DEM. This makes the data available to Terra3D once saved as OBJ and JPG files.


j3d.org

The j3d.org code repository (http://code.j3d.org) contains a DEM loader in org.j3d.loaders.dem, but it's poorly documented with no examples of its use. However, the loader is used as part of the GeoSim application, to display DEM files (http://www.bulletprf.com/lab-index.htm). The program comes with source code.

The org.j3d.geom.terrain package contains classes for creating height maps from images, and the org.j3d.loaders package supports the loading of grid-aligned data, treating the data as height values.


JLand

JLand is a Java 3D applet/application for displaying and generating landscapes (http://www.cyberhipster.com/j3d/jland). It can read elevation maps stored as compressed (GZIP) or uncompressed PGM, DEM, or POV TGA files. Only the class files are available at the moment.


DEM viewer

The JavaWorld article "Navigate through Virtual Worlds using Java 3D" by Mark O. Pendergast is an excellent tutorial on utilizing DEM files and includes fly-through navigation controls using the keyboard and mouse, and level-of-detail (LOD) displays of the data (http://www.javaworld.com/javaworld/jw-07-2003/jw-0704-3d_p.html). All the source code can be downloaded and includes a Grand Canyon example.

The data is stored internally in TRiangleStripArrays using interleaving and by-reference, which is the most efficient format in terms of memory and processor usage. Interleaving is utilized to support color and normal information alongside the coordinates. The normals are generated in the code rather than via a NormalGenerator. Texturing isn't used. Though interleaved data complicate the coding, the data accelerate rendering.

Rather than using a single triangleStripArray (as in Terra3D), Pendergast employs many arrays so LOD features can be offered. The terrain is divided into segments, with each segment represented by several triangleStripArrays holding varying amounts of (by-reference) mesh detail. By-reference means that the mesh data is shared between the various segments, saving considerable space. Switch nodes multiplex between the arrays at runtime: as the user approaches a segment (or moves away from one), more (or less) mesh detail is displayed.

ROAM

A crucial problem for an industrial-strength landscape representation is the enormous amount of memory required for a large map. For example, a height map made up of floats for (x, z) coordinates at 1mm intervals, covering a 10-meter square area, would require about 400 MB of RAM, and that's before the cost of rendering and adding objects to the scene. The obvious answer is to reduce the sampling density, but that will reduce the map's resolution.

A better solution is adaptive meshing, as typified by Realtime Optimally Adapting Meshes (ROAM). It's adaptive in the sense that areas that are flat or distant from the viewpoint are covered by low resolution submeshes, and nearby or rocky areas use more detailed grids. Since viewpoints can move, the level of detail apparent at a particular terrain location will vary over time, as users come closer and move away.

ROAM creates its dynamic mesh with triangle bintrees (a close relative of the quadtree), which are split/merged to increase/decrease the resolution. The standard reference on ROAM is the paper by Mark Duchaineau and others: "ROAMing Terrain: Real-time Optimally Adapting Meshes" in Proc. IEEE Visualization '97, pp.81-88, 1997 (http://www.llnl.gov/graphics/ROAM/).

There's a Java 3D implementation of ROAM in the j3d.org code package org.j3d.terrain.roam. Each terrain tile is implemented as a Shape3D, so view frustum culling and intersection testing can be accelerated. A tile's geometry is stored in a triangleArray so the overhead of translating down to triangles at the hardware level is reduced. Changes to a tile's geometry is performed with a GeometryUpdater object which recalculates its vertices.

transformGroups are avoided; instead a tile is positioned at its intended location directly. This means the shape's coordinate system doesn't need to be mapped to world coordinates when being manipulated, making costly transforms unnecessary.

The ROAM package is explained in Chapter 14 of the textbook Java Media APIs: Cross-Platform Imaging, Media, and Visualization by Alejandro Terrazas, John Ostuni, and Michael Barlow (Sams Publishing; http://www.samspublishing.com/title/0672320940). I recommend this book for its coverage of other advanced Java 3D topics, such as sensors, stereo viewing, head tracking, and JMF integration.

The CLOD Algorithm

Martin Barbisch implemented a Java 3D application for his student project which illustrates the Continuous Level of Detail (CLOD) algorithm (http://wwwvis.informatik.uni-stuttgart.de/javatevi/). The amount of detail visible to the user is adjusted at run time as the viewer moves. The drawback is a "popping" effect as details suddenly appear as the user gets closer to some part of the terrain. The solution is geomorphing, a form of mesh morphing.

Other Java 3D Projects


DTV applet

Nathan Bower has written a Java 3D applet which displays a UK ordinance survey map, textured over a height field for the same area (http://www.nathanbower.com/cms?page_id=03_Java3D_Applet.htm&folder=/02_My_Work). No source code is available, but the information supplied on the web page suggests that he's implemented most of the components himself: the triangulation scheme, viewpoint clipping, the mouse controls. He mentions an application that can display multiple ordinance survey maps, tiled together, sufficient in number to cover the entire UK.


Integrated Data Viewer (IDV)

IDV is a framework for visualizing and analyzing 2D and 3D geoscience data (http://my.unidata.ucar.edu/content/software/metapps/), such as weather satellite imagery and radar. Source code is available.


The Virtual Globe

The Virtual Globe is a client-server application for displaying large terrain models (http://globe.sintef.no/). The terrain database is stored on a server, and the client fetches the data required for generating an image at the required resolution.


JCanyon

JCanyon is a flight simulator which visualizes its large data set (about 300 MB) using JOGL or GL4Java (often called "OpenGL for Java") rather than Java 3D (http://java.sun.com/products/jfc/tsc/articles/jcanyon/).

The terrain is divided into tiles, and multiple samples are prepared for each tile, with varying coordinate and texture resolutions. Only the data for the required resolution is mapped into memory at any given time. Tiles are fetched from the disk in a background thread.

Two novelties of JCanyon are its texture selection technique and a method for eliminating cracks between tiles, called filleting.


The 3D land navigator

The navigator displays land surfaces in 3D and lets the viewer fly over them.

Aerial photos of the landscape must be divided into map cells. Each map cell is then converted into a 3D geometry with texture mapping for the details. As the user flies over the landscape, the map cells near to the user's viewpoint are loaded and displayed. The software is built using the WorldShow3D browser (http://worldshow3d.home.comcast.net/map3d.html).


A Java 3D loader for Terragen

Jean-Marc Jung and Pierre Henry have written a loader for Terragen TER height-map files (http://www.hta-bi.bfh.ch/Projects/diggersim/). The loader is part of their "Digger Simulation" project for training the pilots of mine clearance vehicles.



Killer Game Programming in Java
Killer Game Programming in Java
ISBN: 0596007302
EAN: 2147483647
Year: 2006
Pages: 340

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net