A stormy lighthouse lantern room: low-light brass and glass, volumetric fog beams, an exact gear ratio and beams that detect passing ships.
A stormy lighthouse lantern room: low-light brass and glass, volumetric fog beams, an exact gear ratio and beams that detect passing ships.
shipsGuided by 1, whereas freezing the lens aimed away from all ships adds 0 over 5 s.lensRpm halves the time per full revolution (beamSweeps +1) within 5%, and triggering the foghorn increments foghorns by 1.beamSweeps >= 2, shipsGuided >= 3, and foghorns >= 1, with zero NaN transforms or console errors.FRESNEL BEACON: Clockwork Lighthouse Lens & Fog
HOOK OBJECT: window.__fresnel
Build "FRESNEL BEACON": a stormy coastal lighthouse lantern room in Three.js where a giant first-order brass-and-crystal Fresnel lens spins over a clockwork gear drive, sweeping twin volumetric golden light beams through rolling coastal fog to guide passing ships away from rocky reefs. Watching the glass prisms catch the lamp and watching ships answer the beam with horn blasts is pure atmosphere.
LOOK
- Style: dramatic maritime miniature & brass instrument cinema, palette storm night #0B1421, fog mist #293D52, brass frame #D2A149, refractive crystal prism #E9F6FF, lamp amber #FFD166, sea foam #89B8C8, ship red/green nav lights #FF4B4B / #38E58C.
- Subject: a glass-walled octagonal lighthouse lantern room atop a masonry gallery (left-center hero) housing a rotating 4-panel first-order Fresnel lens (concentric stepped glass bullseye rings + brass ribs + central incandescent lamp + exposed brass bevel-gear clockwork pedestal below), sweeping 4 bright volumetric light cones across a dark rolling ocean with 3 small cargo/fishing ships and a rocky reef marker.
- FIRST FRAME (t = 0, no input): elevated three-quarter view with the glowing Fresnel lantern room, brass dome, concentric glass lens and sweeping golden fog beams filling at least 60% of the screen height, bright and atmospheric (never a pitch-black frame), with a compact top-left watch readout away from the lens.
MOTION / PLAY
- Controls: drag to orbit the lantern room and harbor (`setCameraOrbit(az, el, dist)`); W/S adjusts clockwork rotation speed (2 to 18 RPM); F toggles heavy fog density; Space triggers the coastal foghorn blast and flashes a signal pulse; C toggles close-up LENS CAM vs wide HARBOR CAM.
- Optical sweep & ship response: as each of the 4 volumetric Fresnel beams sweeps across a ship's bearing (angular error < 7°), the ship visibly illuminates, alters course safely away from the outer reef, flashes a white deck signal lamp, and increments `shipsGuided` (once per sweep/pass) with a distant answering horn!
- Clockwork drive: visible brass main gear and pinion mesh at an exact 3:1 angular ratio driving the mercury-bath lens carriage smoothly without stutter.
- ATTRACT MODE: with no input, a hands-free 28–30 s night watch runs on load: opens wide on the glowing lantern room sweeping fog beams over 3 ships, glides close into the spinning crystal prisms and meshing brass gears, deepens the storm fog while firing the foghorn, and pulls back as ships safely clear the reef. Any input takes over; after 8 s idle it resumes.
SOUND
- Clockwork gear drive -> steady gentle mechanical escapement tick synchronized to gear rotation.
- Coastal wind & surf -> filtered low ocean swell that rises in heavy fog.
- Lighthouse foghorn -> deep resonant dual-tone diaphone blast (high-low drop) on horn triggers; distant ship horn reply when a ship is illuminated by the beam.
COUNTERS
stats() returns { fps, lensRpm, beamSweeps, shipsGuided, foghorns, fogDensity }.
- lensRpm: live rotation speed of the Fresnel lens carriage in RPM.
- beamSweeps: +1 each time lens panel #1 completes a full 360-degree revolution. Never on load.
- shipsGuided: +1 each time a sweeping beam genuinely crosses a ship's bearing within 7° and triggers its visible deck signal flash (with per-ship cooldown).
- foghorns: +1 each time the coastal foghorn sounds.
- On screen: top-left pill "LENS NN RPM · SWEEPS N · SHIPS GUIDED N · FOG NN%", never over the lantern room.
CHECKS for ?test=1
With ?test=1, run an accelerated self-test that measures real positions and real events (not self-set flags) and logs "TEST n PASS" or "TEST n FAIL: reason" to the console and to window.__testResults:
1. First frame: lantern room, Fresnel lens and volumetric beams fill at least 55% of screen height, average canvas brightness is >= 14% (readable stormy twilight, not black), and zero console errors occur.
2. Clockwork gear ratio: advancing 6 s rotates the main lens carriage continuously and keeps pinion-to-main-gear angular ratio within 1% of 3.0:1.
3. Honest beam-crossing detection: sweeping a beam across a ship's exact bearing triggers its signal flash and increments `shipsGuided` by 1, whereas freezing the lens aimed away from all ships adds 0 over 5 s.
4. Speed & foghorn controls: doubling `lensRpm` halves the time per full revolution (`beamSweeps +1`) within 5%, and triggering the foghorn increments `foghorns` by 1.
5. Attract night watch: advancing 30 s hands-free records `beamSweeps >= 2`, `shipsGuided >= 3`, and `foghorns >= 1`, with zero NaN transforms or console errors.
KEEP IT SHORT
- Keep the whole file under about 1,500 lines (soft target) so you can write it in one pass and finish well inside 15 minutes.
- Save lines with helpers, loops and instancing, not by dropping features. Everything above must really work: no placeholders, no TODOs.
BUILD RULES (all required):
- Deliver ONE self-contained HTML file: inline CSS and JS, no build step, no local assets. Libraries only from a CDN. If you use Three.js, use exactly this import map: {"imports":{"three":"https://cdn.jsdelivr.net/npm/three@0.160.0/build/three.module.js","three/addons/":"https://cdn.jsdelivr.net/npm/three@0.160.0/examples/jsm/"}}
- It must open straight from disk in desktop Chrome and on an iPhone (Safari), fill the full screen, handle resize and touch, and stay smooth (target 60 fps).
- It must look stunning in the very FIRST frame: no black screen, no loading wait, no tiny subject. The main subject fills at least 50% of the screen height.
- SOUND (required): all sound is made in code with Web Audio (no audio files). Show a small "🔊 TAP FOR SOUND" chip; on the first tap create ONE AudioContext, route everything through a master gain of 0.6 into a DynamicsCompressor, and hide the chip. Also expose enableAudio() on the hook object named at the top.
- Expose the hook object named at the top with: setCameraOrbit(azimuthDeg, elevationDeg, distance) (or an equivalent camera setter), advance(seconds) that steps the simulation exactly that much for still captures, enableAudio(), and stats() returning {fps, ...the counters named above}. Use a fixed random seed of 360 so every run is the same.
- Every on-screen counter must count a real event you can see happen. No fake numbers.
- No text overlapping the subject; any label must be readable in a paused frame.
- No brand logos, no real people, no copyrighted characters, brand names or logos.
FAILURE MODES TO AVOID
- Pitch-black ocean frame where the lighthouse architecture and brass lens disappear into darkness.
- Volumetric beams drawn as opaque solid yellow cones instead of soft additive mist shafts.
- Ships guided counter ticking on a timer instead of checking the real beam angle against ship bearings.
- Static lens or disconnected gears that don't spin at a true 3:1 ratio.
- HUD overlapping the lantern room or lens.
- The same variable declared twice, or methods called on objects that don't exist yet.
SELF-TEST LOOP
- If you can run code: build the file, open it, read the console, run ?test=1, and take screenshots at 3 s, 10 s and 30 s at 1280x720 and 390x844. Look at the screenshots and fix what looks wrong. Fix and retest until all 5 checks pass with zero console errors. Mark anything you could not run as UNMEASURED; never invent results.
- If you are chat-only: go through this prompt line by line, check your code against each line, and fix anything that would fail. Then write one corrected, complete file.
- Final answer: ONE complete HTML file in ONE code block, then the 5 checks marked PASS, FAIL or UNMEASURED. No snippets, no "rest unchanged".
Built one? Post it on X and tag @wikiwaynePost on X