ai21.net
語言

日式神社場景對比

示範影片

日式神社場景對比 — 1

提示詞

Build a single-file interactive WebGL diorama (one index.html, no build step) with Three.js r160 loaded via an import map from https://cdn.jsdelivr.net/, plus OrbitControls and BufferGeometryUtils (mergeVertices, mergeGeometries) from three/examples/jsm. Everything is procedural — no external models or textures.

CONCEPT
"Torii at High Tide": a miniature Japanese shrine island inspired by Itsukushima, inside a 10×10 block of clear water with rounded edges (vertical corner radius ~0.6, top edge radius ~0.26), on a thin sand-colored base slab, on a warm washi-paper background with a soft floor shadow that fades out with distance (so long dusk shadows never streak across the page).

TERRAIN (heightfield ~400×400, clipped to the rounded block, with a boundary "skirt" so the cross-section shows through the water)
- Work in a local frame facing the camera (u = across, v = toward the viewer).
- A forested dome-shaped hill at the back (~2.4 high), a low sandy shrine terrace at its foot, then a wide, gently sloping tidal flat in front (from ~-0.06 down to ~-0.46), dropping to ~-1.0 at the front and sides.
- Two rocky granite headlands framing the bay, each with 1–2 leaning bonsai-style pines (segmented trunks + flattened canopy pads).
- A flattened clearing on the hill flank for the pagoda.
- Terrain shader: granite rock on steep slopes (speckled, darker wet band just above the waterline, algae-dark below it), sand with a wet line, darker wet intertidal sand below the high-tide mark, moss/grass on the hill and in patches on the terrace, snow on upward-facing surfaces in winter, procedural animated caustics under water. CPU-baked horizon AO per vertex plus canopy-cover darkening.

ARCHITECTURE (merge everything into one vertex-colored mesh + one emissive "glow" mesh; write a small Builder that adds boxes/cylinders/spheres/custom geometry with a color and a transform, then mergeGeometries)
- Ryōbu-style torii standing in the bay on the axis of the shrine (~1.9 tall): vermilion tapered main pillars with black base sheaths, four supporting sode-bashira legs with black caps and two connecting beams each, nuki tie beam, central strut with a dark plaque, shimaki, and a curved kasagi (extruded shape with upturned ends) with a black top layer. Pillars must end inside the shimaki, not poke through the kasagi.
- Shrine on stilts over the tidal flat: plank deck (with plank-gap strips and dark edge beams) on a grid of wooden stilts reaching the seabed; a main hall and a smaller front hall (white walls, vermilion posts and tie beams, shoji-style front panels = glow panels behind a thin dark lattice), a lower front stage with vermilion railings, and two roofed vermilion corridors on stilts running sideways then back to the shore.
- Roofs: a hip-roof generator with a concave profile and lifted eave corners (top surface dark cypress-bark brown, warm wood underside, pale fascia trim, black ridge cap).
- A five-storey pagoda on the hill clearing: stone plinth, white walls with vermilion posts, bracket layer, flared roofs decreasing in size, bronze finial with rings.
- Stone tōrō lanterns on the terrace and on the stage (hexagonal base, post, firebox with emissive windows, small roof, jewel).

VEGETATION
- ~4–5k canopy blobs (InstancedMesh of icospheres with vertex-noise displacement + fragment bump), clustered 2–4 per tree, per-instance AO from neighbour occlusion, brighter tops.
- Four kinds via an instance attribute: broadleaf, cherry, maple, pine (flattened pads). Cherries cluster lower on the hill and as 5 feature trees with visible trunks on the terrace; pines dominate the summit and the headlands.
- Colors come from per-kind dark/light palette uniforms that the JS blends across seasons.

SEASONS (cyclic 0..4 = spring, summer, autumn, winter; animated transition from a dock button)
- Spring: pink sakura, falling petals. Summer: lush green, no particles. Autumn: red maples, orange/yellow broadleaf, falling maple leaves. Winter: bare-ish brown deciduous blobs shrunk ~38%, snow on canopy tops, roofs, decks, rocks and ground; snowfall that melts instantly on the water.

WATER (realistic, not jelly)
- Pipeline: opaque scene → MSAA HalfFloat target with DepthTexture; copy to a second target, then draw the water with a custom ShaderMaterial doing a manual depth test; then floating particles; final fullscreen pass with ACES tone mapping, sRGB, subtle tilt-shift. Transparent canvas over the CSS background.
- Color from real thickness: reconstruct the depth behind each water pixel, Beer–Lambert absorption toward a deep scatter color derived from the user's water color (pale over the flats, blue in the deep; side walls get extra path length so they read as a water volume).
- Screen-space refraction, Fresnel sky reflection, sun glints from fine animated detail normals.
- Screen-space reflections (~26 ray-march steps against the depth buffer, fewer on mobile) so the torii, shrine and lit lanterns reflect in the water.
- Ripples: GPU wave equation on a 256×256 HalfFloat ping-pong target, fixed 60 Hz steps, land-mask texture so waves reflect off the shore. Cursor movement injects capsule drops along its path; a click makes a splash.
- Shore foam only where the terrain is near the water level AND gently sloped (no white outlines around cliffs, stilts or the torii pillars); foam band width scaled by slope; broken by noise.
- Tide: a dock toggle animates between high tide (0) and low tide (-0.55): the water block's rim moves and its sides stretch; at low tide the whole flat is exposed and the torii stands on wet sand.

PARTICLES (petals / leaves / snow, ~700 instanced quads, CPU-simulated)
- Spawn from cherry blobs (spring), deciduous blobs (autumn) or the sky (winter); flutter while falling; a gusting wind blows from the island toward the bay so they reach the water.
- Landing: on water they become floating (vertex shader lifts them by the same ripple + wave height as the water), drift slowly, get pushed by the cursor's movement and blown away by click splashes, strand when the tide drops, re-float when it rises; on land they rest and fade.
- Shapes drawn in the fragment shader: notched petal, five-lobed maple leaf, soft snow disc. Manual depth test against the scene depth.

KOI
- 7 koi (lathe body + forked fan tail + pectoral fins, merged), InstancedMesh with a swimming sway in the vertex shader and procedural patterns per type (kohaku, sanke, showa, ogon, plain orange). They wander, steer away from shallow water and the block walls, and flee the cursor and splashes. Rendered under the water so they are refracted and tinted.

TIME OF DAY (slider, shown as a clock from 11:00 to ~19:10)
- Sun elevation, color and intensity, hemisphere colors, and the water's sky reflection shift from noon to golden hour; towards dusk the shoji panels and lanterns glow (emissive) and three warm point lights light the shrine, the stage and the torii.

UI (editorial, minimal, English)
Brand "shiosai°" with a small torii mark, headline "A gate that / stands in the sea.", eyebrow "Shrine and tide, in miniature", a vertical caption "A study of tide and seasons", a location label "Shrine Cove · 34°16′ N · 132°19′ E", a floating pill dock (reset, season cycle with the current season name, High tide / Low tide toggle, Tune, fullscreen), hints and an adaptive FPS + "Season · time" readout in the footer, a glassy settings panel (season, time of day, falling petals; water color, tide level, wave height, ripple strength, clarity, caustics; sun azimuth, tilt-shift), and a "How it's made" card. Vermilion accent, light and dark themes via CSS tokens, responsive to 390 px (panel becomes a bottom sheet), prefers-reduced-motion respected, adaptive pixel ratio and a lighter mode for touch devices. Intro: the water fills the block while the camera eases in.

中文翻譯

用 Three.js r160 構建一個單文件、可交互的 WebGL 微縮立體場景(一個 index.html,無構建步驟),通過 import map 從 https://cdn.jsdelivr.net/ 加載,並包含來自 three/examples/jsm 的 OrbitControls 與 BufferGeometryUtils(mergeVertices、mergeGeometries)。所有內容都是程序化生成的 —— 沒有任何外部模型或貼圖。

概念
“Torii at High Tide”:一座受 Itsukushima 啓發的微型日本神社島嶼,位於一塊 10×10 的清澈水體中,水塊邊緣爲圓角(豎直轉角半徑約 0.6,頂部邊緣半徑約 0.26),下方是一塊薄薄的沙色底板,背景是一張溫暖的和紙,帶有一層隨距離淡出的柔和地面陰影(這樣黃昏時拉長的影子就不會在頁面上拖出條痕)。

地形(高度場約 400×400,裁切到圓角區塊內,並帶一圈邊界“裙邊”,讓剖面能透過水體顯現)
- 在面向相機的局部座標系中工作(u = 橫向,v = 朝向觀察者)。
- 後方是一座森林覆蓋的穹頂狀山丘(高約 2.4),山腳處是低矮的沙質神社平臺,前方則是寬闊、平緩傾斜的潮間淺灘(從約 -0.06 降到約 -0.46),在前方和兩側進一步降至約 -1.0。
- 兩片多巖的花崗巖海岬環抱海灣,每片各有 1–2 棵傾斜的盆景式松樹(分段的樹幹 + 扁平的樹冠片)。
- 山丘側腹有一塊爲塔平整出的空地。
- 地形着色器:陡坡上爲花崗巖(帶斑點,水線正上方有更深的溼潤色帶,其下是被藻類染暗的區域),沙子帶一條溼痕,高潮線以下的潮間帶溼沙顏色更深,山丘上有苔蘚/草地,平臺上也有成片分佈,冬季朝上的表面覆雪,水下有程序化動態焦散。逐頂點由 CPU 烘焙的地平線 AO,再加上樹冠遮蔽的壓暗。

建築(將所有內容合併爲一個帶頂點顏色的網格 + 一個自發光“輝光”網格;編寫一個小型 Builder,用顏色和變換添加盒體/圓柱/球體/自定義幾何體,然後調用 mergeGeometries)
- 位於海灣中、處在神社軸線上的 Ryōbu 式鳥居(高約 1.9):硃紅色收分主柱,配黑色柱腳套;四根支撐用的 sode-bashira 側柱,帶黑色柱帽,各配兩根連接橫樑;nuki 貫梁;帶深色匾額的中央支柱;shimaki;以及一根彎曲的 kasagi(兩端上翹的擠出造型),頂部爲黑色層。主柱必須終止在 shimaki 內部,不得穿出 kasagi。
- 潮間淺灘上方架在木樁上的神社:木板平臺(帶板縫條和深色邊梁)鋪在伸至海牀的木樁網格上;一座正殿和一座較小的前殿(白牆、硃紅立柱與聯繫梁、障子式前板 = 薄暗格柵後的發光面板),前方一座較低的舞臺,帶硃紅欄杆,還有兩條帶屋頂的硃紅迴廊架在木樁上,先向側面延伸,再折回岸邊。
- 屋頂:一個四坡屋頂生成器,輪廓內凹、檐角起翹(頂面爲深色檜皮棕,底面爲暖色木材,淺色封檐板飾條,黑色屋脊蓋)。
- 山丘空地上有一座五重塔:石質基座,白牆配硃紅立柱,鬥拱層,逐層縮小的外擴屋頂,帶環的青銅塔剎。
- 平臺和舞臺上有石燈籠(六角形基座、燈柱、帶自發光窗洞的火袋、小屋頂、寶珠)。

植被
- 約 4–5k 個樹冠團塊(由 icosphere 構成的 InstancedMesh,帶頂點噪聲位移 + 片元 bump),每棵樹 2–4 個成簇分佈,逐實例 AO 來自鄰近遮擋,頂部更亮。
- 通過一個實例屬性分爲四類:闊葉、櫻花、楓樹、松樹(扁平片層)。櫻花樹聚集在山丘較低處,並在平臺上作爲 5 棵樹幹可見的特色樹;松樹佔據山頂與海岬。
- 顏色來自各類別自身的深/淺色調色板 uniform,由 JS 跨季節混合。

季節(以 0..4 循環 = 春、夏、秋、冬;由 dock 上的按鈕觸發動畫過渡)
- 春:粉色櫻花,飄落的花瓣。夏:繁茂的綠色,無粒子。秋:紅色楓樹、橙/黃色闊葉,飄落的楓葉。冬:近乎光禿的褐色落葉樹冠團塊縮小約 38%,樹冠頂部、屋頂、平臺、巖石和地面覆雪;雪花落到水面便立刻融化。

水體(寫實,不要果凍感)
- 管線:不透明場景 → 帶 DepthTexture 的 MSAA HalfFloat 目標;複製到第二個目標,然後用自定義 ShaderMaterial 手動做深度測試來繪製水體;接着繪製漂浮粒子;最後做一次全屏 pass,包含 ACES 色調映射、sRGB 和輕微的移軸效果。透明 canvas 疊在 CSS 背景之上。
- 顏色來自真實厚度:重建每個水像素後方的深度,按 Beer–Lambert 吸收向深水散射色過渡,該顏色由用戶設定的水色推導而來(淺灘處偏淡,深水處呈藍色;側壁獲得額外的路徑長度,因而看起來像水體)。
- 屏幕空間折射、Fresnel 天空反射、由細微動態細節法線產生的陽光閃爍。
- 屏幕空間反射(針對深度緩衝約 26 步 ray-march,移動端步數更少),讓鳥居、神社和亮起的燈籠倒映在水中。
- 漣漪:在 256×256 HalfFloat ping-pong 目標上運行 GPU 波動方程,固定 60 Hz 步進,用陸地遮罩貼圖讓波浪在岸邊反射。光標移動會沿其軌跡注入膠囊形水滴;點擊會產生水花。
- 岸邊泡沫只出現在地形接近水位且坡度平緩的地方(懸崖、木樁或鳥居立柱周圍不會出現白色輪廓);泡沫帶寬度隨坡度縮放;並由噪聲打斷。
- 潮汐:dock 切換開關在高潮(0)與低潮(-0.55)之間做動畫過渡:水塊的邊緣移動,側面拉伸;低潮時整片淺灘露出,鳥居立在溼沙上。

粒子(花瓣 / 樹葉 / 雪,約 700 個實例化四邊形,CPU 模擬)
- 從櫻花團塊(春)、落葉樹團塊(秋)或天空(冬)生成;下落時飄擺;一陣陣風從島嶼吹向海灣,使它們能抵達水面。
- 落點:落在水面上時轉爲漂浮(頂點着色器用與水體相同的漣漪 + 波高將其抬起),緩慢漂移,被光標移動推動,被點擊濺起的水花吹走;潮水退去時擱淺,潮水上漲時重新浮起;落在陸地上則靜止並淡出。
- 形狀在片元着色器中繪製:帶缺刻的花瓣、五裂楓葉、柔和的雪片圓盤。對場景深度手動進行深度測試。

錦鯉
- 7 條錦鯉(車削體 + 分叉的扇形尾 + 胸鰭,合併爲一體),使用 InstancedMesh,頂點着色器中帶遊動擺尾,並按類型使用程序化花紋(kohaku、sanke、showa、ogon、純橙色)。它們四處遊蕩,避開淺水區和區塊壁面,並逃離光標與水花。在水面之下渲染,因此會受到折射和染色。

一天中的時間(滑塊,以 11:00 到約 19:10 的時鐘形式顯示)
- 太陽高度、顏色和強度、半球光顏色,以及水面的天空反射,都從正午向黃金時刻變化;臨近黃昏時障子面板和燈籠亮起(自發光),三盞暖色點光源照亮神社、舞臺和鳥居。

UI(雜誌編輯風格、極簡、英文)
品牌 “shiosai°” 配一個小鳥居標記,主標題 “A gate that / stands in the sea.”,眉題 “Shrine and tide, in miniature”,豎排說明 “A study of tide and seasons”,位置標籤 “Shrine Cove · 34°16′ N · 132°19′ E”,一個懸浮的膠囊形 dock(重置、季節循環並顯示當前季節名稱、High tide / Low tide 切換、Tune、全屏),頁腳中有提示文字和自適應的 FPS + “Season · time” 讀數,一塊玻璃質感的設置面板(季節、一天中的時間、飄落花瓣;水色、潮位、波高、漣漪強度、清澈度、焦散;太陽方位角、移軸),以及一張 “How it's made” 卡片。硃紅作爲點綴色,通過 CSS token 實現淺色與深色主題,適配 390 px(面板變爲底部抽屜),遵循 prefers-reduced-motion,使用自適應像素比,併爲觸屏設備提供更輕量的模式。開場:水面填滿區塊,同時相機緩緩推入。

溯源

原作者
vib3coded
發佈日期
2026-10-13(由推文 ID 反解)
原始出處
查看原帖 ↗
收錄來源
zhuyansen/awesome-opus-5.5-video · 2110014604524896392 · 未聲明授權