HD water: no vanilla texture on the surface (the biome colour only), a darker, deeper colour

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-29 17:56:04 +03:00
committed by airdef
parent 54ada71e63
commit 59426881f3
2 changed files with 10 additions and 5 deletions
+6 -3
View File
@@ -591,10 +591,13 @@ fn fs_water(in: FullOut) -> @location(0) vec4<f32> {
}
let thickness = clamp(length(position_at(uv_floor, floor_z)) - dist, 0.0, 48.0);
let behind = textureSampleLevel(lit_tex, linear, uv_floor, 0.0).rgb;
let colour = clamp(tint.rgb, vec3<f32>(0.03), vec3<f32>(1.0));
// A deep, dark water: the biome's colour darkened and a little greyed, so it reads as
// depth rather than as bright paint.
let biome = clamp(tint.rgb, vec3<f32>(0.03), vec3<f32>(1.0));
let colour = mix(vec3<f32>(dot(biome, vec3<f32>(0.333))), biome, 0.8) * vec3<f32>(0.55, 0.68, 0.8);
// The colours the water takes up fastest are the ones it has the least of.
let absorb = exp(-(vec3<f32>(1.0) - colour) * 0.8 * (thickness + 0.3));
let refracted = behind * absorb + colour * volume_light * 0.9 * (vec3<f32>(1.0) - absorb);
let absorb = exp(-(vec3<f32>(1.0) - colour) * 1.1 * (thickness + 0.3));
let refracted = behind * absorb + colour * volume_light * 0.6 * (vec3<f32>(1.0) - absorb);
// Reflection: the screen where the ray stays on it, the sky where it leaves it or misses.
var r = reflect(-v, n);
+4 -2
View File
@@ -195,9 +195,11 @@ struct WaterOut {
@fragment fn fs_water(in: TerrainOut) -> WaterOut {
let layer = in.layer & 0x7fffu;
if layer != WATER_STILL && layer != WATER_FLOW { discard; }
let color = sprite(in.uv, layer) * in.tint;
// The biome's colour at the texture's mean brightness, not the texture: the HD water draws
// its own surface (waves, reflections), and vanilla's ripples on top would look painted on.
let color = vec3(0.62) * in.tint.rgb;
var out: WaterOut;
out.tint = vec4(color.rgb, clamp(in.lm.y, 0.0, 1.0));
out.tint = vec4(color, clamp(in.lm.y, 0.0, 1.0));
out.normal = vec4(face_normal(in.pos) * 0.5 + 0.5, clamp(in.lm.x, 0.0, 1.0));
return out;
}