Limb Slicing

Limb slicing (or being able to cut away pieces of an animated character in real time) can be easily added to any skeletal animation system. The problem can be divided into two tasks: Cutting away the geometry (and filling any possible holes) and animating it.

Cutting away a character's arm and leg can easily be performed by deciding on the bone we will be cutting and deleting all triangles that are influenced by it or any descendant above a threshold weight. Consider that we want to cut an arm away at the shoulder, for example. We scan all the vertices and compute the bone weight from the upper arm. Those vertices with weights above a threshold will be marked. Then, the same process is applied recursively to all bones below the selected one in the hierarchy. Notice that I said "above a threshold," not "above zero." Some relatively distant vertices (for example, part of the chest) might be affected by the bone, even if it's still distant. Thus, it is good practice to be conservative and set a threshold at which the cutting will begin. Here's the pseudocode for such an algorithm:

 void amputate (bone root, mesh originaldata) { for each children of root    for each vertex in the original mesh       compute weight from bone to vertex       if weight > amputation threshold          mark vertex as deleted       end if    end for    if this bone has children       amputate (children of this node, original mesh,processed mesh)    end if end for } 

Once this step has been performed, we will have our original mesh with some vertices marked as deleted. All we need to do is actually update the mesh structure deleting the vertices. Then, we will have a mesh with a hole where the arm should begin. We now need to retriangulate that zone so the whole mesh is completed. To do so, we can follow a number of strategies. We can, for example, take the pivot point of the ampu tated bone as a reference and do a star triangulation so the mesh is closed again. To detect which vertices we should triangulate to, we take those affected by the bone with a weight below the amputation threshold and above a slightly inferior limit. Clearly, these are vertices close to the amputation zone. Any triangulation algorithm can be used on this small data set to actually reconstruct the mesh.

As for animation, there is no significant change. Matrices and bones will still be valid; the only change being the deletion of several vertices in the mesh. Overall, the same algorithm can be used.



Core Techniques and Algorithms in Game Programming2003
Core Techniques and Algorithms in Game Programming2003
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 261

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net