Skip to content

VFXWeather ​

Inherits: VFXLoop < VFX < Node3D

Weather VFX - Continuous environmental effects like rain, snow, fog Supports shader global control for wind direction and intensity Designed to be attached to the camera for consistent visibility

Properties ​

floatintensity1.0:

Variables ​

Vector3wind_directionVector3.ZERO : set = set_wind_direction
floatwind_intensity0.0 : set = set_wind_intensity
boolhas_set_shader_globalsfalse

Methods ​

floatdefault_fade_in()
floatdefault_fade_out()
voidactivate_vfx( selection: VFXSelection = null )
voiddeactivate_vfx()
voidset_intensity( value: float, seconds: float = 0.0 )
floatlayer_ratio( intensity_value: float, start: float, full: float ) static
boolhas_uniform( material: ShaderMaterial, uniform_name: String ) static
voidset_wind_direction( new_direction: Vector3 )
voidset_wind_intensity( new_intensity: float )
voidtransition_wind_direction( new_direction: Vector3, duration: float = 2.0 )
voidtransition_wind_intensity( new_intensity: float, duration: float = 2.0 )
voidtransition_wind( new_direction: Vector3, new_intensity: float, duration: float = 2.0 )
voidattach_to_camera( camera_controller: CameraController )
boolis_attached_to_camera()
CameraControllerget_attached_camera()
Dictionaryget_wind_data()
voidset_wind_data( data: Dictionary )

Property descriptions ​

Weather

float intensity = 1.0: ​

How strong the weather is (0 to 1): design the effect at 1 (its heaviest) and lower this to thin it out. Move the slider in the editor to see the effect at that intensity. Every particle node of the effect has a range of intensity it comes in over, set as node metadata (Inspector > Metadata): intensity_start (below it the layer emits nothing, default 0) and intensity_full (from it the layer is at full strength, default 1). In between the layer emits that part of its particles (its amount ratio, raised to 1.5). A layer with no metadata follows the intensity from 0 to 1. A sub emitter (a splash, metadata weather_sub_emitter) is left alone: it follows the particles that make it. The weather system sets this at run time from the Weather config

Variable descriptions ​

Vector3 wind_direction = Vector3.ZERO : set = set_wind_direction ​

Wind direction (Vector3 normalized direction vector)

float wind_intensity = 0.0 : set = set_wind_intensity ​

Wind intensity (float 0.0 to 1.0)

bool has_set_shader_globals = false ​

Track if we've set the shader globals (for cleanup)

Method descriptions ​

float default_fade_in() ​

A weather comes and goes by its intensity (set_intensity over time), not by a fade

float default_fade_out() ​

A loop with an end animation fades out over that animation (both end together), without one over 0.35 s (from VFXLoop)

void activate_vfx( selection: VFXSelection = null ) ​

Weather VFX should NOT auto-cleanup (manual control for persistent weather)

void deactivate_vfx() ​

Override deactivation to clean up shader globals

void set_intensity( value: float, seconds: float = 0.0 ) ​

Sets how strong the weather is, at once or easing over seconds

float layer_ratio( intensity_value: float, start: float, full: float ) ​

How much of its particles a layer emits at an intensity: 0 below its start, 1 from its full, and in between the part of the way to full raised to 1.5 (a light weather looks light: half way is a third of the particles, not half)

bool has_uniform( material: ShaderMaterial, uniform_name: String ) ​

Does a shader material have a uniform of this name?

void set_wind_direction( new_direction: Vector3 ) ​

Set wind direction and update shader global

void set_wind_intensity( new_intensity: float ) ​

Set wind intensity and update shader global

void transition_wind_direction( new_direction: Vector3, duration: float = 2.0 ) ​

Smoothly transition to new wind direction over time

void transition_wind_intensity( new_intensity: float, duration: float = 2.0 ) ​

Smoothly transition to new wind intensity over time

void transition_wind( new_direction: Vector3, new_intensity: float, duration: float = 2.0 ) ​

Transition both wind properties simultaneously

void attach_to_camera( camera_controller: CameraController ) ​

Attach weather VFX to camera via RemoteTransform3D

bool is_attached_to_camera() ​

Check if weather is attached to camera

CameraController get_attached_camera() ​

Get the camera controller this weather is attached to

Dictionary get_wind_data() ​

Get current wind data as dictionary (useful for saving/loading)

void set_wind_data( data: Dictionary ) ​

Set wind data from dictionary (useful for saving/loading)