This article is in the Scene Capacity Reduction Series Model section.
Other articles can be found at the links below.
Scene Capacity Reduction Series
Check Project Settings
First, let’s look at Vertex Compression in Project Settings.
Vertex Compression
In Project Settings > Player > Other Settings > Optimization, you will find an item called Vertex Compression.
This is a vertex compression setting that affects all meshes in the project (it is used at build time and does not affect the original mesh file). (It is only used at build time and does not affect the original mesh file.)
This does not reduce the number of vertices, but rather the accuracy (number of digits of coordinate values) of each vertex’s data such as position and UV.
The following items can be checked to reduce the size by half, but the accuracy will also be reduced.
Item name | Initial value | Description |
None | 🔲 | No compression. |
Everything | 🔲 | Compress all of the following |
Position | 🔲 | Position. Compression can have a significant impact on appearance. |
Normal | ✅ | Normal vector |
Tangent | ✅ | tangent (in trigonometry) |
Color | 🔲 | Color (I mean vertex color, not texture) |
Tex Coord 0 | ✅ | The main UV, typically used for color textures and normal maps. |
Tex Coord 1 | 🔲 | Sub UV, so called UV2, generally used for lightmaps. |
Tex Coord 2, 3 | ✅ | Spare UV |
Checked items reduce the precision from FP32 to FP16.
This is a tradeoff between appearance and performance, as the capacity can be cut in half, but the accuracy is also slightly worse.
Difference between FP32 and FP16
Both FP32 and FP16 are data formats that allow computers to represent real (floating) numbers.
The differences are as follows.
Data Format | Capacity | Expression range |
FP32 | 32bit | 1.4 x 10^{-45} ~ 3.4 x 10^{38} |
FP16 | 16bit | 5.96 x 10^{-8} ~ 65504 |
Note that Vertex Compression does not work on skin meshes.
A skin mesh is a mesh that deforms in conjunction with moving bones, such as an avatar.
Review model settings
Next, review the settings for each model.
When you select a model file, such as an FBX, the following settings appear in the Inspector window.
These setting items are only used at build time and do not affect the original model file when changed.
In this issue, we will introduce some of these items that may be effective in reducing space.
Import BlendShapes
Import BlendShapes is the setting for whether or not blendshapes are imported.
Models that do not use blendshapes can save space by turning it off.
What are blendshapes?
Blendshapes are a technique for animating mesh vertices by moving them.
It is often used to control a character’s facial expressions and mouth.
The following illustration shows how blendshapes change the shape of a mouth.
From left to right, the a i u e o blendshapes are applied.
Mesh Compression
Mesh Compression is a setting that determines the compression level for each mesh.
Mesh Compression, which is an individual setting for each mesh, takes precedence over Vertex Compression, which is a common setting for the entire project.
The following options are available.
Value | Capacity | Quality | Position Compression Ratio | Normal Compression Ratio | Tangent Compression Ratio | UV compression ratio |
Color Compression |
Off | Maximum | Highest | 1.0 | 1.0 | 1.0 | 1.0 | 1.0 |
Low | Large | High | 1.6 | 4.6 | 4.4 | 2.0 | 1.0 |
Medium | Medium | Medium | 2.9 | 5.6 | 5.3 | 3.2 | 1.3 |
High | Small | Low | 3.2 | 7.4 | 6.7 | 4.0 | 2.0 |
- None
- Medium
- High
reproduction in graphic form: Reducing build sizes in Unity3D
As shown in the figure above, the higher the value, the smaller the capacity, but the lower the quality, so there is a tradeoff between appearance and performance.
Legacy Blend Shape Normals
Legacy Blend Shape Normals is a setting related to blend shape normals.
Turning it ON applies the old normal calculation method, and turning it OFF applies the new method (Blend Shape Normals).
As the name “Legacy” suggests, this is a setting item to enable the old method, so it is better to turn it OFF unless you have a strong preference.
Instead, set Blend Shape Normals properly, which is explained in the next section.
Blend Shape Normals
Blend Shape Normals is a setting related to the normals of the blend shape.
It can be set by turning off Legacy Blend Shape Normals.
Value | Capacity | Function |
Import | Large | Use the normals for each blendshape owned by the model. Select this option if you want to use the normals created by the modeling software as they are. |
Calculate | Large | Unity automatically calculates the normals for each blendshape. Specifically, they are calculated according to the Normals Mode Smoothness Source Smoothing Angle value. This is a more sophisticated algorithm than Legacy Blend Shape Normals. |
None | Small | Does not use normals for each blendshape. Use a common normal for all blendshapes. |
For models that do not use blendshapes, choose None to reduce capacity.
If you decide that it is acceptable to use a common normal for all blendshapes, you can still choose None to save space.
What you can do outside of Unity
We have introduced Unity’s configuration items so far, but they tend to be large and limited in their ability to deal with the problem.
If you can use modeling tools such as Blender, you may be able to reduce the capacity by the following methods.
Delete unnecessary data
Assets sold in stores and elsewhere contain a great deal of data that can be used for a variety of purposes. They are as follows.
- Mesh
- Normal
- Tangent
- UV
- Vertex Color
- Bone
- Skin weight
- Blend Shapes
It is often not the case that all of the above data is necessary for the Unity scene you are creating.
Unnecessary data can be deleted before importing into Unity to save space.
Reduce the number of vertices
One method that has not been mentioned so far, but is very effective in reducing the amount of space required, is vertex count reduction.
For meshes with more vertices than necessary, it is recommended to reduce the vertex count.
However, the risk of appearance corruption is high and requires careful consideration and advanced knowledge, so make a backup of the model before reduction.
reproduction in graphic form【Blender3.1】面/頂点を削減:デシメートモディファイアー
This concludes the Scene Capacity Reduction Series (Models).
Other articles in the same series can be found at the following links
Special thanks:segur(せぎゅ)