Per-Vertex Tangent

what is the correct way to generate a Binormal and Tanget per-vertex for dot3 bump
mapping???

Thanks in advance

Assuming your normal is pointing in the “Z” direction of your tangent space. This normal defines a plane perpendicular to the normal, passing through the vertex. In this plane, at the vertex, the texture “u” coordinate points in the binormal and the “v” coordinate points in the tangent direction. You can easily solve for these by projecting the vertices at the other end of edges going out from the vertex onto the plane, and solving a 2d equation system in u,v.

Note that, if the vertex lies on a texture seam, then you get two different tangent spaces at this point. Also, there may be different amounts of stretching (or even, shudder, mirroring) in the vertex, which would lead to several different tangent spaces which you’d have to average to get something useful out of.

i dont know about correct way but what ive done in the past is just add all the tangent matrixs together (of the polygonscontaining the vertex) + (ortho) normalize the end result. it seems to work ok