Off File Viewer
I wrote this 3D scene rendering program, initially for a University
project but then realised that this could be used to do static displays
of scenes on the web. So began the Off Viewer project for the web.
How To Use It
For ease of use and more power, type in commands in the command text field
and press enter. The following commands are accepted:
off offfile sx sy sz rx ry rz tx ty tz - To add a new offfile
from the list of available choices subject to the specified transformations
(scaling by sx, sy and sz, rotation by rx, ry, rz and translation by tx,
ty, tz)
light intensity xDir yDir zDir - To add a new light source at
infinity coming FROM the direction denoted by the vector (xDir, yDir,
zDir) going TOWARDS (-xDir, -yDir, -zDir). So basically imagine a light
source at infinity whose rays are parallel to the line (xDir, yDir, zDir) -> (-xDir, -yDir, -zDir).
n nValue - To set the value of the specular reflection exponent factor..
dim width height - To set the dimensions of the view port.
focal focalLength - To set the focal length of the "Camera". This
parameter controls the overall "size" of the scene.
ambient ambient-light - To set the ambient light (0 to 1)
ka ambient-reflectin-coefficient - To set the value of the ambient
reflection coefficient (0 to 1).
kd diffuse-reflection-coefficient - To set the value of the diffuse
reflection coefficient (0 to 1).
ks specular-reflection-coefficient - To set the value of the
specular reflection coefficient (0 to 1).
render - To actually render the current scene with the current
options on the frame.
Here are some examples:
Scene 1:
off ktests/cube.off 040.0 040.0 040.0 12.0 30.0 45.0 050.0 +030.0 -600.0
off ktests/cube.off 070.0 070.0 070.0 -45.0 30.0 -65.0 090.0 -000.0 -500.0
off ktests/head.off 009 009 009 200.0 40.0 180.0 -150.0 -050.0 -400.0
off ktests/seashell.off 090 090 090 110.0 13.0 -21.0 -000.0 040.0 -250.0
off ktests/x29_plane.off 3 3 3 140.0 115.0 -110.0 000.0 -20.0 -300.0
off ktests/volkswagon.off 1 1 1 0 -30 0 100 -130 -400
off ktests/space_shuttle.off 1 1 1 -60 30 20 00 -120 -800
light 0.7 1 1 1
Scene 2:
off ktests/hand01.off 1.0 1.0 1.0 90 -30 0 -1 5 -10
light 1.0 -1.0 0.0 0.0
off ktests/apple.off 0.2 0.2 0.2 0 0 0 0 0 -10
ambient 0.2
off ktests/klingon.off 1.0 1.0 1.0 -30 -30 -30 5 5 -10
light 1.0 0.0 1.0 0.0
off ktests/r2.off 0.1 0.1 0.1 -90 30 0 -100 -50 -160
light 1.0 1.0 -1.0 1.0
off ktests/space_station.off 0.1 0.1 0.1 -90 30 0 1 -1 -3
light 1.0 -1.0 1.0 -1.0
off ktests/seashell.off 2 2 2 -90 30 30 -1 -1 -3
off ktests/volkswagon.off 1 1 1 0 -65 0 200 -1 -200
To Do
I plan to do the following changes to the program:
-
Fixed Point Calculations as opposed to floating point ones.
-
Easier architecture to easily be able add newer modules and algorithms.
-
A proper engine that could accept VRML syntax too.