Game Development Reference
In-Depth Information
be easily painted in Photoshop, normal maps are not so easily visualized
and edited. Cut-and-paste operations on normal maps are usually safe, but
for the normal map to be valid, each pixel should encode a vector that is
normalized. The usual technique for making a normal map is for an artist
to actually model a low- and high-res version of the mesh. The low-res
mesh is the one actually used at runtime, and the high-res mesh is solely
to create the bump map, 20 using an automated tool that raytraces against
the higher resolution mesh to determine the surface normal for every texel
in the normal map.
The trickier issue is that texture memory is a precious resource. 21 In
some simple cases, every texel in the normal map is used at most once on
the surface of the mesh. In this case, we could simply encode the normal
in object space, and our earlier description would work just fine. But
real-world objects exhibit a great deal of symmetry and self-similarity, and
patterns are often repeated. For example, a box often has similar bumps
and notches on more than one side. Because of this, it is currently a more
e cient use of the same amount of memory (and artist time) to increase
the resolution of the map and reuse the same normal map (or perhaps just
portions of it) on multiple models (or perhaps just on multiple places in the
same model). Of course, the same principle applies to any sort of texture
map, not just normal maps. But normal maps are different in that they
cannot be arbitrarily rotated or mirrored because they encode a vector.
Imagine using the same normal map on all six sides of a cube. While
shading a point on the surface of the cube, we will fetch a texel from the
map and decode it into a 3D vector. A particular normal map texel on the
top will produce a surface normal that points in the same direction as that
same texel on the bottom of the cube, when they should be opposites! We
need some other kind of information to tell us how to interpret the normal
we get from the texture, and this extra bit of information is stored in the
basis vectors.
10.9.1 Tangent Space
The most common technique these days is for the normal encoded in the
map to use coordinates in tangent space. In tangent space, +z points out
from the surface; the +z basis vector is actually just the surface normal n .
The x basis vector is known as the tangent vector, which we'll denote u , and
it points in the direction of increasing u in texture space. In other words,
when we move in the direction of the tangent vector in 3D, this corresponds
20 And for high-res renders for the box art. Some people also use high-res models to
make disingenuous screen shots of “in-game” footage, sort of like how the hamburger
you get at a fast-food restaurant doesn't look like the one in the picture on the menu.
21 We don't all have id Tech 5 's MegaTexturing yet.
 
Search WWH ::




Custom Search