Getting interpolated, transformed vertices during animation

I want to place markers at the vertices of a glTF animation while it is playing. Is there any way to get the interpolated, transformed positions of the model vertices?

What kind of animation? Morph target / shape keys, skinning, or keyframed translate/rotate/scale?

/cc https://stackoverflow.com/questions/53798106/getting-interpolated-transformed-vertices-during-animation

I’m unsure of the kind of animation, but I believe it’s morph target / shape key (particularly since it’s the same file as discussed here (https://github.com/KhronosGroup/glTF-Blender-Exporter/issues/48).

Code so far at:
https://utopian-emu.glitch.me/

Original .glb at:
https://github.com/mrdoob/three.js/blob/dev/examples/models/gltf/Flamingo.glb

(Sorry about the cross-post, hope it’s not a violation of T&Cs.)

Looking at the code, the function setupVertexAttributes seems to assign consecutive morphTargets to gl buffers. Is the interpolation done shader side?

The interpolation is done on the GPU, yes. You can certainly apply the transformation yourself on the CPU if you know what weights the different morph targets have at the time. Then it’s just a weighted average of the morph positions and the vertex positions using geometry.attributes.position and geometry.morphAttributes.position.

OK. Well, that lets out the possibility of using it for an introductory session! :slight_smile:

So, if I want to have smoke trails it’ll have to be shader side. Something to look forward to when I have time, but I’ll have to shelve it for now.

Thanks for the help.