PDA

View Full Version : Tangent Mapper: gets tangent vector on poly


zhang
09-20-2005, 07:38 AM
http://zjprogramming.com/img/tmap_graph.jpg

Description:

TangentMapper is a node returns tangent and normal vector on the input mesh. It is useful to generate tangent space for normal mapping. Current version is developed for MTOR user to output per-vertex primitive variables on Tangent and Normal.

File:
http://zjprogramming.com/bin/tangentMapper_210905.zip

Usage:

1.Load the plug-in.
2.Source the mel.
3.Execute command:
mtorMapPolyTangent meshShapeName

sporadic
09-20-2005, 02:57 PM
There's more than one tangent to a surface at a specific point (any vector 90 degrees from the normal is tangent). Which does it pick? Is the tangent it picks consistent during deformation?

I currently use two point on mesh objects to calculate approximate, but consistent during deformation, tangents. An exact method would be nice, though, so if you can give a bit more information, I'd appreciate it.

zhang
09-20-2005, 03:20 PM
The plug-in defines tangent vector by the direction where points on mesh grows along U-direction. UV coordinate will not change during deformation.

You can find the algorithm here:

http://www.terathon.com/code/tangent.html

The limitation is the mesh must have UV texture coordinate, and no overlapping UV or zero-area traingles are allowed.

When the tangent vector is found, you can easiily cross-product with normal to find the bi-normal, and construct the tangent space by:

| tangent.x binormal.x normal.x 0 |
| tangent.y binormal.y normal.y 0 |
| tangent.z binormal.z normal.z 0 |
| 0 0 0 1 |

That will be helpful to use normal map on a skinned model.

sporadic
09-21-2005, 12:55 AM
Oh, good. That's really nice. The setup I'm, currently using only uses built in Maya nodes (one of them only in Unlimited) and also bases the tangent on the UV space, so that's not a problem. I've got it scripted, but even so is a bit of a pain to set up. Having the tangent and normal come out of the same node would be much cleaner.

I'll have to try it out.

JulianJohnson
09-22-2005, 11:23 AM
Keep up the Great work Dr zhang :thumbsup:

Iconoklast
03-08-2006, 10:13 AM
On the topic of Tangents and so on, (as I'm not very good with this kind of thing), is a face tangent (or vertex tangent) not available through MEL and math, without the use of nodes?

Robert Bateman
03-08-2006, 12:48 PM
On the topic of Tangents and so on, (as I'm not very good with this kind of thing), is a face tangent (or vertex tangent) not available through MEL and math, without the use of nodes?

you can calculate them in mel, though it may be unpleasant. In the API though, MFnMesh can provide you with the tangents and bi-normals.

CGTalk Moderation
03-08-2006, 12:48 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.