22 lines
699 B
Plaintext
22 lines
699 B
Plaintext
shader_type fog;
|
|
|
|
uniform float surface_y : hint_range(-100.0, 100.0) = 0.0;
|
|
uniform float abyss_depth : hint_range(-200.0, 0.0) = -60.0;
|
|
|
|
void fog() {
|
|
float depth_factor = clamp((WORLD_POSITION.y - abyss_depth) / (surface_y - abyss_depth), 0.0, 1.0);
|
|
|
|
vec3 surface_color = vec3(0.15, 0.45, 0.6);
|
|
vec3 abyss_color = vec3(0.02, 0.08, 0.15);
|
|
vec3 fog_color = mix(abyss_color, surface_color, depth_factor);
|
|
|
|
float current_wave = sin(TIME * 0.3 + WORLD_POSITION.x * 0.05) * 0.02
|
|
+ sin(TIME * 0.17 + WORLD_POSITION.z * 0.04) * 0.01;
|
|
|
|
float base_density = mix(0.3, 0.05, depth_factor) + current_wave;
|
|
base_density = clamp(base_density, 0.0, 0.4);
|
|
|
|
ALBEDO = fog_color;
|
|
DENSITY = base_density;
|
|
}
|