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 · 未声明许可