shader_type fog; // Water column for the volumetric fog: the scattering albedo follows the same // per-channel Beer-Lambert transmittance as the seabed shader, so the haze turns // from green-blue near the plateau to indigo at the drop-off foot, and the density // grows slowly with depth (more suspended sediment, less light). It covers every // object in the volume, not only the terrain. uniform vec3 shallow_albedo : source_color = vec3(0.5, 0.78, 0.92); uniform vec3 water_absorption_per_m = vec3(0.11, 0.04, 0.032); uniform float reference_depth_m = 24.0; uniform float minimum_albedo = 0.03; uniform float base_density = 0.012; uniform float density_per_m = 0.00012; uniform float emission_strength = 0.0; void fog() { // Above the reference depth the haze keeps its shallow colour: brightening it // further would wash the upper water column towards white. float excess_depth_m = max(-WORLD_POSITION.y - reference_depth_m, 0.0); vec3 transmittance = exp(-water_absorption_per_m * excess_depth_m); ALBEDO = clamp(shallow_albedo * transmittance, vec3(minimum_albedo), vec3(1.0)); DENSITY = base_density + density_per_m * excess_depth_m; EMISSION = vec3(emission_strength); }