Detail normal maps are used in the same way as detail textures, to add high frequency information/detail to an otherwise low frequency base map or texture. This is useful in situations where a large range of view distances are allowed, such as a landscape, where the view point can encompass the ground close up and distant terrain.
Ideally, the base texture would be of high enough resolution to provide enough detail close to the viewer (using mipmapping to handle the lower sampling frequency at further distances). In fact, the use of mega-textures achieves just this, by texture streaming the relevant resolution segments into memory. However, this solution is not yet in wide use, next-gen engines such as id Tech 5 being among the first to implement it in real-time on current hardware.
Excluding this, the usual method is to stretch one texture over a large mesh to provide a low frequency basic colour and modulating it with a repeating texture to give the illusion of higher detail. The same is done with detail normal maps, but because the maps represent unit length direction vectors, the base and detail normals can’t simply be multiplied together the same way albedos (colours) can.
Primary normal map
Instead, the primary map perturbs (rotates) the interpolated vertex normal, passing the derived normal as input to the next normal map. Pertubation is performed by constructing a matrix composed of the current normal/binormal/tangent vectors that defines the ”basis” of the polygon. This is simply the vectors in world space representing the 3 axes that are perpendicular to the surface (normal), parallel to the surface (binormal) and a third vector also parallel to the surface but perpendicular to the other two vectors (tangent).
By multiplying the normal sampled from the normal map by this NBT matrix (actually the BTN matrix, as the normal is z-axis), the sampled normal is transformed into world space. Breaking down the matrix multiply, the transformation of the sampled normal (n1) from tangent-space into world space (Normal′) becomes straight forward:
 Normal′ = n1.x * Binormal + n1.y * Tangent + n1.z * Normal
In the case of a flat normal with no deviation, n1=(0,0,1), resulting in Normal′=Normal. The x and y components cause according Binormal & Tangent contributions, and as long as the basis axes and the sampled normal are all unit vectors, the resultant linear combination is also of unit length.
Detail normal map
After the primary normal map has been applies, you’re left with Normal′, Binormal and Tangent vectors as the new basis. As only the normal is required for the lighting equation, the fact that the Binormal and Tangent are no longer orthonormal (perpendicular) to Normal′ isn’t a problem with only a single normal map. With a second perturbation, the Binormal and Tangent need to be made orthonormal to the first perturbed normal Normal′ before the . This can be achieved by removing the Normal′ component in the Binormal vector and renormalising it. After that, it’s a simple matter of taking the cross product of the normal and binormal to derive the perturbed tangent:
 Binormal′ = normalise( Binormal - (Binormal . Normal′) * Normal′ )  Tangent′ = Normal′ x Binormal′
Strictly this may not be the geodesic rotation (the least rotation required to map the basis to align with the perturbed normal) like you can get through the use of quaternions, but it provides consistent results for a relatively small performance impact.
The departure hall was quiet.
Floors polished to brilliance by years of heels hurrying across its grey expanse did little to reduce the cold impersonal glare of the multitude of lights. The hall offered scant warmth and, from the demeanour of those who sat with in it, less cheer. In constrast to the hustle and energy of most of establishments of its ilk, this was the very picture of lifelessness. In corners men spoke in hushed tones, discussing things best not overheard by the uninvolved. A grunt of agreement to a whispered proposal or a bitter laugh from weary traveller were the only sounds to intrude upon the silence. The majority of the denizens of the airport were closely watching the clock, each tick bringing them a step towards their escape.
The man had sat, willing himself to sleep, but slumber would not come to him in this place. Unendingly tended by servants, cleaning and replacing the lights as they faltered, the hall was free of all shadows. His wonder at first entering the hall, which had prompted him to privately name it the Court of Light, had long since passed. After this long bathed in the unceasing colour-sapping brilliance he had come to realise its true name, Hell.
As some of you may know, from this Three Panel Soul comic, Viva Pinata toys are being sold as part of a Burger King promotion running in the US. However, they’ll also be débuting in the UK from 9th Nov – 6th Dec.
Gotta catch ‘em all! (or something equally cheesy but less copyright infringing)