CHAPTER 1 Introducing Java 3D
CHAPTER 1 Introducing Java 3D
collection of high level constructs for creating, rendering, and manipulating 3D scene graph makes 3D programming easier: emphasizes scene design (rendering) and hides graphics pipeline supports complex graphical elements (e.g. lighting modes, picking, collision detection)
Overview of Java 3D
prior to 1.5: 2 Java 3D variants: 1 implemented on top of OpenGL and 1 on top of DirectX Graphics o OpenGL is cross language, cross-platform API for 3D (and 2D) computer graphics o DirectX Graphics API supports rendering pipeline describing all geometry in terms of vertices and pixels 1.5: JOGL rendering pipeline added easier to develop future Mac versions o offers lightweight JCanvas3D class as alternative to Canvas3D class Java 3D 1.6 use JOGL binding to combine OpenGL and Java 3D rendering more closely should be installed after Java SE
relevant nodes can be created with Java 3Ds SimpleUniverse utility class
Java 3D Strengths
The Scene Graph
simplifies 3D programming speeds up resulting code hides low-level 3D graphics elements and allows programmer to manage and organize 3D scene supports wide range of complex graphical elements used to group shapes with common properties carries out view, occlusion and execution culling, level of detail selection, behavior pruning o optimizations that must be coded directly by programmer in lower level APIs uses multithreading to carry out parallel graph traversal and rendering optimization
Performance
at high level by scene graph optimizations - at low level by being built on top of OpenGL or DirectX Graphics Some programmer-specified scene graph optimizations are available through capability bits, which state what operations can/cannot be carried out at runtime (e.g., prohibiting a shape from moving). Java 3D also permits the programmer to bypass the scene graph, either totally, by means of the immediate mode, or partially, via the mixed mode. Immediate mode gives the programmer greater control over rendering and scene management, but isnt often required. Mixed mode mixes the immediate and retained modes so a program can utilize lower-level rendering and a scene graph together. Retained mode programs (the default Java 3D coding style) only use the scene graph API.
Unique Features
Java 3Ds view model separates the virtual and physical worlds (through the ViewPlatform and View nodes). This makes it straightforward to reconfigure an application to utilize a range of output devices, from a monitor to eyeglasses with stereo displays to CAVEs (rooms with projected images covering every wall). Virtual world behavior is coded with Behavior nodes in the scene graph and triggered by events. Among other things, Behavior nodes offer a different style of animation based on responding to events instead of the usual update-redraw cycle used in most games programs. The core Java 3D API package, javax.media.j3d, supports basic polygons and triangles within a scene graph, while the com.sun.j3d packages add a range of utility classes, including ColorCube and SimpleUniverse, mouse and keyboard navigation behaviors, audio device handling, and loaders for several 3D file formats. Geometry compression is possible, often reducing size by an order of magnitude. When this is combined with Javas NIO and networking, it facilitates the ready transfer of large quantities of data between applications, such as multiplayer games. Java 3D supports both of the popular programmable shader languages, OpenGLs GLSL (the default), and NVIDIAs Cg. This allows programmer to create specialized rendering effects such as bump mapping and shadowsvery easily. Java 3D offers 2D and 3D audio output, with ambient and spatialized sound. Unfortunately, there are bugs in the sound system, so spatialized sound isnt available by default in Java 3D 1.5. Version 1.6 will probably include JOALMixer class instead, which will act as programming interface to a JOAL-based audio device. JOAL is a Java binding for a 3D audio API called OpenAL, which is supported by many sound cards.
Java Integration
offers object orientation, threads, exception handling can easily make use of other Java APIs (e.g. JMF and JAI)
Java 3D Games
Java 3D Model Loaders for Games - tool for quickly populating game with people, artifacts, and scenery Extra Gaming Libraries
Java 3D Support
Alternatives to Java 3D
JOGL and LWJGL