Last Updated 4-4-98


This is identical to the document available at DarkJedi. I believe it serves its purpose.

The Basics

It's easy to create a sphere. It's easy to convert that sphere to a 3DO. It is not easy or trivial to manually texture that sphere. Such a task is better left to a CAD program, but, until such a program is released, you will have to do it the hard way.

The basics: A 3DO is made up of faces. A face is a planar object defined by 3 or more vertices. A vertex is a position in 3D space. Imagining yourself at the origin (0,0,0), your right would be +X, your left would be -X. Up is +Z, while down is -Z. In front of your is +Y, behind you is -Y. A texture vertex is a two-dimensional point. It is based off of pixel units of the image file, but also supports sub-pixels or "parts of pixels." (0,0) is located at the top-left of an image. To the right is +U to the left is -U. Downward is +V, while up is -V. The coordinate (10.5,12) would mean ten and one-half pixels to the right, and twelve pixels down from the top-left corner.

Three parts of a 3DO are relevant to texturers: the Vertex list, the Texture Vertex list, and the Face list. The vertex list declares each vertex used within a mesh. In a simplified world, each face would declare its individual vertices. But, instead, there is a list which will be refrenced by each face. It is done this way for several reasons, speeded rotations is one instance. The fact that it's done this way will not effect you in the least. Like the Vertex list, the Texture Vertex list contains a declaration of each texture vertex. Similarly, a face uses references to texture vertices -- as apposed to direct declarations. Lastly is the Face list. Each face is defined by a multitude of properties. The relevant sections for us are mat and verts. Mat is a reference to which material file (image file in MAT format) which will be used to texture that face. All mats are declared in the materials section of the 3DO. The verts section is a tad more complicated -- but not much. First the number of vertices is declared. Then follows n combinations of vertex, texture vertex ordered pairs. Thus you could state:

4 0, 2 1, 3 2, 4 3, 5

This would tell JK that there are four vertices. It knows that the first vertex is vertex number 0, and that it should use texture vertex number 2 at that point. The second is vertex 1, and texture vertex 3, etc.

Now that we know how to texture the face, let's now look at the process of deriving the ordered pairs.

The Details

This is the fun part of texture mapping. Let's first consider what is going on. The geometry of the face is defined by its vertices. As we all know, an image file can be placed on a face to give it a more "realistic" appearance. One issue remains: because the shape of a face is usually not a perfect square, JK needs to know how to position the image file onto the face. If you wish, you can think about it this way: a face is just a plane. It needs to have vertices defined so that JK knows which part of that plane is to be drawn. Likewise, JK has to know which part of a material is needed to cover that face. Now that you're completely confused, allow me to present a metaphor for texture mapping a mesh:

A scultpter creates a sculpture and folds a thin, square rubber mat around it. He holds the mat in place using thumbtacks at all of the vertices. He then paints the mat to what he wants the sculpture to look like. He doesn't have enough space to store the sculpture itself so....he writes down the exact positions in space of each thumbtack. He also writes lists of references to the thumbtacks so that he knows how to arrange them later. He then lays that mat out on the floor and writes down exactly where on the mat each thumbtack was placed. He then stores the two lists, the thumbtacks, and the mat.

This is how Acrissime described texture mapping, and I think it is a perfect way to think of it. To apply it to 3DOs -- the artist wrote down the 3D position of each thumbtack in a Vertex list, after he layed the mat on the floor he noted where the thumbtacks lay on the mat. Because it was flat against the floor, he only needed a 2D coordinate to define each vertex. He then wrote those down, using the previously mentioned coordinate system, in a Texture Vertex list. He can now say, "in this face, the thumbtack was placed at (-1,0.5,0), but that is the texture point of (10,12)." Later when he wishes to view his statue, he can easily set it back up.

This analogy fails when we consider that we cannot just "paint" onto the model. We, instead, select points on the mat that, when put in order, will mimic the shape of the face and not distort the image the image. So it is up to you to figure out the texture coordinates for each vertex of the face. I'll present two examples that may help you out.

If you have a square face, then you're really lucky. You can define four texture vertices quite easily: (0,0)-(64,0)-(64,64)-(0,64). Asuming the chosen mat is 64x64 pixels, this would apply the entire mat to the face. Jobs done. But what if you don't want the entire mat on the face, but only the lower right quarter? Then you can simply change your texture vertices to (32,32)-(64,32)-(64,64)-(32,64). Now that was easy! Now what if you want the texture rotated 90º? Simply redefine your vertices so that the "top" edge is defined second and the "left" edge is defined first: (0,64)-(0,0)-(64,0)-(64,64).

But what if you have a triangular face? No problem, you only have to define three texture vertices to place the entire mesh on it: (32,0)-(64,64)-(0,64). This assuming of course that you have an equilateral or similar triangle where its base is horizontal. There is a creative way showing the same part of this texture on the face. In looking at texture vertices, I'm sure you've seen some that had negative values in them. Negative values are allowed because a texture is not just that single image, but really an inifinetly tiled plane of that texture. Think of the Windows desktop. Now if (0,0) is the top-left corner of a texture, what is (-1,-1)? It would be the lower-right corner of the texture! So our triangle's texture coordinates could be (-32,0)-(0,64)-(-64,64). If you wish to rotate the texture 90º, then your new coordinates would be: (64,32)-(0,64)-(0,0) or (-64,32)-(0,64)-(-64,0) or (64,-32)-(0,0)-(0,-64) or even (128,32)-(64,64)-(64,0)!

The Conclusion

If you have questions, the best way to get them answered would be to post on the JED Message Board at www.darkjedi.com. There are some knowledgeable people out there that will be able to help you out.

I hope this helps you out in some way. For now, I have to get back to writing my editor, May the Force Be With You!