Web Browser Applet Allows Visualization of Three-dimensional Models
LeRoy M. Dorman, Scripps Institution of Oceanography, University of California, San Diego, La Jolla, Calif., USA; and Douglas D. Gehringer, Sun Microsystems Inc. Beaverton, Ore., USA
Copyright 2002 American Geophysical Union
The Earth and ocean sciences are rapidly advancing into the area of three-dimensional models aided by increasing numbers of instruments, faster computer processors, and increases in available disk storage. The comprehensiveness of seismic and fluid mechanical theory has increased to match these capabilities. We have made the transition from the one-dimensional Earth (the terrestrial monopole described by depth or altitude-dependent velocities, densities, and attenuations) to the three-dimensional Earth.
Both one-dimensional and two-dimensional models are well represented by pictures on two-dimensional paper surfaces. The display of three-dimensional models, however, remains a challenge. Except for the expensive and rare "true three-dimensional" displays such as shutter-switched CrystalEyes glasses, scientists are limited to two-dimensional paper and computer displays of models. Virtual reality simulating software systems such as Advanced Visualization System (AVS) can make single, high-quality renderings, but because of its flexibility, this class of software is not easy for the casual user to operate, and it is too costly for many users.
One approach that is especially suitable to outreach programs is to view models in a browser under user control, allowing the user to rotate the model by dragging a mouse across it. Generating the images locally eliminates the need to rapidly refresh the screen across a network; a significant economy, since many seismic images--for example--are derived from low-frequency waves of limited spatial resolution. The Java applet performs this function. For a model of dimension 64 x 64 x 32, a 300MHz-computer provides acceptable speed. A Sun workstation or basic PC without graphics acceleration yields a frame rate of about 1 per second. Machines with graphics acceleration, such as Sun with an Expert three-dimensional card or a PC with a NVIDIA GeForce2 card, render the model at interactive rates > 15 frames/s.
Representation of three-dimensional models by two-dimensional images is aided by the use of four-dimensional color maps. While a three-dimensional color map shows each model value as a specific color, usually defined as a red-green-blue (RGB) triplet, a four-dimensional color map associates each value with a 4-component set-RGBA--where the A represents alpha, the transparency. The utility of this additional component is that we can allow the user to see through parts of the model--the reference or "uninteresting" parts--to the anomalous or "interesting" parts. This allows us to see into the model. But this is not a complete solution, since it does not provide depth perception.
In the absence of true three-dimensional representation, a useful substitute is to allow the model or the viewpoint to rotate so that objects at different distances from the viewer move differently. There are two approaches to this, one non-interactive and the other interactive. The first involves making a sequence of images--a movie, that is then viewed. The moviemaker decides the path of the viewer around the model.
This produces a "canned" product, such as a videotape or the digital equivalent. Both of these products have very high information content because they contain many images, and a simple movie can be typically tens of megabytes in size.
The second interactive approach, on the other hand, relies on generating, or rendering, the image under the control of the user, in the user's computer, so it requires only the transmission of as much data as is required to represent the model. For the Lau Basin model of Zhao et al. [1997], the model can be represented in less than 150 kbytes and is derived from body-wave data observed on islands and ocean-bottom seismometers.
The interactive approach conveys the three-dimensional nature of the data using several perceptual cues: perspective, double buffering, and stereo. A perspective view draws objects that are further from the viewer smaller than objects that are close to the viewer, matching our perception of the world. Perspective can be disabled by the user for displays, such as mechanical computer-aided design (MCAD) data, where the relative sizes of features must be preserved. Double buffering hides the frame being rendered until the rendering is complete, creating smooth transitions as the viewing direction is changed. Double buffering can be disabled so the user can see the rendering if the display is so slow that the delay between frames is a problem. Stereo displays generate separate images from the viewpoint of each of the viewer's eyes. When viewed using stereo display hardware, the result is an image with the illusion of true depth. Our program does not generate stereo displays at present, but Java 3D makes it very simple to switch from mono display to stereo.
An additional advantage of an interactive solution is that the user can adjust the boundaries between visible and transparent values to examine choice features. In the program offered here, this is accomplished by adjusting two slider controls, which move the upper and lower boundaries that define the limits of the range of transparency. When examining a simple body, moving the appropriate slider displays the shape as defined by different isopleths of whatever is being displayed.
The primary problem in using the interactive approach is that it must run on the viewer's computer, whatever that may be. Fortunately, the essence of a solution is at hand in the form of the Java language, which its developer, Sun Microsystems, advertises as "write once, run anywhere." This is pretty much true for "plain vanilla" Java, which is available in the Netscape 4.x, Internet Explorer, and other browsers. It is almost true for advanced extensions such as Java 3D, which is now available on Windows machines, Solaris SPARC, Silicon Graphics, Hewlett-Packard, and PCs running Linux. Netscape 6 is bundled with Java 2, which is the foundation for Java 3D.
Earlier browsers must use a plug-in that allows use of a newer version of Java than what was packaged with the browser originally. Java 3D is under active development for MacOS X. For more information on Java 3D, see Walsh and Gehringer [2001]. We have tested this code on Sun and PC hardware, with Netscape 4.7x, 6.x, and Internet Explorer 6.0 browsers. This three-dimensional rendering applet was started at Sun Microsystems as an application (an ordinary user-executed program) that demonstrated Java's 3D capabilities. We need to run an applet in a browser rather than an application. While an application must be copied into the user's computer and executed, an applet in a browser using a plug-in that invokes the applet using a Java Virtual Machine (JVM).
The browser downloads the executable Java class files from the Web server, and the JVM executes the code and displays the results. To protect the user's computer from malicious programming, the applet runs with fewer privileges than would a program that the user executes directly and explicitly. The most challenging problems in applet programming are related to Java security. Since the user imports a program from a not-necessarily-trusted source, it runs in a "sandbox" on the viewer's computer and is restricted from local file access and from many operating system functions. These require re-coding of some commonly used programming practices, such as the use of command-line arguments. Reading data from a remote URL restricts the user to serial, rather than random-access, input-output.
Reaching outside the sandbox requires either that the program come from a source identifiable as "trusted" by a Certificate Authority (CA) or be granted specific individual rights by the user. The chief nuisance is that different and largely incompatible security models are used by Sun Microsystems, Netscape, and Microsoft. For this reason, it is useful to make complementary versions of the program: an application that has the ability to make, load, and save any of the program parameters, and an applet, which has limited capabilities. It can load program parameters and interactively change some program parameters, but not save parameters.
What does this code provide? The code package consists of an application, called VolRendEdit, an applet called VolRendView, and an application called Byter, which creates a binary data file from a grid, either character or binary. Both VolRendEdit and VolRendView display the three-dimensional grid and allow the user to rotate the image by dragging the cursor across the image, and allow adjustment of the boundary between the transparent and opaque parts of the colormap.
VolRendEdit allows creation and editing of a session file containing the current geometry (point of view), the colormap, the name of the data file, and the names of the files that are displayed on the faces of the data cube to show scales or other geometric features. These files should be in image formats--currently GIF or PNG--that support transparency so the datacube is not occluded. The charts in the examples showing geography, instrument locations, tectonic features, and scales were made with programs from the Generic Mapping Tools (GMT) suite by Wessel and Smith [1991].
The PostScript file from GMT was converted to a GIF file using sdtimage, part of Solaris 2 Common Desktop Environment from Sun, and the background was made transparent using the PERL scrip transgif. Transparent images can also be created using ImageMagick or Adobe Illustrator. The GIF89a format allows one color entry in the color map to be made transparent, while PNG is more general.
VolRendView is the applet, whose byte code (class files) reside with the host Web page. It is executed through HTML calls and is downloaded into the viewer's computer to display the results. It reads the session file from the Web host and uses the parameters there for the initial display, but it cannot alter the file. Byter creates the volume file from user-supplied information, as well as the individual values of the three-dimensional data grid. The data grid is preceded by a simple header that contains data limits, grid dimensions, and other housekeeping information.
At the Web site cited below, five images are available, four of which are Earth models and one of which is a slowness spectrum of ocean waves. The first image (Figure 1) is of compressional velocities under the Tonga island arc and Lau Basin, from Zhao et al. [1997]. The size of the grid is about 1000 km horizontally and about 675 km in depth. The blue object is the Pacific plate, which is being subducted beneath the island arc. The reddish material is low-velocity, presumably hot and magma-rich material that forms the source material for the back-arc spreading center and the arc volcanism.
The "new science" was that the volcanoes and the spreading center are fed from sources that are more or less connected, and that the spreading centers (indicated on the figure by red lines) are somewhat to the east of the main body of the source material. The tectonic mechanism in operation is that the Pacific Plate is sinking because of its great age and high density, as well as a little push from the East Pacific Rise. The space thus created makes room for the Lau Basin, and the east flank of that spreading center is pulled rapidly eastward, moving the spreading center east of the magma source. Responding to this asymmetry, the Lau spreading center is migrating to the west. Adjusting the lower slider of the display will vary the amount of the low-velocity material that is visible by moving the low-velocity bound of the band of velocities that is transparent. Adjusting the upper slider moves the upper bound of the transparent region.

Fig. 1. This image shows compressional seismic velocities beneath the Tonga Island Arc and Lau Basin. The chart atop the structure shows the islands of Fiji on the west and Samoa to the northeast. Red dots indicate land seismic stations that operated for 2 years, while the blue squares show the positions of the OBSs that operated for 4 months. The green triangles are active volcanoes. The red lines show the lau spreading centers and associated faults. The scale bars on the chart are 2o (222 km) in length.
The second (Figure 2), third, and fourth data sets (not shown here) are of the seismic velocity structure beneath Southern California, using travel times from local earthquakes and controlled sources. The models extend from the U.S.-Mexican border to the southernmost coast ranges and are aligned parallel to the coast. The dimensions are 400 km x 640 km x 33 km (inland x longshore x depth). The image shows variations between the local velocity and the mean velocity for that depth for the entire model. The values displayed in three images are compressional (P) velocity, shear (S) velocity, and the P/S ratio from Hauksson [2000].

Fig. 2. This image shows compressional velocity anomalies beneath Southern California from Hauksson [2000]. The initial view is approximately to the north. The most prominent features are the higher upper mantle velocity beneath the Continental Borderland (poorly resolved). The red (low-velocity) regions are the surficial (1-km depth) expressions of the southern San Joaquin Valley, the Los Angeles and Ventura Basins, and the Imperial Valley. The figure is plotted with a vertical exaggeration of about 5. A fault map and the outline of the state are displayed on the upper surface of this image.
The fifth image (Figure 3) is a frequency-slowness representation of the spectral density of ocean waves (swell) measured by an array of ocean-bottom seismometers at a depth of 30 m offshore of Camp Pendleton Marine Corps Base in southern California.

Fig. 3. Slowness spectra of ocean waves of Camp Pendleton Marine Corps Base, California, is shown here. At the center of the plane defined by the red and blue vectors, the horizontal slowness is zero (infinite velocity) and the maximum values are 200 s/km. The concentric rings represent integral multiples of 40 s/km slowness. Up (opposite the blue axis) is increasing period, with the greatest value being 16 s. The strongest component is in the east-northeast direction with a subsidiary peak in a more northerly direction. These coordinates are taken from memory and the calculations were made several years ago, so the details are subject to correction.
The Java source code, as well as the compiled class files and example images, are available through http://www.mpl.ucsd.edu/people/ldorman.
Disclaimer: Hyperlinks established in this article are live and active at the time of publication. However, these links are not guaranteed by AGU for indefinite future use. Responsibility for the viability of such links rests with the linked Web site.
Acknowledgments
This work was supported in part by the U.S. National Science Foundation under grant OCE94-03587. Dapeng Zhao provided the grid of the Lau Basin model and Egill Hauksson provided the grids of the southern California models.
References
Hauksson, E., Crustal structure and seismicity distribution adjacent to the Pacific and North America plate boundary in southern California, J. Geophys. Res., 105, 13875-13903, 2000.
Walsh, A. E., and D. Gehringer, Java 3D API Jump-Start, 266 pp., Prentice Hall PTR, New York, 2001.
Wessel, P., and W. H. F. Smith, Free software helps map and display data, Eos, Trans. AGU, 441, 1991.
Zhao, D., Y. Xu, Y., D. A. Wiens, L. M. Dorman, J. Hildebrand, and S. Webb, Depth extent of the Lau back-arc spreading center and its relationship to subduction processes, Science, 278, 254-257, 1997.