Java 3D Programming

Daniel Selman

2002 | 400 pages
ISBN: 1930110359

Out of Print $49.95 Softbound print + eBook
$39.99 eBook edition (PDF only)



Java 3D Programming steps programmers through the important design and implementation phases of developing a successful Java 3D application. The book provides invaluable guidance on whether to use Java 3D, user interface design, geometry creation, scene manipulation and final optimizations. The book does not attempt to exhaustively cover the API or replicate the official documentation but rather serves as a roadmap to alert programmers of design issues and potential pitfalls.

The author distills 12 months of using the Java 3D API for commercial projects, as well as innumerable discussions on the Java 3D email list into a book that all Java 3D developers will appreciate. Experienced Java 3D developers will applaud an authoritative resource containing the state-of-the-art in techniques and workarounds, while novice Java 3D programmers will gain a fast-track into Java 3D development, avoiding the confusion, frustration and time wasted learning Java 3D techniques and terminology.

Java 3D Programming comes complete with a comprehensive set of programming examples to illustrate the techniques, features, workarounds and bug fixes contained in the main text.

Readers of this book would include students and postgraduate researchers developing visualization applications for academia. Moderately experienced in Java, some experience of 3D graphics, little or no experience of Java 3D is needed. R+D s/w engineers at commercial institutions. Experienced Java developers, experienced with OpenGL or VRML, little or no experience with Java 3D.


Daniel Selman is a Staff Engineer for BEA System, working on personalization technology for scalable J2EE applications, and specification lead for JSR-94, the Java Rule Engine API. As Managing Director of Tornado Labs Limited, he worked on commercial projects using the Java 3D API. He has written modeling applications for CAD visualization and facial modeling/animation tools using OpenGL and C++. He has a B.S. in Civil Engineering with Computing and an M.S. in Artificial Intelligence.


Chapters 1 and 13 of Java 3D Programming are available here in Portable Document Format (PDF); you need Adobe's free Acrobat Reader software to view them. You may download Acrobat Reader here.

Download Chapter 1

Download Chapter 13


About this book

Java 3D is a client-side Java application programming interface (API) developed at Sun Microsystems for rendering interactive 3D graphics using Java. Using Java 3D you will be able to develop richly interactive 3D applications, ranging from immersive games to scientific visualization applications.

Who should read it?

Java 3D Programming is aimed at intermediate to experienced Java developers. Previous experience in graphics programming (OpenGL and Swing, for example) will be very useful, but it's not a prerequisite. No book stands alone and you should make good use of the many online resources and books listed in appendix B and the bibliography. Readers new to Java 3D should definitely download Sun's excellent (free) Java 3D tutorial. This book is intended to serve as a companion to the Sun API documentation and the Java 3D tutorial.

How is it organized?

The book has 18 chapters, plus three appendices and a bibliography. Each chapter is fairly self-contained or explicitly references related chapters, allowing you to focus quickly on relevant material for your problem at hand. I have ordered the material so that, if you were starting a project from scratch, progressing in the book would mirror the design questions you would face as you worked through your design study and development efforts. More commonly used material is, in general, closer to the beginning of the book.

Chapter 1 focuses on getting started with Java 3D, system requirements, running the examples in the book, plus a look at the strengths and weaknesses of Java 3D.

Chapter 2 introduces some of the fundamentals of 3D graphics programming, such as projection of points from 3D to 2D coordinates, lighting, and hidden surface removal.

Chapter 3 gets you started with Java 3D programming, from setting up your development environment and resources to running your first application.

Chapter 4 explains the fundamental data structure in Java 3D, the scenegraph. Aspects of good scenegraph design are described using an example application for discussion.

Chapter 5 is a reference to Java 3D's scenegraph nodes, along with usage instructions and examples.

Chapter 6 explains the elements of the Java 3D scenegraph rendering model and guides you in your choice of VirtualUniverse configuration.

Chapter 7 takes a step back and examines data models for 3D applications. Choosing a suitable data model involves understanding your interaction and performance requirements.

Chapter 8 is a reference to creating geometry to be rendered by Java 3D.

Chapter 9 covers the elements of the Java 3D Appearance class, used to control the rendered appearance of the geometric primitives in your scene.

Chapter 10 illuminates the Java 3D lighting model and shows you how to create powerful lighting for your scene.

Chapter 11 introduces the Java 3D behavior model, which allows you to attach code to the objects in your scene. Examples illustrate both keyboard and mouse behaviors for graphical user interfaces.

Chapter 12 expands upon the discussion of behaviors, covering the Interpolator behaviors, used to control geometry attributes using the Alpha class.

Chapter 13 describes how to write your own custom behaviors and register them with Java 3D for invocation. Example behaviors for debugging and complex physical animation as well as others are presented.

Chapter 14 explains how to increase the realism of your scenes by applying bitmaps to your geometry using the process of texture mapping.

Chapter 15 highlights some of the utility classes provided with Java 3D for operations such as triangulation and loading of input data.

Chapter 16 delves into more techniques valuable for interacting with 3D scenes, object interaction using the mouse for selection of 3D objects, and performing collision detection between 3D objects.

Chapter 17 shows, through example, how to build Java 3D applications that use the Swing packages for 2D user interface elements, and can be distributed as Java applets for use from a web browser.

Chapter 18 goes low-level to explain some of the implementation details of the Java 3D API. The aim is to give you a greater appreciation for what is going on behind the scenes and help you optimize your applications.

Appendix A cross-references all the examples by chapter and includes instructions for downloading, installing, and running the example code from the publisher's web site.

Appendix B includes a comprehensive listing of programming and graphics resources online. Print references are provided in the bibliography.

Appendix C explains the Primitive utility class, its geometry cache, and the GeomBuffer class, along with tips and caveats.

Source Code

The book contains over 30,000 lines of example code, including some reusable library code that I hope will contribute to the collective understanding of the Java 3D community. Code of particular interest is shown in boldface. Appendix A contains a list of the example Java 3D applications and applets developed for this book, as well as detailed instructions for running the examples. The code itself is identified in the text by an initial reference to its location at http://, the Manning web site for this book.

Typographical conventions

Italic typeface is used to introduce new terms.

Courier typeface is used to denote code samples as well as elements and attributes, method names, classes, interfaces, and other identifiers.

Courier bold typeface is used to denote code of special interest.

Code line continuations are indented.

How to use the book

I have tried to organize many of the topics in the book in an order appropriate for developers designing and building a new Java 3D application. I would suggest initially reading or skimming the chapters sequentially to get an overall feel for the design of your application, and then returning to specific chapters and examples for reference material as required. Please note that the example source code for the book is provided under the GNU General Public License (GPL) ( I encourage you to modify and distribute the source code in accordance with the spirit of open source and the GPL license.

If you still need help or have questions for the author, please read about the unique Author Online support that is offered from the publisher's web site.

Author Online

Purchase of Java 3D Programming includes free access to a private web forum run by Manning Publications where you can make comments about the book, ask technical questions, and receive help from the author and from other users. To access the forum and subscribe to it, point your web browser to This page provides information on how to get on the forum once you are registered, what kind of help is available, and the rules of conduct on the forum.

Manning's commitment to readers is to provide a venue where a meaningful dialog between individual readers and between readers and the author can take place. It is not a commitment to any specific amount of participation on the part of the author, whose contribution to the AO remains voluntary (and unpaid). We suggest you try asking the author some challenging questions, lest his interest stray!

The Author Online forum and the archives of previous discussions will be accessible from the publisher's web site as long as the book is in print.


"Reading the book and trying out the samples is only a matter of clicking and a few keystrokes. This is very important because Java3D samples are usually lengthy. The last chapter is an analysis of the architecture of Java3D classes and thus rounds up a discussion of this new frontier. Readers who have an interest in 3D programming using Java should not miss this book."

"...a fascinating complement to the Sun tutorial. If you plan to program with Java 3D components, this book will be very useful."
     --Middle Tennessee Java Users' Group

"!!!! Exceptional"
     --Today's Books

"a solid introduction to the Java 3D API. It tries to strike a balance between teaching 3D concepts to those with no 3D background and explaining to experienced 3D programmers how to use the Java 3D system...both groups should find value in book."
     --Austin Java Users Group


Source code from Java 3D Programming is contained in a single ZIP file. Free unzip programs for most platforms are available at

Download the source code. (Source Code -- 2.95 Mb)