Use three.js (0.160, imported from jsdelivr via importmap) to build a web-based 3D scene called “Caisson Ceiling Star River”: the Mogao Caves in Dunhuang at night, featuring a cave with a truncated-pyramid ceiling. Do not use any 3D models, images, or external assets. Generate everything in code: assemble the forms with three.js, and hand-paint the murals as textures with Canvas 2D.
Define the coordinate plan before building (units: meters, y points upward):
- The cliff face is at z = 0, facing east (+z), 200 wide and about 46 high, with five or six tiers of cave openings in varied sizes and staggered positions; to the west of the cliff top is Mingsha Mountain, with dunes forming successive sharp ridges that grow taller in the distance
- The cave to enter: a passage from z 0 → -5, 1.8 wide and 2.7 high; the main chamber spans x ±4 and z -5 → -13, with 4.2-high walls; four sloped ceiling panels rise inward from the tops of the walls to a caisson frame at y = 7 (±1.75), with a central square well at ±1.05, then recess upward to y = 7.35
- Cut a niche into the west wall (x ±1.6, y 0.8 → 3.9, depth 1.6), with a seated Buddha inside and a lamp stand in front
- Add a nine-story tower on the right side of the cliff face: nine tiers of eaves, upturned roof corners, and lamplight shining through the windows
Build it piece by piece. After completing each piece, render a screenshot and inspect it before moving on:
1. Patterns: thousand Buddhas (small seated Buddhas, cycling through four color schemes for body halo, head halo, robe, and lining; offset each row by one position to create diagonal color bands), scrolling foliage, pearl borders, diamond grids, hanging curtains (triangular valances with beaded ornaments and bells), lotus medallions, auspicious clouds, flame patterns, and cusped niches. Use the faded colors of the Mogao Caves: earth red, mineral green, mineral blue, chalk white, and umber-black. Apply a unified aged finish at the end: stains, fading, flaking ground layers, and fine cracks
2. The four walls and ceiling: scrolling foliage along the upper walls, thousand Buddhas in the middle, and a cusped-niche dado below; a preaching scene centered on each of the south and north walls; flame patterns around the west-wall niche; and seven Buddhas painted above the east-wall entrance. The four sloped panels are trapezoidal and fully covered with small thousand Buddhas, with hanging curtains along the upper edges. Surround the caisson with several bands of decorative patterns, and place a large lotus at the center of the square well
3. Figures: draw the apsaras with Bezier-curve linework and flat colors. Give them tall hair buns, long skirts trailing behind them, and flowing scarves; their hands hold a flower tray, lotus, transverse flute, or scattered flowers. Draw the donors and the seated Buddhas in the preaching scenes the same way. Build the Buddha in the niche from lathed solids and spheres, and paint a low-lidded eye onto a spherical face texture
4. Outside the cave: a gradient night sky, with a trace of sunset glow remaining in the west, plus the Milky Way and several thousand stars. Cut real doorways through the cliff-face mesh into the passage; paint the other cave openings on the texture. Also create an emissive texture (R stores brightness, G stores the order in which lights turn on), and have the shader light up the cave openings one by one over time
5. Lighting: moonlight enters the passage from the low eastern sky; enable shadows, then add an additive-blended shaft of light. Inside the cave, add an oil lamp whose flicker is the sum of several sine waves, written as a function of time. Later, turn on eight floor lamps along the walls. Add bloom, a vignette, and warm color grading in post-processing
6. Animated elements: four apsaras begin as paintings inside the square well. After awakening, they leave the caisson, each carrying two trailing ribbons that spiral around it (the ribbons trail behind along their flight paths, with an added layer of undulation, then twist around the paths). Petals fall downward. The center of the square well then dissolves open to reveal the starry sky. The apsaras rise and shrink into star points, landing precisely on the four stars of the Big Dipper’s bowl. Project the Big Dipper and San Tai using their actual right ascension and declination, connect them segment by segment in the style of a Dunhuang star chart, and place the vermilion label “北斗” beside them
Camera and captions (60 seconds total, with everything written as a function of time t for convenient frame-by-frame rendering):
- 0–21 seconds: look toward the cliff face from below Mingsha Mountain and slowly push in; starting at 8.6 seconds, the cave openings light up one by one with a golden glow
- 21–37 seconds: pass through the passage, see the lamp, look at the Buddha niche, turn to view the thousand-Buddha wall, then look up at the four sloped panels
- 37–48 seconds: face the caisson, slowly rotate the frame, and show the apsaras awakening
- 48–60 seconds: pass through the caisson and rise into the starry sky; connect the Big Dipper, then show the vertically arranged title “Caisson Ceiling Star River”
- Captions, in order: In 366 CE, the monk Le Zun came to Mingsha Mountain; suddenly he saw a golden light, shaped like a thousand Buddhas; he then began cutting into the rock to build a cave shrine; over the next thousand years, painters created more than 4,500 apsaras here; tonight, the lamps are lit, and they awaken; a Tang-dynasty star chart lies in the Library Cave, and they have returned to the Big Dipper
Page:
- Play the full 60 seconds on launch, with pause and timeline controls in the upper-right corner; also provide an “Enter Cave” mode, with drag-to-look and scroll-wheel view controls. Camera buttons should include Caisson, Buddha Niche, Thousand Buddhas, and Look Back at Passage
- Synthesize the sound live with WebAudio: wind, a sustained drone, pentatonic plucked strings, and a temple chime. Start audio only after the user clicks a button
- Expose window.renderAt(t): given a time, it renders a deterministic frame; when the URL includes ?render=1, hide the controls so a headless browser can capture frames for a 1080p video
- Style: a warm-black background, the title set vertically in regular script, vermilion square seals as accents, and captions styled like film subtitles
- Inspect every screenshot: Is the image too dark? Are the patterns distorted? Are there interpenetrating meshes or large areas of black?