首页 > 其他 > 详细

How to get current deformed vertex positions in MoBu?

时间:2014-11-28 15:56:27      阅读:216      评论:0      收藏:0      [点我收藏+]

This is a question from partner. Currently, as you know, you can fetched the static geometric 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 to get the deformed vertex positions?

bubuko.com,布布扣

 

Actually, Mobu have made lots of low level change regarding the internal geometry data structure to utilize the modern powerful GPU capability since MoBu 2011. And 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. And you will be able to get the vertex/normal position before/after deformation (Skinning, BlendShape, PointCache) via 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. And further according the material/texture/UVSet/Normal and etc layer elements mapping combination, control point is splitted sometimes to preserve visual fidelity. At last this TessellatedMesh is converted to an OpenGL vertex/index buffer object friendly format (FBModelVertexData, access via FBModel::ModelVertexData).

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

bubuko.com,布布扣

 

So back to the question itself, if you want to get the deformed vertex positions, you can try 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);

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

How to get current deformed vertex positions in MoBu?

原文:http://www.cnblogs.com/johnonsoftware/p/4128375.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!