Java3D 1.2 API

3D geometry classes for Java

Three-dimensional graphics programming has come a long way over the past twenty years.

Classic Atari Arcade game from the 80s screenshot

In the early eighties programmers were limited to using geometric primitives such as simple lines and polygons to create 3D wire frame graphics with languages like FORTRAN (remember Battlezone?).

When workstations became more powerful and object-oriented programming became more popular, developers migrated to C++ and OpenGL, which became the standard for 3D graphics development.

With the evolution of the Internet programmers and users alike became interested in sharing information as much as possible, and when Java came out, being the first truly platform-independent programming language, Sun realized that they really had something worth developing given the state of the Internet and portability of Java applets across the Net.

Since 3D programming technologies had come so far in the past 15 years it was easy for Sun's developers to implement classes on top of the standard Java foundation classes to include support for OpenGL and complicated graphics techniques like texture mapping, lighting, and 3D sound, and combine them with the portability of Java.

some example Java3D code
Java3D Code Example

The best aspect of Java3D is that it simplifies 3D programming by offering platform and hardware independence--as in, any Java3D applet or application will run on any machine as long as it has a working copy of the Java3D runtime environment installed. Also, the programmer's work load is eased by the organization of 3D scene graphs provided by Java3D. When a developer creates a 3-dimensional model using Java3D, the scene is structured quite simply into a standard graph, where each object has a parent and possibly some children, which enables even a beginning programmer to create complicated 3D applications that remain organized and useful with very little interaction from the programmer.

Java3D is also an excellent top-level API since all the actual OpenGL and OS-specific calls are essentially hidden from the programmer.

When it comes to actually coding a 3D scene using Java3D, the programmer can take full advantage of Java's object-oriented capabilities. Everything, down to the most insignificant appearance of a visual object, is implemented using objects.

Say, for example, we have a Shape3D node, such as a box, that we want to animate in the scene and specify a separate color for each side. The problem is easily broken up into OO concepts: every aspect of this scene is an object. First we would create a Virtual Universe, the 3D "universe" where all the objects in this program will reside. For Java3D, this universe is measured in cubic meters. We then simply attach a 3D box to this universe and apply the necessary visual changes to it.

The Universe is the root of the graph, the box is its child, and the appearance of the box is the box's child (or children). Even the animation behavior for this box object has the box as its parent, so it is easy to visualize the organization of this graph structure.

Java 3d Scene Graph Diagram
Scene Graph Diagram

Naturally, the API is capable of far more complicated routines and graphs. If you want, you could have a single object contain many other objects as its children as well as a behavior object, so that the entire object could be animated instead of just each individual object.

This is great for user features like navigating through a visual scene with the mouse or applying various behaviors or animations to the scene graph or an individual object after the scene has been rendered on the screen.

More advanced features like collision detection, interpolations, morphing animations, and camera manipulation are also supported, all within the standard API available for download from Sun. The only limits involved here are set by the hardware being used to run the application. A scene graph could be many levels deep and each node could have its own appearance and behavior, and everything would remain organized within the graph. And, of course, if you wanted to share your creation across the Internet, a Java3D applet can be embedded in a web page as easily as any Java applet.

In conclusion Java3D is a great addition to the standard Java foundation classes, allowing all code to be written in standard Java and ported to another system like any Java program. Ease of use, object-oriented design, top-level classes, and portability make Java3D an ideal API for 3D graphics development whether you are a beginning programmer or a seasoned guru. Java3D provides everything a developer needs to get 3D applications off the ground, including extensive online documentation of all classes. Of course, performance is definitely an issue, but that's the way it goes with Java.


Java3D slide show by Sun

Introduction to Java3D, no author mentioned