adam Posted June 3, 2016 Share Posted June 3, 2016 I've been experimenting with shape keys to pose my character's face in Blender. Is there currently anyway to export and use shape keys in BJS? ozRocker 1 Quote Link to comment Share on other sites More sharing options...
gryff Posted June 3, 2016 Share Posted June 3, 2016 @adam: You might want to have a look at these links: and Tower of Babel Exporter Scroll down to New In 4.0 cheers, gryff adam 1 Quote Link to comment Share on other sites More sharing options...
adam Posted June 3, 2016 Author Share Posted June 3, 2016 This looks great. Are there any simple examples of shape keys in the PG? Where can I find the QI.Mesh class? Edit: I see JCP linked to his test scene in that post: https://16133f78f07b2eee3540cf35e266c69a27b82b71.googledrive.com/host/0B6-s6ZjHyEwUNnEwREtwekRiLTg/ I'm not seeing how to use shape keys, though. Quote Link to comment Share on other sites More sharing options...
adam Posted June 3, 2016 Author Share Posted June 3, 2016 I have a shape key for blinking. Do I need to add that to an animation in Blender before I can use it in BJS? Quote Link to comment Share on other sites More sharing options...
adam Posted June 3, 2016 Author Share Posted June 3, 2016 @JCPalmer where can I find the QI classes that are referenced in the tower of babel export file? Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted June 3, 2016 Share Posted June 3, 2016 You cannot. This is not ready. Quote Link to comment Share on other sites More sharing options...
adam Posted June 3, 2016 Author Share Posted June 3, 2016 OK, thanks. It looks promising. Quote Link to comment Share on other sites More sharing options...
adam Posted June 4, 2016 Author Share Posted June 4, 2016 Here is a simple QI class I wrote (not the official one). Include this in your code before your tower of babel export file. Then in your code: var myShapeKeyGroup = mesh.shapeKeyGroups["ENTIRE_MESH"]; myShapeKeyGroup.shapeKeys["Key 1"].value = .5; to morph your mesh using a shape key you created in Blender. simple example: http://www.babylonjs-playground.com/#1RH0J8#4 animation examples: http://www.babylonjs-playground.com/#1RH0J8#5 http://www.babylonjs-playground.com/#1RH0J8#7 QI.js QI.ts gryff and jerome 2 Quote Link to comment Share on other sites More sharing options...
gryff Posted June 6, 2016 Share Posted June 6, 2016 An animated "Suzanne" - very neat adam Would give it 5 likes if I could Where did the data come from for the Float32Arrays? From the TOB exporter? cheers, gryff Quote Link to comment Share on other sites More sharing options...
adam Posted June 6, 2016 Author Share Posted June 6, 2016 8 hours ago, gryff said: Where did the data come from for the Float32Arrays? From the TOB exporter? yes Quote Link to comment Share on other sites More sharing options...
adam Posted June 6, 2016 Author Share Posted June 6, 2016 Does anyone know of a cleaner way to set up that animation? This didn't work: var animationBox = new BABYLON.Animation("tutoAnimation", "mesh.shapeKeyGroups['ENTIRE_MESH'].shapeKeys['KEY 1'].value", 30, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE); That's why I resorted to this: mesh.shapeKey = mesh.shapeKeyGroups['ENTIRE_MESH'].shapeKeys['KEY 1']; var animationBox = new BABYLON.Animation("tutoAnimation", "shapeKey.value", 30, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE); Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted June 6, 2016 Share Posted June 6, 2016 The actual ShapeKeyGroups are implemented as an beforerender on the mesh. Each group has a queue of new targets to morph to. There is also a pose queue for skeleton interpolations. I am starting to think about bringing out QueuedInterpolation without anything specific to MakeHuman to start. It be supported by Tower of Babel 5.0, which is been completely re-factored into 17 files & distributed as a .zip file. There will be no documentation changes for TOB, or any documentation for QI. There could be breaking changes without apology. It still would better than what you are doing. There is plenty of code comments, & Javadoc like code arg descriptions. Quote Link to comment Share on other sites More sharing options...
adam Posted June 6, 2016 Author Share Posted June 6, 2016 11 minutes ago, JCPalmer said: There could be breaking changes without apology. It still would better than what you are doing. That is so very nice of you, Jeff. I'm glad I got you to move, though. Quote Link to comment Share on other sites More sharing options...
dbawel Posted June 6, 2016 Share Posted June 6, 2016 @adam - Sorry to chime in so late, but I was out of town the past few days. Obviously, you have been provided examples on how to export/import blend shape keys. However, in many years of working on rigging game characters, if you don't require extreme close-ups by the camera of the character's face and specifically their eyes, then the rotation of half or smaller parts of simple colored and/or textured spheres are by far the best method with the least computation in a scene. And this method specifically limits various conflicts and concerns when translating and transforming your character in the game. By maintaining the mesh's center in the center of the partial sphere and rotating simple sphere geometry from the local center won't contribute to the additive effects of using other bend shapes on the face. Just make certain that you maintain or re-position your sphere's center position to rotate the lids correctly - as many surface operations to reduce the polygons to a half or 1/3rd sphere often repositions the mesh's center to the average position of its remaining polys. And on any console game ever released where I have any rigged characters, no one has ever noticed that I wasn't using blend shapes to open and close the upper and lower eyelids. And FYI - it's allot less work with virtually the same results - unless as I say again, you require facial closeups for expressive emotions directly to camera - which even then doesn't often require blend shapes for eyelids, unless we're talking extreme closeups and emotions. DB Quote Link to comment Share on other sites More sharing options...
adam Posted June 7, 2016 Author Share Posted June 7, 2016 Hi @dbawel. That's what I was planning on doing. Deltakosh fixed an attachToBone bug a few days ago for me that allows me to use separate eyelids for blinking. I'm going to use this morphing code to make my character squint and close his eyes. The separate eyelid meshes looked terrible for that. dbawel 1 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.