在网格加载和处理过程中如何变换蒙皮网格?
我创建了自己的蒙皮网格加载器。它工作正常,但我的问题是我不知道如何变换(缩放和旋转)蒙皮网格,以便将变换“烘焙”到顶点上。如果它只是一个几何体,变换顶点是小菜一碟,但现在涉及蒙皮信息,例如,如果我进行缩放,我的网格就会全部拉伸。我知道我也需要转换我的蒙皮数据,但是哪些部分呢?所有绑定姿势矩阵?逆绑定姿势矩阵?我似乎不明白该怎么做。
我的实现是用 C# 和OpenTK 和我专门加载从 Blender 2.6 导出的 Skinned Collada 文件。
提前致谢。
I created my own skinned mesh loader. It's working fine, but my problem is I don't know how to transform (scale & rotate) the skinned mesh so that the transformations are "baked" onto the vertices. If it were just a geometry, transforming the vertices are a piece of cake, but now that skinning info is involved, if I do a scale for example, my mesh gets all stretched. I know I need to transform my skinning data too, but which parts? All the Bind Pose matrices? The Inverse Bind Pose Matrices? I can't seem to understand how to go about this.
My implementation is in C# & OpenTK and I am specifically loading Skinned Collada files exported from Blender 2.6.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不懂 C# 和 OpenTK,但我尝试在理论方面提供帮助。顶点通过加权全局变换矩阵进行变换。要形成全局变换,您需要连接每个关节的局部变换。要创建局部变换,您需要连接局部平移、旋转和缩放。重量来自关节。所以我认为你需要获得绑定姿势的联合局部旋转/平移/缩放,然后操纵这些局部矩阵并将它们形成全局矩阵。之后,将权重应用于全局变换,然后变换顶点。
以下链接可能与您的问题类似。
COLLADA:反向绑定姿势在错误的空间?
我创建了这个 collada 文件播放器,但使用 C++。
http://www.youtube.com/watch?v=bXBfVl-msYw
I don't know C# and OpenTK, but I try to help on the theoretical side. Vertices are transformed by weighted global transform matrix. To form a global transform, you need to concatenate local transform of each joints. To create a local transform, you need to concatenate the local translate, rotate and scale. The weight would come from the joint. So I think you need to get joint local rotation/translation/scaling of your bind pose, then manipulate those local matrix and form them to global matrix. After that, you apply weights to the global transformation then transform the vertices.
The following link may be similar to your question.
COLLADA: Inverse bind pose in the wrong space?
I created this collada file player, but use C++.
http://www.youtube.com/watch?v=bXBfVl-msYw