Interactive 3D

More Instructions

Here are some examples by St Francis Students:

3D Object Code


Click and drag on the picture to rotate the object.

To change or construct an entirely new object, change the 3D Object Code. The syntax of the Object code is adapted from the Wavefront .obj format. Each line starts with a letter followed by some numbers. Every object must have vertices (corners, if you will), which are later grouped as a face of the obect or as a simple link between two vertices.

Say you want a vertex at the three dimensional point (-1, 0, 0). Simply type a line in the Object Code starting with a "v" followed by the three numbers, separated by spaces:

v -1 0 0

These vertices are refered to later by the order which you created them, the first vertex is 1, the second is 2, and so on. Let's add a few more:

v 0 0 0
v 1 0 1
v 1 1 0
v 0 1 1

To construct a face on your 3D Object, connect any number of vertices by typing a new line in the Object Code starting with a "f" (for face) followed by the numbers representing the vertices (again, each number is separated by a space).

For example, to make a triangular face from the first three vertices you made, type a new line:

f 1 2 3

This connects the first three vertices together.

To make a simple line from one vertex to another, use the letter "l" to link a pair of vertices. For example, to draw a line between 1 to 4, 2 to 4 and 3 to 4:

l 1 4
l 2 4
l 3 4

The source.

Back to Main Page