问题
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.
回答1:
I know I can get vertices of the object by using .fromBufferGeometry().vertices on the Mesh geometry.
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?
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.
来源:https://stackoverflow.com/questions/54590938/extract-animation-vertices