Rasmus Fonseca


J3DScene is a library for viewing 3D-scenes created in Java. A set of basic geometric primitives are supported, and can be added to a scene which can then be viewed from different angles. Colors, movements and transparencies are supported as well.

The viewer can pan, rotate and zoom using the mouse, and supports repainting every n'th millisecond, which enables generating live animation-sequences. The library is intended to be as simple as possible to support very quick overview of a 3D-scene. It is well-suited for visualizing 3D-algorithms, geometric problems and solutions and even molecular structures where user-defined properties are illustrated.

You can e-mail me if you're interested in the source code. Notice that J3DScene requires Java3D to be installed as well as JRE >=1.5.

Download J3DScene.jar


To get started quickly simply import the jar into your java-project, and create a frame with some objects the following way:

import edu.j3dScene.J3DScene;
import edu.math.Vector;
import edu.geom3D.*;
J3DScene scene = J3DScene.createJ3DSceneInFrame();
scene.addShape( new Cylinder(new Vector(1,0,0), new Vector(0,1,0), 0.1f) );
scene.addShape( new Capsule(new Vector(0,0,0), new Vector(-1,1,0), 0.2f), new java.awt.Color(200,40,40,100) );
scene.addText( "Some text", new Vector(1,1,0) );

This creates a scene with a cylinder, a red transparent capsule and some text, all displayed in a JFrame.

When viewing the scene the following navigations work:

Following are screen-shots of the frame from the above example.


When creating animations the properties defining the primitives (e.g. the center of a sphere or the corner of a tetrahedron) are simply changed and repaint called. Following example will show an animated sphere rotating around origo:

J3DScene scene = createJ3DSceneInFrame();
Sphere sphere = new Sphere( new Vector(1,0,0), 0.1f);
float t = 0;
sphere.center = new Vector(Math.cos(t), Math.sin(t), 0);
try{ Thread.sleep(30); }catch(InterruptedException exc){}