3D Scene Java applet overview
Purpose and features
This program illustrates most of the modeling, illumination, and rendering methods presented ITEC 501 - 701 - Advanced Computer Graphics (c)Tecnical University of British Columbia.
The applet has the following features:
- generating wire-frame models of cylinder, sphere, and torus with input parameters entered by user;
- aranging any number of 3D objects in a user-definded 3D scene;
- rendering the scene using the following algorithms:
- plain wire-frame,
- wire-frame with hidden-lines removed,
- Z-buffer (objects treated as polyhedrons),
- Z-buffer with smooth shading,
- ray-tracing with user-defined maximal recursion depth.
In many aspects the 3D Scene applet uses data encoding and algorithmic techniques similar to Ammeraal's Java programs.
However, there some differences from Java applications found in the textbook:
- All wire-frame models are based on triangle meshes.
- The sphere-generating algorithm in 3D Scene is not based on Platonic solids.
- All three types of solids are generated by 3D Scene programmatically, without using external data files.
The major reason for not using data files is the simplicity. Creating a Java applet that would read files requires special security settings on the client computer that may be inconvenient for the user.
The illustration below displays the controls that can be used for running the applet.
The left control group selects the rendering method.
The central control group allows the user to add a selected object to the scene.
The right control group changes the viewer aspect angle.
To add an object to the scene, the user must click on the respective button in the center of the control panel. A dialog like the one shown below will open.
In the dialog window for cylinder, the user should enter:
- the number of vertices in the regular polygon standing for the top and bottom faces,
- the top/bottom radius,
- the height, and
- XYZ coordinates of the center.
There is also an option to select the color and to place the cylinder axis vertically or horizontally with the respective controls.
By clicking on the Generate button user adds the solid to the existing scene. In the illustration above, the scene already contains a torus, and the user is about to add a cylinder to it.
Click here to run the applet.
Click here to view the source code (the applet class).
Click here to download the whole applet (all classes - zip file)