Avatar Animation and Texturing
I apologize in advance if you read both Flipcode and Game, as I am duel posting this message.
Our team has been going back and forth on this for a long time. We have a single skin / morphing system in place now as a place holder, but want to move to the next level. I would like to get your opinion on this. Our target hardware is 700 MHz PC and GeforceII GTS as minimum specs.
The requirements are:
1. The ability to change the clothing and equipment for avatars at will.
2. Be as efficient as possible of texture memory.
3. Allow layers of clothing and jewlery and items to be shown.
4. Allow items to bulk up the character (like a coat).
5. Allow for seperate attached items to be moved in concert with limbs.
6. Allow smooth blended animations.
The proposed solution is this:
1. Body is divided into 21 pieces representing major pieces of the human anatomy.
2. Animation information is generated using Character Studio with IK solving. Animation is a series of quaterion rotations applied to a nested hierarchy of bones.
3. Each animation sequence is time-coded for its step time between key-states.
4. Multiple animation sequences can be applied at the same time if they are applied to differnet parts of the bone hierarchy (i.e. upper and lower body).
5. Transitions from one animation to another are done by calculating parallel sets of joint rotations for that time state and blending them on each part of the quaterion vector over a set amount of time, say 500-700ms.
6. As the avatars are modeled, each of the 21 pieces are texture mapped into a standard pre-determined texture map in a large imaginary texture.
7. If two or more sub-meshes are built for one body part (for bulking for example) then they must be done in such a way that they can fit with all other meshes they are adjecent to.
8. Every vertice of every sub-mesh will have a reference to all the bones that influence it, and the associated weight of each bone.
Texture Building
----------------
At the time the character is loaded, or at the time that a wearable item is changed we need to determine how the mesh is to be rendered. The idea is that we will use single textures per sub-mesh where possible, but be prepared to build a dynamic merged texture for meshes if necessary. Merged textures will be placed on a single texture in such a way as to allow for smooth interpolation between sub-meshes. This allows us to share texture memory for characters in view having the same item, and the ability to build some items which use anisotropic filtering (for metal) or use a higher res texture for more detail, but still support layered clothing and jewlery.
1. Each wearable item will be flagged with a set of body parts it covers, and the class of sub-meshes needed to support it (example is that it covers upper and lower chest, using Bulk Chest Mesh #2. Each item is also flagged with whether or not it covers 100 percent of the body parts referenced. So to recap an "item" is a texture, the names of the body parts it covers, and the type of mesh (skin tight, medium bulk, big bulk or even specific sub-mesh) for each body part covered.
2. If an item does not cover 100 percent of the body parts referenced then the artist built texture should have an alpha mask which indicates which part of the texture is not covered.
3. The 21 sub meshes are grouped into 2 categories. One category are meshes which have their own texture. So if the avatar is wearing a long sleeve shirt, with nothing over it, then all the arms and chest sub-meshes will be grouped together because they all share the same texture. The second category are sub-meshes which do not have their own texture because the items on them only partially cover the underlying texturem requireing a merge. A dynamic texture is built and used for a single merged sub-mesh which encompases all of the second category items.
4. Merged textures are built by starting at the base race/gender/complextion texture per part, laying down scars, cuts, bruises and tattoos, and then laying down the appropriate item textures on top of them, alpha blending them together. These little body part textures are arranged on a single larger texture with as much efficientcy as possible and rendered with the merged sub-mesh.
Rendering
---------
1. Each frame walk the bones, perform rotations, time interpolation and rotation blending.
2. Step through all the vertices in all the sub-meshes and apply the bone weighted transformations.
3. render the groups of sub-meshes which have their own texture.
4. render the rest with the dynamic texture.
Optimizations
-------------
1. If the client machine is weak in CPU but strong in texture memory you can disable sub-meshing and force all of them into the 2nd category (merged textures). This would then render as a single deformable mesh, but each avatar would use a 256x512 texture.
2. If the client is weak in CPU and weak in texture memory, do the same as in step 1, but scale the avatar texture down by half.
3. If the number of avatars being animated in a viewable area is too large, start reducing the animations FPS down, starting with characters farther away from the view. Effectively this would mean that some characters would recompute their animation every other frame, or even less frequently.
Analysis
--------
1. This should be a very flexible design covering all the requirements.
2. Commonly worn items, if they are 100 percent coverage on their body parts, should end up being shared textures, conserving tetxure memory (assuming two or more people wearing the same item are within view)
3. The scheme can be scaled for different machine classes.
4. This supports layering and unique look per character.
Well thats the basic idea. We are going to start coding a prototype, but if anyone can think of any glaring issues with this then please let me know.
David Yazel
http://www.cosm-game.com/
David Yazelhttp://www.cosm-game.com
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement