feat(world): volumetric coral heads on patch reefs
Quality Gate / Quality Gate (pull_request) Failing after 3m18s

Three procedural coral head meshes (boulder, brain-ridged, lobed domes on
a flat base, vertex-shaded crevices) are scattered on gentle rock between
12 and 40 m, clustered by noise, one MultiMesh per tile and variant, with
an opaque shader under the shared water column. The coral assertions
run on the Banc du Vigilant, whose patch reef lies in the lit band.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
OlivierandClaude Fable 5.1 committed 2026-10-07 08:22:09 +02:00
1 parent 0f9918224a
commit 48e054557c
12 files changed
+293 -24

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
shader_type spatial;
render_mode depth_draw_opaque;
// Massive coral heads: opaque, vertex-coloured (mesh shade times the instance tint),
// lit under the same water column as the seabed. INSTANCE_CUSTOM.x is a per-head
// mottling phase; the submarine's projectors are not attenuated.
#include "res://game/world/sites/water_light.gdshaderinc"
uniform vec3 water_absorption_per_m = vec3(0.11, 0.04, 0.032);
uniform float reference_depth_m = 24.0;
uniform float minimum_daylight = 0.05;
uniform float mottle_strength = 0.18;
varying float daylight;
varying vec3 chroma;
varying float mottle;
void vertex() {
vec3 world = (MODEL_MATRIX * vec4(VERTEX, 1.0)).xyz;
vec3 transmittance = water_transmittance(-world.y, water_absorption_per_m, reference_depth_m);
daylight = water_daylight(transmittance, minimum_daylight);
chroma = water_chroma(transmittance, water_absorption_per_m, reference_depth_m);
mottle = sin(VERTEX.x * 9.0 + INSTANCE_CUSTOM.x * TAU) * sin(VERTEX.z * 7.0 + VERTEX.y * 5.0);
}
void fragment() {
ALBEDO = COLOR.rgb * (1.0 + mottle * mottle_strength) * chroma;
AO = daylight;
AO_LIGHT_AFFECT = 0.35;
ROUGHNESS = 0.8;
METALLIC = 0.0;
}
void light() {
float sun = water_sun_factor(LIGHT_IS_DIRECTIONAL, daylight);
float lambert = clamp(dot(NORMAL, LIGHT), 0.0, 1.0);
DIFFUSE_LIGHT += lambert * ATTENUATION * LIGHT_COLOR * ALBEDO * sun / PI;
}