Contents
Overview
By using the wind generation function, you can add wind to the cloth simulation and draw it more realistically.
This is controlled by placing a MagicaWindZone component in the scene that specifies the area within which the wind is generated.
You can also change the effect of the wind on the MagicaCloth component by adjusting the settings on the [Wind] panel.
Sample Scene
A sample scene is provided for the wind function.
These can be found in the following folders, select a scene in your render pipeline to test.
WindDemo.cs attached to WindDemo in this sample scene is the test code.
Note that the reason the scenes are separated for each pipeline is simply to switch rendering materials.
The sample code included inside is identical.
Wind zone settings
To generate wind, you need to specify its range in the scene.
We will use the MagicaWindZone component for this.
Note that Unity also has a WindZone component, but it does not affect MagicaCloth.
A dedicated MagicaWindZone component is required to give wind to MagicaCloth.
Components can be added from the right-click menu as follows:
Wind zones are divided into several types according to [Mode].
Since the setting items differ for each mode, we will explain these types next.
Global Direction
A directional wind that affects the entire scene.
No range.
Main | Wind speed (m/s) |
Turbulence | Wind turbulence rate |
Direction Angle X | Wind direction X angle (Deg) |
Direction Angle Y | Wind direction Y angle (Deg) |
Is Addition | Addition style flag |
Sphere Direction
A directional wind that affects a spherical area.
Radius | Area radius |
Main | Wind speed (m/s) |
Turbulence | Wind turbulence rate |
Direction Angle X | Wind direction X angle (Deg) |
Direction Angle Y | Wind direction Y angle (Deg) |
Is Addition | Addition style flag |
Box Direction
Directional winds that affect boxy areas.
Box Size | Range XYZ size |
Main | Wind speed (m/s) |
Turbulence | Wind turbulence rate |
Direction Angle X | Wind direction X angle (Deg) |
Direction Angle Y | Wind direction Y angle (Deg) |
Is Addition | Addition style flag |
Sphere Radial
A radial wind that affects a spherical area.
Radial wind is generated from the center of the area toward the outside.
Therefore, there is no direction specification.
It is also possible to specify the attenuation curve of the wind force from the center toward the outside with [Attenuation].
Radius | Area radius |
Main | Wind speed (m/s) |
Turbulence | Wind turbulence rate |
Attenuation | Attenuation curve |
Is Addition | Addition style flag |
Wind zone priority
If multiple wind zones overlap on the cloth component, only the one with the lowest volume will be active.
However, the only exception is the GlobalDirection zone, which is treated as volume ∞ and has the lowest priority.
This priority is excluded if the [IsAddition] flag described later is turned on.
IsAddition flag
If the [IsAddition] flag is turned on, the wind zone will be treated as additive.
The addition type ignores the priority processing of wind zones and can affect multiple at the same time.
In this case, the wind will be added instead of switching.
However, up to three additional winds can be applied to one cloth component.
MagicaCloth settings
Wind effects can also be adjusted per cloth component.
Use the Wind panel for this.
Influence | It is the influence rate of the whole wind. It is possible to weaken the wind received by lowering it overall. The value can also be set to 1.0 (100%) or higher. |
Frequency | period of shaking. You can adjust the speed of the shaking waveform. The value can also be set to 1.0 (100%) or higher. |
Turbulence | turbulence rate. You can adjust the size of the shaking disturbance. The value can also be set to 1.0 (100%) or higher. |
Noise Blend | Waveform blend ratio. You can adjust the blend ratio of the Sin waveform and Noise waveform. Sine waves and noise waves will be explained later. |
Synchronization | sync rate. You can adjust how in sync each baseline in the cloth moves. If you set it to 1.0, it will be the same movement, and if you set it to 0.0, it will move separately. |
Depth Weight | depth effect. By increasing the value, the vertices near the starting point are less affected by the wind. This is useful for stabilizing skirts, bangs, etc. |
Moving Wind | Moving wind effect. It is possible to automatically generate wind against the movement of the cloth. The larger the value, the stronger the wind effect when moving. |
Sine wave and noise wave
Two waveforms, sine waveform and noise waveform, are used for wind fluctuation.
The sine waveform has a constant cycle and can be used to create a scene from a Japanese animation.
However, the trade-off is the loss of randomness.
The Noise waveform has an irregular cycle and can create more natural and realistic movements.
These two waveforms can be mixed by [Noise Blend].
Moving wind
By increasing the [Moving Wind] parameter, you can automatically generate wind according to the movement of the character.
The force of the moving wind is affected by the inertia parameter.
In other words, if the influence of movement is suppressed by the inertia parameter, the influence of moving wind will be reduced accordingly.
Tuning tips
- The wind speed in the wind zone can be set up to 30m/s, but be careful as too strong winds are likely to cause tunneling problems during collision detection.
- If you want to reduce the wind effect of a specific cloth component, try adjusting Influence
- If you don’t want your waist to sway too much with a skirt, try increasing the DepthWeight.
- If you want hair to sway irregularly, try lowering Synchronization.
- If you want to adjust the randomness of the shaking, try adjusting Synchronization in addition to NoiseBlend.
- Moving wind is affected by inertia parameter reduction
- For blast, it is effective to set the mode to SphereRadial and set the IsAddition flag to On.