顶点的副法线是其法线与切线的交点吗?
我试图找出图形编程背景下的副法线是什么,但很快,我在一个网站上看到副法线被计算为法线和切线之间的叉积(即 cross(normal, 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 cross product between the normal and tangent (i.e. cross(normal, tangent)), is this the correct way to calculate a binormal?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
只是要指出,这完全不是双正态的定义。这就是 Bi 切线的定义。副法线是与曲面形成的“其他”法线完全不同的东西。
人们需要学会不要重复这个错误(由法线贴图时代早期的人犯的)。
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).
根据mathworld,副法向量定义为
cross(tangent,normal)< /code> 其中
切线
和法线
是单位法线向量。请注意,严格来说,当您使用交叉产品时,顺序很重要。
cross(tangent,normal)
指向与cross(normal,tangent)
相反的方向。这可能重要也可能不重要,具体取决于您的应用程序。只要您的计算内部一致,这并不重要。According to mathworld, the binormal vector is defined as
cross(tangent,normal)
wheretangent
andnormal
are unit normal vectors.Note that, strictly speaking, order matters when you take cross products.
cross(tangent,normal)
points in the opposite direction fromcross(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.法线、切线和副法线向量形成正交基来表示切线空间。
切线空间(有时称为纹理空间)用于每像素光照和法线贴图来模拟表面细节(想象一堵墙或一个高尔夫球)。
切线和副法线向量表示等效纹理 UV,即平行于表面法线的向量。
所以从技术上来说,当它们形成正交基础时,binormal = cross (tangent,normal)但是在实践中,因为binormal和切线是从法线贴图中的UV生成的,并且可以在几个顶点上取平均值那么它们可能不是严格正交的。
有关该主题的几篇好文章请阅读
http://www.3dkingdoms.com/weekly/weekly.php?a= 37
和
http://www.blacksmith-studios.dk/projects/downloads/bumpmapping_using_cg。 php
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
事实上,不,有时并非如此。至少在 3D 图形领域是这样。
如果纹理被拉伸,则副法线可能不会垂直于法线和切线(尽管它应该是垂直的)。
只需使用您的出口商计算出的任何内容即可。如果出口商同时提供切线和副法线,那就很好。如果只有切线,则将副法线计算为切线和法线的垂直线。
获取一个计算了切线和副法线的复杂对象,并比较使用副法线时的照明,该照明与将副法线计算为叉积时获得的照明一起提供。会有差异。
无论如何,我认为正确的方法是在导出器中计算切线和副法线,然后使用导出器提供的内容。
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.
是的,副法线或双切线是顶点法线和切线之间的交叉。如果这三个向量中有任意 2 个,则可以计算另一个向量。
例如,如果您有切线和副法线(或双切线),您可以计算法线。
这是一个可以在 GLSL 中创建只有法线的副法线和双切线的示例:
虽然它可能无法获得所需的结果,但有时它应该可以让您到达您想要的位置。
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:
While it might not get the desired restults sometimes it should get you where you want.