Mesh morph animation in Babylon.js

Recommended Posts

Hello fellows!


I've been working on my school project, as I've mentioned before somewhere, and I'm taking a break from terrain generation, and getting back to importing some models as meshes, but I've found something I can't get through.


Namely, I'm trying to use some files as models acquired from  (because these are the cutest, and they fit my needs), but the problem is that they are in three.js' format, and I've devoted my time to implement this featurette in Babylon.js.


The problem is, that I need my models animated, and the three.js format (in my case) uses mesh morph animation. That is practically a keyframe based animation just like the skeleton animation in babylon, but no skeletons, instead all the vertices for all keyframes.


Is there any support for such things (I'll do the format conversion) in babylon? Or can you think of a clever workaround, given you know all the hidden bits of babylon? 


If you deem my case unsolvable, can you suggest a place where I can browse for animatable models (with bones for babylon then)?


Thanks in advance,


Share this post

Link to post
Share on other sites

Thanks! I myself was also thinking about that alternative, but I thought that might be somehow slower than a stock function (for some unknown WebGL dark trickery).


Is this feature, you plan to insert, simply wrapping this workaround in a function, or somewhat more complex? If so, I might try to implement it, as I'm going to have to do it anyway.

(Also, I use typescript, and you mentioned that you would want to move there too)

Share this post

Link to post
Share on other sites

Ok DK - I'm sending you two .blend files you can play with.


1: is a ball that has two shape keys - "squish" and "squash". It has a short animation but apart from that it is a very simple file.


2: is a "talking head". Still very simple though it is four objects - head two eyes and teeth.


I gather from watching your recent talk that you may not be too familiar with Blender so the image below is to describe the layout of the files:


A - the scene layout - just make sure that "Male Head" is selected and you will see all the other stuff


B - the properties of the current selected object. Make sure the little triangle is selected and you will see the shape key window. You will see 3 shape keys, open, wide, upper in the red box. The first two control vertices of the whole mouth and the last one just the upper lip. The "Basis" is the unaltered orginal mesh.


C - The shape key editor - a window for creating shape key animations. Below it is the basic Blender animation timeline - click arrow keys to play. Notice the three shape keys in the purple box. LMB and drag on the green flag with a number and you can scrub through the animation and the values in the purple box will change.


If you want to delete theys animation keys, put your mouse over this animation window and making sure all keys are selected (they will be bright yellow-orange) hit the X key and then confirm "delete key frames". To simply select all key frames - tap the A key till they are that bright yellow orange colour.


D - is a window containing a text file describing the mixes of the three shape keys that roughly describe the basic Preston Blair phonemes for speech. ( only in the "talking head" file)


Hope I am not being insulting with the image and the above - just do not want you confused at all.


I will PM you with a link to the zip files.


If the new Blender exporter looks to be working with shape keys - please post so I can try it out.. Looking forward to trying some lip syncing.


If you need anything else - just ask.


cheers, gryff :)

Share this post

Link to post
Share on other sites

Yes.  It was not made part of the BABYLON repository / namespace.  It is in the MORPH namespace, in the Extensions repository.


Version 1.0 could not actually do the talking shown in the above thread.  Working on 1.1 which will.  See this thread for this.


Some 1.0 examples are in this thread.  The name at the time was BABYLON.Automaton.  The Tablecloth & Multi-group are the ones to concern yourself with:

Share this post

Link to post
Share on other sites



Is there any news on morph targets?


I was playing around with putting a talking head from 3ds max into babylon and realised it wasn't supported yet.


I imagine getting it into the 3ds max exporter is even further down the road (is this even planned or will it just be blender?) so will put this in hold for now, I'm glad it is being worked on though, this will be a really great feature!

Share this post

Link to post
Share on other sites

I am doing work in that area, though I also see it on road map.  My focus is in the before render architecture (not animation system) , and I also do not believe in the importing of morph targets, per se.


Rather, I import shape keys from Blender, grouping them together.  This has 3 effects over directly importing morph targets:

  • You can have multiple groups, say one for face, & two for hands.
  • A group limits the vertices that need changing, not the whole mesh, which improves CPU performance.
  • You can make an infinite # of morph targets for each shape key group, once on the babylon side.

My first implementation also combined morphing with POV movement & rotation.  I have since pulled out POV to make it standalone.  MORPH now subclasses it, though that has not been pushed up to repository.


I have experimented with speech & voice syncing.  I am waiting on MakeHuman 1.1 to come out, so things are in a holding pattern.  Their road map has shifted the date, again & again.


I have no need to do anything with 3ds max.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.