Jump to content

How best to create a composite model of head, brain and spine, for dynamic animation of head/neck movement?


TrevorPT
 Share

Recommended Posts

Hello,

I'm new to Babylon.js (fantastic library!), to Blender, and to 3d animation in general (it's been a couple of weeks). I'm on an R&D project where we have a motion sensor attached to someone's head, and would like to model the motion in our nw.js application. So far I have been able to take a simple model of a human head and shoulders, add an armature, export the mesh/armature from Blender to Babylon, import that into our project, and make the head/neck move by manipulating the rotation of the "neck" bone (the skeleton is simple, it has 5 bones: 1 root, 2 shoulders, 1 neck, 1 head). It works great and the mesh moves pretty realistically in 3d-space considering we're only providing one sensor input and manipulating one bone.

Now, however, we'd like to use a translucent model that shows the brain and neck vertebrae moving (the simple one I have working is an opaque model with skin). I've hit a wall with how to approach this.  I'm not sure if I should ask in the Babylon forum or a Blender forum, and I'm not even sure what are the right questions to ask.

What I've tried so far is: I found a human model that had all the components (brain, spine), and cut it off at the shoulders. The model consists of 4 meshes (1 for the head/shoulders, 1 for the spine, 2 for the brain). I've successfully imported these meshes into our app and can display them using Babylon. I can rotate the meshes together no problem.

I then added an armature the same way I did with the first (brainless) model (select mesh, select armature, parent), but I can't figure out how to get the components moving together properly. In some cases rotating a neck bone causes the shoulders to move (I'm guessing it has to be disassociated with the appropriate vertices, but I never had to do that with the first simpler model).  The brain and spine do not move at the same rate as the mesh; sometimes rotating the neck bone too far causes the brain to fall outside the head mesh.

Having discovered that Babylon is a terrific fit for our JavaScript/nw.js application, and knowing that whatever I do it will have to work in Babylon, I thought I'd start here with some questions:

  • What would be the best way to approach this (showing both a head/shoulders outline with an inner brain and spine and manipulating it dynamically)? Am I on the right track?
  • The model I was trying this with has 4 meshes; should I combine them into one? (I tried this briefly and added the armature, but instead of the mesh being distorted by the armature, the entire thing moved as one); or do I combine the "inner" meshes (not sure if that's the right term for the brain and spine) into one and leave the head/shoulders outline as a separate "outer" mesh?
  • Do I parent each mesh to the same armature, or do I parent the "inner" meshes (brain and spine) to the "outer" mesh (the human figure)?
  • Can I parent a mesh to an armature that exists outside the mesh? (ie. the shoulder bones are outside the spine; the neck bones are outside the brain)
  • I also noticed that because we only have one sensor input, it would be difficult to "realistically" (as possible) bend the neck -- ie. if I have a bone for each vertebrae, when I set the rotation on one it "breaks" the neck at that bone; I don't think IK is the solution as then we'd have to calculate the end coordinate of where we want the sensor point to be, right (we just know the yaw/pitch/roll)? I wondered if instead of rotating one bone by the full amount, could you rotate each of the bones in the neck a fractional amount so the total rotation is represented by the movement of several bones?
  • Is this the best forum for this discussion, or should I try one of the Blender forums?

See attachments for: a shot of the head/brain/spine model I want to animate (model from Blend Swap by daylanKifky); and, two shots of a simple model working correctly with an armature (model from TurboSquid by fishzombie). I'm willing to give more details or screenshots, but I figure I've rambled enough for a first post and will wait to find out if this is the appropriate place to discuss.

Thanks!

Capture.JPG

head1.jpg

head2.jpg

Link to comment
Share on other sites

@TrevorPT : Hi Trevor and welcome to the forum :)

I'm sure it is all doable - but if you are " I'm new to Babylon.js (fantastic library!), to Blender, and to 3d animation in general (it's been a couple of weeks) " then there maybe a bit of a learning curve :unsure:

But for a start a question. The model you want to use (which is very good) has a lot of vertebrae (neck and spine). Do you want to move each of the vertebrae separately? or just have one neck bone and one spine bone?

16 hours ago, TrevorPT said:

In some cases rotating a neck bone causes the shoulders to move

This maybe an issue with the weight painting of meshes and bones.

I downloaded the dalanKifky model, but it might be better if you could post your blend file so that I can take a look at exactly what you are using and look at the weight painting

cheers, gryff :)

Link to comment
Share on other sites

@gryff Hey gryff, thanks for the welcome and for the reply.  Yes, it's been quite the learning curve :blink: and I'm definitely in the deep end (knowing just enough to be dangerous!). I was somewhat stunned at how easily Blender and Babylon worked with the simple model from fishzombie. So mostly I want to know if I'm at least heading in the right direction and not missing something simpler.

Quote

The model you want to use (which is very good) has a lot of vertebrae (neck and spine). Do you want to move each of the vertebrae separately? or just have one neck bone and one spine bone?

I only have one rotation value to play with, so ideally (for ease) it would be one neck bone and one spine bone but I'm thinking it wouldn't look very realistic when moving (ie. the neck would snap in half).  I'd like each vertebra to move a little so it's more "realistic" (I use the term lightly as I know it won't be realistic) so I'm guessing I'd have to have a bone for each vertebra?

Quote

it might be better if you could post your blend file so that I can take a look at exactly what you are using and look at the weight painting

Hmm, the .blend file is 20Mb so exceeds the attachment size limit. The meshes have a lot more detail than I need (the final model will be drawn at about the size of the screenshots above) so was eventually going to look at decimating those; maybe I should do that sooner rather than later? (I've been focusing on proof-of-concept first rather than doing each step perfectly, so perhaps I'm over-complicating the process by skipping steps.) I have not done any manual weight painting, I only used the automatic parenting "with automatic weights" (I'm guessing weight painting is a next step I'd have to learn).

I could upload the .blend to hightail.com (file sharing) and message you the link (or post it here, if posting URLs is permitted).

Thanks! Trevor

Link to comment
Share on other sites

22 minutes ago, TrevorPT said:

could upload the .blend to hightail.com (file sharing) and message you the link (or post it here, if posting URLs is permitted).

Go for it Trevor :)  Link can be on this thread or in a PM - your choice.

Looking at the blend file is always better than trying to describe issues in pictures or text :o

As for the number of bones issue - we can change that as we go :)

cheers, gryff :)

Link to comment
Share on other sites

Not sure -- I assumed I'd want one bone per vertebra so that each could move independently of the others. For example, if I wanted to bend the neck forward by 45 degrees, instead of having one vertebra rotated 45 deg and the others linear (basically snapping the spine in half), each of the vertebra would move a fraction of the 45 deg so the result would be the head is tilted at 45 deg to the horizontal, but each vertebra is shown as tilting a little to contribute to the whole. Make sense?

Link to comment
Share on other sites

@TrevorPT :What you are saying makes sense Trevor though I guess it assumes that that each vertebra makes the same contribution. However enough discussion about that for the moment.

I've been looking at the weight painting and there are issues ...:wacko:

As an example, the image below shows the weight painting for bone 008 on the mesh "Male Base" the "skin" for your subject.

As you can see bone 008 (highlighted in blue) is having an impact on the vertices around the chest area

To set this up for yourself in Blender:

1. Open Up the bones in armature as A in image

2. In Pose Mode for the armature, Select bone008

3. Now Select the mesh "Male Base" and go into Weight Paint Mode (green outlines)

You should get the painting seen in the image below.

While in the WP mode you can select other bones so you can see the impact other bones are having on this mesh.

For example, check the shoulder bones - they are influencing the top of the head.

WP needs fixing dramatically. :(

cheers, gryff :)

Edit : There are other issues too with at least one mesh and with materials :(

weights1.png

Link to comment
Share on other sites

@gryff - many thanks. Until now I hadn't paid attention to weight painting so I will look into that. The materials I hadn't worried too much about yet, but I did have to convert them from Cycles to Blender materials (so they would export to Babylon), and that may have created issues. As for the meshes, before I go weight painting crazy, how do I properly get the inner meshes (Cerebelo, Cerebro, and Vertebral join) to move the same as the outer mesh (Male_Base)? Is it purely a weight painting problem or did I parent them incorrectly? Should I have joined the inner meshes into one?

Link to comment
Share on other sites

@TrevorPT ; Morning Trevor :) More on the meshes and materials.

Meshes

Image 1 below shows you one of the meshes - the "Male Base". Originally, the two halves of the body were created using the mirror modifier. Unfortunately they don't match up very well - there is a nasty seam marked A. If you look at the "Vertebral join" mesh you will also see a seam :(

Materials

You may have tried to switch the materials but the ones from Cycles are still present in the file and are detected by the exporter and it will bake out a texture for them which will be included in the babylon file  and BJS will expect them.See Image B which shows the Node Editor displaying the Cycles materials node.

To my way of thinking, those two issues should be sorted before tackling the weight painting issue

cheers, gryff :)

mesh1.png

material1.png

Link to comment
Share on other sites

Good morning (or afternoon for you by now)! Haha, yes, I had noticed the seams :huh: but chose to ignore them for now just to get the overall animation working. (Hackish, I know, but such is the nature of having no budget and no time, eh?). I really think I need simpler meshes to work with, as these are far more complex than we need for the end result and are probably complicating the process.

I thought BJS didn't support Cycles materials (thought I had read that somewhere).  When I had tried the export prior to converting the materials, I just got several black .jpg files. After the conversion, I got two .jpg files for the Vertebral join (normals and texture) and the others seemed to work so I figured it had been resolved.  I'll have another look. 

Thanks again for your input, it's much appreciated. (Off to do other non-3d work so it may be a day or two before I get back to this.)

Link to comment
Share on other sites

@TrevorPT ; Here is a blend file built from the blendswap original :

cerebelo.zip   (deleted)

It includes all the body parts that you want to use - but all materials have been removed.

I have added a simple body mesh and scaled it to fit over the male mesh from the original. It has a material.

You will have to tweak the file to get the spine right - between shoulder blades.

If you can get a setup you are happy with - let me know.

Do NOT apply any of the modifiers during the tweaking - so the vertex count can be adjusted later.

cheers, gryff :)

PS let me know when you have the file so I can delete it :)

Link to comment
Share on other sites

@gryff - got the file. Many thanks! But you didn't have to do that! Much appreciated, though. I'll spend some time with it (when I can, probably busy on other things the next couple of days) and see what I can do. As an aside, do you freelance on this sort of thing? I probably wouldn't get approval but any idea what it would typically cost to have this sort of blend put together properly?  Also, where did you get the mesh from? I have to know for licencing and redistribution (if I end up pieces of it).

Thanks again! Trevor

Link to comment
Share on other sites

9 hours ago, TrevorPT said:

Also, where did you get the mesh from? I have to know for licencing and redistribution (if I end up pieces of it).

@TrevorPT : Morning again :)

The mesh was created with MakeHuman, then exported to Blender. License for such exports here (Section C). So yours to use :)

Same tools used here and here

cheers, gryff :)

Link to comment
Share on other sites

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...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...