create weather controller and daynight controller
This commit is contained in:
40
core/daynight/fog.gdshader
Normal file
40
core/daynight/fog.gdshader
Normal file
@@ -0,0 +1,40 @@
|
||||
shader_type spatial;
|
||||
render_mode unshaded, depth_draw_never, cull_disabled, blend_mix;
|
||||
/*
|
||||
group_uniforms TextureCheck;
|
||||
uniform sampler2D fog_noise : repeat_enable, filter_linear_mipmap;
|
||||
uniform bool use_red_as_alpha = true;
|
||||
|
||||
group_uniforms Settings;
|
||||
uniform vec4 fog_color : source_color = vec4(0.8, 0.85, 0.9, 0.5);
|
||||
uniform vec2 scroll_speed = vec2(0.05, 0.01);
|
||||
uniform vec2 texture_scale = vec2(1.0, 1.0);
|
||||
|
||||
group_uniforms Edges;
|
||||
uniform float edge_softness_y : hint_range(0.0, 0.5) = 0.2;
|
||||
uniform float edge_softness_x : hint_range(0.0, 0.5) = 0.1;
|
||||
|
||||
group_uniforms Illumination;
|
||||
uniform float night_intensity : hint_range(0.0, 1.0) = 0.0;
|
||||
uniform vec3 sun_color : source_color = vec3(1.0);
|
||||
|
||||
void fragment() {
|
||||
vec2 moving_uv = UV * texture_scale + (TIME * scroll_speed);
|
||||
vec4 noise_tex = texture(fog_noise, moving_uv);
|
||||
|
||||
float noise_alpha = noise_tex.a;
|
||||
if (use_red_as_alpha) {
|
||||
noise_alpha = noise_tex.r;
|
||||
}
|
||||
|
||||
float fade_y = smoothstep(0.0, edge_softness_y, UV.y) * smoothstep(1.0, 1.0 - edge_softness_y, UV.y);
|
||||
float fade_x = smoothstep(0.0, edge_softness_x, UV.x) * smoothstep(1.0, 1.0 - edge_softness_x, UV.x);
|
||||
float edge_mask = fade_x * fade_y;
|
||||
|
||||
//Paint fog with sun color
|
||||
vec3 tinted_fog = fog_color.rgb * sun_color;
|
||||
vec3 dark_fog = tinted_fog * 0.5;
|
||||
ALBEDO = mix(tinted_fog, dark_fog, night_intensity);
|
||||
|
||||
ALPHA = fog_color.a * noise_alpha * edge_mask;
|
||||
}*/
|
||||
Reference in New Issue
Block a user