Performance optimization of the animation system in Unity

Reduce the number of bones and reduce the number of faces.

method:

1. Check Optimize Game Objects to remove the Transform node corresponding to the bone node

2. Turn on the multi-threaded rendering option

The function call overhead that is mainly affected can be viewed in the profiler:

Animators.Update

MeshSkinning.Update

Camera.Render

Notice:

1. After the Animators.Update function is optimized for the bone nodes, a hundred models are placed in the scene to play the animation. The time-consuming reduction of this function is not obvious, but the CPU time consumption and FPS increase are obvious.

2. After multi-threaded rendering is enabled, the rendering pressure of the main thread will be reduced, but when the number of characters is too large, frame rate optimization will reach a bottleneck, but it reduces the performance pressure of the main thread, which is still very useful, allowing the main thread to have More energy to deal with complex game logic

Other optimization strategies:

1.BakeMesh, which is equivalent to converting the skin to a normal mesh

2.GUI Skinning stores the 1*4 movement matrix and 3*3 rotation matrix information of each frame of skeletal animation in the texture grid in the form of (r, g, b, a), and obtains information through GPU sampling Computation is done in the GPU to save CPU consumption.

Guess you like

Origin blog.csdn.net/l17768346260/article/details/131148483