babbleon Posted May 10, 2018 Share Posted May 10, 2018 Hello, I'm posting this partly to help anyone else who has struggled with this, but also to ask if I am doing something wrong / if this is a bug in the exporter. When I export a mesh from Blender with 'Shape Keys', I have to create two Keys in addition to the Basis for it to work in Babylon. One Key + basis: https://www.babylonjs-playground.com/#0XATER#1 Two keys + basis: https://www.babylonjs-playground.com/#0XATER Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted May 10, 2018 Share Posted May 10, 2018 Well, I see that the key is added The only thing I can think of on the exporter side is that basis is used for the data for the first key. Look in the export & see if the data for the positions is the same as key 1. If it is different, then I am inclined to think the export is fine & problem downstream. Quote Link to comment Share on other sites More sharing options...
babbleon Posted May 10, 2018 Author Share Posted May 10, 2018 Here's the positions for the vertices of mesh & targets for Key 1 (this is the one with only one shape key). one shape key Mesh vertex positions: [0.5,0,0.25,-0.5,0.38,0.25,0.5,0.38,0.25,0.5,0,-0.25,-0.5,0,0,0.5,0,0,0.5,0.76,0,-0.5,0.76,-0.25,0.5,0.76,-0.25,0.5,0.38,-0.25,0.5,0.38,0,-0.5,0.38,-0.25,-0.5,0,-0.25,-0.5,0.38,0,-0.5,0,0.25,0.5,0.76,0.25,-0.5,0.76,0 ,-0.5,0.76,0.25] Target vertex positions for 'Key 1': [0.5,0,0.25,-0.5,0.38,0.25,0.5,0.38,0.25,0.5,0,-0.25,-0.5,0,0,0.5,0,0,0.5,0.76,0,-0.5,0.76,-0.25,0.5,0.76,-0.25,0.5,0.38,-0.25,0.5,0.38,0,-0.5,0.38,-0.25,-0.5,0,-0.25,-0.5,0.38,0,-0.5,0,0.25,0.5,0.76,0.25,-0.5,0.76,0 ,-0.5,0.76,0.25] ...the same. This may be something for @V!nc3r to add to the docs until it's sorted. V!nc3r 1 Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted May 10, 2018 Share Posted May 10, 2018 I just looked at the code & cannot see where this is wrong, so I made my own cube, added a basis & key. Went into edit mode (while the key was selected) & colapsed a face in. When I export, I get different values for the positions & target positions: "meshes":[{"name":"Cube","id":"Cube","materialId":"shapekey.Material","billboardMode":0,"position":[0,0,0],"rotation":[0,0,0],"scaling":[1,1,1],"isVisible":true,"freezeWorldMatrix":false,"isEnabled":true,"checkCollisions":false,"receiveShadows":false,"pickable":true,"tags":"" ,"positions":[1,-1,-1,-1,-1,1,1,-1,1,-1,1,1,1,1,-1,1,1,1,-1,-1,-1,-1,1,-1] ,"normals":[0.577,-0.577,-0.577,-0.577,-0.577,0.577,0.577,-0.577,0.577,-0.577,0.577,0.577,0.577,0.577,-0.577,0.577,0.577,0.577,-0.577,-0.577,-0.577,-0.577,0.577,-0.577] ,"indices":[0,1,2,3,4,5,5,0,2,4,6,0,6,3,1,2,3,5,0,6,1,3,7,4,5,4,0,4,7,6,6,7,3,2,1,3] ,"subMeshes":[{"materialIndex":0,"verticesStart":0,"verticesCount":8,"indexStart":0,"indexCount":36}] ,"instances":[],"morphTargetManagerId":535126} ], "morphTargetManagers":[{"id":535126 ,"targets":[{"name":"Key 1" ,"positions":[-0.7202,-1,-1,-1,-1,1,-0.7202,-1,1,-1,1,1,-0.7202,1,-1,-0.7202,1,1,-1,-1,-1,-1,1,-1],"influence":0}]}], Cannot reproduce. Quote Link to comment Share on other sites More sharing options...
babbleon Posted May 10, 2018 Author Share Posted May 10, 2018 Okay... I see the issue. When you export with the 'Key 1' value set to 1.000 it exports the same positions for meshes & targets, seems to work when set to any other value. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted May 10, 2018 Share Posted May 10, 2018 I think it is more accurate to say that each morph target is always exported with the same values. The positions themselves are not directly exported in the first place. A temp copy with all modifiers including current shapekey settings is made, & that is what gets exported. This is very powerful. You might have Mirror modifier for making a perfectly symmetrical mesh with only doing half the work. You do not to HAVE TO apply your modifiers to do an export, since it would wreck more development. Probably best to store all your shapekeys @ 0 in the .blend file to get your mesh exported without any influences per-applied. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.