Game Development Reference
In-Depth Information
between the light and the pencil is 90 degrees, and no effect when the card faces away
from the light.
Each vertex gets its own normal vector. This might seem like a waste of memory, but
consider this: If each vertex has its own normal, you can change the direction of the
normal vectors to
the lighting system. You can make the 3D object take on a
smoother shading effect. This is a common technique to blend the edges of coinci-
dent triangles. The illusion you create allows artists to create 3D models with fewer
polygons.
The normals on the teapot model are calculated to create the illusion of a smooth
shape, as shown in Figure 14.15.
Now that you know what a normal vector is, you need to know how to calculate one.
If you want to find the normal vector for a triangle, you
fool
'
ll need to use a cross product
as shown here:
Vec3 triangle[3];
triangle[0] = Vec3(0,0,0);
triangle[1] = Vec3(5,0,0);
triangle[2] = Vec3(5,5,0);
Figure 14.15
Vertex normals on a teapotahedron.
Search WWH ::




Custom Search