Performance When Working With Models in the SDK
Updated: 06/28/2024
Performance
Update rate
When displaying models on the SDK, performance may be degraded depending on the order in which ArtMeshes are drawn.
Cubism models are drawn one ArtMesh at a time from the back (canvas side).
As you draw an ArtMesh on the screen, if its blend mode differs from that of the ArtMesh drawn immediately before it, performance on the SDK will be degraded.
Settings where switching will degrade performance are as follows.
- Texture used by the ArtMesh to be drawn
- Blend mode (normal, additive, multiply) of the ArtMesh to be drawn
- Whether the ArtMesh to be drawn is clipped or not
These factors will affect each other.
Clipping switches settings even if the texture, blend mode, and ArtMesh that serves as the mask are the same.
For example, suppose a model with two textures and some ArtMeshes is placed in the following order from the back.
[Name] | [ID] | [Draw settings] | [Switchover occurs] |
Right eyelash | ArtMesh6 | Texture: 2nd sheet | ○ |
Right eyebrow | ArtMesh7 | ○ | |
Right cheek | ArtMesh8 | Blend mode: Multiply | ○ |
Right highlight | ArtMesh9 | Clipping: Right white eye, blend mode: Additive | ○ |
Right pupil | ArtMesh10 | Clipping: Right white eye | ○ |
Right white eye | ArtMesh11 | ○ | |
Left eyelash | ArtMesh16 | Texture: 2nd sheet | ○ |
Left eyebrow | ArtMesh17 | Blend mode: Multiply | ○ |
Left cheek | ArtMesh18 | ○ | |
Left highlight | ArtMesh19 | Clipping: Left white eye, blend mode: Additive | ○ |
Left pupil | ArtMesh20 | Clipping: Left white eye | ○ |
Left white eye | ArtMesh21 |
These ArtMeshes are drawn in order from the bottom of the table.
When lined up like this, the draw settings are counted from the bottom of the table and a changeover occurs eleven times.
If this draw order is rearranged as follows, the number of times the draw setting is switched is reduced to seven times.
[Name] | [ID] | [Draw settings] | [Switchover occurs] |
Right eyebrow | ArtMesh6 | Texture: 2nd sheet | |
Left eyebrow | ArtMesh16 | Texture: 2nd sheet | ○ |
Right cheek | ArtMesh7 | Blend mode: Multiply | |
Left cheek | ArtMesh17 | Blend mode: Multiply | ○ |
Right eyelash | ArtMesh8 | ||
Left eyelash | ArtMesh18 | ○ | |
Right highlight | ArtMesh9 | Clipping: Right white eye, blend mode: Additive | ○ |
Left highlight | ArtMesh19 | Clipping: Left white eye, blend mode: Additive | ○ |
Right pupil | ArtMesh10 | Clipping: Right white eye | ○ |
Left pupil | ArtMesh29 | Clipping: Left white eye | ○ |
Right white eye | ArtMesh11 | ||
Left white eye | ArtMesh21 |
The order and switching status of ArtMeshes can be checked in Cubism Viewer for OW.
If you set up a deformation in which the draw order changes depending on the parameters, it becomes difficult to predict the number of times it will switch.
Also, be careful not to use too many of the following objects or too many settings for each status, as it will affect performance of the SDK.
- Number of ArtMeshes
- Number of polygons
- Number of deformers
- Division number of deformer conversion
- Number of deformer parent-child hierarchies
- Number of parameters set for one object (ArtMesh, deformer)
Of these, number 6 has a particularly large impact, and it is typically recommended that up to two settings be used.
This is because the amount of blending computation between the keyforms of the parameters increases with multiplication.
Reference: Keyforms (Parent-Child Hierarchy Movement)
For example, if two parameters are set for one ArtMesh, a blend calculation is performed for each parameter, and then the results of each calculation are further blended together.
Therefore, the more parameters set, the more blending calculations are required.
When the number of parameter multiplications is large, you can greatly reduce the computational cost by replacing these multiplications with the Bend Shape function, which adds the differences to the model shape.
In addition, if the ArtMesh or deformer falls outside the range of the parent warp deformer, performance is reduced due to the increased processing load.
For more information on points to keep in mind when building parent-child hierarchies, see the Combination of Parent-Child Hierarchy page below.
Combination of Parent-Child Hierarchy
Initialization speed
Extended interpolation is a function that curvilinearly interpolates linear interpolation of parameters, and, in actuality, automatically generates a specified number of keyforms for extended interpolation between keyforms.
Therefore, when extended interpolation is set on an object with multiple parameters, the size of the model file increases proportionally because the keyforms added by extended interpolation are multiplied with each other.
Please note that when dealing with extended interpolation in the SDK, there is little effect on performance during execution, but there is a slowdown when loading the model.
Resolution
If the mesh of the mask occupies a large area of the displayed screen, the resolution of the mask on the screen will be reduced and fine expression may be lost.
This occurs when a mask created at a smaller size than its actual size is enlarged to a larger size, because the resolution of the texture that generates the mask does not change.
To avoid this, avoid using large masks.