3D Viewer

An experiment in 3d rendering

About this project

This is a networked 3d rendering and physics engine written entirely in java, with a simple serialization protocol for storing/loading 3d models. The rendering algorithm gets reasonable speeds for a few thousand polygons on fast processors (even though it was written in java :-P). It was written in 2 months by 2 juniors in high school (at that time): Elliot Kroo and Russell Chou, for the purpose of forcing ourselves to learn more about 3d geometry. It goes about the rendering process in a similar way to OpenGL.

How this works

The base renderer

  1. This project starts with an array of polygons to be rendered.
  2. All vertices in each polygon are transformed into a single coordinate system with 4x4 tranformation matricies (points are translated to and from homogenous coordinates in this step)
  3. All vertices in each polygon are then transformed into the Camera coordinate system, where x, y represent the dimensions of the image, and z represents the depth into the image to be rendered
  4. A near clipping plane is established, and everything behind this plane is removed.
  5. All vertices in each polygon are given perspective by scaling by their z value, then sorted by their distance to the camera note: this replaces the z-buffering step, which would have been hideously slow in java. This means overlap errors occur when objects are too big or very close.
  6. Finally, each polygon is drawn in 2d using awt

The physics engine

  • Every object follows simple 3DOF newtonian physics
  • Every object has a bounding box taken from the min/max vertices in each dimension -- used for rough collision detection
  • Upon collisions, a distance algorithm we developed for ngons in 3-space is used to detect which face the object is really colliding with
  • We are in the process of converting to a new, 6DOF engine, because we like moments. (this may never happen though :-) )

How Networking works

  • Player objects send "pose" updates to a central server, which relays the information to all other players. "Pose" is defined with a Vertex and a Quaternion.
  • The application recieves forwarded updates from other players through the central server, who update the corresponding Player objects.

How the editor works

Here is my proposal for animation:

*Its running really slow right now*, but to download it, click here:  link (for the editor, download this link:  link)

to work on it:

-- ElliotKroo? - 21 May 2007

Attachments