Re: tangent maps

Date : Thu, 25 Jan 2007 11:20:09 +0100
To : XSI(at)Softimage.COM
From : André Adam <a_adam(at)49games.de>
Subject : Re: tangent maps
Hi Bernard,

the tangent property in XSI is the so called tangent map, or tangent space. Encoded in there you can find a given texture space's u-direction (the reason why you have to reference a texture projection when creating a tangent property) in 3d space (you could call this the "texture mapped" u-direction) on a per sample basis, so we're talking of vectors here. In absence of a more convenient property Softimage decided to encode the tangents into vertex colors. That means you have a little bit of math to do to revert them back to vector data: (VC-0.5)*2. This formula stretches the RGB vertex color values, which have a 0-1 range, back to a vector's -1 to +1 range.

The reason you need a tangent space when dealing with normal maps is that a "normal map in tangent space" (there is also an object space flavour)
stores relative information as to where a given normal should be bent, which after all is what bump mapping is all about (bump mapping and normal mappinng are practically the same thing). The lila-blueish color in a tangent space normal map means that the geometry's input normal should not be altered, where cyan, magenta, etc colours indicated a shift in normal orientation.
This shift, which is a relative bit of information as it does not point to global world coordinates, needs a reference on the object itself from which the relative shift should be calculated - the tangent space. The tangent space offers a predefined vector for each sample point and is directly generated from the texture projection the normal map is mapped with onto the object.


I've written a small utility that creates little pointers from the tangent space right on the object's surface to better show the vectors encoded there. I've attached two screenshots which might clearify that a bit. The first one shows a straight spherical mapping, the second one is twisted. As soon as a texture space shows distortions (or even worse: seams), just like the second one, tangent spaces become tricky; the samples for a single vertex point in different directions, which finally would create artifacts during normal mapping. To cope with this issue the tangent operator in XSI has a smoothing value, which basically middles the different sample's tangent vectors using an angle-based approach.

Since the normal map stores its data relative to the tangent space, generation, as done with the ultimapper for example, therefore always needs to reference it during generation to provide correct results. Ultimapper basically marries referenced object curvature from a high resolution source object with the normals of the low resolution source object and the tangent space of the low resolution object.

The Photoshop plugins and tools provided by graphics hardware vendors don't have this kind of 3d information available when generating normal maps from heightmaps. They assume that the object the generated normal map might get mapped onto shows an ideal tangent space, which usually is nonsense. The more distorted the texture space on the mapped object is, the wronger (is that english?!) the bump mapping results with such a textures are. I'd stay away from these tools for production work.

Hope that makes some sense, cheers!

   -André



Bernard Lebel wrote:

-snip-
- you need to use a "Tangent" property. If someone could tell me why
I'd be more than happy. I suspect this is due to the fact that tangent
normal maps are heavily used in realtime rendering, and the Tangent
property is a color at vertices property (which also makes it an
absolute nightmare scripting-wise... why not having a new cluster
property for this one, please oh God?) so there must be something
related here.
-snip

JPEG image


Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.