# Thread: Tangents for indexed meshes?

1. ## Tangents for indexed meshes?

Good morning everyone!

After hours of searching and researching I cannot dig up some valuable information on calculating correct tangent vectors for an indexed triangle mesh. I've had my experiences with non-indexed geometry so I'm familiar with the algorithm.

Obviously I'm already dealing with averaged vertex normals here, so is it the right strategy to take an arbitrary triangle sharing a vertex and calculating one tangent vector with respect to the smoothed vertex normal and the UVs of this triangle and then orthogonalize it?

Am I correct in thinking that by having the same base at this particular vertex for all connected triangles I will have correct lighting results? Apparently D3DX has a function which does just that so I assume it is quite possible.

Guess I need some math pro advice here.

BTW, I tend to use the approach described in (Lengyel, 2005).

Thanks everyone!

2. ## Re: Tangents for indexed meshes?

The first link actually IS the text from (Lengyel, 2005). The second basically describes the same thing - if I didn't miss anything, the author doesn't take care of potentially different signs for the bitangent. So no gain here.

The GDC pres. by Mittring is more like it. Calculating the TS per Triangle is not a big deal. For step 2, correct vertex normals are already provided by Blender.

If I get step 3 correctly, this would still require knowledge about the neighbouring triangles, so I'm forced to build a corresponding data structure. Right?

Does someone have experience with this?

Again: Tangent per triangle isn't a problem and my vertex normals are already smoothed.

Thanks again.

3. ## Re: Tangents for indexed meshes?

Connectivity/neighbouring between triangles/faces aren't generally directly provided by the model, so effectively a corresponding data structure have generally to be [re]computed

(Note that the stripping format can already directly provide the neightbouring informations into each independants strips, so only neighbouring between strips have to be computed ...)

I have discovered on internet the Moebius strips
http://www.cut-the-knot.org/do_you_know/moebius.shtml http://en.wikipedia.org/wiki/M%C3%B6bius_strip
=> the idea can perhaps to be extented for to handle a closed model instead a single band ?

Note too that sharing/averaging normals for each vertex doesn't handle the simple case of the cube where we have three faces that share the same vertex **but** with differents and perpendiculars normals ...

4. ## Re: Tangents for indexed meshes?

Sorry for my delayed reply. I guess I'm gonna give Schüler's method of calculating the tangent frame in the fragment shader a try. I can't really deal with extending my geometry processing methods right now.

Thanks for the input!

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•