Overview
Animation, in general, in various stages of computer development, has nothing to do with the illusion of motion when artists rapidly browse a series of slightly different pictures from each other. In 1872, Eadweard Muybridge took a group of continuous photos of the running horse, proving that the horse will leave the ground at the same time. This is the earliest documented record of a series of image streams that can produce motion illusion.
Now in Ogre, there is no need to assemble some devices to create this kind of motion illusion. The illusion is generated only when a small amount of data is moved or deformed at each frame. It is indeed just an illusion. Ogre does not track object speed, acceleration, or the role's arm is being lifted
Or cross the waist. Ogre processes the position and orientation frame by frame. What ogre can do for you is to help you replay these animations. These animations can be made using offline tools, or generated during running, or are filled with a series of location curves just for camera roaming.
Each frame of the scenario is repainted, and nothing will be saved between the two frames. The animation in ogre is only based on any variable (usually
Is a time function to locate and target roles. Each frame, under the control of the ogre animation system, the entity and animation in the scene are slightly
Move or produce deformation, and then the scene is re-painted. This way of generating animations is similar to that of the Warner Brothers animation team.
One row draws 24 cartoon rabbits, which are slightly different from each other, and then plays continuously in one second.
Animation type in Ogre
There are two ways to control objects: Animation Based on key frames and controller.
Abstract: Animation in ogre is a collection of related tracks. Track is a set of data values stored as time functions. A pair of "track value" and "Time Point" constitute a key frame. A better argument is that the orientation of all or part of the object on the timeline is, zoom to sample. Based on the animation type, ogre supports several key frames. The name "Key Frame" comes from the era of hand-made animation (like the cartoon rabbit animation mentioned above). The chief artist will provide a set of key frames to his subordinates. These frames give the location of the role in the scenario, and then the lower-level artists draw the location of the role between frames based on these frames. In ogre, you are the chief artist and need to provide these key frames. ogre is your subordinate, which helps you complete the transition between frames.
Ogre supports the following types of tracks (all key frames in a track must have the same type ):
NumericAnimaitonTrack (NumericKeyFrame ):
The key frame contains an AnyNumeric scalar value. Any is the structure defined in ogre. It is the same as the variant type in COM and supports data type polymorphism. AnyNumeric limits that the possible data types can only be numbers (real numbers, integers ).
NodeAnimationTrack (TransformKeyFrame ):
The key frame contains two three-dimensional vectors, one Quaternary, indicating the node location, scaling, and orientation.
VertexAnimationTrack (VertexMorphKeyFrame, VertexPoseKeyFrame ):
A key frame contains or references vertices and VertexPoseKeyFrame at a specific time point (in the pose animation ).
Animation status
The main interaction between a program and an animation in ogre is the animation state ). In the modeling tool, multiple animations can be defined for the skeleton or vertex mesh along the timeline. During export, each animation can define a name to locate the same animation in the Entity. Multiple attributes of an animation can be accessed through the animation state: length, current position, animation name, loop, validity, weight (used for mixed animation ). The weights are processed according to the type of the mixed animation.
Hybrid weight average:
Tells the ogre that the sum of ownership is 1. If it is not 1, ogre will perform normalization to make the sum of them 1. This method is only effective for bone animation, and it is also the default hybrid method.
Hybrid permission accumulation:
Ogre simply accumulates the effects of all referenced weights without any further balance. This method is only effective for vertex animation (pose, morph) and can be used for bone animation.
The animation status also adds time to the animation to push it forward. Basically, a time increment is always provided, which means the time has increased since the last call. In essence, adding a time increment is no different from directly setting the time position.
Skeleton Animation
Bone animation is the most common animation type. The vertices in the mesh are bound to the skeleton, just as the muscles of our body are bound to the bone.
The difference is that the "bone" in computer animation does not actually exist. They use some (no corresponding entity) transformations to represent the position of the bone, orientation and scaling, often expressed in a matrix. The key frame of the skeleton animation is only an offset from the restoration position of the skeleton. They are combined to form a certain point of bone along the timeline.
The bones in the Ogre are hierarchical, such as connecting the ankle and the tibia, and connecting the tibia and the knee. In this hierarchy, each bone has a father except root. But not limited to only one root, this hierarchy is only used to pass the conversion (top-down ). Changing a bone affects the locations of all its children. The reverse motion ogre is not supported: When a bone moves, it does not affect the father generation.
Vertex binding
When a vertex is bound to a bone, a weight is specified, indicating the effect of the bone movement on the vertex. Typically, a vertex is bound.
Assign different weights to multiple bones. Ogre supports only four bones at each vertex, but each bone can be associated with any number of vertices.
Vertex Animation
The animation Method for Calculating the vertex position is different from that for calculating the animation skeleton. Vertices are directly animated. It is a resource-intensive solution that transfers a complete copy of vertex data for each animation location. Sometimes this approach is a way of doing this, such as implementing realistic facial expression animation.
Vertex animation is managed and manipulated at the animation track level. This means that we can use a complex pose animation for the role's header and face, while the rest of the role uses a relatively simple morph animation. However, different animation types cannot be used for the same vertex. When a vertex animation references a set of vertex sets, either all or one of them is referenced. This means that at the mesh level, all the shared geometry forms the vertex data of the vertex animation. At the submesh level, all the submesh vertices constitute the vertex data of the vertex animation. For example, some vertices in a subgrid are involved in the morph animation, while the remaining vertices are involved in the pose animation. This is not allowed.
Morph Animation)
Deformation animation is the simplest and most intuitive method of two vertex animation technologies. The actual vertex position is saved as a "snapshot. This is similar
The cartoon rabbit animation process is the same. This method consumes resources, but has the highest computing efficiency. Data between keys is worth inserting.
The main drawback is that you cannot mix multiple deformation animations because they store the absolute position of the vertex. Of course, if there are two animations, they
The affected vertex does not have an intersection, so the two animations can indeed be mixed.
Pose Animation)
The pose of the model is saved in the animation tracks. These postures can be mixed to create more complex animations. The vertex position is relative
The offset of the recovery position, rather than the absolute position of the vertex. And only changed data is saved. Therefore, it is not only more flexible, but also
Resource usage is more efficient.
One or more pose tracks are referenced in the key frame of the pose animation. Each reference has an impact on the pose weight. The weight determines the effect of each vertex offset on the final vertex position when pose is mixed. You do not need to reference a pose in each frame. In practice, pose mixing imposes some restrictions: each additional pose requires more processing time.
Hybrid Animation
You cannot mix pose with morph or mix multiple morph animations.
When a hybrid skeleton animation and a vertex animation are used, ogre will first compute/mix the vertex animation, and then apply the skeleton deformation to the hybrid vertex.
The standard pose and skeleton animation mix the whole body of the skeleton animation and complex facial expressions. For example, you can use pose animation for the facial vertices of a role, while the rest of the role (including the header) uses relatively simple skeleton animation.
Mixing two skeleton animations is most useful for switching between animations. For example, the role may execute the "running" animation cyclically.
He may have to stop (execute the "idle" animation), then the two animations need to be mixed.
The combination of Morph and bone animation is suitable for adding "outer skin" mesh deformation to the role of the bone animation. For example, mixing a clothing animation with the actual skeleton animation of the role avoids the high cost of real-time simulation of the clothes.
Hardware vs Software
When using hardware acceleration, remember that the hardware animation mesh data cannot be used by the CPU. This is very important! Assume that you are dependent on Grid Data
For other calculations (Volume Shadow computing, physical simulation), once the vertex deformation calculation is moved to the GPU, the vertex will disappear forever and will not be used in the code, if the transformed vertex data is required, you have to use the CPU for the same computing as the GPU! This can also be done. Tell ogre to do it: Entity: addSoftwareAnimationRequest ().
A combination of hardware-accelerated bone animation and vertex animation will execute a mixture in the vertex program. If you haven't noticed
Now you have the opportunity to realize this: first vertex, then skeleton. This also means that all animation technologies should be based on hardware acceleration and cannot mix hardware-accelerated skeleton animation with software-based vertex animation.
When using GPU to accelerate bone animation, consider the essential requirements of the bone animation algorithm. When calculating each vertex, the data of all bones in the skeleton must be provided. Old hardware only supports 24 bones or fewer skinning channels. In this case, the mesh should be divided into several segments and skin them in multiple channels. Ogre only sends the bones referenced by the submesh to the skinning shader, instead of all bones in the skeleton. This makes multiple skinnig pass possible.
The main advantage of performing Interpolation on the morph animation vertices in the CPU is the use of the essence of GPU parallel computing. Morph is not complex in computing,
The main input is two vertex locations and an interpolation factor. The vertex location generated by the vertex program after interpolation is used as the output.
The pose animation is similar to the morph animation and has a restriction similar to the skeleton Animation: how to transmit the number of pose provided to the program.
Tag point
Tags are not part of an animation, but they are often used to link arbitrary objects (such as weapons) to an existing animation model. Tag point
The concept is relatively simple: it is a special bone in the skeleton, it can control the position and orientation of the bound object at runtime. No prior
You can create a tag point to attched a movable object to a named Bone in the skeleton during the motion period. Entity has the following method:
AttachObjectToBone (); Once an object is bound to a bone, it moves with the tag point. You need to know that the object is not real
Is attched to the tag point. It is attched to the Entity that uses that skeleton.
Animation and Controller
Both control the object state based on a one-dimensional Variable and input the variable into a function for output. For animation, the input variable is time, and for the controller, the input variable is anything you want.
Animation features:
The interpolation function is used to calculate the track value at a given time point to generate the output, thus changing the vertex position.
Animation is regarded as a closed system: You set the input value, and ogre uses it to update the attributes of related objects.
Interpolation functions are relatively fixed: line values or cubic splines.
Animation supports many tools provided by ogre.
Controller features:
The output computation is more flexible and the work functions need to be provided, so there are more options.
A controller can form a chain, and one output can be used as another input.
The controller does not move anything on its own and can do nothing for the output. Ogre uses a controller to drive texture animation.
The Controller automatically updates frames by frame. However, you must manually add code to make the animation of each frame change forward.