3D Models of Objects

Ultimately we must know where every point on the surface is, what colour it is and, what it is made of and how much light is falling on it. We might think of recording a 3D co-ordinate for every point on the surface. But how many points are there on the surface of a goldfish, or put another way, what is the size of a point?

A point has no size, therefore we would need an infinite number of points to specify the surface of our goldfish (well one per molecule anyway). No computer can store an infinite number of points so we must give our point some size, some area. The simplest shape that has area is a triangle. A triangle has three edges, two of which meet at a point (a vertex).

Therefore there are three vertices per triangle. If we specify a 3D co-ordinate for each vertex we have completely specified the position and orientation of a triangle. We can even find the co-ordinates of points within a triangle if we need to do so.

If we imagine a goldfish's surface covered with triangles and each triangle defined by the co-ordinates of its vertices we have a set of numbers that model the shape of a goldfish. The triangular pieces (which we will call faces) don't have to be the same size or shape (they must of course be triangular).

For example, suppose we want to model a cube, 12 triangles will give a perfect cube no matter what the size of the cube is. Because several of the vertices of the triangular faces occur at the same place we don't need to store 3 vertices per face, 8 vertices will do the job for the whole cube. In the same way, if two triangles have a common edge we need only store a single edge, that can be used for both triangles.

A cube of any size can be described exactly using 8 3D co-ordinates, one for each vertex. The 12 triangular faces are recorded by storing the identity of the vertex at each corner of the triangle, 36 numbers. A cube made up from triangular pieces has 18 edges and since each edge is joined to 2 vertices, two numbers are needed to specify an edge. Therefore 36 numbers are needed to define the edges in a cube made up from triangular faces. As mentioned earlier, 3 numbers are needed to specify a 3-D co-ordinate, thus the shape of a cube can be fully specified by 24+36+36=96 numbers.

The computer loves manipulating numbers and from a numerical model it can reproduce a view of a cubic goldfish tank, goldfish or anything else. Building a numerical model for an object means that you won't have to do any additional modelling work to change you view point or the lighting conditions.

There is one drawback to using triangular faces to describe the surface of an object and that is that objects are rarely made up of triangular pieces!. The surface of a sphere is not made up of triangular pieces, it is perfectly curved. Some objects can be exactly modelled by triangular pieces, the pyramids at Gisa for example. Any object that has part of its surfaces curved cannot be represented exactly by triangular pieces, but don't despair, if we choose the right number of triangles and make then the right size and shape we will get surfaces that look as smooth and curved as the aerodynamic shape of a high performance sports car.

The pyramid example cited above would need 6 triangles to get the shape exactly right. If there had been any curved surfaces on the pyramid we would have modelled this by increasing the number of triangles, and consequently decreasing the size of each triangle so that they cover the same surface area.

To imagine how increasing the number of triangles leads to better and better models for the real thing consider a Sphere. We can get pretty good looking spheres if we use 80 triangles covering the surface, and spheres that will be impossible to tell apart from the real thing if we use 1280 triangles to cover the surface.

One of the first skills that you will need to acquire is in deciding how many vertices and faces are needed to model an object. The more vertices and faces you use the better looking the model, but you will run out of memory on the computer and it will take longer and longer to draw (or render) the images if you just go on adding vertices, edges and faces. It is usually possible to reach a good compromise long before the machine lets you down.

It is good practice to build models, especially complex ones in pieces. Store each piece in a separate file and when all the components have been built they can be brought together to make a single model. (Much the same thing happens in any modern factory.) For example a push-bike can be made by building the frame, the front and rear wheels, the saddle, the brakes, etc. as separate bits.

Once we have build our model using the vertex, edge and face date structure its a very simple procedure to change how the model will look like, just by moving the vertices. You could for example turn our goldfish into a shark by making it larger and moving the vertices in the fins so that they look more like those of a shark.

If you keep the number of vertices the same but change their positions you will be able to "morph" the model so that it changes from a goldfish into a shark before you very eyes. You might have more difficulty in changing the goldfish into an aeroplane, but it could still be done.