Posts

3D Graphics Programming | Chapter 4

Image
CHAPTER 4 The scenegraph  4.1 Overview 39 4.2 What is a scenegraph? 4.3 Java 3D and the scenegraph 4.4 Elements of scenegraph design  4.5 Scenegraph advantages 4.6 Hierarchical control 4.7 Immediate mode vs. retained mode vs. mixed mode  4.8 Summary Is a scenegraph appropriate for your application? If you choose to use a scenegraph for your application you should be able to sketch the required elements out on paper.  In this chapter, I’ll introduce the concept of a scenegraph for modeling 3D scenes. I’ll present several examples that can be used to guide the scenegraph design process for your application. I’ll show you the benefits and drawbacks of using the Java 3D scenegraph along with comparative information for rendering in immediate mode and mixed mode. The possible elements of a Java 3D scenegraph are presented along with usage hints and tips.

3.4 Summary | JAVA 3D Programming | Chapter 3

Image
3.4 Summary This example has rather plunged you in at the deep−end of the Java 3D pool. I hope you have enjoyed the guided tour of some of the capabilities of Java 3D. In the chapters to come we will be picking apart many of the features listed and showing you how to get the most out of them for your Java 3D application. Do not be too concerned if the example code presented in this chapter looks very intimidating, and the descriptions were too vague. You can refer to this example as topics such as scenegraphs, geometry, and appearances are explained in detail in later chapters. This example should have given you a sense of the power of Java 3D and can serve as a good test bed for experimenting with your own applications or trying out the ideas presented in later chapters. Before you start designing your application, it is important that you understand the data structure that underlies Java 3D rendering—the scenegraph. Once you have a firm grasp of it you will quickly be...

3.3 Exercises for the reader | JAVA 3D Programming | Chapter 3

Image
3.3 Exercises for the reader When you run the example, I would encourage you to make some changes and see their effects. For example: Colors and lighting See how the color of the Material and the color of the directional light interact to produce the actual rendered color. Sophisticated lighting equations are at work to combine the effects of both at runtime. Try changing the shininess parameter to (80.0f) to increase or decrease the apparent shininess of the smaller Sphere. Try removing the setMaterial call and see how rendering is affected. Animation parameters The Alpha class that is used to control the PositionInterpolator can be parameterized using nine variables (figure 3.2) to produce a sophisticated timing function. Figure 3.2 The phases of the Alpha class: trigger time (1), phase delay (2), increasing alpha (3), increasing alpha ramp (4), at one (5), decreasing alpha (6), decreasing alpha ramp (7), at zero (8), loop count (9) I’ll discu...

3.2 Your first Java 3D application | JAVA 3D Programming | Chapter 3

Image
3.2 Your first Java 3D application          The SimpleTest example (figure 3.1) is intended to build upon the HelloUniverse example that comes with the Java 3D distribution. I’ve attempted to expand upon HelloUniverse by documenting the relationships between the various constructs used in the example and showcasing some of the features of Java 3D that enable you to build fairly complex applications with very little code. This example is 280 lines (less than 100 without comments) and illustrates some fairly complex functionality: Figure 3.1 The SimpleTest example. One hundred lines of Java code give you an animated scene, including a  graphical textured background with directional lighting Background geometry, in this case the scene is placed within a Sphere.  Textured geometry, an image is applied to the inside of the background Sphere to give the illusion of a distant skyline. Lighting, a single directional light is created t...

3.1.6 Java class decompiler (optional) | JAVA 3D Programming | Chapter 3

Image
3.1.6 Java class decompiler (optional) When things get really sticky and you can’t understand what Java 3D is doing it can be useful to decompile the Java 3D class files. You will need to decompress the Java 3D JAR files and extract the class files prior to decompling them. A popular (and free) decompiler is JAD (JAva Decompiler). Find it at http://www.geocities.com/SiliconValley/Bridge/8617/jad.html .  Ok good luck, See you in next tutorial

3.1.5 Performance analysis tools (optional) | JAVA 3D Programming | Chapter 3

Image
3.1.5 Performance analysis tools (optional) As you formalize your designs and requirements it is often helpful to drop into a performance measurement tool to see where your code is spending its time. Two popular commercial tools for Java optimization are:   OptimizeIt, VMGear ( http://www.vmgear.com ) JProbe, Sitraka ( http://www.sitraka.com/software/jprobe/ ) You can also use the free (but harder to interpret) performance measurement capabilities of the Java 2 JVM. See the documentation for the java –Xprof argument for details. Ok good luck, See you in next tutorial

3.1.4 Java 2 development environment (optional) | JAVA 3D Programming | Chapter 3

Image
3.1.4 Java 2 development environment (optional) Every developer has their favorite programmer’s editor, and an increasing number of Integrated Development Environments (IDEs) are available that support Java 2. They range from free to expensive, and have a wide variety of features. Some of the more popular IDEs for Java 2 development are: Kawa, Allaire ( http://www.allaire.com/ ) All the examples for this book were built using Kawa. Unfortunately, after Allaire was acquired by Macromedia, development of Kawa was discontinued. JBuilder, Borland ( http://www.inprise.com/jbuilder/ ) Emacs, GNU ( http://www.gnu.org/software/emacs/ ) Visual CafĂ©WebGain ( http://www.webgain.com/Products/VisualCafe_Overview.html ) NetBeans ( http://www.netbeans.org ) Eclipse (Open Source, IBM) ( http://www.eclipse.org/ ) IntelliJ IDEA ( http://www.intellij.com/ ) Ok good luck, See you in next tutorial :)