Jump to content

Blender shape keys and MorphTargetManager


Recommended Posts

I'm using the preview release of Babylon (3.0. alpha) and the 5.3.-1 exporter in Blender. The Blender scene includes shape keys attached to a mesh called "Cloth":

1.png.7e11648e97dc1a93e81474b0998a31e8.png

When I export to a babylon file, this information appears to be saved correctly. There is a "MorphTargetManager" entry in the file JSON that looks like this:

"MorphTargetManager": {
    "id": "Cloth",
    "targets": [
        {
            "name": "Draped",
            "position": [lots of numbers...],
            "influence": 0
        },
        {
            "name": "testtest",
            "position": [lots of numbers...],
            "influence": 0
        }
    ]
}

I then load the babylon file with BABYLON in the browser, but I can't for the life of me figure out how to access this saved MorphTargetManager.

Here are some things I tried:

BABYLON.scene.morphTargetManagers; ==> []

BABYLON.scene.getMorphTargetManagerById("Cloth"); ==> null

BABYLON.scene.getMorphTargetManagerById(0); ==> null

(After setting the "Cloth" mesh to clothMesh...)

clothMesh.morphTargetManager; ==> undefined (but present when I inspect the mesh object...)

I feel like all the parts are there, I just can't figure out how to access the MorphTargetManager that I think should be present when I import the babylon file. Any help you can offer would be appreciated! Thanks!

 

Link to post
Share on other sites

Do not really know how to access them, but would suggest calling through mesh.

This is implemented wrong.  I am placing this inside of a meshes tags.  A morphTargetmanager is a high level thing within the JSON file, and then leashed up to a mesh.  This is very different from my implementation of shapekeys.  The export design will need to  change.  Thanks for testing.

Link to post
Share on other sites

Thanks for your help, JCPalmer. Just to clarify, you mean I should save the different shape keys as separate meshes (in blender) and then programmatically create a morphTargetManager? Can you provide a code outline?

Also, would you mind pointing me in the direction of your implementation of shapekeys? It seems the one I'm using now isn't ready for prime time. Thanks.

Link to post
Share on other sites

No, you should not need to anything differently to the blend.  I was speaking of the JSON organization.  My implementation though farther along in the morph area is an completely different animation system, wiith its own workflow & dynamic deployment using computer generated Javascript. 

It is undergoing a bunch of changes that I am just finalizing to allow geometry & texture read ahead.  I am think to be done around June 1st.  Will be beginning network testing of a scene this week.  Will post on demos section as completed.  Will not get to changing anything for the JSON implementation till this milestone is achieved, (plus I do not know what to do yet).

Link to post
Share on other sites
  • 2 weeks later...

Ok, @jdurrantwith my scene posted on demos, I changed the .JSON exporter to deal with morph targets properly.  I ran the flying carpet test scene through the sandbox.  I know morph targets is now getting parsed, since I had a spelling of a property wrong, and it failed at first.

I PR'ed but with Deltakosh on vacation, you could just pull the zip file from my repo.

Link to post
Share on other sites
  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...