Recommended: Sing it, brah! 5 fabulous songs for developers
JW's Top 5
Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs
Page 6 of 6
Finally, unordered rendering allows the Java 3D runtime to pick the optimum rendering path through the scene graph. A great deal of effort has been expended in determining how to optimize rendering speeds when the order of objects to be rendered can be controlled. Sun's Java 3D takes advantage of this previous work to speed things up.
For more information on all of these API performance-oriented features, please refer to Resources.
When a developer calls BranchGroup.compile(), Java 3D checks which capability bits are set and compiles those portions of the branch group. That is, it rearranges the
applicable portion(s) of the scene graph for optimum rendering performance. The runtime may, in fact, do all sorts of weird
things to the geometry and other nodes of the scene graph unbeknownst to you. The net result is that things speed up without
your needing to understand all of the "magic" behind the process.
But without some statistics to back it up, this is just cheap talk. I added compile() methods to our previous Java 3D examples to see what effect, if any, they would have. For instance, I added the line
contentBranchGroup.compile();
to Example 4 to generate Example 7.
I did not, however, see any noticeable performance differences in any of the previous examples. All loaded and executed in roughly the same time with and without the compile statement.
I ascribe this to the fact that I do not have very complicated content branches that would allow Java 3D to optimize their performance. If you have more complicated applications of Java 3D, I suggest trying compilation to speed things up. But as always, your mileage may vary.
Java 3D is an interesting technology with a broad scope and an equally broad range of tips and tricks. I have endeavored to provide you with good examples with which to get started exploring the API, but as always, there just isn't enough room or time to go into all the nuances in great enough detail. I have included more information on tips and tricks in the Resources section to help you find your away around this exciting API.
You'll find pointers to:
One more thing to note: I've received several questions on the applicability of Java 3D to collaborative world building and interaction. I believe Java 3D to be more than capable of handling 3D rendering tasks for building collaborative virtual worlds. There is no fundamental restriction to building collaborative virtual worlds in Java 3D. In fact, some of Sun's customers are building, demoing, and deploying large scale simulations and collaborative apps using the technology today (see Sun's Java 3D product site for examples of this).
The networking support inherent to the Java platform makes the communication aspects of collaboration easier than many other languages and APIs. You might have difficulties with client-side availability, however, because Java 3D is not installed in browsers or on desktops by default, and it is not currently available beyond Win32 and Solaris. But if your problem domain and customer base allows you to install software onto participating users' systems and to deal with a Win32 and Solaris-only solution, Java 3D is worthy of further investigation.
In this column and the last, we've seen how to create and manipulate Java 3D scene graphs, how to load in content from popular file formats and external programs, and how to use VRML97 and Java 3D together.
Next month, we'll shift our attention from Java 3D and VRML to Java bindings for OpenGL, the current frontrunner in cross-platform graphics APIs. I'll give a quick review of the publicly available Java-OpenGL bindings, then settle in for a discussion of one of the most popular bindings -- and the likely starting point for the OpenGL ARB's Java binding standard -- Magician. As always, if you have questions or ideas for upcoming columns, please let me know.
Until then, happy hacking and merry media. (I know, I know...gratuitous holiday puns are never successful, are they?)
Read more about Core Java in JavaWorld's Core Java section.