Ogre itself comes with two sets of complete bone Animation models, which are stored in the Ogre \ samples \ media \ models directory, and one is a robot (robot. mesh and robot. skeleton), one set is ninja. mesh and ninja. skeleton ). Among them, the ninja model has a relatively high polygon number and rich and delicate movements. We use this ready-made ninja model to learn how to read and play skeleton animations. The role model and skeleton animation of ogre are separated into two files in different formats. One is the *. Mesh file, which defines the role's skin (skin)
Model, role material name, and role *. the file name of the skeleton animation; In *. in the skeleton file, the skeleton information and the bone animation sequence of the role are defined *. the skeleton file contains at least one bone definition part and several bone animation sequences in ninja. the skeleton file contains the definition of multiple animation sequences, such as walk, jump, attack1, and idle2. You can use
Ogrexmlconverter.exe. This tool is in the compiled ogrenew \ tools \ xmlconverter \ bin \ release directory.
There are many levels and types of bone animation, not all engine and model creation tools are supported. Ogre supports skeleton animation for the following features:
- 1. Each grid can define an independent skeleton animation.
- 2. Each bone animation supports unlimited bones.
- 3. Reverse power acting on the skeleton.
- 4. Each skeleton set can define animations with multiple names.
- 5. Each skeleton animation can have multiple key frames.
- 6. Linear or spline interpolation between key frames.
- 7 A vertex can be associated with multiple bones and can be assigned a weight for fusion.
- 8. Through weight fusion, multiple animations can be applied to a grid data at the same time.
The skeleton and animation information are saved in the file ending with. Skeleton and can be exported through exporters of ogre. When an object is created based on a mesh, if the mesh contains animation information, the corresponding. Skeleton file will be automatically loaded. Then you can operate the entity based on the animation State described in section 8.2. You can use software or shaders to implement skeleton animation. In general, the second method is better, because it will hand over some CPU work to the GPU, And the vertex data does not need to be updated every frame. It is very useful for large models with many details. Hardware skin can be achieved by specifying a material script with a vertex program. For more information, refer to the vertex program for hardware skin. A skeleton animation can be combined with a vertex animation.