3d book

Prompt

Build a polished, interactive 3D pop-up book called “A Day in the Forest” as a single self-contained HTML file. It should feel like a handcrafted paper theatre, not a flat web page with pictures pasted on it. The book follows one forest day from dawn to night. It has six two-page spreads plus a front and back cover: Dawn — a doe and her fawn in a misty clearing. Morning — a red squirrel and a great spotted woodpecker in a big oak; the tree unfolds upward and becomes the tall centerpiece. Midday — a fox family at their den among ferns. Afternoon — a hedgehog and rabbits in the undergrowth, with mushrooms in the foreground. Dusk — a bear beside a stream with a layered, tunnel-book waterfall. Night — a tawny owl on a branch, a paper moon, and fireflies. Each spread gets two or three short, warm, concrete story sentences. Include a small “Look closely” prompt printed on the right-hand page. Add one fact card per animal, opened by clicking or tapping the animal. Include a working paper pull-tab that turns the owl’s head. TECHNICAL CONSTRAINTS One index.html file. No build step, no bundler, no external image assets. Use three.js ES modules via an import map from a CDN. Use a recent r160+ release, preferably three@0.170.0. Use vanilla JavaScript and CSS. Google Fonts may load from the network, with a local fallback stack; all illustrations, textures, grain, paper edges, and scenery must be generated procedurally with Canvas 2D or geometry. No downloaded images, 3D models, video, or audio required. Use MeshStandardMaterial, real 3D geometry, soft shadows, and alpha-tested cut-outs. The book must work on a static server and remain one self-contained HTML file. PAPER ENGINEERING Build a real 3D book rig: a fixed right board, a left board/page hinged at the spine, and separate stage coordinate frames for the two halves. The paper pieces must be physical geometry, not DOM or CSS cut-outs. Use at least these mechanisms: V-fold: two hinged wings with an apex, a concealed sliding glue land, and a ridge that rises as the page opens. Parallel fold: a riser and platform forming a box stage. Layered theatre: tunnel-book planes at increasing depths, with a consistent vanishing geometry. The pop-up geometry must be driven by opening angle, not by timers. Write the folding math as pure, documented functions. Test them at 0°, 45°, 90°, 135°, and 180°; include a mechanics test that asserts the pieces are flat at 0°, rise correctly at the intermediate angles, and are fully open at 180°. Closing must fold everything flat in reverse. Pieces must not pass through the pages or through each other. Use hinge math and visual QA rather than a formal mesh-mesh collision solver. Keep the page art, printed story, and 3D pieces in the same physical coordinate system. PAGE TURNING — REVISED Do not close and reopen the whole book to change spreads. Once the book is open, internal page turns must keep both boards flat at 180°. Use a separate printed page leaf hinged at the spine: The leaf is a real sheet with thickness, a cream page edge, and printed art on both sides. The front carries the outgoing right page; the back carries the incoming left page. When turning backwards, reverse that relationship. As the leaf lifts, the underlying right page becomes the next right page. The underlying left page changes to the next left page only when the leaf lands and covers that half. The leaf must be correctly oriented in both directions. No mirrored or upside-down text. The outgoing 3D spread clears as soon as the page starts moving. The incoming 3D spread stays hidden under the leaf and rises from flat once the leaf lands. Standing paper must never pass through the turning leaf. The boards remain at 180° for the entire turn. Only the front and back covers use the board hinge to open or close. The page-turn camera may rise to a more overhead angle so the leaf is visible and fits the frame, but it must return smoothly to the normal reading view. The page-turn readout should report the leaf angle while turning and return to “opening 180°” at rest. PAGE-TURN INTERACTION Drag the right fore-edge left to turn forward; drag the left fore-edge right to turn backward. The page leaf should follow the drag. Releasing past 50% completes the turn with an eased animation. Releasing before 50% returns the leaf and restores the current spread. Clicking or tapping a page edge should also turn the page. Arrow keys and page-up/page-down should turn pages. Include previous/next controls and optional progress dots. The page edge should have a generous hit area and an appropriate resize/edge cursor. The book must never close accidentally during an internal turn. The front cover opens to the first spread; the last spread can close to the back cover. INTERACTION Limited 3/4 orbit camera, clamped so it cannot go below the desk. A reset-view control. Drag gestures on the book must not fight the orbit controls. Optional mouse wheel or pinch zoom, but keep the whole spread framed. Fact cards: clicking an animal opens one short natural-history fact; close by button or Escape. Animal clicks must not fire after an orbit drag. Owl pull-tab: a paper tab lies on the page and dragging it sideways turns the owl’s head. Reduced-motion support: shorter camera and page-turn animations, no unnecessary bounce. Touch support: pointer events, no page scrolling while dragging the book, tap targets large enough for a phone. ART DIRECTION Cut-paper illustration style, warm and restrained, with a limited forest palette: cream paper, moss and olive greens, bark browns, muted rust, dusk amber, night teal. Procedural paper grain, rough/deckled edges, subtle fibre texture, printed ink that looks slightly absorbed into the paper. Alpha-tested cut-out silhouettes with printed detail, not rectangular cards. Paper thickness: thin board/page slabs, cream edge strips, foot tabs, and backing layers. Pop-ups should cast soft cut-paper shadows. Warm reading-lamp key light, cool rim light, soft contact shadows, and a dark green desk surface. Avoid harsh black; use tone mapping and a cozy, tactile light. Embossed-looking cloth front cover with title, small field-guide mark, and a spine. A back cover with a short blurb. Rounded, readable storybook typography; Fraunces for display and Nunito for UI. Printed page text must be part of the page texture, with a readable HTML “Read page” fallback for narrow screens. PERFORMANCE AND LAYOUT Target 60 fps on a normal desktop; cap device pixel ratio around 1.6. Keep draw calls and shadow work reasonable. Large tunnel-theatre layers may receive but not cast full-plane shadows if that avoids artifacts; foreground cut-outs must cast alpha-tested shadows. Responsive layout: desktop, tablet, and portrait phone. The entire landscape spread must fit on screen in portrait, even if that makes the printed text small; provide Read page and pinch zoom. No console errors, no missing assets, no 404s. Keep the file organized into clearly commented sections: constants, texture/art generation, book rig, folding mechanics, paper-piece factory, scene data, covers, interaction, camera/render loop. Make adding a spread data-driven: metadata, scene piece data, and illustration functions should be enough to add one. QUALITY BAR This is a finished demo, not a flat prototype. The pop-ups must actually rise, cast shadows, be visible from a 3/4 angle, and fold flat. Verify with headless screenshots at multiple opening angles, at several page-turn moments, and on a phone viewport. Check for clipping, floating feet, mirrored text, and pieces intersecting the pages. Include a hidden grey-paper mechanics lab at ?lab=1 for inspecting the V-fold, parallel fold, and theatre layers. Run an end-to-end interaction check for page-edge drags, clicks, release/cancel, keyboard turns, progress dots, covers, fact cards, the owl tab, mobile touch, and reduced motion. At the end, list known limitations honestly. DELIVERABLE A single index.html containing the complete book, all procedural art, all six spreads, both covers, the page-leaf turn, interactions, and the hidden mechanics lab. No build step. No external image files.

A system prompt was added to support web rendering

Drag to resize

Response not available

Drag to resize
Drag to resize
Drag to resize