Quality Gate / Quality Gate (pull_request) Failing after 2m58s
SeabedFloraActor scatters seagrass tufts on flat sand in the lit band and sea fans on rock between 15 and 60 m, deterministically from the site id, one MultiMesh per tile and kind, with procedural alpha-cut meshes and textures (SeabedFloraAssets), vertex sway and wrapped lighting, no collision and no sonar presence. Placement reads the field arrays directly and runs on the worker thread pool. The seabed shader grows turf algae on sunlit rock, coralline crusts in patches and encrusting sponges in the shade, fading out between 40 and 75 m. The water-column optics move to a shared shader include. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
28 lines
1.3 KiB
Plaintext
28 lines
1.3 KiB
Plaintext
// Shared water-column optics for the seabed and flora shaders: per-channel
|
|
// Beer-Lambert transmittance relative to a reference depth, split into a scalar
|
|
// daylight factor (dims the sun and the sky ambient) and a chroma (tints albedo).
|
|
// Artificial lights are never attenuated: see water_sun_factor.
|
|
|
|
const vec3 WATER_LUMINANCE_WEIGHTS = vec3(0.2126, 0.7152, 0.0722);
|
|
|
|
vec3 water_transmittance(float depth_m, vec3 absorption_per_m, float reference_depth_m) {
|
|
return exp(-absorption_per_m * (depth_m - reference_depth_m));
|
|
}
|
|
|
|
float water_daylight(vec3 transmittance, float minimum_daylight) {
|
|
return max(dot(transmittance, WATER_LUMINANCE_WEIGHTS), minimum_daylight);
|
|
}
|
|
|
|
// Chroma of the transmittance, normalised so the authored palette holds at the
|
|
// reference depth once the reference transmittance (red already filtered) is applied.
|
|
vec3 water_chroma(vec3 transmittance, vec3 absorption_per_m, float reference_depth_m) {
|
|
float brightness = max(dot(transmittance, WATER_LUMINANCE_WEIGHTS), 0.001);
|
|
vec3 reference = exp(-absorption_per_m * reference_depth_m);
|
|
reference /= dot(reference, WATER_LUMINANCE_WEIGHTS);
|
|
return transmittance / brightness * reference;
|
|
}
|
|
|
|
float water_sun_factor(bool light_is_directional, float daylight) {
|
|
return light_is_directional ? daylight : 1.0;
|
|
}
|