-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modern Mixer-based Animation System #6934
Conversation
…rtyBinding.apply logic as a closure.
…ete interpolators.
Just noticed via @WestLangley that there is a build/three.js in there. I'll have to remove it. Give me a bit. |
d24f3e0
to
94d8f1a
Compare
Okay, I have removed the build/three.js that @WestLangley noticed. :) This PR is ready again to review. |
Looking really good! Seems like http://exocortex.github.io/three.js/examples/webgl_animation_scene.html is now 90degree rotated? Is it intentional? |
@mrdoob wrote:
Good attention to detail. Yes the change is intensional. It was actually wrong before -- here is the scene it was exported from: https://clara.io/view/96106133-2e99-40cf-8abd-64defd153e61 |
Ok, now that the animations are defined at the top level, how about something like this? {
"metadata": {},
"animations": [{
"uuid": "AF2ADB07-FBC5-4BAE-AD60-123456789ABC",
"type": "vector3",
"fps": 29,
"tracks": [{
"keys": [{
"value": [1.22253,1.22253,1.22253],
"time": 5
},{
"value": [1.22253,1.22253,1.22253],
"time": 6
}]
}]
}, ... ],
"geometries": [],
"object": {
"name": "cylinder001",
"uuid": "7935BB30-4CBC-3BEE-A497-8994876785B6",
"matrix": [1.22253,-0,-0,0,-0,-0,-1.22253,0,0,1.22253,-0,0,0,38.7012,-1.71412,1],
"visible": true,
"type": "Mesh",
"material": "541CFE3C-B1BD-37FD-8A82-3870870BB8A8",
"castShadow": true,
"receiveShadow": true,
"geometry": "CAEC0410-6CA0-3646-AF22-DE6D5D34C387",
"animations": {
"position": "AF2ADB07-FBC5-4BAE-AD60-123456789ABC",
"scale": "AF2ADB07-FBC5-4BAE-AD60-123456789ABC"
}
}
} This will allow us to reuse animations with different properties and different objects. This way will also follow the format design. Thanks so much for your patience guys! We're almost there! |
@mrdoob wrote:
Hmm... I am not sure I understand. Is the idea to save space? Or to allow an animation to be reused on multiple nodes? One of the issues of having references from the "objects" hierarchy into the "animations" set is that usually the animations are potentially conflicting -- such as you can have walk, run, jump, which all can be applied to the same object. Thus referencing a specific animation from an object sort of conflicts with that idea of choosing different animations to apply to a object. The other issue is that reuse is already support in the "animations" via the use of relative track names. While each track name requires a property name to be specified, e.g. "position", "scale.x", "visibility", etc., you do not have to mention a node name or UUID, you can leave it name blank. If you leave it blank the node to which the animation is applied is determined by the node you reference when creating the AnimationAction(). This means that the AnimationClip is shared between all actions, even if they are hundreds of different nodes. :) If you use a node name, and you have multiple node with that name in the scene, AnimationAction will only bind to the first node it finds as a child of the node you specify as the bind point. Thus if you have different "Gun" nodes you can reuse the Gun animations just by specifying the base character node and it will apply to the the "Gun" node under those characters, not all Guns. The idea of relative tracks is "inspired" by what Softimage, Maya do with relative tracks. It is the same concept and it is crazy powerful. |
Both.
Ah, I see... Yeah, my suggestion collides with this... I guess experience with all this will show us the correct design. By now, lets go with your design! 😊
Actually, I think this is the behaviour I was suggesting. |
Modern Mixer-based Animation System
Yay! Thanks guys! |
Wohoo! Thanks @mrdoob for putting up with me and this huge PR. |
Just chiming in to say I'm currently dealing with a big project, involving dozens of animations on the same JSON object, and this refactor was a godsend. A HUGE thank you to everyone involved! |
How would you use multiple animation mixers on multiple skinnedmeshes? |
This PR is an implementation of the idea outlined here: #6881
There are five new classes in the
/src/animation
directory:I have also modified these classes to work with the new system:
MorphAnimMesh
BlendCharacter
UCSCharacter
MD2Character
I've updated the animation examples to work with the new system -- these are the most interesting:
https://exocortex.github.io/three.js/examples/#webgl_animation_skinning_morph
https://exocortex.github.io/three.js/examples/#webgl_animation_skinning_blending
https://exocortex.github.io/three.js/examples/#webgl_morphtargets_horse
https://exocortex.github.io/three.js/examples/#webgl_morphtargets_md2
The main benefits of this design are tremendous:
Cool things:
This was developed with significant input from @dsarno and @amirebrahimi.