Posts

Featured Post

4.7 Immediate mode vs. retained mode vs. mixed mode

Image
Java 3D does not interact directly with system display hardware to produce the 3D rendering of a scene, but rather relies upon a lower level 3D graphics API: currently either OpenGL or DirectX. The designers of Java 3D have added several locations within the Java 3D rendering loop that application developers can hook into to directly render 3D primitives irrespective of the current scenegraph. Using Java 3D in retained mode does not exploit these capabilities. This is usually the recommended and most common mode for Java 3D. The application developer defines the scenegraph for the application, passes it to Java 3D, and Java 3D is responsible for rendering the scene. Java 3D also coordinates and carries out a lot of the chores related to user interaction. In complete contrast, using Java 3D in immediate mode does not exploit Java 3D’s scenegraph abilities at all, and the application developer assumes all responsibility for rendering and user interaction. Java 3D is merely be...

4.6 Hierarchical control | JAVA 3D Programming | Chapter 4

Image
Many 3D applications define a complex scenegraph hierarchy. An important function of the scenegraph is to enforce the geometric and spatial relationships that the scenegraph defines. Just as when the F1 car was moved its constituent parts were also moved. This principle is central to applications that require hierarchical control.          At the scenegraph level, the key to specifying relative positions for Nodes within the scenegraph is the TransformGroup Node. A TransformGroup encapsulates a Transform3D instance, which in turn encodes a 4 ×4 scaling, rotation, and translation matrix. The important principle is that a scenegraph Node’s rotation, scaling, and translation is always specified relative to its parent Node’s rotation, scaling, and translation.          To illustrate these principles, in this section I’ll show you a Java 3D scenegraph to animate a model of a human arm (figure 4.13). Requ...

4.5 Scenegraph advantages | JAVA 3D Programming | Chapter 4

Image
By now you should be aware of many of the advantages of using a scenegraph. Setting up the scenegraph hierarchy imposes a design rigor upon the application developer. Initially, particularly with scientific visualization applications, the scenegraph may seem unnecessarily restrictive, especially for developers from a low−level OpenGL or DirectX background. However, advanced planning and design will usually prove the utility of the scenegraph model, even for applications that do not initially appear to contain hierarchical graphical objects per se. Object management         The scenegraph is a data structure. All the Nodes in it can also reference external data through the ScenegraphObject.setUserData method (discussed in chapter 8). Rendering optimization         Scenegraph node Bounds play an important role in optimizing rendering and behavior scheduling. Picking support     ...

4.4 Elements of scenegraph design | JAVA 3D Programming | Chapter 4

Image
Designing a good scenegraph structure may involve making trade−offs across several factors. The scenegraph should be easy to manipulate at runtime (you may want to dynamically attach and detach entire branches to switch them on or off) as well as easy to customize in the future. You may have to make compromises to get good performance to ensure that Java 3D can process your scenegraph efficiently. Object−oriented         Object orientation allows easy reuse of scenegraph branches. Ideally, each branch should define a component of the application that can be meaningfully used independently of the other scenegraph branches. You should imagine having to drop the scenegraph branch in question into another application. Compilable          This property is related to the goal of object orientation. If scenegraph branches can be reused within the scenegraph without modification of their appearance or relati...

4.3 Java 3D and the scenegraph | JAVA 3D Programming | Cheater 4

Image
4.3 Java 3D and the scenegraph This section will cover additional scenegraph elements required by Java 3D to manage and render your scenegraph. A VirtualUniverse contains at least one Locale object. A Locale defines a geographical region within your scenegraph. Locales are covered in depth in chapter 6.  In Java 3D there are two distinct branches within the scenegraph: scene and view. Up to now we have discussed only the high−level principles behind the scene side of the scenegraph. The scene branch contains the application’s scenegraph elements, as discussed in the preceding examples. The view branch contains a ViewPlatform node and defines scaling, rotation, and translation information for the view. The view is responsible for rendering the scene side of the scenegraph. As shown in figure 4.6, the view attaches to a ViewPlatform and reads position and orientation information from the Nodes above the ViewPlatform on the view side of the scenegraph. The view render...

4.2 What is a scenegraph | JAVA 3D Programming | Chapter 4

Image
4.2 What is a scenegraph? A scenegraph is a hierarchical data structure that captures the elements of spatial relationships between objects. Technically a scenegraph is a directed acyclic graph (DAG). Once you think and model an application hierarchically, the 3D graphics API is provided with a much richer set of information to use to optimize rendering. A scenegraph description also enables application developers to apply object−orientated (OO) principles such as abstraction and reuse to their designs. In Java 3D, the scenegraph is encapsulated within the Virtual Universe class. The scenegraph is composed of objects derived from the Node class. Every instance of the Node class has one parent Node. Additionally, the scenegraph contains objects derived from the Group class which encapsulates a collection of Node child objects. In this way a hierarchy of Group−derived objects can be created with Node−derived objects attached to the parent Group objects, as shown in figure 4.2....

4.1 Overview | JAVA 3D Programming | Chapter 4

Image
4.1 Overview Your application’s 3D virtual world contains geometric objects with which the user interacts. In Java 3D this virtual world is called the VirtualUniverse, the top−level class that contains all the elements that you define within your virtual world. In addition, the VirtualUniverse contains nongeometric objects that control or influence the world. Lights are a good example of this type of object. In a 3D environment, one cannot see a Light, but one can see the effect of the Light within its zone of influence. A concrete example helps to describe some of the details. Imagine a virtual world that models a Formula 1 Grand Prix race (figure 4.1). The model is a simplification of reality. It contains: • 3 Williams F1 cars • 2 Ferrari F1 cars • 3 McLaren F1 cars • 2 Jordan F1 cars • 1,000 trees 300 pine 300 oak 400 spruce • 100 pit crew 43 • 100 marshals • 60 advertising billboards 20 for a sport channel 20 for a car part manufacturer 20 fo...