This article is the Animation section of the Scene Capacity Reduction Series.
Other articles can be found at the following links.
Scene Capacity Reduction Series
Review animation settings
Let’s review the settings for each animation.
Select the FBX file and click on the Animation tab in the Inspector window to see the following settings.
In this issue, we will introduce some of these items that may be effective in reducing capacity.
Anim. Compression
Anim. Compression is the compression level setting for the animation.
The following options are available.
Compression Type | Quality | Capacity | Features |
Off | High | Large | No compression. |
Keyframe Reduction | Medium | Medium |
Reduces the number of keyframes.The criteria for reducing the number of keyframes is determined by Rotation Error, Position Error, and Scale Error, which are described below. |
Optimal | Medium | Small |
If the animation is short or noisy, compress in dense format Otherwise, compress with keyframe reduction |
Off is quite large and should not be selected unless you have a strong preference for it. (If you have already done thorough weight reduction on your original animation files, choose Off.)
Optimal is a newer algorithm than Keyframe Reduction and is said to be easier to reduce the file size.
Rotation Error
When Anim. Compression is set to Keyframe Reduction or Optimal, a Rotation Error item is available.
Rotation Error allows you to set the maximum rotation error allowed during animation compression. The unit is degrees (°).
The default value of 0.5 means that a maximum of 0.5° of rotation error is allowed.
The following is an example of a compression result.
Rotation Error : 0° / Capacity : 249KB (100%)
Rotation Error : 0.5° / Capacity : 119KB (47.8%)
Rotation Error : 10° / Capacity : 69KB (27.7%)
Rotation Error : 100° / Capacity : 14KB (5.6%)
reproduction in graphic form: Animation Compression in Unity
In the 100° view above, the right foot is missing the ground contact and is stuck in the ground.
As you can see, the larger the Rotation Error, the lower the quality of the animation, so there is a tradeoff between performance and quality.
The default setting of 0.5° is so high quality that it is hard to tell where the quality has been degraded, but it cuts the file size by about half, so if in doubt, choose 0.5°.
Position Error
When Anim. Compression is set to Keyframe Reduction or Optimal, an item called Position Error can be set.
Position Error allows you to set the maximum position error allowed during animation compression.
The unit is percent (%).
The default of 0.5 means that position error is allowed up to 0.5%.
Here is an example of the compression result
Position Error | Animation Curve Example |
Original( 0% ) | |
10% | |
reproduction in graphic form: Unity Documentation / Animation タブ |
The original animation curve has two peaks, but the compressed curve has lost the right peak.
This is because the keyframe with the right peak had a Position Error of less than 10%, so it was reduced.
Thus, it is important to note that increasing the Position Error can significantly reduce the quality of the image.
Scale Error
When Anim. Compression is set to Keyframe Reduction or Optimal, a Scale Error item is available.
Scale Error allows you to set the upper limit of scale error allowed during animation compression.
The units are in percent (%).
The default value of 0.5 means that a maximum of 0.5% scale error is allowed.
This concludes the Scene Size Reduction Series (Animation).
Other articles in this series can be found at the following links
Special thanks:segur(せぎゅ)