开发者

Is the binormal of a vertex the cross between its normal and tangent?

I'm trying to find out what a binormal is in the context of graphics programming but coming up short, I saw on a site that the binormal was being calculated as the cros开发者_StackOverflow中文版s product between the normal and tangent (i.e. cross(normal, tangent)), is this the correct way to calculate a binormal?


Just to point out that is TOTALLY not the definition of the binormal. Thats the definition of a Bi Tangent. A Binormal is something totally different relating to the "other" normal formed by a curved surface.

People need to learn not to re-iterate that mistake (Made by someone early on in the days of normal mapping).


According to mathworld, the binormal vector is defined as cross(tangent,normal) where tangent and normal are unit normal vectors.

Note that, strictly speaking, order matters when you take cross products. cross(tangent,normal) points in the opposite direction from cross(normal,tangent). That may or may not matter depending on your application. It really doesn't matter as long as your calculations are internally consistent.


Normal, tangent and binormal vectors form an orthonormal basis to represent tangent space.
Tangent space ( sometimes called texture space ) is used in per-pixel lighting with normal maps to simulate surface detail ( imagine a wall or a golf-ball ).

The tangent and binormal vectors represent the equivalent texture UVs i.e the vectors parallel to the surface normal.

So technically speaking - as they form an orthonormal basis then binormal = cross (tangent,normal ) however in practice, since binormals and tangents are generated from the UVs in the normal map and may be averaged over several vertices then they may not be strictly orthonormal.

For a couple of good articles on the subject read
http://www.3dkingdoms.com/weekly/weekly.php?a=37
and
http://www.blacksmith-studios.dk/projects/downloads/bumpmapping_using_cg.php


Actually, no, sometimes it isn't. In 3d graphics, at least.

If a texture was stretched, then it is possible that binormal will not be perpendicular to both normal and tangent (although it should be perpendicular).

Just use whatever your exporter has calculated. If the exporter provides both tangent and binormal, it is good. If there is only tangent, then calculate binormal as a perpendicular to tangent and normal.

Get a complex object with both tangent and binormal calculated, and compare lighting when you use binormal which was provided with the lighting that you get when binormal was calculated as cross-product. There will be a difference.

Anyway, I believe that a proper way is to get both tangent and binormal calculated in exporter, and just use what exporter has provided.


Yes the Binormal or Bitangent is the cross between the normal and the tangent of a vertex. If you have any 2 vectors out of these three you can calculate the other one.
For instance if you have a tangent and a binormal (or bitangent) you can calculate the normal.
Here is a sample that can create binormal and bitangents in GLSL having just the normal:

varying vec3 normal;
varying vec4 vpos;
varying vec3 T,B;
void main()
{
    gl_TexCoord[0] = gl_MultiTexCoord0;
    normal = normalize(gl_NormalMatrix*gl_Normal);
    gl_Position =gl_ProjectionMatrix*gl_ModelViewMatrix*gl_Vertex;
    vpos = gl_ProjectionMatrix*gl_ModelViewMatrix*gl_Vertex;
    T = cross(normal,vec3(-1,0,0));
    B = cross(T,normal);
}

While it might not get the desired restults sometimes it should get you where you want.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜