Skip to main content
GameDev.net gamedev.net
🔒 Locked

Normal Maps and Tangent space

Started by akhin Feb 14, 2011 at 4:47 PM 3 replies 5.4k views
Original Post
akhin
akhin
Hi all ,

I have some questions about tangent space and normal maps.



1. In the nomal mapping/parallax mapping samples I have seen , along with normals , also
tangent and binormals are passed to the shader for object space -> tangent space calculation.

I am trying to understand what actually a tangent vector and a binormal vector represent and what is their difference ?



2. What are the advantages of using tangent space instead of object space ?

In one place as I have read , it was saying we should have different normal maps for different orientations where as that does

not apply to tangent space. I didnt understand the word orientation, do you have any clue ?



3. Is there any tool you could suggest , to create normal maps ? I looked at Crazy Bump but it is not free.

Is there any free one you could suggest ? Or is there any way to produce them in 3DSMax/Maya ?



many thanks
0xffffffff
0xffffffff
Think of tangent and bitangent (or binormal if you prefer) as the x axis and y axis of a coordinate frame which has the surface normal as z axis. They are parallel to the surface while the normal is perpendicular.

A few advantages to storing normal maps in this space rather than object space-- one is that the texture map is decoupled from the surface geometry so it can tile/wrap and be applied to any surface, not just the one it was designed for. Another is that the "z coordinate" (that is, the normal coefficient--usually the blue color channel) in this space is a function of the other two coordinates and doesn't need to be stored explicitly, so there are a few schemes to take advantage of this and yield better quality under DXT compression, etc.

Some disadvantages, too-- since the per-pixel reconstruction of the normal is dependent on per-vertex tangents, ultimately the reproduction of the bump normal is influenced by the tessellation of the geometry and interpolation of the tangents. So, for perfect fidelity, object space might be preferable if you have wide range of LODs for models. In practice, this level of obsession is rare wink.gif. Tangent space is the de facto standard these days.
Burnt_Fyr
Burnt_Fyr

Hi all ,

I have some questions about tangent space and normal maps.



1. In the nomal mapping/parallax mapping samples I have seen , along with normals , also
tangent and binormals are passed to the shader for object space -> tangent space calculation.

I am trying to understand what actually a tangent vector and a binormal vector represent and what is their difference ?


For a texture mapped planar object, the Tangent and Bitangent vectors are those that are collinear with U and V from tangent space. I said bitangent as that is the *correct* term for binormal, though it is often confused. There is a good reason as to why it's a bitangent as opposed to binormal, and when I find the article I'll post a link. So basically the Tangent, Bitangent , and Normal are the basis vectors of tangent space, in local coordinates. These can be used to form a matrix that will convert from object space to tangent space and vice versa


2. What are the advantages of using tangent space instead of object space ?

In one place as I have read , it was saying we should have different normal maps for different orientations where as that does not apply to tangent space. I didnt understand the word orientation, do you have any clue ?

[/quote]

Object or local space normal maps encode everything relative to an objects local coordinate system. That means that if the object is deformed(like a skinned mesh), the normals will be wrong. Using Tangent space means that the normals are relative to the surface they are mapped to, which means that they will work fine when a mesh is deformed.


3. Is there any tool you could suggest , to create normal maps ? I looked at Crazy Bump but it is not free.

[/quote]
Normal maps are generally used to provide surface details that would be costly (in cpu cycles) to render in a real time app. The usual process is to model all the fine details, then make a copy of the mesh with less detail, and BAKE the normals from the hires mesh to the lowres mesh. The lowres mesh can be used in game, and the normals are sampled from the normal map to allow lighting to be calculated as if the extra detail was actually there. Most 3d modeling packages will allow you to bake normals to a texture. Crazy bump generates normals from a texture, but it is actually guessing, as it has no way of actually knowing what that surface is like.
akhin
akhin
Thanks for explanations , now I am clerarer with tangent space
0xffffffff
0xffffffff

Object or local space normal maps encode everything relative to an objects local coordinate system. That means that if the object is deformed(like a skinned mesh), the normals will be wrong. Using Tangent space means that the normals are relative to the surface they are mapped to, which means that they will work fine when a mesh is deformed.

It's actually quite feasible to apply object-space normalmaps with deformation to a skinned object. In terms of calculation, it's identical to the per-pixel deformation of tangent-space normals--it all boils down to a 3x3 transform of the bump normal (or the inverse transformation of light vectors into surface local space--if you're insane)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.