Sand AISand AI MAGI-2MAGI-2 现已上线 SandBase:支持原生音频的 1080p 视频立即试用

WebGPU Soft-Body Gummy Bears

Four translucent gummy bears on an ivory floor, rendered with native WebGPU. A deterministic 36-second choreography stretches, presses, flips and tumbles them before they settle back to the exact rest pose. Drag any bear to stretch, squish or toss it. A fixed-step tetrahedral XPBD solver in one offline HTML.

示例

Gummy Bears interactive WebGPU soft-body scene
在新标签页中打开

Gummy Bears interactive WebGPU soft-body scene

该示例在沙盒化的框架中运行,无法访问此页面。

在线运行

在 SandBase sandbox 中运行,并在 Lab 中查看结果。

在 Lab 中打开 ↗

你将获得什么

Bring a soft subject, its gesture choreography and an optional palette. The Skill returns a downloadable Skill, interactive demos and example videos.

工作原理

  1. 01

    Fill the Four Softies prompt

    Gummy Bears fills its prompt with node scripts/fill-prompt.mjs --slots assets/prompts/examples/four-softies.json --out prompt.md, then node scripts/new-project.mjs --out my-gummies and npm ci. The body shape, cage and gesture schedule are code in src/sim.mjs, so a new subject or choreography means editing that module and rerunning the tests. Copy lives in src/i18n/strings.json.

  2. 02

    Grab and toss a bear

    Four translucent bears on an ivory floor play a seekable 36-second choreography of stretch, lift, twist, press, drop, flip, tumble, tip and recover. Press on a bear to grab the surface; nearby material follows, ears and limbs lag, and a moving release tosses it. Each bear is a 4278-tet XPBD solid stepped on the CPU in Float64 at 1/120 s, drawn with native WebGPU and WGSL.

  3. 03

    Build, shoot and record

    npm run build:single writes the single HTML, npm run shoot -- --file dist-single/index.html runs the checks and npm run record makes the film with ffmpeg and ffprobe. Node 22.4 or newer is required. The release reported zero GPU errors, zero inverted tets, no NaN values, volume staying between 0.97 and 1.02 of rest, an exact recovery and a deterministic replay.

常见问题

Does Gummy Bears need WebGPU?

Yes. Gummy Bears requires WebGPU and has no WebGL fallback. It was verified on one machine, an Apple M5 with Metal in Chrome 155. Because the solver runs on the CPU, slow machines and phones step below real time.

What do the Gummy Bears sliders change?

Gummy Bears exposes Firmness and Internal damping, which animate with the choreography and change the physics. Dragging a slider overrides it until the next keyframe. The sidebar also offers Give it a nudge, Reset, quarter speed, Show mesh for the tetrahedral cage, Pause and a sound toggle.

Is the Gummy Bears physics realistic?

Gummy Bears is partly realistic. It runs a real tetrahedral XPBD solver, but all four bears move in lockstep, the late recovery is a kinematic blend to the exact rest pose, and the mass, volume and kinetic energy readout uses illustrative units.

Can I seek the Gummy Bears choreography?

Yes. Gummy Bears steps at a fixed 1/120 s, so window.gummyDemo.renderAt(t) seeks deterministically to any time. Adding ?capture=1 turns autonomous stepping off, which is how the film is recorded frame by frame.

Does Gummy Bears call any model?

No. Gummy Bears needs no credentials, paid calls or uploads, and loads no models, fonts, images or network assets at runtime. Any model use happens only in the coding agent you choose to edit it with. Sound is optional synthesized squishes that start muted.