Computer Graphics Soft Body Animation - Skinning CO2409 Computer Graphics Week 22.
-
Upload
felix-arnold -
Category
Documents
-
view
229 -
download
0
Transcript of Computer Graphics Soft Body Animation - Skinning CO2409 Computer Graphics Week 22.
Lecture ContentsLecture Contents
1. Rigid Body vs Soft Body
2. Skeletons
3. Bone Influences / Vertex Weights
4. Vertex Blending
5. Technical Considerations
Rigid Body LimitationsRigid 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
Soft Body AnimationSoft 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?
Skeletons (Bones)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
Skeletons within GeometrySkeletons 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)
Bone Influences / Vertex WeightsBone 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
Bone Influences / Vertex WeightsBone 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
Vertex BlendingVertex 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…
Vertex Blending - MathsVertex Blending - Maths
• Given a single vertex V, influenced by n bones – The world matrices for the bones are M1 to Mn – Their influence weights on this vertex are W1 to Wn
– Then we calculate the blended world position P by:
P = V M1W1 + V M2W2 + … + V MNWN
• E.g. A kneecap vertex (n = 2, W1 = 0.2, W2 = 0.8)– Upper leg world pos = V M1 = (0.5, -1.5, 1.0) [for example]– Lower leg world pos = V M2 = (1.0, -1.0, 0.5)
Then the final position isP = (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)
Overall ProcessOverall 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
Technical ConsiderationsTechnical 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