提取动画顶点 [英] Extract animation vertices

查看:22
本文介绍了提取动画顶点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 GLTFLoader 加载的对象和一个使用 THREE.AnimationMixer 的动画.我知道我可以通过在网格几何体上使用 .fromBufferGeometry().vertices 来获取对象的顶点.如何在动画期间获取所有顶点并查看它们随时间的变化?KeyframeTrack 似乎没有直接修改几何体.

I have an object loaded with GLTFLoader and an animation using THREE.AnimationMixer. I know I can get vertices of the object by using .fromBufferGeometry().vertices on the Mesh geometry. How can I get all the vertices during an animation and see how they change over the time? KeyframeTrack does not seem to modify geometry directly.

推荐答案

我知道我可以通过在网格几何体上使用 .fromBufferGeometry().vertices 来获取对象的顶点.

I know I can get vertices of the object by using .fromBufferGeometry().vertices on the Mesh geometry.

没有必要将您的几何图形转换为 Geometry(它将在某个时候从库中删除).相反,您可以通过使用相应的缓冲区属性来访问顶点信息.关于 BufferGeometry 的文档页面提供了有关此主题的更多详细信息.

It's not necessary to convert your geometry to Geometry (which is going to be removed from the library at some point). Instead you can access vertex information by working with the respective buffer attributes. The documentation page about BufferGeometry provides more details about this topic.

如何在动画期间获取所有顶点并查看它们随时间的变化?

How can I get all the vertices during an animation and see how they change over the time?

在使用骨骼动画或变形目标动画等动画技术时,重要的是要意识到实际的顶点位移发生在顶点着色器 (GPU) 中.如果由于某些原因需要在 JavaScript 代码 (CPU) 中转换顶点,则必须手动执行相应的顶点位移.目前没有任何库功能可以为您执行此操作.但您可能会在 论坛 或 github 上找到一些代码示例.

When using animation techniques like skeletal animation or morph target animation, it's important to realize that the actual vertex displacement happens in the vertex shader (GPU). If you need transformed vertices in your JavaScript code (CPU) for some reasons, you have to manually perform the respective vertex displacement. There is no library functionality that can do this for you right now. But you might find some code samples at the forum or at github.

这篇关于提取动画顶点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆