The calculation of bone animation is time-consuming because of the large amount of data.
This part of data is computed using the CPU, that is, the software skin. If GPU is used for computing, the hardware skin is used.
1. Software skin
Ogre itself has implemented the software skin, which is the software skin by default. The calculated code is in void entity: updateanimation (void)
2. Hardware skin
The shader needs to be used to put the computing into the GPU for processing, and the shader Code does not need to be written by itself. The Ogre itself contains a vertex program that supports two weights,
Because a vertex can be bound with a maximum of four bones and a maximum of four weights, it is a little effort to implement the vertex in four cases. Therefore, the configuration of the vertex program should be dynamically added in the code, not written in. in material.
It is better to use the hardware skin of the torch light and have a complete set of implementations,
Do we need hardware skin? The answer is that every 3D game should have one.
Tianlong and torch light use hardware skins because they can greatly increase the running speed,
The only shader program used by torch light is hardware skin, and no other shader program can be found.
Therefore, hardware skin should be the most important shader program, which is efficient.
We use the Ogre example to test the speed.
6 people, 132 and 198 FPS, the gap is not small,
//////////////////////////////////////// //////////////////////////////////////// //////
In addition, if the shader program is used, the Xray implementation method I mentioned earlier will be changed.
Because the previous method is for a fixed rendering pipeline, I want to disable the rendering state change method. If there is a shader program, it will not work if it is disabled.
However, another method can be used, that is, after the pass attribute is set to the rendering state, I will change the rendering State. Where can I change it? In subentity, rewrite the following function,
You can change it before rendering.
Virtual bool prerender (scenemanager * SM, rendersystem * rsys)
{(Void) Sm; (void) rsys; return true ;}