fix wind!
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
shader_type canvas_item;
|
||||
|
||||
uniform sampler2D screen_texture : hint_screen_texture, filter_linear_mipmap;
|
||||
global uniform float global_wind_speed;
|
||||
|
||||
uniform vec4 dust_color : source_color = vec4(1.0, 0.456, 0.125, 0.6);
|
||||
|
||||
//Wind -> negative x = to the left. positive y = to the bottom
|
||||
uniform vec2 wind_velocity = vec2(-0.2, 0.05);
|
||||
uniform vec2 wind_speed = vec2(-0.2, 0.05);
|
||||
uniform float wind_oscillation : hint_range(0.0, 1.0) = 0.3;
|
||||
uniform float dust_speed : hint_range(0.01, 1.0) = 0.15;
|
||||
|
||||
@@ -28,12 +28,13 @@ vec3 hash33(vec3 p3) {
|
||||
void fragment() {
|
||||
vec4 scene_color = texture(screen_texture, SCREEN_UV);
|
||||
float base_time = TIME * dust_speed;
|
||||
|
||||
|
||||
vec2 osc = vec2(sin(TIME * 0.5), cos(TIME * 0.3)) * wind_oscillation;
|
||||
vec2 final_wind = (wind_velocity + osc) * dust_speed;
|
||||
float wind_active = step(0.0001, abs(global_wind_speed));
|
||||
vec2 final_wind = ((wind_speed + osc) * dust_speed) * wind_active;
|
||||
|
||||
float final_particle_alpha = 0.0;
|
||||
|
||||
|
||||
//Thresolds (near, medium, far)
|
||||
vec3 layer_scales = vec3(20.0, 50.0, 100.0) / dust_density;
|
||||
vec3 layer_thresholds = vec3(0.96, 0.98, 0.99);
|
||||
@@ -70,4 +71,4 @@ void fragment() {
|
||||
vec4 dust_colored_particle = dust_color * final_particle_alpha;
|
||||
|
||||
COLOR = scene_color + dust_colored_particle;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user