Найти тему

Unity Loading Module In-depth Analysis of Animation Resources

Unity Loading Module In-depth Analysis of Animation Resources

In the previous technology push, we have analyzed the texture, mesh, shader, and other resources in the loading module for everyone. Today we continue the series by sharing with everyone the things need to pay attention to when loading animation clips.

Please continue to pay attention to this series. After collecting in-depth analysis of all resource types, you can summon the great god!

Resource Loading Performance Test Code

Like the test code mentioned in the previous articles, we also use this test code for the loading performance analysis of AnimationClip resources. At the same time, we made the AnimationClip file into an AssetBundle file of a certain size, and loaded them on different devices through the following code one by one, in order to obtain the corresponding resource loading performance comparison.

Test environment

Engine Version: Unity 5.4 version

Test Equipment: Three mobile devices of different grades (Android: Redmi 2, Redmi Note2 and Samsung S6)

AnimationClip Resources

AnimationClip resource is one of the most frequently loaded resources when the project is running, and its loading efficiency is mainly determined by its own loading capacity, and the main factor that determines the loading capacity of AnimationClip resource is its compression format. Currently, the Unity engine provides three compression formats for the imported AnimationClip, Off, Keyframe Reduction and Optimal. Among them, Off means that no compression processing is used; Keyframe Reduction means that keyframes are used for processing, and Optimal means that the Unity engine will automatically select an optimal compression method according to the characteristics of the animation curve, may be keyframe compression, it could be Dense compression.

-2

Note: For the explanation of the specific compression method in the AnimaitonClip curve, please check the Unity official manual document:
https://docs.unity3d.com/Manual/class-Animator.html

Test: Test the loading efficiency of AnimationClip resources in different compression formats

We have produced three sets of test cases, the number of AnimationClip resources are 10, 30 and 50 respectively. At the same time, each group of AnimationClip is divided into three groups based on its compression format: None Compression, Keyframe Reduction and Optimal.

We load these AnimationClip resources on three different grades of models. To reduce contingency, we have repeated the load operation ten times on each device and take the average value as the final performance cost. The specific test results are shown in the table below.

Group 1 test

After 10 “None Compression” resources, 10 “Keyframe Reduction” resources and 10 “Optimal” resources are packaged into AssetBundle files, their file sizes are: 409KB, 172KB, and 92KB respectively.

-3

Group 2 test

After 30 “None Compression” resources, 30 “Keyframe Reduction” resources and 30 “Optimal” resources are packaged into AssetBundle files, the file sizes are 1.42MB, 514KB and 312KB respectively.

-4

Group 3 test

After 50 “None Compression” resources, 50 “Keyframe Reduction” resources and 50 “Optimal” resources are packaged into AssetBundle files, the file sizes are: 2.46MB, 858KB and 525KB respectively.

-5

Through the above test, we can draw the following conclusions:

1. Optimal compression method can indeed improve the loading efficiency of resources, whether it is on high-end, mid-range or low-end devices;2. The better the performance of the hardware device, the higher its loading efficiency. However, with the improvement of equipment, the improvement of the loading efficiency of Keyframe Reduction and Optimal is not very obvious;3. The Optimal compression method may lower the visual quality of the animation. Therefore, whether the Optimal compression mode is finally selected depends on the acceptance of the final visual effect.

Optimization suggestion

For the optimization of resources, our suggestion is that prevention is greater than disaster relief! The specific feasible methods are as follows:

1. Our project team have wrotea resource detection tool (or find the relevant asset detection toolsin the Unity Asset Store) to check the data information of the AnimationClip resource, and check whether its compression format and file size are reasonable;2. If your project is using the UWA performance evaluation service, you can view the memory usage and animation duration of AnimationClip resources in the “Specific Resource Usage Interface” to locate whether there are non-compliant AnimationClip resources;3. If your project is using the UWA resource detection service, you can view the AnimationClip resource in the “Resource Usage” interface, focusing on its “Dense curve number” and “Stream curve number”. Generally speaking, only the AnimationClip resource with Optimal compression mode enabled will have the “Dense curve number”.
1. Our project team have wrotea resource detection tool (or find the relevant asset detection toolsin the Unity Asset Store) to check the data information of the AnimationClip resource, and check whether its compression format and file size are reasonable;2. If your project is using the UWA performance evaluation service, you can view the memory usage and animation duration of AnimationClip resources in the “Specific Resource Usage Interface” to locate whether there are non-compliant AnimationClip resources;3. If your project is using the UWA resource detection service, you can view the AnimationClip resource in the “Resource Usage” interface, focusing on its “Dense curve number” and “Stream curve number”. Generally speaking, only the AnimationClip resource with Optimal compression mode enabled will have the “Dense curve number”.

The above is the performance test of the AnimationClip resource when it is loaded. Regarding the performance of loading modules, we will continue to introduce a series of technical articles such as audio resource loading performance analysis, resource unloading performance analysis, resource instantiation performance analysis, and performance analysis of different loading methods. The common problems of the projects tested by UWA are summarized, in order to let everyone have a deeper understanding of the loading efficiency of the project and improve the ability to control the loading module.

Due to the content space, image limitation, for the full content with data and graphics, please feel free to read more here: https://blog.en.uwa4d.com/2021/12/01/unity-loading-module-in-depth-analysis-of-animation-resources/

Please feel free to read more related topics on the UWA official blog page at https://blog.en.uwa4d.com. Over 9000 video games tested and optimized by UWA Game Optimization Toolkit, if you want to have a 15-day free trial, you can visit the UWA official website and register an account at: https://en.uwa4d.com

You may also like:

GameLook: In the six months when the game version number was suspended and the pandemic repeated, how does UWA practice the game industrialization?

https://blog.en.uwa4d.com/2022/05/12/in-the-six-months-when-the-game-version-number-was-suspended-and-the-pandemic-repeated-how-does-uwa-practice-the-game-industrialization/

UWA DAY 2022 Conference Topic Submission — Practicing the Industrialization of Game R&D

https://blog.en.uwa4d.com/2022/03/14/uwa-day-2022-conference-topic-submission/

With 35 lectures in 2 days, focusing on industrialization problems, what substantial knowledge of game R&D did UWA DAY 2021 bring?

https://blog.en.uwa4d.com/2021/12/08/with-35-lectures-in-2-days-focusing-on-industrialization-problems-what-substantial-knowledge-of-game-rd-did-uwa-day-2021-bring/

A Happy Knowledge Sharer:

To be honest, my current and previous video game studios and video game developer friends who develope video games all using UWA game performance optimization toolkit, It saves us lot of time, human resource and cost. I know UWA provides a variety of optimization products for developers who use Unity Engine and Unreal Engine, such as: Game Performance Monitor, Static Testing, Game Optimization Toolkit Online, etc., helping developers efficiently solve development problems, locate performance bottlenecks and find solutions.

By the way, if you want to test and optimize your game, you can tell them that i recommended you, they will free test your game and free provide you game optimization solutions. This is special ~~~