Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Graphics Soft Body Animation - Skinning CO2409 Computer Graphics Week 22.

Similar presentations


Presentation on theme: "Computer Graphics Soft Body Animation - Skinning CO2409 Computer Graphics Week 22."— Presentation transcript:

1 Computer Graphics Soft Body Animation - Skinning CO2409 Computer Graphics Week 22

2 Lecture Contents 1.Rigid Body vs Soft Body 2.Skeletons 3.Bone Influences / Vertex Weights 4.Vertex Blending 5.Technical Considerations

3 Rigid Body Limitations Rigid body models are suitable for models made of distinct rigid parts –We have looked at the example of a mechanical arm However, consider human joints: –When they bend, the body shape bends as well –No distinct parts We cannot represent this with rigid bodies –Or the pieces would separate, where there should be stretching or compression

4 Soft Body Animation Such models are called soft-bodied Implying that the pieces of the model can stretch and flex Examples of soft body models: –Humans, animals, aliens and other creatures –As well as other living organisms – plants, trees –Also clothing and material, rubber-like objects etc. This flexibility means there may not be a clear distinction between different pieces the geometry –In the previous picture, the leg is a single piece of geometry, though it clearly has two parts –How can we handle this?

5 Skeletons (Bones) Note that these soft-bodied models appear to have hierarchies, much like rigid bodies So we can define an independent hierarchy of bones assumed to lie within the geometry This is called a skeleton –Analogous to a human skeleton The movement of the bones drives the overlaid geometry –The bones are treated as rigid body The geometry bends & flexes depending on nearby bones –This is called Skinning

6 Skeletons within Geometry So how to position the vertices as the bones move? Most vertices follow a single bone In the example: –Dark blue follow the lower leg –Purple remain with the upper But vertices at the joints are affected by multiple bones: –Cyan area stretched between upper & lower leg position –Yellow area compressed Skinned geometry is often made of just a single part –Although there are exceptions (e.g. eyes may be separate parts)

7 Bone Influences / Vertex Weights Each vertex is influenced by certain bones –We specify a list of influences for each vertex in the vertex data The strength of each influence is a value from 0.0 to 1.0 –Varies for each vertex and is called the influence weight Consider vertices influenced by the lower leg bone: –Purple vertices not influenced by this bone The bone is not in their list of influences –Dark blue vertces are influenced by the bone with a weight of 1.0 They exactly follow the lower leg bone –The shaded areas are influenced with weights ranging from 0.0 to 1.0 Increasing closer to the lower leg

8 Bone Influences / Vertex Weights For each vertex, the sum of the weights from all the influencing bones = 1.0 –E.g. A kneecap vertex may have two influences, an 0.2 weight from the upper leg, 0.8 from the lower leg In practice, most vertices are influenced by a small number of bones (around 1 to 4) –Here, most of the leg vertices have one influence, the knee areas have two –Areas like the hips or shoulders may have more influences The bone influences and vertex weights are set up by the artists

9 Vertex Blending Each bone in the skeleton hierarchy has a world matrix, just as with rigid bodies –Again stored relative to the parent We can use a bone’s world matrix to transform the vertices it influences into world space –But vertices are affected by multiple bones… So calculate all the possible world space positions of a vertex, one for each bone that influences it Then linearly blend these world positions using the vertex weights from each bone Giving a final blended world position –The maths follows…

10 Vertex Blending - Maths Given a single vertex V, influenced by n bones –The world matrices for the bones are M 1 to M n –Their influence weights on this vertex are W 1 to W n –Then we calculate the blended world position P by: P = V M 1 W 1 + V M 2 W 2 + … + V M N W N E.g. A kneecap vertex (n = 2, W 1 = 0.2, W 2 = 0.8) –Upper leg world pos = V M 1 = (0.5, -1.5, 1.0) [for example] –Lower leg world pos = V M 2 = (1.0, -1.0, 0.5) Then the final position is P = (0.5, -1.5, 1.0) * 0.2 + (1.0, -1.0, 0.5) * 0.8 = (0.1, -0.3, 0.2) + (0.8, -0.8, 0.5) = (0.9, -1.1, 0.7)

11 Overall Process To implement vertex blending for soft-bodies we need to: –Store a skeleton hierarchy with the model geometry –Store additional data for every vertex: A list of influencing bones – indexes into the depth-sorted skeleton hierarchy An associated list of weights (floats) –Perform additional per-vertex processing Calculate not a single world position, but one world position for every influencing bone (using the bone world matrices) Blend the multiple world positions using the influence weights for the final result

12 Technical Considerations Using many matrices in a vertex shader is a burden Try to keep the number of bones per-vertex to a minimum –Add this as a modelling constraint – an upper limit Soft body models require much extra detail per-vertex from the modellers –Scope for modelling problems –Often hidden until model animates Also soft-body objects may form part of a rigid body hierarchy – e.g. eyes in a character are not skinned –In this case there will be two loosely related hierarchies - potentially overlapping – tricky… Tricky to import / export / pre-process such models –Much scope for errors, technical and/or modelling –Need very well tested conversion processes and tools


Download ppt "Computer Graphics Soft Body Animation - Skinning CO2409 Computer Graphics Week 22."

Similar presentations


Ads by Google