What’s JAVA 3D?

Java 3D is an addition to Java for displaying three-dimensional graphics (3D) using a true object-oriented approach. Java 3D and its documentation are available for download separately, they are not part of the Java Development Kit (JDK).

With the use of Java 3D, it is easy to create virtual worlds with lighting, texture mapping, behaviors, and other features that immerse users in a visual and interactive experience. Indeed, Java 3D allows you to create virtual worlds complete with objects that move automatically and with fully spatialized sound.

Creating 3D is a big consumer of calculations. To speed up its processing, Java 3D builds on existing technology such as Direct3D and OpenGL so the programs do not run slowly. In other terms, the processing power of Java 3D depends on the power of the microprocessor (the CPU) but also on the graphics card (the GPU) in your computer.

How it works?

Java 3D is based on a scene graph programming model. Scene graphs are treelike data structures used to store, organize, and render 3D scene information (objects, appearances, lights, etc.). They are made up with objects called nodes.

So, a scene graph is a collection of nodes enclosed in a graph or a tree structure. This means that a node can have multiple children but only one parent. Thus, an effect applied to a node has repercussions on its descendants, which makes it possible to propagate the operation to a group of nodes.

What’s exactly a node?

As I explained before, the scene graph consists thus of a succession of parent nodes, child nodes, and data objects :

– The parent nodes, called Group nodes, organize and, in some cases, control how Java 3D interprets their descendants. Group nodes serve as the glue that holds a scene graph together,
– The child nodes can be either Group nodes, as we’ve seen before, or Leaf nodes. Contrary to Group nodes, Leaf nodes have no children. They encode the core semantic elements of a scene graph. For example, what to draw (geometry), what to play (audio), how to illuminate objects (lights), or what code to execute (behaviors). Leaf nodes refer to data objects,
Data objects, also called NodeComponent objects, are not scene graph nodes, but they contain the data that Leaf nodes require, such as the geometry to draw or the sound sample to play.

The structure of a scene graph determines the relationships among the objects in the graph and determines which objects a programmer can manipulate as a single entity.

What to do with all these?

Java 3D cannot start rendering a scene graph until a program « gives » it the scene graph. The program does this by with the superstrucutre which contains the VirtualUniverse and the Locale.

The term VirtualUniverse is used to describe a 3D space populated with 3D objects, it defines a universe. A universe allows to create a separate and distinct arena for defining objects and their relationships to one another.

The Locale object specifies a fixed position within the universe. That fixed position defines an origin for all scene graph nodes beneath it. For objects that exist in space, this implicit location provides a local coordinate system for that object, a fixed reference point defines with x, y and z (0, 0, 0). Even abstract objects that may not seem to have a well-defined location, such as behaviors and ambient lights, have an implicit location.

When complete, the scene graph is attached to a virtual universe, which makes the scene graph appear on the screen. Changes are made to the scene graph by calling methods on the objects. As changes are made to the scene graph, Java 3D automatically updates the display to reflect the changes.

Sources :


Axel Teillier


Laisser un commentaire