3DMAX导出网格顶点切向量

3DMAX的IGame接口对导出顶点的切向量写的不够清晰。

IGameMesh接口(3DXI V 2.2)关于切向量相关说明:

Binormal and Tangents can be initialized and accessed separately from other mesh data, To initialize entire mesh data (including Binormals and Tangents) IGameObject::InitializeData() should be called.

 

MAX中关于切向量的存储位置如果放在下面Face中是最好了。

class FaceEx: public MaxHeapOperators
{
public:

 //! Index into the vertex array
 DWORD vert[3];
 //! Index into the standard mapping channel
 DWORD texCoord[3];
 //! Index into the normal array
 DWORD norm[3];
 //! Index into the vertex color array
 DWORD color[3];
 //! Index into the vertex illumination array
 DWORD illum[3];
 //! Index into the vertex alpha array
 DWORD alpha[3];
 //! The smoothing group
 DWORD smGrp;
 //! The material ID of the face
 int matID;
 //! Additional flags
 DWORD flags;
 //! Index of corresponding face in the original mesh
 int meshFaceIndex;
 //! Index into edge visibility array. 
 /*! 1 for visible, 0 if the edge is invisible.*/
 DWORD edgeVis[3]; 

};

可惜我们看上面没有关于切向量的的数据。如果使用FaceEx::norm作为切向量的索引得到的结果是不正确的。仔细读下IGameMesh类,发现里面有个

virtual int GetFaceVertexTangentBinormal (int faceIndex, int corner, int mapChannel = 1)=0;

这个接口函数可以用来获取Tangent和Binormal的索引,Tangent和Binormal的索引是同一个值。有了这个索引值就可以通过

Point3 GetTangent(int index, int mapChannel = 1) ;

Point3 GetBinormal(int index, int mapChannel = 1);

获取Tangent和Binormal的具体数值。

导出一个经典的茶壶模型,查看TBN数据,白色代表N,红色代表T,绿色代表B。

 

2011020720020419.jpg

从表面上看数据基本正确。但是我计算一下TBN之间的夹角,发现TBN并非完全垂直,因此这个TBN数据也许需要进行一定的较正。以后再说吧。

 

转载于:https://www.cnblogs.com/Perit/archive/2011/02/07/1949719.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值