Replays in full HD with shader effects driven by the recording (#56), recorded clock survives gaps (#57), cinematic intercepts: layered sound with travel delay, big flash, light burst, exposure punch, shock ring (#51) (fork patch 31)
build / mod (push) Successful in 3m21s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-30 03:59:47 +03:00
parent 4bab572293
commit 8a12225ba1
40 changed files with 1185 additions and 105 deletions
+36 -10
View File
@@ -8,6 +8,7 @@
// [0] now (mod ticks), blasts, lights, -
// [1 + 2i], [2 + 2i] blast i: x, y, z, size | start tick, life ticks, kind, -
// [97 + 2j], [98 + 2j] light j: x, y, z, radius | r, g, b, intensity
// [255].x hold: 0 live; a replay's share of the frame's partial tick it does not advance with
const BLAST_BASE: i32 = 1;
const LIGHT_BASE: i32 = 97;
@@ -80,7 +81,7 @@ fn screen_radius_clip(c0: vec4<f32>, radius: f32) -> f32 {
}
fn now() -> f32 {
return frame.params[0].x + frame.time.y;
return frame.params[0].x + frame.time.y * (1.0 - frame.params[255].x);
}
// Fire's colour from its heat (0 cold soot .. 1 white-hot).
@@ -231,12 +232,15 @@ fn post(uv: vec2<f32>, pixel: vec2<f32>) -> vec4<f32> {
}
color = color * trans + lit;
// 3. Flashes: a bright bloom at the blast and the whole view lit up for a moment.
// 3. Flashes (#51): a huge bright bloom at the blast, a wide halo that lifts the sky and the
// clouds, a white shock ring racing out, and the view lit up for a moment. The sum is
// squashed, so a crowded sky never whites the screen out for long.
var flare = vec3<f32>(0.0);
for (var i = 0; i < blasts; i++) {
let a = frame.params[BLAST_BASE + 2 * i];
let b = frame.params[BLAST_BASE + 2 * i + 1];
let age = t_now - b.x;
if age < 0.0 || age > 10.0 { continue; }
if age < 0.0 || age > 24.0 { continue; }
let c0 = clip_of(a.xyz);
if c0.w <= 0.5 { continue; }
let p = vec3<f32>(clip_uv(c0), c0.w);
@@ -244,15 +248,37 @@ fn post(uv: vec2<f32>, pixel: vec2<f32>) -> vec4<f32> {
// than the distance along the ray towards the screen edge.
let dist = length(a.xyz - frame.camera.xyz);
let visible = select(0.25, 1.0, scene_distance(p.xy) > dist - a.w);
let f = exp(-age * 0.7) * min(a.w / 4.0, 2.5) * visible;
let r = screen_radius_clip(c0, a.w * 2.5) + 20.0;
let dd = length(px - p.xy * frame.resolution.xy) / r;
// The bloom's tail is below 5e-4 (under 8 bits) past nine radii.
if dd < 9.0 {
color += vec3<f32>(1.0, 0.85, 0.6) * f * (exp(-dd * dd * 3.0) * 2.5 + exp(-dd * 0.8) * 0.25);
let mass = min(a.w / 4.0, 2.5);
// How close it is, in its own sizes: a burst overhead is felt, a far one only seen.
let near = clamp(1.0 - dist / (a.w * 40.0), 0.0, 1.0);
let centre = p.xy * frame.resolution.xy;
if age <= 10.0 {
let f = exp(-age * 0.7) * mass * visible;
let r = screen_radius_clip(c0, a.w * 2.5) + 20.0;
let dd = length(px - centre) / r;
// The bloom's tail is below 5e-4 (under 8 bits) past nine radii.
if dd < 9.0 {
flare += vec3<f32>(1.0, 0.85, 0.6) * f * (exp(-dd * dd * 3.0) * 3.2 + exp(-dd * 0.8) * 0.3);
}
// The halo: a third of the screen wide for a close blast, lifting the sky and clouds most.
let wide = (0.12 + 0.3 * near) * frame.resolution.y;
let dw = length(px - centre) / wide;
if dw < 4.0 {
let sky = select(1.0, 1.7, wall > 1.0e5);
flare += vec3<f32>(1.0, 0.82, 0.58) * f * near * sky * exp(-dw * dw) * 0.55;
}
flare += vec3<f32>(1.0, 0.8, 0.55) * f * (0.12 + 0.2 * near) / (1.0 + p.z * 0.01);
}
// The shock ring: the same radius as the wave that bends the picture.
let ring = screen_radius_clip(c0, age * 3.2 * (0.6 + a.w * 0.1));
let width = 3.0 + ring * 0.025;
let x = (length(px - centre) - ring) / width;
if abs(x) < 4.0 {
let fade = 1.0 - age / 24.0;
flare += vec3<f32>(1.0, 0.9, 0.72) * exp(-x * x) * fade * fade * mass * (0.25 + 0.5 * near) * visible;
}
color += vec3<f32>(1.0, 0.8, 0.55) * f * 0.12 / (1.0 + p.z * 0.01);
}
color += flare / (1.0 + flare * 0.2);
// 4. Glows: engine flames and muzzle flashes.
for (var j = 0; j < lights; j++) {