Trending
Opinion: How will Project 2025 impact game developers?
The Heritage Foundation's manifesto for the possible next administration could do great harm to many, including large portions of the game development community.
This example shows how to do SkinnedMesh animation using the framework.
This demonstration uses a SkinnedMesh with bone hierarchy transformations, which is a mesh that has vertices assigned (using weights, this process is called skinning) to “bones” created in Blender, and exported as a “.X” file, and the bones/matrices when transformed (in hierarchical order), transform the vertices assigned to them, thereby moving or animating much more life-like and fluid. The animations themselves were also created in blender, and gets exported as AnimationSets, which form part of the “.X” file format, the format is then parsed and processed by a custom X file importer, provided by this framework.
Animations are then referenced by name, and advance using matrix interpolation, as well when transitioning between animation sets, to create smoothed linear animation transitions.
The model in this example is also bump mapped, so a low polygon mesh is used, and not the high resolution mesh.
This can also be achieved in blender, and the bump mapping is explained a previous tutorial for this framework.
Basic description of exactly how the framework manages animation.
Animation is imported from .X file (as animation sets, text format, including weight matrices, and all other required geometry data (position, texture coord, normals)), into a custom format, but basically boils down to keeping the animation data as an Animation Set, which contain “bones” or frames which are transformation matrices, and are called “animations”, each animation set, affect a series of “bones” or matrices, and each animation, or “bone” has a set of animation keys, animation keys are the transformation matrices on that given bone at a specific animation time (10....20..300..etc), as animation time advances for a given animation set (always from a minimum to a maximum defined by each animation set itself), the appropriate/(corresponding by current animation time) matrix is multiplied into the animation set's bones, one by one, and once multiplied, the bones are multipled with their parent bones, and then finally, all bones are multiplied with the inverse bind pose (created by the export program, that creates the animation set data, and imported by this framework as “weight matrices”), this is about as complex as it gets for 3D rendering, nevermind the maths behind all of this, which should be second nature by now at least.. as the animation time advances between animation keys, I.e if animation key 1 and 10 is defined, but it is currently animating for animation key 4, the matrix at animation key 1, and 10 are interpolated between , by calculating the degree or percentage or linear interpolation that 4 would represent between 1 and 10 (percentage).. I.e 4...40%.. 5, 50%... 6...60%.. generally, the keys would be in frames of 10... but this is by no means hard coded or set, it could be every frame, or every n-th frames/animation time, so this value has to be calculated every time, for the given animation time.
The framework caters for this exact scenario , this is why animation looks so smooth, matrices are calculated by interpolation between the previous, and next animation key, and including the last and next animation set's matrices, (first and last... !!!!) when changing animation sets.
An animation set could be “walking”, and the bones assigned could be “left leg, Right leg, left foot, right foot...etc...” , and animation keys could be deinfed as:
Animation Set Walk
Animation Left Leg*
Animation Key 1 Stand Left Leg*
so between key/frame 1 and 10, standing and lifting the leg, to determine how much the leg must lift at any given point/animation time, calculate the percentage of time wrt above and below times(previous/next), and then linearly interpolate between the above, and below matrices at the percentage just calculated.
Animation Key 10 Left Leg Starts Lifting up*
Animation Key 20 Left Leg Starts Moving Forward*
Animation Right Leg*
Animation Key 1 Stand Right Leg*
Animation Key 10 Right Leg Starts Lifting up*
*Denotes these would be 4x4 Matrices.
Source Code: SkinnedMeshAnimation
More Technical Documentation:
Pictures of this demo:
Pictures II
Screenr demo:
Previous Demo: [http://alwyndippenaar.blogspot.com/2011/11/3d-audio.html ]
Read more about:
BlogsYou May Also Like