Step 1: A device
Step 2: The shader
HLSL here, so the frame camera comes from gpu.hlsli. Bindings follow WebGPU: group as the space, binding as the register number.Step 3: The pipeline
frame.camera, frame.sceneDepth and frame.color are virtual: the views you make once keep
pointing at the current frame, resizes included.
Step 4: Every frame
Pings start at your feet every three seconds. Submit the pass to thetransparent hook from a render
listener.
render replaces it, so the ring keeps up
with the camera even when your script is busy.
Going further
- The same shader in WGSL: drop
language: "hlsl"and declare the camera as a struct (the layout is in gpu.hlsli). WGSL matrices takecamera.viewProj * vec4f(p, 1.0). frame.worldDepthinstead ofsceneDepthignores players and smoke boxes: the ring then only runs over the map.frame.on("transparent", (encoder) => ...)saves you the encoder and thesubmit.