Overgrowth takes place in the savage world of Lugaru where rabbits, wolves and other animals are forced to use paws, claws and medieval weaponry to engage each other in battle. Combining 3rd person adventure platforming with intricate melee combat, Overgrowth achieves a unique feel. Overgrowth also benefits from Wolfire's brand new Phoenix Engine which has been built from the ground up to allow the use of cutting edge graphics, animation, and physics. Add to these exciting features Overgrowth’s realistic artificial intelligence and streamlined control system and the result is an astoundingly immersive experience.

Report article RSS Feed Volumetric heat diffusion skinning

After seeing our rigging tutorial, a number of you asked me how we calculate our vertex weights. However, many of you reading the blog are probably asking yourselves a more basic question: What are vertex weights?

Posted by jeffr on Nov 25th, 2009

After seeing our rigging tutorial, a number of you asked me how we calculate our vertex weights. However, many of you reading the blog are probably asking yourselves a more basic question:

What are vertex weights?

When we first load the rabbit, it's a static model: just a collection of triangles with an image wrapped around it. Next, we create the skeleton, which is a set of line segments (bones). Finally, we get to the tricky part. How do we attach the model to the skeleton so that they both move in the same way?
For every vertex (triangle point) in the model, we have to figure out which bones it should be attached to, and how strong each attachment should be. This information is stored in the vertex weighting. Below you can see the static model, the model with a skeleton, and the area of influence for each bone.


Using the vertex weights, we can match the model's pose to the skeleton's. Whenever a bone moves, we can apply the bone's movement to all vertices that are attached to it, modulated by the attachment strength. The attachment strength is important for smooth deformation at joints, where vertices are attached to multiple bones. Here is an example of pose matching using vertex weights:


Usually these weights are painstakingly applied by hand, using a virtual 'paintbrush' or some kind of 'envelope' system. However, this is a long, tedious process, and I didn't want to force Aubrey (and modders) to go through it if it could be automated.

How do we calculate them automatically?

The most obvious way to calculate vertex weights is to attach each vertex to the closest bones, weighted by distance. At first glance the results look ok, but if you move the bones around, you start to see problems. For example, the bones in one foot can affect vertices in the other because they're in close proximity, even though they're not connected.


Clearly we're can't just use simple Cartesian distance -- we need the distance of the shortest path within the volume of the model. For example, the distance from the right foot to the left foot should be about equal to the distance from the right foot to the right shoulder, because the path must go up one leg and down the other. When working with volumetric calculations, it's often helpful to voxellize the model. Voxellization turns the model into a 3D cube structure that approximates the model's shape.


I found that the easiest way to think about this was in terms of heat. We can treat each bone as a heating filament, and then diffuse the heat through the voxel model. Diffusion is pretty easy using a voxel model -- we can just set each voxel's heat to a weighted average of its neighbors' heat, and repeat as necessary until it diffuses completely.
The final heat distribution is proportional to the shortest path from the bone to any point in the model, so we can get the final vertex weights by just comparing the heat from each bone at each vertex. Here is a picture of the foot bone's 'filament', the foot's heat distribution, and its final vertex weights:


I found this algorithm to be intuitive and easy to use, and it eliminates the most tedious part of character modeling. I am very happy with this technique! Confusingly, there's an existing skinning algorithm called 'bone heat', but it has a very confusing implementation, and incorrectly uses surface diffusion instead of volumetric. If I had to name my techique I would call it "volumetric heat diffusion". Here is the rabbit posed in various ways using automatic vertex weights:


There are a couple of ways I can think of to improve this technique, but haven't implemented them yet because they're not urgent. First, the heat diffusion is a massively parallel task, so it could be sped up by orders of magnitude using the GPU. Second, it would be useful to have some interface to make the joint blending harder or softer in specific areas by using different power functions on the heat values.
Do you have any more questions about the vertex weights, or ideas to improve it?
(permalink)


Track us on ModDB (visit our page)

Please join us here too:
Facebook icon ModDB icon Steam icon Twitter icon YouTube icon

Post comment Comments
NullSoldier
NullSoldier Nov 25 2009, 10:32pm says:

I'm addicted to your articles, stop posting such great articles.

When ever I feel like not programming anymore because I've delt with some annoying issue you inspire me to get up and keep writing code and coming up with solutions to problems in creative ways.

+11 votes     reply to comment
PringleX
PringleX Nov 25 2009, 11:01pm says:

Your guys' work is simply stunning.

+3 votes     reply to comment
wilsonC
wilsonC Nov 25 2009, 11:09pm says:

This method looks really easy and fast, but it doesn`t seem that precise. Will we still be able to select vertices and assign them to bones, and set their weightsÉ

+1 vote     reply to comment
Orac|
Orac| Nov 25 2009, 11:21pm says:

Ah, my beloved voxels.

+1 vote     reply to comment
Dra6o0n
Dra6o0n Nov 26 2009, 12:09am says:

I wonder if you guys ever tried to give us some nice realistic poses using the models, and not screenshots of them laying/pushed about ragdoll style lol...

+1 vote     reply to comment
myles
myles Nov 26 2009, 3:56am says:

Looks like you've gone a step ahead of most professional packages, Maya just uses Cartesian distance meaning you have to spend a good few hours cleaning up the weights. Have you any plans to allow modders to paint/change the vertex's them selves ~ I'm sure this system wont be perfect for everything.

+1 vote     reply to comment
AlekZanDer
AlekZanDer Nov 26 2009, 5:01am says:

Nice.

+1 vote     reply to comment
Syncing
Syncing Nov 26 2009, 8:40am says:

Like nearly every article you make, its really intertesting to read.
Go on!

+1 vote     reply to comment
hogan_skoll
hogan_skoll Nov 26 2009, 10:38am says:

i like cleaning weights and getting them just right on knees and stuff though - i mean the manual control of painting weight like in xsi - i hope you add some functionality like that

or that yor system is perfect :)

nice either way

+1 vote     reply to comment
Croco15
Croco15 Nov 26 2009, 12:28pm says:

Cool.

+1 vote     reply to comment
Metalspy
Metalspy Nov 26 2009, 1:28pm replied:

Lol.. that's the only thing I've ever seen in your comments; 'Cool.'

But you're right, it IS cool!

+1 vote     reply to comment
Dragonlord
Dragonlord Nov 26 2009, 1:49pm says:

Good system for models compatible with it. Not a cure all but good for first time rigging and if character models are of low to medium complexity ( no chance at high complexity ). That technique should be added as a script to Blender. Would allow to make the first bone weighting automatic and then adjust from there where fine tuning is required ( or rather, where automatic simply fails ). Would be the best of both worlds since Blender knows only R3-distance bone heat/envelop and mesh deformation ( but the later one can be funky at times ) and manual bone weighting is a must if you want good animations ( especially complex ones with tricky geometry and extreme poses ).

Edit: by the way. Why not use the mesh edges for transfering heat instead of voxels? If required the mesh can be temporarily sub-dived using simple sub-division and propagate heat along connecting edges. Faster since you can pre-record the edge length and just apply the edge length while walking along the mesh. Works also with non-manifold meshes which would fail with your voxel method.

+1 vote     reply to comment
Elementalist
Elementalist Nov 26 2009, 9:00pm says:

So, um... I have to wonder. Are you guys just at some point going to go all out and make a simple character animation/rigging application? Seems like it could be really simple and not too difficult based on what you've already done.

Amazing work, great articles.

+2 votes     reply to comment
jeffr
jeffr Nov 27 2009, 1:42pm replied:

Well, we already have one built into Overgrowth. We could theoretically make a standalone version too. :) Maybe after we finish the game!

+1 vote     reply to comment
AshtonAndersen
AshtonAndersen Nov 28 2009, 6:04pm says:

Everything seems great and I like the tech posts, but when can we expect to see some form of gameplay?

+1 vote     reply to comment
Post a Comment
click to sign in

You are not logged in, your comment will be anonymous unless you join the community today (totally free - or sign in with your social account on the right) which we encourage all contributors to do.

2000 characters limit; HTML formatting and smileys are not supported - text only

Icon
Overgrowth
Platforms
Windows, Mac, Linux
Developer & Publisher
Wolfire Games
Contact
Send Message
Official Page
Wolfire.com
Release Date
TBD
Game Watch
Track this game
News
Browse
News
Report Abuse
Report article
Related Games
Overgrowth
Overgrowth Indie Single & Multiplayer Adventure
Related Engines
Custom Built
Custom Built Commercial Released Sep 1, 2007
Related Groups
Wolfire Games
Wolfire Games Developer & Publisher with 3 members