Liquids
Target API: 5 · Target build:
bbb6l5(2026-11-20, production and preprod) · Status: Verified (ported to the current API — on-device re-check recommended)
Rippling surface (color shimmer)
fn bloxdLiquidSurface(s: BloxdSurfaceIn) -> BloxdSurface {
var out = bloxdDefaultSurface(s);
let worldX = s.position.x + f32(bloxdRenderOffset().x);
let worldZ = s.position.z + f32(bloxdRenderOffset().z);
let ripple = sin(bloxdSeconds() * 2.1 + worldX * 1.3 + worldZ * 0.9);
out.colour = clamp(out.colour * (1.0 + ripple * 0.06), vec3f(0.0), vec3f(1.0));
#ifdef BLOXD_ALPHA
out.alpha = s.alpha; // liquid always has BLOXD_ALPHA — guard kept as habit
#endif
return out;
}Pseudo depth-based transparency by height (not a real shallows test)
True water depth needs the liquid-only
bloxdOpaqueBehind(), which measures the thickness to the opaque face behind (the full recipe: Making water look natural). The following is a simpler pseudo styling without it:s.position.yis a local coordinate, so using it raw shifts the effect as the chunk origin changes. Convert withbloxdWorldPosition()for world height. The following only varies alpha by world height — a pseudo effect, not shoreline/bottom-aware shallows. AdjustpackWaterReferenceYto your world height.
const packWaterReferenceY: f32 = 0.0;
const packWaterHeightSpan: f32 = 8.0;
fn bloxdLiquidSurface(s: BloxdSurfaceIn) -> BloxdSurface {
var out = bloxdDefaultSurface(s);
let worldY = s.position.y + f32(bloxdRenderOffset().y);
let heightFactor = clamp((worldY - packWaterReferenceY) / packWaterHeightSpan, 0.0, 1.0);
#ifdef BLOXD_ALPHA
// thinner at low altitude, closer to base alpha up high; verify direction in game
out.alpha = mix(0.45, 0.9, heightFactor) * s.alpha;
#endif
return out;
}Underwater murk from inside
fn bloxdLiquidLight(s: BloxdSurface, l: BloxdLightIn) -> BloxdLight {
var out = bloxdDefaultLight(s, l);
let dist = distance(bloxdEyePosition(), l.position);
let murk = clamp(dist / 40.0, 0.0, 0.5);
out.colour = mix(out.colour, out.colour * vec3f(0.35, 0.55, 0.9) + vec3f(0.0, 0.02, 0.06), murk);
return out;
}Liquids-only pack (terrain untouched)
// write no terrain_* hooks at all. Then:
// - terrain variants = no hooks = engine defaults for terrain
// - liquid variants = only liquid_* hooks take effect