From 95665f54eb0dead1a528c46baa6e0bcd66571b5c Mon Sep 17 00:00:00 2001 From: Dan Baker Date: Tue, 24 Jun 2025 09:19:11 +0100 Subject: [PATCH] Makes wind uniforms global Changes wind-related shader uniforms to be global. This allows easier access and modification of these parameters from other shaders or scripts, improving the wind effect consistency across the scene. --- grass.gdshader | 8 ++++---- project.godot | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/grass.gdshader b/grass.gdshader index 433d77b..11e584b 100644 --- a/grass.gdshader +++ b/grass.gdshader @@ -9,11 +9,11 @@ uniform float specular_strength: hint_range(0.0, 1.0, 0.01) = 0.4; uniform float player_displacement_strength: hint_range(0.0, 1.0, 0.01) = 0.4; uniform float player_displacement_size: hint_range(0.0, 2.0, 0.01) = 1.0; -uniform vec3 wind_direction; // Use a negative y component to give it an extra touch (For displacement effect and noise scroll direction) -uniform float wind_strength: hint_range(0.0, 1.0, 0.01) = 0.3; +global uniform vec3 wind_direction; // Use a negative y component to give it an extra touch (For displacement effect and noise scroll direction) +global uniform float wind_strength; uniform sampler2D wind_noise; // Periln FBM Noise looks Best -uniform float wind_noise_size: hint_range(0.0, 1.0, 0.001) = 0.05; // high values dont work well -uniform float wind_noise_speed: hint_range(0.0, 1.0, 0.001) = 0.1; +global uniform float wind_noise_size; // high values dont work well +global uniform float wind_noise_speed; // Instance the Player Position through a GDScript in the _physics_process instance uniform vec3 player_position; diff --git a/project.godot b/project.godot index 531232d..08935bf 100644 --- a/project.godot +++ b/project.godot @@ -56,3 +56,22 @@ jump={ "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null) ] } + +[shader_globals] + +wind_direction={ +"type": "vec3", +"value": Vector3(5, 1, 5) +} +wind_noise_size={ +"type": "float", +"value": 0.1 +} +wind_noise_speed={ +"type": "float", +"value": 0.2 +} +wind_strength={ +"type": "float", +"value": 7.0 +}