146
Video Game Design Foundations
Pixel Shading
Pixel shading
is based on the idea that as you move farther from the light
source, things get darker. The game engine shades the pixels of distant objects
darker and closer objects lighter. As you move toward a distant object, it
will get brighter until it reaches full color when you are next to the object. In
addition to distance shading, an object will have different shades of color on
different surfaces to give contrast to the object.
Vertices
Pixel shading is useful, but something has to make the objects get bigger
and move as though you were seeing them get closer. The 3D engine does this
by adjusting the distance between vertices on the model. A
vertex
is a point on
a 3D model where the corners of adjacent faces meet.
For example, a cube object has six faces and eight vertices. See Figure 4-26. The
maximum number of vertices visible on a cube in a given shaded view is seven.
This means from one to four vertices are hidden from view, depending on where the
camera is located. Also, notice the pixel shading of the cube shown in Figure 4-27.
Think about the phrase, the light at the
end of the tunnel. Think about how you
might draw this concept in a very long
straight tunnel. How does the use of a
vanishing point work in this drawing?
UP!
4.3
Figure 4-26.
Goodheart-Willcox Publisher
A—A cube has eight vertices, represented by the spheres. In this view, only seven vertices
are visible. B—As the view of the cube is rotated, different vertices are visible and hidden.
Now, only six vertices are visible. C—When the view is rotated to show the front face, the
cube looks like a square and only four vertices are visible.
Previous Page Next Page