Read an Excerpt
Chapter 1: Java 3D Overview
In this chapter we'll give you a top-level overview of how Java 3D relates to Java, and how the two combine to form a powerful 3D development platform. During our blitzkrieg tour you'll see that Java 3D is part of the Java Media family of ap-plications programming interfaces (APIs), making it a sibling of many other media-centric Java extensions. Along the way we'll introduce you to essential Java 3D jargon as we explore the fundamental structure common to all Java 3D programs.
Digging into Java 3D
Java 3D is a full-featured 3D graphics API. It employs a scene-graph program-ming model in which the application program describes a scene; Java 3D then manages the display of that scene. Java 3D's scene graph allows your program to focus on what happens to the objects in your scene, while the Java 3D runtime and rendering engines do the hard work of figuring out how to draw your scene on the display as fast as possible.Java 3D includes the most essential features found in other popular 3D graphics APIs such as OpenGL and Direct3D (the 3D component of Microsoft's DirectX suite of graphics APIs). Because it is based on Java, however, Java 3D offers higher-level programming constructs when compared to these low-level APIs. As a result, programmers familiar with Java can create sophisticated 3D applications in a shorter amount of time than they could expect to with lower-level graphics APIs. In other words, Java 3D allows developers to focus on what to draw, not how to draw.
With Java 3D it is easy to create virtual worlds with lighting, texture mapping, behaviors, and other features that immerse users in a rich visual and interactive experience. But that's just the beginning. Java 3D allows you to create virtual worlds complete with objects that move automatically and with fully spatialized sound. In addition, Java 3D makes it simple to create programs that operate consistently across a variety of output devices—from a single monitor to stereo glasses to room-sized, multiscreen immersive “caves.”
Extremely large, yet crisp and responsive, virtual worlds can be created in Java 3D thanks to its ability to maximize both the CPU and graphics display resources. In short, Java 3D supports the features required for today's most demanding 3D applications while offering plenty of “headroom” to accommodate tomorrow's applications.
Java 3D in Action
Java 3D is designed to support a wide range of applications, from traditional graphics applications such as mechanical computer-aided design (MCAD) to scientific visualization, product visualization, collaborative engineering, eCommerce solutions, and games. If the current trend in 3D graphics progress continues, we'll be able to interact with impressive Toy Story-quality Java 3D content delivered over broadband Internet connections in just a few years.To appreciate what the future holds for Java 3D we must consider the types of applications developers have created today. In the following sections we'll explore just a few of the many ways in which developers are pushing the envelope with Java 3D.
Fun and Games with Java 3D Entertainment Applications
Entertainment is arguably the most common way in which people today are ex-posed to 3D graphics. Even as you read this book, high-powered desktop com-puters and console games are flooding into the home market, bringing interactive 3D content to the masses. Fun and games with 3D is fast becoming the norm; only a few years ago compelling 3D entertainment was relatively hard to come by.Millions of home computers and console devices such as Sony PlayStation and Microsoft XBox are whirring around the world. This very moment cutting-edge games such as Quake, Tomb Raider, Tekken Tag, Soul Reaver, Madden NFL, Oddworld: Munch's Oddysee, Final Fantasy, and countless others are further priming the market for an emerging class of Java 3D entertainment applications.
Likewise, many movies today take advantage of 3D in order to add a dash of realism to otherwise entirely fabricated characters, props, and locations. Past box-office smashes Toy Story, Antz, and A Bug's Life were all created using sophisticated 3D technology developed exclusively for the movie industry. This technology is now being used in live action movies and television shows.
Note
Nearly every movie that rolls out of Hollywood these days is produced using some form of 3D technology. If you've seen a motion picture in the past decade you've almost certainly been exposed to 3D. From virtual sets and environments, to digital creatures and synthetic human actors, 3D touches almost every aspect of the broadcast film and television industry. The blockbuster movie Gladiator, for instance, made extensive use of 3D technology to create virtual sets and combat scenes. 3D also allowed the studio to construct a completely synthetic face and body for an actor that passed away before the filming of Gladiator was complete, creating, in effect, an utterly realistic yet entirely digital human being.
Although relatively new to the industry, Java 3D is proving to be well suited to developing commercial entertainment applications. Specifically, the combination of Java 3D's powerful yet easily mastered graphics capabilities and the portability and networking provided by the ubiquitous Java platform result in a compelling development platform for entertainment content.
At Boston's Museum of Science (www.mos.org/), for example, children interact with a Virtual FishTank created with Java 3D (see Figure 1–2). Developed by Nearlife, Inc., this unique interactive exhibit offers visitors the ability to construct their very own digital fish. By configuring options using a touch-sensitive computer screen, visitors create their own fish by hand. After selecting the physical attributes for their fish, users next specify rules for how it will interact in its environment and with other fish, and finally release their virtual creation into a digital “tank” that consists of jumbo computer monitors mounted on the museum walls. Visitors can then interact with their fish in the real world museum exhibit using data captured from motion sensitive cameras or online through a Web browser front end at www.VirtualFishTank.com/.
Online
Even if you're not in Boston you can create your own Virtual FishTank fish online at www.VirtualFishTank.com/. Using a combination of Shockwave and Java, this online version of the application allows users to create fish that interact with the Virtual FishTank exhibit currently installed at the Boston Museum of Science.
Cosm is an online 3D fantasy game being developed using Java3D. In Cosm (www.cosm-game.com), players use magic and swordplay and take on the role of a character that can interact with players from across the room or across the world. Players can develop their character from humble beginnings to become a mighty warrior, powerful wizard, wealthy merchant, or virtually anything they want in this dynamic society. Figure 1–3 shows an image from Cosm....