ai21.net
語言

果凍材質效果模型對比測試

示範影片

果凍材質效果模型對比測試 — 1

提示詞

Build "Citrus Jelly" — a single self-contained HTML file (inline JS/CSS, no libraries) with a real-time WebGPU soft-body jelly shaped like a half-moon citrus slice that the user can grab, stretch and let go.

Object
- A rounded half-moon slice: half-disk profile extruded into a thick slab with softly rounded edges; flat cut edge on the bottom, arc on top.
- Three material zones by radius: translucent fruit flesh inside, a pale pith band, and a thin glossy rind along the arc (the cut edge is all flesh).
- Inside the jelly: thin milky radial membranes between the segments (inset from both faces), a few seeds, small air bubbles with a faint rim and a pin-point highlight, and tiny sub-surface glints like sugar crystals.

Physics (XPBD tetrahedral soft body)
- Mesh: 2D Bowyer–Watson Delaunay of the profile, extruded into prisms and split into tets. Render mesh embedded in sim tets with barycentric coordinates.
- Constraints:
- co-rotational per-tet shape matching (warm-started quaternion, Müller 2016), which recovers inverted tets;
- tet volume constraints for near-incompressibility;
- hard edge strain limits (max 1.8×, min 0.35× rest length).
- Fixed timestep, "small steps" XPBD (many substeps, 1 iteration each).
- Damping: relative-velocity damping along edges, light air drag, and settling that bleeds off residual jitter.
- Floor contact with Coulomb-style positional friction (static and kinetic). Never crush the held patch into the floor; lift the patch instead.
- Grab and pull:
- pick a surface point with the mouse or touch;
- the patch around it is attached softly;
- reach is bounded, so stretching is strong but never unbounded;
- on release the slice wobbles back.
- Safety: reset gently if any value becomes NaN.

Rendering (WebGPU / WGSL)
- Procedural photo studio: pale cyclorama paper sweep, overhead softbox, back-left strip light, front-right fill card.
- Jelly material:
- refraction of the scene through the slice;
- view-ray thickness from a back-face depth pass, used for Beer–Lambert absorption;
- Fresnel studio reflections and a key highlight.
- Soft PCSS-style floor shadows, tinted by the jelly color.
- Post: exposure, Khronos PBR Neutral tone mapping, sRGB, dither. Optional mesh-overlay debug view.

UI (minimal editorial style, English)
- Corner label "Material Studies / No. 010", big title "Citrus / Jelly.", hint "Grab. Stretch. Let go."
- Variety swatches: Orange, Blood Orange, Lemon. Each changes the flesh, pith and rind colors.
- Sliders: Firmness (log-mapped edge compliance) and Internal damping.
- Buttons:
- "Give it a nudge": a small hop with a twist;
- Reset;
- Pause.
- Keys: Space to pause, N to nudge, R to reset.
- Fallback screen "This slice needs WebGPU." when the browser has no WebGPU.
- Responsive: works on mobile with touch and no horizontal scroll.

中文翻譯

構建 “Citrus Jelly” —— 一個單文件、自包含的 HTML 文件(內聯 JS/CSS,無庫),其中有一個實時 WebGPU 軟體果凍,形狀像半月形的柑橘切片,用戶可以抓取、拉伸並鬆手。

物體
- 一個圓潤的半月形切片:半圓盤輪廓拉伸成厚板,邊緣柔和圓潤;底部是平直的切邊,頂部是圓弧。
- 按半徑分爲三個材質區域:內部是半透明的果肉,一圈淡色的白皮層,以及沿圓弧分佈的薄而有光澤的外皮(切邊處全是果肉)。
- 果凍內部:瓣與瓣之間有薄薄的乳白色徑向隔膜(從兩個面內縮),幾粒籽,帶有微弱邊緣與針尖般亮點的小氣泡,以及像糖晶般細小的次表面閃光。

物理(XPBD 四面體軟體)
- 網格:對輪廓做 2D Bowyer–Watson Delaunay 三角剖分,拉伸成棱柱並拆分爲四面體。渲染網格通過重心座標嵌入仿真四面體。
- 約束:
- 每個四面體的共旋形狀匹配(熱啓動四元數,Müller 2016),可恢復翻轉的四面體;
- 四面體體積約束,以實現近似不可壓縮性;
- 硬性邊應變限制(最大 1.8×,最小 0.35× 靜止長度)。
- 固定時間步長,“小步長” XPBD(大量子步,每個子步 1 次迭代)。
- 阻尼:沿邊的相對速度阻尼、輕微空氣阻力,以及逐步消解殘餘抖動的沉降。
- 與地面的接觸採用 Coulomb 式位置摩擦(靜摩擦和動摩擦)。絕不要把被抓住的那片區域壓進地面;而是應將其抬起。
- 抓取與拉伸:
- 用鼠標或觸摸選取一個表麪點;
- 其周圍的那片區域被軟性附着;
- 抓取範圍有上限,因此拉伸力度強,但永遠不會無限;
- 鬆手後切片會晃動着回彈。
- 安全:任何數值變成 NaN 時溫和地重置。

渲染(WebGPU / WGSL)
- 程序化攝影棚:淺色無縫背景紙的弧形背景、頂置柔光箱、左後方條形燈、右前方補光板。
- 果凍材質:
- 場景透過切片的折射;
- 由背面深度通道得到的視線方向厚度,用於 Beer–Lambert 吸收;
- Fresnel 影棚反射和一處主高光。
- 柔和的 PCSS 風格地面陰影,帶果凍顏色的染色。
- 後期:曝光、Khronos PBR Neutral 色調映射、sRGB、抖動。可選的網格疊加調試視圖。

UI(極簡編輯風格,英文)
- 角落標籤 “Material Studies / No. 010”,大標題 “Citrus / Jelly.”,提示 “Grab. Stretch. Let go.”
- 品種色板:Orange、Blood Orange、Lemon。每個都會改變果肉、白皮層和外皮的顏色。
- 滑塊:Firmness(對數映射的邊柔度)和 Internal damping。
- 按鈕:
- “Give it a nudge”:帶扭轉的小跳一下;
- Reset;
- Pause。
- 按鍵:Space 暫停,N 輕推,R 重置。
- 當瀏覽器沒有 WebGPU 時,回退畫面顯示 “This slice needs WebGPU.”
- 響應式:在移動端支持觸摸,且沒有橫向滾動。

溯源

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