GameSpawn Site Map
GameSpawn Update mailing list

Lee's Lessons



An Introduction

Hello. My name is Michael Lee and I am a software developer. I am 29 years old, work for BEA systems and currently help out part time with this site. I have been coding since I was about 10 years old. Most of the code I wrote when I was young was on the TRS 80 or the Commodore 64, of course! I got into electronics and moved away from computers but found my way back in with the comming of age of the PC in the early 90s. This led to a BS in CS from Clemson University and hopefully a Masters of Software Engineering. This is all well and good but everyone knows these damnned things are really only good for games so let me get to what I'm doing here.

This site has some great artists for images, sounds and other media types but I am here for more of the technical side. I will publish code, research or articles and news pertaining to java and the gaming community on this site. Gaming, they say is both and art and a science. Think of me as more of the science of this site. I will add content pertinent to the entertainment software developer. The emphasis will be on Java code development. If anyone has any comments or criticisms (constructive please) about any of my code or work, please feel free to email me at You can also feel free to submit any work of your own. All we ask is that it, also, is free! Everything at this site is free. Take all the code and articles I write and do with them what you will. We at follow the Mozilla Open Source standard and ask that any submittals to this site do also. Without further blather.......

Today - Java3D Example Code

A small example demonstrating many of the features of Java3D.

This small, yet very encompassing, program shows many of the powerful features of Java3D such as:

  • The ability to quickly define and show many geometries (cubes, spheres, etc.);

  • Loading of external 3d image files such as .obj, the Java3D standard. I will discuss with sample code a DXF loader implemented by the NCSC;

  • The ability to add complex appearances to your shapes/geometries such as reflective properties, color, textures, etc.;

  • Dynamic lighting and colored lighting;

  • Full scene graphs rendered with a compiled and full running Java3D engine loop;

  • Creating a basic heavyweight component for a Java3D scene; and

  • Adding behaviors to objects to be activated upon events within the Java3D engine loop.

As you can see it is a lot for one day but it will be broken up into manageable parts in the next couple weeks demonstrating each feature of Java3D in more detail. These pieces will eventually lead to Java3D tools that can be utilized by the average Java3D developer. The developer can take the code written here along with the examples from the next couple of weeks and use them in his own code. A good deal of the 3D code I write is pulled from this very beginning!

This code may contain some commented out sections. This is due to some Video card compatibility problems or other issues. These will be explained and put back in for other reasons at a later date.

The .jar file will not run as a self-executing program like most Java1.2 .jar files due to a problem with Java3D. It must be run from the command line. :(

Move Viewer

This program shows the power of Java3D. It has a pretty generic object loader. It can take multiple shapes and multiple appearances for those shapes. For example, look at figure 1 to the left. For shapes it accepts a cube a sphere and even a P51 mustang! The P51 mustang is an object that was loaded in by Java3D. This is one of its more powerful features. An object can be created in a 3D rendering package and brought into a Java3D program through a convienence loader. NCSC has a loader for DXF files!!

An appearance can be added to any of the shapes easily. Here we see textures that were applied, one of my head on a monkey and the other of Emanuel Lewis of 'Webster' fame.

Each of the objects except the bottom right can be moved. With a 3 button mouse. Left button rotates, middle button translates on the Z axis and the right button translates on the X and Y axis. This is a great small program that shows off the ease of which 3d objects can be created and manipulated.


  • Supported Java3D Video Cards. NOT ALL 3D CARDS WORK WITH JAVA3D! Read This!!!

  • Today's code will be broken up into much smaller, more manageable and understandable pieces. The first example will be to aid in understanding Java3D by using an example to display a simple shape.

Michael C. Lee, Jr.