I’m implementing BRDF in our 3d-engine, but I don’t know how to calculate binormals and tangents for a bunch of triangles.
I downloaded a demo from nvidia, but it uses patches, not triangles, no help there…
The binormal and tangent are vectors perpendicular to the normal and to eachother. Given the position and normal of a vertex, you can figure out the plane the vectors lie in, but not the specific directions that they point. For that you need more information.
The vectors should align themselves along and acrossed the “grain” of the material. I’m assuming the Nvidia demo uses the gradients of the patches to define this. If you don’t have patches but do have textures, you could use the gradient to the texture coordinate UV’s. If all you have is positions and normals… try picking some arbitrary but consistent vector, like the local z-axis, and do a cross product with your normal to get the tangent and then cross the tangent and the normal to get the binormal. It won’t correspond to anything specific, but at least it’s a start!
In the end, the tangent/binormal of a vertex is a separate property that realy should be specifically assigned, but I am not aware of any 3D modeling packages that currently support this concept.
-Cory
Originally posted by Morten:
[b]I’m implementing BRDF in our 3d-engine, but I don’t know how to calculate binormals and tangents for a bunch of triangles.
I downloaded a demo from nvidia, but it uses patches, not triangles, no help there…