Blender bendy bones and deformation cages for joints

Works in progress and technical screen shots.

Moderator: joepal

Blender bendy bones and deformation cages for joints

Postby blindsaypatten » Fri Oct 05, 2018 9:08 pm

Some time ago Blender added bendy bones, which allow you to bend objects. Here's a simple example where a bendy bone is used to bend a cylinder:
BendyCylinder.jpg

The usual skeleton types cause problems at joints where the surface collapses on the side that gets compressed:
DefaultSkel.jpg

By placing a bendy bone at a joint the collapse can be mitigated. I placed a bendy bone at a knee joint, with one end attached to (parented) the upper leg bone and the other end attached to the lower leg bone. This prevents the collapse:
BendySkel.jpg

I suspect that it could be improved further by playing with the placement and weight painting, which I didn't spend much time on. Part of the problem is just the granularity of the mesh, it can be hard to keep a smooth mesh.

Just for illustration, here is the knee joint with the bones displayed as bendy bones. I'm not sure why they get displayed so wide here.
BendyStraight.jpg

BendyBent.jpg


A nice point of this approach is that the animation code isn't affected at all, the bendy bones are controlled by the regular bones without even needing drivers.

Edit:
With slightly less bend the bendy knee isn't distorting at all while the regular knee has already started to collapse:
Compare.jpg
Last edited by blindsaypatten on Wed Oct 10, 2018 5:14 pm, edited 1 time in total.
blindsaypatten
 
Posts: 586
Joined: Tue Mar 14, 2017 11:16 pm

Re: Using Blender bendy bones for joints like knees

Postby bogdan666 » Sat Oct 06, 2018 7:30 am

I've solved the collapsing knee joint problem by changing the bone weights around the knee bend and for keeping the knee volume I'm using the Dual Quaternion Skinning Algorithm ( "preserve volume" in blender terms).

But Dual Quaternion has it's own problems, mainly in the armpit area, if you want to make a pose with raised arms, because it keeps volume, where it should not.
The only solution is to make a shape key for each armpit.

But if you still want to use the Linear Skinning Method, you will have to make even more shape keys (for every joint you want to twist or bend), because of volume loss problems.
I don't know what's better: Linear Skinning Method+Shape Keys or Dual Quaternion Skinning+Shape Keys, but I'm inclined to say that the second approach is better, because it needs fewer shape keys.
bogdan666
 
Posts: 48
Joined: Wed Aug 08, 2018 6:16 pm

Re: Using Blender bendy bones for joints like knees

Postby blindsaypatten » Sun Oct 07, 2018 1:05 am

I tried using preserve volume but the effect seemed minimal. Do you need to do more than click the box in the Armature modifier?

However I rediscovered the Corrective Smooth modifier which is very effective.
CompareKnees65deg.jpg
Using Corrective Smooth: without preserve volume, with preserve volume, and using a bendy bone.


I think the bendy bone looks a little better when the angle is 90 degrees, the back of the default rig has started to collapse, but probably not worth the work for most purposes. Corrective Smooth is the key.
CompareBendyAt90deg.jpg
Comparing default and bendy bone at 90 degree bend.
blindsaypatten
 
Posts: 586
Joined: Tue Mar 14, 2017 11:16 pm

Re: Using Blender bendy bones for joints like knees

Postby bogdan666 » Sun Oct 07, 2018 8:52 am

You only need to change the weights of bones in the knee area by reducing the weights slightly+smoothen the mesh by clicking on the smooth button in the weight tools+preserve volume. (to activate the button, click the "vertex selection masking for painting" button, while in weighting mode)

The Corrective Smooth modifier works only inside of blender, but my method works even in Unreal Engine etc., because you can't export the blender modifiers out of blender. However it will be ok, if you only want to do renders inside of blender.

I've uploaded a character, which has my weight mod+smoothening applied. The legs look now even smoother with sitting poses+the hip area has now more volume with extreme poses. (legs up)

If you want to add this modification to your custom made MakeHuman char, you have to make a MakeHuman char with the default rig (has most bones), append my char to your character blender file and finally transfer the weights from my character to yours. As a result you will get all the modifications.

Link to the weight mod char: viewtopic.php?f=4&t=16392
bogdan666
 
Posts: 48
Joined: Wed Aug 08, 2018 6:16 pm

Re: Using Blender bendy bones for joints like knees

Postby blindsaypatten » Sun Oct 07, 2018 6:34 pm

Thanks for the links and the blender files, having the blender file makes it so much easier to see what's going on.

What I see is that by avoiding overlap in the weight painting of the two sides of the joint the surfaces attached to the bones simply pierce one another instead of forming an ugly indentation. The downside is that you still see the crease on the outsides of the joint.
KneeCircled.jpg
KneeCircled.jpg (16.01 KiB) Viewed 1661 times


I was doing the same thing a year ago, viewtopic.php?f=3&t=14183 we had a five page thread about it but in the end no one knew how to change the weights in MakeHuman ;)

Mostly for the sake of feeling that I tried everything, I decide to try out mesh deformation cages, which are used in BlenRig 5, which are supposed to produce very good results.

As a starting point I just made a cylinder that encased a leg mesh. I used a stupidly high resolution cage mesh, one of the beauties of mesh deform cages is that you don't need fine meshes, and that because the mesh is low res it is relatively easy to make corrective shape keys as needed. The other wonderful thing is that they are reusable, the same deformation mesh can be fitted to any humanoid body without redoing the shape keys, you just need to line up the joints. In theory you should be able to run the cage mesh through makeclothes and have it automatically fitted to any model. I had hoped to do that with the BlenRig cage mesh but it turned out that mesh contains triangles around the major joints because triangles behave better under deformation, a triangle is always planar while quads often become non-planar when deformed.

Anyway, I started with this:
MDC1.jpg


Bending it 90 degrees gave this:
MDC2.jpg


Adding a very lazy shape key:
MDC3.jpg


Produced this result:
MDC4.jpg

Not too bad considering I didn't do a proper shape key or fine mesh fitting.

A few notes: that I didn't use an optimized mesh which should give better results, I didn't fit the mesh close to the body which would give better results, I only did the deformation bind at level 5, you would use level 7 for production but that takes several minutes of compute time to do the binding, and I didn't put any real effort into the shape key and used the default weight painting. So, I would say this approach is promising.

A blender question, when developing shape keys is there an easy way to edit the mesh in its posed state? Normally when you go into Edit Mode the mesh snaps back to the rest state. I seem to remember something like making a shape key for the posed position and then a second one for fixing the deformation... I have to look into that...
blindsaypatten
 
Posts: 586
Joined: Tue Mar 14, 2017 11:16 pm

Re: Using Blender bendy bones for joints like knees

Postby bogdan666 » Mon Oct 08, 2018 12:20 pm

The bent knees look better with Dual Quaternion Skinning (has more volume), the old screenshot from above (knee with red circle) is with Linear Blend Skinning. But a crease is normal to a certain degree in the real world as well.
Do mesh deformation cages even work with keyframing, loading mocap files etc. or with clothes?

For editing a mesh in pose mode:

Go to edit mode-->modifier tab.

To the right of the name "ARMATURE" there are different buttons (hover over them to see more details): Click on the buttons "display modifier in edit mode" and "Adjust edit cage to modifier result". As a result you can now
modify the mesh of a posed character.
Attachments
knee.jpg
bogdan666
 
Posts: 48
Joined: Wed Aug 08, 2018 6:16 pm

Re: Using Blender bendy bones for joints like knees

Postby blindsaypatten » Mon Oct 08, 2018 2:40 pm

Thank you for the pointer to the buttons on the modifier tab, I knew there had to be an easy way to do it!

With regard to creases in real life... :oops:

I was looking at my own leg for a reference, and, well, naturally, sitting at the computer, I'm looking at the inside of the knee. Well, it turns out the inside and outside look quite different :o
RealKneesAt90deg.jpg

And once the calf and thigh meet there's definitely a crease:
YogaPoseKnees.jpg
MalePosesKnees.jpg

The problem is really more at the less extreme positions before the calf and thigh meet.

The Deformation cage is controlled by the existing armature so it works fine, without any changes, for all the usual armature-based animation techniques. The mesh has to completely enclose the vertices it will control, so with loose fitting clothing you might need to manually expand the cage to include the clothing. For things like dresses, you would probably want to create a "dress deformation cage", I haven't thought that through. You can use multiple deformation cages so that shouldn't be a problem.

Just as an experiment, I created a simple deformation cage just for one leg in Blender and used MakeClothes to get it into MakeHuman, and then exported back to Blender. The results so far are encouraging.
CageInMH.png

Compare45deg.png
Deformation cage versus default skeleton
blindsaypatten
 
Posts: 586
Joined: Tue Mar 14, 2017 11:16 pm

Re: Using Blender bendy bones for joints like knees

Postby blindsaypatten » Mon Oct 08, 2018 5:57 pm

In order to test mesh deformation cage portability I created three versions of a toon each with a different topology and then bound all three to the same deformation mesh. The result was pretty good:
ThreeTopos.png
male generic, default/none, and male1591 topologies

The significance in this case is that I had created a shape key for the deformation mesh instead of for a specific model topology. Normally I would have to make a new shape key for each model mesh topology. On top of that, the deformation mesh is pretty simple and therefore easier to make a shape key for, at least for something where the shape key doesn't need to be particularly detailed. The next step would be to try models with different dimensions. MakeHuman would handle adapting the mesh automatically, but I'm not sure how shape keys work when you morph the mesh they are on. Actually I don't even know how to copy a shape key from one mesh to another...
blindsaypatten
 
Posts: 586
Joined: Tue Mar 14, 2017 11:16 pm

Re: Using Blender bendy bones for joints like knees

Postby bogdan666 » Mon Oct 08, 2018 7:13 pm

It looks promising, but as for copying a shape key from a character A to a slight differently shaped character B (same rig and vertex count) it seems that the "target character B" takes on the shape of character A as a result, because the whole character is considered a shape key.

You can try it out yourself: Load a blender file with a character A with shape keys and then append a character B to it (identical rig).

Now create a base shape key for character b and afterwards select char A and hold shift+select char B-->click the bold arrow that is showing downward (below the minus symbol; in the shape key menu)
-->select "join as shapes" and you will see that everything gets messed up pretty bad. (Complete transformation of character A to character B, but shape key works correctly)

As it is now, the only solution will be to create the shape keys manually for every new character. Or is there a better method?
bogdan666
 
Posts: 48
Joined: Wed Aug 08, 2018 6:16 pm

Re: Using Blender bendy bones for joints like knees

Postby blindsaypatten » Tue Oct 09, 2018 9:34 pm

I wasted a huge amount of time banging my head against this wall and in the end the problem was that pin button in the armature modifier panel. If you turn it off and the use the transfer shape key function the value slider will work as expected. Actually, I'm not sure but it may get turned back on by the transfer in which case you need to turn it off again.

Once that was taken care of, and once I changed the deformation cage fitting to rigid in MakeClothes, I was able to fit the cage to a significantly different character and then use the same (copied) shape key.
LargeFemaleCage.png

LargeFemaleCompare.png
Using the default armature and using the deformation
blindsaypatten
 
Posts: 586
Joined: Tue Mar 14, 2017 11:16 pm

Next

Return to WIP (Work In Progress)

Who is online

Users browsing this forum: No registered users and 1 guest