Culling System

 

overview

By using the culling system, it is possible to stop the cloth simulation of characters that are not drawn on the camera.
This can greatly improve performance, especially in first-person FPS and VR.

The next image shows a visualization of camera culling.
There are many characters in the field, but the cloth simulation is actually performed only on the bright objects drawn on the camera.

 

Setting Culling Mode

MagicaCloth allows you to set whether or not culling is applied to each cloth component.
And there are several types of culling process.
This mode can be set from the <Culling> item in the Cloth inspector.

The details of each culling mode are as follows

Culling Mode Description
OFF No culling is performed.
The simulation will always run regardless of the drawing state.
Reset If it is off-screen, stop the simulation.
When it appears again, it resets the simulation.
(Default setting)
Pause If it is off-screen, it stops the simulation.
When it reappears, it will restart the simulation from the stopped state.

 

Interaction with character animation

A character is usually animated by an Animator or Animation component.
Animator/Animation implements a culling system as well, which looks like this

Animator

Always Animate No culling is performed.
The animation will always run.
Cull Update Transforms The animation runs off-screen, but it is not reflected in Transform.
In other words, the internal animation is running, but the posture is paused in a special state.
Cull Completely The animation pauses when off-screen.
While paused, the animation will not be updated.
When it is displayed again, it will resume from the paused state.

Animation

Always Animate No culling is performed.
The animation will always run.
Based On Renderers This is the same as Animator’s “Cull Update Transforms”.
The animation runs off-screen, but it is not reflected in Transform.
In other words, the internal animation is running, but the posture is paused in a special state.

For this reason, it is recommended to match these animation culling with MagicaCloth culling mode.
This will ensure that the stop/resume of the simulation is nicely synchronized with the animation.
The recommended MagicaCloth culling mode for each animation cull is as follows

Animator

Animation Culling Recommended MagicaCloth culling mode Description
Always Animate OFF Always run it.
Cull Update Transforms Reset When restarting, the Transform is reset to an arbitrary posture, so the simulation is reset as well.
Cull Completely Pause When the simulation is restarted, it will continue from the stopped state, so the simulation will also be restarted from the paused state.

Animation

Animation Culling Recommended MagicaCloth culling mode Description
Always Animate OFF Always run it.
Based On Renderers Reset When restarting, the Transform is reset to an arbitrary posture, so the simulation is reset as well.

Basically, you can use the above mode settings for the Animator/Animation culling settings.

 

Renderer for culling determination

Whether or not the cloth component is drawn on the camera is judged from the drawing status of the Renderer(Mesh).
Therefore, it is necessary to register the Renderer for culling judgment to the cloth component in advance.
Please note that the culling function will not be enabled if it is not registered.
This step is required only for BoneCloth/BoneSpring.
In MeshCloth/MeshSpring, this setting is not necessary because it is automatically determined from the connected RenderDeformer.

First of all, a renderer is a Unity component that is required to draw a mesh as shown below.
Whenever you want to display something on the screen, there is always a renderer component.

In BoneCloth/BoneSpring, you need to register the corresponding renderer in the “Cull Renderer List” as follows.

To make these registrations easier, you can use “Auto Select” for automatic registration.
“Auto Select” will select all the renderers connected to the bones registered in the RootList.
Therefore, when using this button, please register the necessary bones in the “Root List” before executing it.

This completes the culling mode setup.

 

Checking the culling status

You can check the visibility and execution status of the cloth component from the inspector.
Visible is the visible state, and Calculation is the execution state.
If the simulation is excluded, Calculation will be set to False.

You can also check the overall execution status from the Cloth Monitor.
In the Cloth Monitor, you can see the total number of components that are running.

 

Points to note

Notes on running the editor

Note that when running in the Unity editor, the Scene view of the editor will also be subject to camera culling.
For example, if a character is not visible in the Game View but is visible in the Scene View, it will be drawn and no camera culling will be applied.

Shadow effects

Your character’s shadow is also subject to culling.
Note that even if the character itself is not visible, if its shadow is visible on the screen, it will not be culled.

About Animator’s culling problem

If you set Animator culling to something other than Always, you may see a pose with simulation disabled for a moment when your character reappears on screen.
This is because the Animator’s culling is determined during the rendering process, and the pose is written to the transform and overwritten on the fly.
This is a specification of Unity and unfortunately cannot be avoided.