Game.Rendering.WindVolumeComponent
Assembly: Assembly-CSharp.dll
Namespace: Game.Rendering
Type: class
Base: UnityEngine.Rendering.VolumeComponent
Summary:
A VolumeComponent that exposes a set of wind-related parameters used by the rendering system to drive vegetation (grass and trees) wind animation. Parameters control global wind strength, direction and per-feature (grass / tree) base, gust and flutter behavior. All numeric fields are Volume parameters (ClampedFloatParameter or AnimationCurveParameter) so they integrate with Unity's Volume framework (blending / interpolation, overrides in VolumeProfile/Volume) and are editable in the inspector when the component is present in a VolumeProfile.
Fields
-
public ClampedFloatParameter windGlobalStrengthScale = new ClampedFloatParameter(1f, 0f, 3f)
Global multiplier for wind strength affecting vegetation. Default 1. Range [0, 3]. Can be blended by Volume system. -
public ClampedFloatParameter windGlobalStrengthScale2 = new ClampedFloatParameter(1f, 0f, 3f)
Second global multiplier (likely used for a secondary wind layer or an alternate strength channel). Default 1. Range [0, 3]. -
public ClampedFloatParameter windDirection = new ClampedFloatParameter(65f, 0f, 360f)
Main wind direction in degrees. Default 65°. Range [0, 360]. -
public ClampedFloatParameter windDirectionVariance = new ClampedFloatParameter(25f, 0f, 90f)
Max variance applied to the wind direction to introduce natural variation. Default 25°. Range [0, 90]. -
public ClampedFloatParameter windDirectionVariancePeriod = new ClampedFloatParameter(15f, 0.01f, 20f)
Period (in seconds) over which wind direction variance evolves. Default 15s. Range [0.01, 20]. -
public ClampedFloatParameter windParameterInterpolationDuration = new ClampedFloatParameter(0.5f, 0.0001f, 5f)
Duration used when interpolating parameter changes (smoothing transitions). Default 0.5s. Range [0.0001, 5].
[Header("Grass Base")]
- public ClampedFloatParameter windBaseStrength = new ClampedFloatParameter(15f, 0f, 75f)
Base bending strength for grass. Default 15. Range [0, 75].
-
public ClampedFloatParameter windBaseStrengthOffset = new ClampedFloatParameter(0.25f, 0f, 3f)
Offset / multiplier applied to base strength (used to tune shape). Default 0.25. Range [0, 3]. -
public ClampedFloatParameter windBaseStrengthPhase = new ClampedFloatParameter(3f, 0f, 10f)
Phase / frequency for the base grass motion. Default 3. Range [0, 10]. -
public ClampedFloatParameter windBaseStrengthPhase2 = new ClampedFloatParameter(0f, 0f, 10f)
Secondary phase component for grass base motion. Default 0. Range [0, 10]. -
public ClampedFloatParameter windBaseStrengthVariancePeriod = new ClampedFloatParameter(10f, 0.01f, 20f)
Period controlling variance in grass base strength. Default 10s. Range [0.01, 20].
[Header("Grass Gust")]
- public ClampedFloatParameter windGustStrength = new ClampedFloatParameter(25f, 0f, 75f)
Strength of gusts affecting grass. Default 25. Range [0, 75].
-
public ClampedFloatParameter windGustStrengthOffset = new ClampedFloatParameter(1f, 0f, 5f)
Offset/multiplier applied to gust strength. Default 1. Range [0, 5]. -
public ClampedFloatParameter windGustStrengthPhase = new ClampedFloatParameter(3f, 0f, 10f)
Phase/frequency for gusts (grass). Default 3. Range [0, 10]. -
public ClampedFloatParameter windGustStrengthPhase2 = new ClampedFloatParameter(3f, 0f, 10f)
Secondary gust phase for grass. Default 3. Range [0, 10]. -
public ClampedFloatParameter windGustStrengthVariancePeriod = new ClampedFloatParameter(2f, 0.01f, 10f)
Variance period for grass gusts. Default 2s. Range [0.01, 10]. -
public ClampedFloatParameter windGustInnerCosScale = new ClampedFloatParameter(2f, 0f, 5f)
Cosine scale used to shape gust falloff/inner region. Default 2. Range [0, 5]. -
public AnimationCurveParameter windGustStrengthControl = new AnimationCurveParameter(new AnimationCurve(new Keyframe(0f, 1f), new Keyframe(10f, 1f)))
Animation curve used to modulate gust strength (for example over wind speed or time). Default is a flat curve at value 1 between 0 and 10.
[Header("Grass Flutter")]
- public ClampedFloatParameter windFlutterStrength = new ClampedFloatParameter(0.4f, 0f, 10f)
Strength of fine flutter motion for grass (small, high-frequency movement). Default 0.4. Range [0, 10].
-
public ClampedFloatParameter windFlutterGustStrength = new ClampedFloatParameter(0.2f, 0f, 10f)
Additional flutter amplitude during gusts. Default 0.2. Range [0, 10]. -
public ClampedFloatParameter windFlutterGustStrengthOffset = new ClampedFloatParameter(50f, 0f, 75f)
Offset/scale applied to flutter gusts. Default 50. Range [0, 75]. -
public ClampedFloatParameter windFlutterGustStrengthScale = new ClampedFloatParameter(75f, 0f, 75f)
Scale of flutter gust strength. Default 75. Range [0, 75]. -
public ClampedFloatParameter windFlutterGustVariancePeriod = new ClampedFloatParameter(0.25f, 0.01f, 2f)
Variance period for flutter gusts. Default 0.25s. Range [0.01, 2].
[Header("Tree Base")]
- public ClampedFloatParameter windTreeBaseStrength = new ClampedFloatParameter(0.25f, 0f, 10f)
Base bending/motion strength for trees. Default 0.25. Range [0, 10].
-
public ClampedFloatParameter windTreeBaseStrengthOffset = new ClampedFloatParameter(1f, 0f, 5f)
Offset for tree base strength. Default 1. Range [0, 5]. -
public ClampedFloatParameter windTreeBaseStrengthPhase = new ClampedFloatParameter(0.5f, 0f, 2f)
Base phase/frequency for tree motion. Default 0.5. Range [0, 2]. -
public ClampedFloatParameter windTreeBaseStrengthPhase2 = new ClampedFloatParameter(0f, 0f, 2f)
Secondary base phase for trees. Default 0. Range [0, 2]. -
public ClampedFloatParameter windTreeBaseStrengthVariancePeriod = new ClampedFloatParameter(6f, 0.01f, 20f)
Variance period controlling tree base strength. Default 6s. Range [0.01, 20].
[Header("Tree Gust")]
- public ClampedFloatParameter windTreeGustStrength = new ClampedFloatParameter(1f, 0f, 10f)
Gust strength for trees. Default 1. Range [0, 10].
-
public ClampedFloatParameter windTreeGustStrengthOffset = new ClampedFloatParameter(1f, 0f, 5f)
Offset for tree gusts. Default 1. Range [0, 5]. -
public ClampedFloatParameter windTreeGustStrengthPhase = new ClampedFloatParameter(2f, 0f, 10f)
Gust phase for trees. Default 2. Range [0, 10]. -
public ClampedFloatParameter windTreeGustStrengthPhase2 = new ClampedFloatParameter(3f, 0f, 10f)
Secondary gust phase for trees. Default 3. Range [0, 10]. -
public ClampedFloatParameter windTreeGustStrengthVariancePeriod = new ClampedFloatParameter(4f, 0.01f, 10f)
Variance period for tree gusts. Default 4s. Range [0.01, 10]. -
public ClampedFloatParameter windTreeGustInnerCosScale = new ClampedFloatParameter(2f, 0f, 5f)
Inner cosine scale for tree gust shaping. Default 2. Range [0, 5]. -
public AnimationCurveParameter windTreeGustStrengthControl = new AnimationCurveParameter(new AnimationCurve(new Keyframe(0f, 1f), new Keyframe(10f, 1f)))
Curve to control tree gust strength (similar role to grass gust curve). Default flat.
[Header("Tree Flutter")]
- public ClampedFloatParameter windTreeFlutterStrength = new ClampedFloatParameter(0.1f, 0f, 5f)
Flutter strength for trees (small twigs/leaves). Default 0.1. Range [0, 5].
-
public ClampedFloatParameter windTreeFlutterGustStrength = new ClampedFloatParameter(0.5f, 0f, 5f)
Additional flutter strength during tree gusts. Default 0.5. Range [0, 5]. -
public ClampedFloatParameter windTreeFlutterGustStrengthOffset = new ClampedFloatParameter(12.5f, 0f, 75f)
Offset for tree flutter gusts. Default 12.5. Range [0, 75]. -
public ClampedFloatParameter windTreeFlutterGustStrengthScale = new ClampedFloatParameter(25f, 0f, 75f)
Scale for tree flutter gusts. Default 25. Range [0, 75]. -
public ClampedFloatParameter windTreeFlutterGustVariancePeriod = new ClampedFloatParameter(0.1f, 0.01f, 2f)
Variance period for tree flutter gusts. Default 0.1s. Range [0.01, 2].
Properties
- (None declared)
This component exposes only public VolumeParameter fields. To get/set values at runtime, use the.value
property on the parameter instances (e.g., windComponent.windGlobalStrengthScale.value = 2f).
Constructors
public WindVolumeComponent()
Default constructor. Instances are normally created and managed by Unity's Volume/VolumeProfile system (added to a VolumeProfile in the editor or at runtime).
Methods
- (None declared)
All behavior is data-driven through the exposed parameters. The actual evaluation and application of these parameters to vegetation shaders/systems is handled elsewhere in the rendering code.
Usage Example
// Example: find a Volume in the scene and modify the WindVolumeComponent
using UnityEngine;
using UnityEngine.Rendering;
using Game.Rendering;
public class WindTweaker : MonoBehaviour
{
void Start()
{
var volume = FindObjectOfType<Volume>();
if (volume == null || volume.profile == null) return;
// Try get existing WindVolumeComponent
if (!volume.profile.TryGet<WindVolumeComponent>(out var wind))
{
// If not present, add it to the profile
wind = volume.profile.Add<WindVolumeComponent>(true);
}
// Set values at runtime (these updates are blended by the Volume system)
wind.windGlobalStrengthScale.value = 1.5f;
wind.windDirection.value = 180f;
wind.windGustStrength.value = 30f;
// Replace the gust control curve
wind.windGustStrengthControl.value = new AnimationCurve(
new Keyframe(0f, 0.5f),
new Keyframe(10f, 1.5f)
);
}
}
Notes and tips: - Because parameters are VolumeParameters, changing their .value will participate in Volume overrides and blending. For instantaneous changes you can adjust windParameterInterpolationDuration to control smoothing. - Expose different VolumeProfiles in scenes or use weighted Volumes to transition wind behaviour across areas of the city. - The AnimationCurveParameters are useful to map a driving quantity (for example wind speed or gust intensity) to a multiplier used in shaders or vegetation logic; the exact input domain expected by the curve depends on the rendering system that samples it.