Demos

Lantern playground

Amber lanterns tumble through a field of posts on a night stage. Each lantern is a light, each post casts a shadow, and you can throw, gather and scatter them.

Runs on WebGPU in this page.

lantern playground · the engine itself, compiled to WebAssembly, on WebGPU in this page

controls Drag a body to throw it. Press and hold on empty space to gather the bodies around the pointer, then let go to scatter them.

controls Drag a body to throw it. Hold on empty space to gather the bodies, then lift your finger to scatter them.

About this scene

Sixty-four bodies pour down two ramps and through fifteen posts, stepped by Rapier 2D at a fixed 60 Hz and drawn every frame between ticks, so they move smoothly at any refresh rate. Six of them are lanterns that carry point lights, and every post is an occluder, so the posts throw soft shadows across the back wall that swing as the lanterns fall. The pointer carries a cool light of its own. Every sprite comes from one atlas the scene generates when it starts; there are no image files.

What it exercises

  • AppHost on WebGPU
  • Rapier 2D physics
  • Point lights and soft shadows
  • Additive glow and bloom
  • Interpolated rendering
  • Generated sprite atlas
  • Pointer input