Make low fog patches drift together slowly across the room

This commit is contained in:
JariKo
2026-10-28 16:11:34 +02:00
parent d61e1fa1a7
commit 3c488b5d53
2 changed files with 8 additions and 3 deletions
+5 -3
View File
@@ -2,6 +2,7 @@ shader_type fog;
uniform float density = 0.38675;
uniform float surface_height = 0.45;
uniform vec2 drift_velocity = vec2(0.16, -0.07);
uniform vec3 player_position = vec3(0.0);
uniform float fog_time = 0.0;
@@ -19,9 +20,10 @@ float noise(vec2 p) {
void fog() {
vec2 p = WORLD_POSITION.xz;
float billow = noise(p * 0.9 + vec2(fog_time * 0.12, -fog_time * 0.08));
float detail = noise(p * 2.1 + vec2(-fog_time * 0.09, fog_time * 0.15));
float patches = noise(p * 0.32 + vec2(fog_time * 0.025, -fog_time * 0.018));
vec2 flow = p - drift_velocity * fog_time;
float billow = noise(flow * 0.9 + vec2(fog_time * 0.02, -fog_time * 0.015));
float detail = noise(flow * 2.1 + vec2(-fog_time * 0.025, fog_time * 0.02));
float patches = noise(flow * 0.32);
float coverage = mix(0.02, 1.5, smoothstep(0.42, 0.76, patches));
float top = surface_height + (billow - 0.5) * 0.22;
float layer = 1.0 - smoothstep(top - 0.23, top + 0.10, WORLD_POSITION.y);