How to get current deformed vertex positions in MoBu?

获取变形顶点位置
本文介绍了如何在MotionBuilder中获取变形后的顶点位置,包括皮肤绑定、混合形状及点缓存等变形方式。通过使用FBModelVertexData类的方法,可以在GPU或CPU上获取到变形前后的顶点和法线位置。

As you know, you can fetched the static geo metric data from a FBModel using the following ways:

Get vertex:

   model.Geometry.GetPositionsArray(); 

Get indices:

   model.Geometry.PolygonVertexArrayGet()

But when the model is deformed(Skinning, BlendShape, PointCache), GetPositionsArray() always returns the same static coordinates, regardless of the current animation position. How can you get the deformed vertex positions?

 

Actually, MotionBuilder has made many low level changes regarding the internal geometry data structure to utilize the modern and powerful GPU capability since the MotionBuilder 2011 version. These changes did improve the deformation (skinning & blendshape) and display performance of the dense geometry a lot on the CUDA enabled cards according to our internal initial benchmark. You can get the vertex/normal position before/after deformation (Skinning, BlendShape, PointCache) via the ORSDK for the internal geometry, while the deformation could still happen in GPU side

Note that since MoBu 2011, we do convert all kinds of original geometry format (FBMesh, FBNurb, FBPatch, access via FBModel::Geometry property) into a tessellated triangle mesh. According the material/texture/UVSet/Normal and etc layer elements mapping combination, control point is split sometimes to preserve visual fidelity. In the end, this TessellatedMesh is converted to an OpenGL vertex/index buffer object friendly format (FBModelVertexData, access via FBModel::ModelVertexData).

MoBu perform deformation (GPU or CPU) & rendering only on this final ModelVertexData.

 

So back to the question itself, if you want to get the deformed vertex positions, you can use the following methods of FBModelVertexData class:

  int * GetIndexArray();

  void * GetVertexArray (FBGeometryArrayID pArrayId, bool pAfterDeform=true); 

  unsigned int GetVertexArrayVBOId (FBGeometryArrayID pArrayId, bool pAfterDeform=true);

  void * GetVertexArrayVBOOffset (FBGeometryArrayID pArrayId, bool pAfterDeform=true);

Before using them, be sure to Use VertexArrayMappingRequest()/VertexArrayMappingRelease() to toggle CPU / GPU skinning per model when necessary.

转载于:https://www.cnblogs.com/johnonsoftware/p/4128375.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值