I'm trying to grasp the concept of normal mapping, but I'm confused by a few things. In short, I'm not sure whether a normal map is viewpoint dependent or not (i.e. whether you'll get a different normal map of the same object when you rotate around it). Secondly, I don't get why the blueish color is the predominant color in normal maps.
How I think about normals, and their relation to RGB colors, is as follows. The unit sphere represents any unit normal possible — in other words, the X, Y and Z components of a unit normal vector range from -1 to 1. The components of an RGB color all range from 0 to 255. Therefore, it makes sense to map -1 (normal component) to 0 (color component), 0 to 127 or 128, and 1 to 255. Any value in between is just linearly interpolated.
Applying this mapping to the normals of an arbitrary 3D object results in a very colorful picture, not at all predominantly blue. For example, when taking a cube, all six faces would have a different, but uniform, color. For instance, the face with the normal (1,0,0) would be (255,128,128), the face with the normal (0,0,-1) would be (128,128,0) and so on.
However, for some reason the normal maps of a cube I found are completely blueish, i.e. (128,128,255). But clearly, the normals are not all in the positive z-direction, i.e. (0,0,1). How does this work?
[Edit]
Ok, so the approach described above seems to be referred to as the object space normal map or the world space normal map. The other one is called the tangent space normal map. I understand how such a tangent space normal map can be used to modify the normals of a geometry, but I'm still not completely sure how it is actually calculated (see my comment at Nicol Bolas' answer).
[Edit 2]
I should probably mention that I'm working with piecewise parametric surfaces. These surfaces consist of a set of surface patches, where each patch is associated with its own parametric space (u,v) = [0,1] x [0,1]. At any point on the surface, the normal can be calculated exactly. Apparently, the vectors T (tangent) and B (bi-tangent) — required to span the tangent space — are not simply the partial derivatives of the surface patch in the direction of u and v...