Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Implemented Skeletal Animation Blending #4029
This work was directly integrated into the Animation object with some additional bookkeeping added to the Bone object.
Anyhow, it works!
Removing an animation while the AnimationHandler was iterating over them was causing an update to be missed resulting in a choppy 1 frame glitch. Typo was preventing an optimization.
Here's another demo to play with: http://www.realitymeltdown.com/WebGL2/marine-demo.html. Unfortunately, I don't think it's legal to distribute this model as it originally came from Evolver.com (when that was still around).
Hmmm... I think before merging I wanted to clean up what's there right now.
I'm thinking that may be nice to have this kind of api...
var skeleton = new THREE.Skeleton( bones ); var mesh = new THREE.SkeletonMesh( mesh, skeleton );
Also would be nice, for debugging purposes to do a nice
That way we'll be able to visualise the skeletons and the blending nicely.
What do you think?
I agree that factoring out the skeleton into it's own object would be more clean and readable.
As for the THREE.SkeletonMesh, are you suggesting a different object for that or rather making it a part of THREE.SkinnedMesh?
Or perhaps THREE.SkinnedMesh could be modified to be composed of a THREE.Mesh and a THREE.Skeleton?
Or THREE.SkinnedMesh could create its own THREE.Skeleton using the bones passed in geometry.bones.
Also, I'm working on a visualization to help debug animations and blends. Here's what I've got so far: http://www.realitymeltdown.com/WebGL3/skeletal-anim-inspector.html
The top row of meshes each play a single animation. The mesh on the bottom will blend according to the weights set in the gui. You can change the speed of the animation as well as take individual time steps.
Sometimes blends will look terrible without some special massaging (ie time warping) and this demo will help make it more obvious as to whether there is a problem with the code or the art.
I think both options are ok. Thinking about it again, maybe the first one is more intuitive.
I've fixed up the demo linked above quite a bit including hooking up the "show bones" option. Stepping and pausing work together much better as well.
I've pulled the latest three dev branch and re-merged the blending code. In the process I've fixed a couple areas I'd consider buggy that we can talk about when I submit a new / separate pull request.
Also, currently I have fade in/out code inside animation to alter the blend weights. This adds some additional complexity and may not be as flexible if you want to have direct control over modifying the weights over time yourself. I'm thinking there needs to either be a separate object to control weighting (fade in/out, cross fading, etc..) or maybe incorporate that into