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