DRAWBACK
Build one self-contained HTML file, drawback.html: "Drawback", episode 2 of my "Cross Section" series. A block of sea and coast on a studio backdrop: a calm island harbor where the sea suddenly pulls back, leaves the boats on dry sand, and then returns as a huge wave that floods the shore and the town. English UI. Original design only: no real brands, logos, characters or text from real products or films. Open it and check it runs before you finish.
THREE.JS ONLY
- All rendering goes through Three.js: import exactly [email protected] from a CDN with an import map and use WebGLRenderer
- Only Three.js and its official addons (three/addons: OrbitControls, EffectComposer, bloom, depth of field, RoomEnvironment and so on). No other libraries
- No raw WebGL or WebGPU code: no getContext, no direct gl calls. Custom shaders only through Three.js materials (ShaderMaterial or onBeforeCompile)
- All physics and motion are your own plain JavaScript. No physics libraries, no external models or textures, all geometry and materials procedural
FIRST STEP, BEFORE ANYTHING ELSE
Run a shell command that creates a unique run ID and the current time, and saves both to run-log.txt next to your HTML. Print the run ID once in your reply. You will need it at the end to find your own session log.
After every major step (block, sea, island, boats and life, wave, cameras, UI, demo), read your session log and append the running token totals and the current time to run-log.txt. If your context gets compacted, these checkpoints keep the earlier usage.
The picture matters most. It should look like a museum-grade miniature: rich, juicy, every square centimeter full of detail.
THE BLOCK
- A block of the world, 8 units wide and 6 deep, standing on a warm pale-grey paper studio backdrop with a soft floor shadow. Clean cut faces with slightly softened edges, like a museum specimen
- About 60% of the block is sea, 40% is island. The open sea is at the front and left, the island rises at the back right
- The front face is clear glass: you see the water and the seabed in section, with fish swimming inside
- A gentle tilt-shift depth of field so it reads as a real miniature
THE SEA
- Clear turquoise over pale sand near the shore, deeper blue toward the open edge, caustics dancing on the seabed, light shafts under water
- A seabed of rippled sand, rocks, coral heads in pink and orange, swaying seaweed, starfish and shells
- Fish everywhere: schools of small silver fish that turn together, a few bigger striped fish, a slow sea turtle, a ray gliding over the sand. All of them visible through the glass front
- Gentle swell and small waves breaking white on the reef and the beach
THE ISLAND
- A harbor with a curved stone breakwater, a long wooden pier, and 6 boats: two red and blue fishing boats moored at the pier, a small ferry, two white sailboats at anchor, and a rowboat with two fishermen out in the bay
- Fishermen sitting on the pier with rods, lines and floats in the water, buckets beside them
- A beachfront: pale sand, a row of palms, colorful beach umbrellas, wooden beach huts, a small café with striped awnings and tables
- The town climbs the hill behind: 15 small houses in soft pastel colors with terracotta roofs, a market square with stalls, narrow streets, a striped lighthouse on the point, and a path winding up to a lookout on the hilltop
- Seabirds circling over the harbor and resting on the breakwater
- Tiny villagers walking the beach, the pier and the market
THE EVENT AND PHYSICS
- Water: nonlinear shallow-water simulation on a grid of about 256 by 192, with wetting and drying, so the sea can pull back off the seabed and run up onto land. Drive it from the open-sea edge with a long trough followed by a tall crest. No explanation of the cause is shown
- The sea pulls back: the waterline slides away from the beach and past the breakwater, exposing the wet seabed, the coral and the harbor floor. Moored boats settle on the sand and lean over, the rowboat is left stranded, fish flop in the puddles. Birds lift off all at once. The fishermen and villagers drop everything and run up the path to the hilltop
- The wave: a white line appears on the horizon, grows into a steep wall as it reaches the shallows, curls, and breaks into a churning white front taller than the harbor houses
- The flood: the front runs over the beach, the pier and the lower town. It lifts the stranded boats, spins and carries them inland, capsizes some, tears up beach huts, umbrellas, café tables and palm trunks and carries them through the streets. Streets turn into rivers, only roofs stay above the water in the lower town
- Backwash: the water rushes back out to sea, dragging boats and debris with it, then the sea slowly calms
- Boats are rigid bodies with buoyancy and drag in the flow, mooring lines snap above a load, they capsize past a tilt limit
- Spray, mist and foam particles at the breaking front. Wet surfaces darken. Houses reached by the water keep a dark waterline mark
- The villagers are safe on the hilltop
CAMERAS
- Wide: a side view, a little above the water, showing the whole block, the bay, the island and the glass front with the fish
- Wave: a low tracking shot that flies alongside the wave just above the water at crest height, looking along it toward the shore. The face rises, the crest curls and starts to break, spray drifts across the lens, the stranded boats and the town get closer. Slight camera shake
- Top: a steep overhead view of the shore and the town, so you see the white front sweep inland and the streets fill
- Hard cuts between shots, like a film edit
UI (same look across the series)
- Top left: a museum specimen label with small caps "CROSS SECTION No. 2", the title "Drawback" in a bold grotesque, and one line: "The sea leaves. Then it comes back"
- Bottom left: an instrument strip with a harbor tide gauge graph (sea level over time: the drop, then the spike), wave height, boats afloat / stranded / capsized, flooded area
- Bottom center: pill buttons Wave, Wide, Wave cam, Top, Reset
- Right edge: slim vertical sliders: Size (small to huge) and Time scale
- Thin lines, warm off-white panels, one accent color: signal red
- Drag empty space to orbit, scroll to zoom, drag on the sea to make ripples
Sound: procedural Web Audio, starts on the first click or key press (pressing D starts it too): gulls and gentle surf, then an eerie hiss as the sea pulls back, a rising roar, the crash of the wave, wood knocking together.
QUALITY BAR
- Stylized but rich: matte clay-like land with crisp edges, glossy water, thick white foam, sand that darkens when wet, soft shadows, warm studio light
- The block fills about 75% of the frame in the Wide shot and reads well in a 16:9 crop and a square crop
- 60 fps on a normal laptop, a calm start, no NaNs over long runs, no console errors
IDLE AND DEMO
- On load: a calm sunny day, birds, fishermen, boats bobbing, fish behind the glass, a slow auto-orbit. This alone should work as a clean 20-second beauty shot
- Press D for a fixed 30-second demo with a fixed random seed, so every run is identical. During the demo the UI fades out except the specimen label and the tide gauge:
0s to 6s Wide: calm harbor, birds circling, fishermen casting, boats bobbing, fish schools behind the glass
6s to 12s Wide, slow push toward the shore: the sea pulls back, the harbor floor is exposed, boats settle on the sand, fish flop, birds lift off, people run uphill
12s to 18s cut to Wave cam: the white line becomes a wall, rises, curls and starts to break
18s to 25s cut to Top: the front hits the beach and sweeps through the town, boats are carried and spun, streets fill with water
25s to 30s cut to Wide from a three-quarter angle, slow pull back: the backwash streams out to sea with boats and debris, the villagers watch from the hilltop
LAST STEP: REAL TIME AND API COST
Do this as the very last step, right before your final reply. Use real numbers from your own session log, do not estimate.
1. Find your session log on disk: the file that contains your run ID
- Claude (Claude Code, Cowork): a .jsonl file under ~/.claude/projects/. Sub-agent logs, if any, may sit in a subfolder with the same name; include them
- Codex: rollout .jsonl files under ~/.codex/sessions/
2. Time: from the first to the last timestamp in the log. If the log has no timestamps, use run-log.txt start time to now
3. Tokens
- Claude logs: every API response has message.usage with input_tokens, cache_creation_input_tokens (split into 5-minute and 1-hour in cache_creation when present), cache_read_input_tokens and output_tokens. The same response is repeated on several lines, one per content block, so count each message id only once
- Codex logs: take the last cumulative token_count totals. Cached input is usually included inside input, and reasoning tokens are billed as output: do not count anything twice
4. Price every request with the table below. For a model not in the table, use your vendor's official pricing page and give the URL
PRICES, USD per million tokens (Claude API, https://t.co/MumWcfinp3, checked 12 Oct 2026)
model | input | cache write 5m | cache write 1h | cache read | output
Opus 5.5 | 4 | 5 | 8 | 0.20 | 20
Sonnet 5.5 | 2 | 2.50 | 4 | 0.10 | 10
Haiku 5.5, prompt up to 100k | 0.10 | 0.125 | 0.20 | 0.01 | 0.50
Haiku 5.5, prompt over 100k | 0.50 | 0.625 | 1 | 0.05 | 2.50
- Haiku's tier is decided per request: prompt size = input + cache write + cache read tokens of that request
- If usage shows speed "fast" (Opus only): $8 input, $40 output. If inference_geo is "us": multiply everything by 1.1
5. If the log was compacted and earlier usage is missing, take it from the checkpoints in run-log.txt and add it to what remains in the log, without counting anything twice
6. Save cost-report.txt next to the HTML and paste it in your final reply:
MODEL: exact model name from the log
TIME: Xh Ym (start and end timestamps)
API REQUESTS: number of unique responses
TOKENS: input / cache write 5m / cache write 1h / cache read / output
COST: dollars per category and TOTAL
SOURCE: path to the log file, plus run-log.txt if checkpoints were used
If you could not find the log, mark every number ESTIMATE and explain how you got it. Note that this final reply itself is not in the log yet.
Also in your final reply, a short report: what is real physics, what is faked, key numbers (water grid, max wave height, boats, particles, file size, Three.js version and renderer).