Time & animation
Target API: 5 · Target build:
bbb6l5(2026-11-20, production and preprod) · Status: Verified (ported to the current API — on-device re-check recommended)bloxdSeconds()wraps every 3600 seconds (1 hour). Note this is shader elapsed time and is not guaranteed to sync with the in-game sun/day-night. Use it for visual periodic animation, but preferbloxdSunDirection()and lighting inputs for actual night detection.
Day-night cycle (1 day per hour)
fn bloxdTerrainLight(s: BloxdSurface, l: BloxdLightIn) -> BloxdLight {
var out = bloxdDefaultLight(s, l);
let day = 0.5 + 0.5 * sin(bloxdSeconds() * 6.2831853 / 3600.0); // 0..1 one-hour period; not necessarily synced with in-game day/night
out.colour = mix(out.colour * vec3f(0.6, 0.7, 1.0), out.colour, day);
return out;
}Wobble (layered sines)
fn pack_wobble(x: f32, t: f32) -> f32 {
return sin(x * 0.8 + t * 1.7) * 0.5 + sin(x * 1.9 - t * 1.1) * 0.3 + sin(x * 3.7 + t * 2.3) * 0.2;
}Flowing aurora bands / fluorescent stripes
// blend 3 colors by XZ position and time
fn pack_auroraColour(x: f32, t: f32) -> vec3f {
let phase = x * 0.05 + t * 0.05;
let w1 = 0.5 + 0.5 * sin(phase);
let w2 = 0.5 + 0.5 * sin(phase * 1.7 + 2.1);
let w3 = 0.5 + 0.5 * sin(phase * 0.6 + 4.2);
return (vec3f(0.2, 0.9, 0.55) * w1 + vec3f(0.55, 0.3, 0.95) * w2 + vec3f(0.95, 0.35, 0.75) * w3) / (w1 + w2 + w3 + 0.001);
}