Wind Manager
Overview
The Zephyr Wind Manager (ZephyrWind) is the central controller for the Zephyr wind simulation system.
It manages global wind direction, strength, gusts, flutter, and localized wind zones, synchronizing all parameters to shaders and connected components in real time.
This manager acts as a singleton — only one instance should exist in a scene at a time. All wind-aware shaders and systems reference this global instance to produce cohesive, physically consistent wind behavior.
Key Responsibilities
Defines global wind direction and strength, transitioning smoothly toward target values.
Simulates gusts and flutter using procedural noise textures.
Manages local wind zones (
ZephyrWindZone) via an internal octree system for efficient lookup.Sends all active wind data to the GPU for use in shaders.
Provides CPU-side sampling of wind at any position in the scene.
Offers debug visualization in the Scene view.
Internal Wind Simulation
Zephyr continuously updates wind simulation both in Play Mode and Edit Mode.
Direction and Strength Interpolation
Wind direction and strength smoothly interpolate toward target values using the Wind Acceleration Coefficient. This ensures natural transitions when the environment or gameplay logic changes wind settings.
Gusting and Flutter
Gusts and flutter are derived from a scrolling noise texture. Offsets advance each frame based on their respective speed and scale, producing a dynamic, looping pattern of turbulence.
Wind Zones
Wind zones (ZephyrWindZone) are managed through a Point Octree for fast spatial querying.
Only zones within the Wind Zone Search Radius are evaluated, up to the limit defined by Max Wind Zones.
Best Practices
Use a single ZephyrWind per scene.
Adjust
TargetWindStrengthandTargetDirectionthrough scripts for natural environmental changes (e.g., storms, seasons).Limit
Max Wind Zonesto 8–16 for performance balance.Always assign a wind noise texture.
Variables
Direction Source
TransformForward / GlobalVector / LocalVector
Defines how the global wind direction is determined.
Target Wind Strength
float
Target wind intensity (recommended range: 0–5).
Wind Acceleration Coefficient
float
Determines how quickly the wind adjusts to new targets.
Gust Strength
float
Scales the strength of gusts relative to base wind.
Gust Scale
float
Controls the scale of the gust noise texture. Larger values = broader gust patterns.
Gust Speed
float
Controls how quickly gust patterns move through the scene.
Gust Pullback
float (0–1)
Determines how gust troughs can “pull back” against the main wind for chaotic motion.
Wind Noise Texture
Texture2D
Procedural noise used for gusting and flutter simulation.
Flutter Strength
float
Adds small perpendicular motion to simulate curling or turbulent wind.
Flutter Scale
float
Scale of the flutter noise pattern.
Flutter Speed
float
Speed of the flutter texture scroll.
Max Wind Zones
int
Maximum number of active wind zones considered per frame.
Wind Zone Search Radius
float
World radius used to gather nearby wind zones relative to the camera.
Properties
Direction
Vector3
The current wind direction. To transition smoothly, set TargetDirection instead.
TargetDirection
Vector3
The target direction the wind should gradually turn toward.
WindStrength
float
The current base wind intensity.
Instance
ZephyrWind
Global singleton reference to the active wind manager.
GPU Integration
Zephyr synchronizes all wind parameters to shaders each frame through global shader variables:
_WindDirection
Current global wind direction
_BaseWindStrength
Current global wind magnitude
_GustStrength, _GustScale, _GustSpeed, _GustPullback
Gusting parameters
_WindNoiseTexture
Noise map used for gust and flutter sampling
_FlutterStrength, _FlutterScale, _FlutterSpeed
Flutter parameters
_WindZones
Structured buffer of active wind zone data
Developers can read these in custom shaders to achieve synchronized wind movement across trees, grass, cloth, or particles. For more details, see the Shaders integration guide.
Example: Accessing Wind from Script
Last updated
