I’m trying to develop a speaking avatar. I have all the visemes in a unique animation (FBX) (I don’t know too much about this topic, I think it’s just one track…).
With next lines I can play the full animation.
var action = model.mixer.clipAction( animation_visemes.animations[ 0 ] );
What I want to do is to play a range of the animation depending on the viseme.
For “A” viseme i want to animate frames from 2 to 4.
For “C” viseme frames from 8 to 10.
I have tried several things but without success.
Someone knows how could it be done? Help would be appreciated.
Thanks in advance.
same here buddy, been giving me headache lately
I am going to be busy some days… Then I’ll keep looking for a solution. If I find it I’ll share it.
FBX only support a single animation track per file, and as far as I know there is no (easy) way to split the animation up like that in three.js. At least, I’ve spent a while trying it and never found a way.
So the best solution is to export multiple FBX files - one with just the model, and and then others with each section of animation, and then apply the animations to your model.
The other solution i found, could be to export each of my animated actions in multiple JSON files and eventually conbine them manually ( by copy/paste the "animations node content of each file and rename the initial “name”:“default”) into one single JSON file
If you have to do this many times then you could easily write a script to do this.
Yes you right but before merging animations together i still need to dive into each exported JSON file for manually rewrite the “default” name
because actually it’s just allowed to export one “Big” Action (and try to split it for doing small strips with different ranges to play…), i tried to modify the Blender exporter for making it available to export all Actions of the .blend file.
I am really really novice in Python scripting (for being honest : since this morning…) and really new on Github, so if someone experienced can watch what i did, check it and tell me if it’s good
Here is the pull request i did : https://github.com/mrdoob/three.js/pull/12646
Thank you for your help and advices
i have the same problem. Having one animationclip and have to play it, for example, from second 5 to 8.
Are there any new ideas or methods to do so?
Lol I think there’s much demand for this playAnimation (begin frame, endframe)…tbh this killed off one of my project
Could anyone share a model with different animations in different ranges of the same clip? I would think you could do this, but haven’t tested:
// loaded from model or whatever
// poor man's "clip.clone()"
var clip2 = THREE.AnimationClip.parse(THREE.AnimationClip.toJSON(clip));
// trim each clip to times
clip.tracks.forEach((track) => track.trim(0, 5));
clip2.tracks.forEach((track) => track.trim(5, 10));
Perhaps a utility method to split clips in one step would be a good addition to the library.
Kupoman/blendergltf exporters also supports multiple actions directly, and is an option if you’re using Blender.
Highly agreed. Exporting assets with animations set up something like:
Walk: frames 1-100
Run: frames 100-200
Jump: frames 200 - 250
is very common and recommended in many tutorials and books. Currently, there is no easy way to split these animations with three.js.