ai21.net
言語

インタラクティブなゼリースイカのおもちゃ

インタラクティブなゼリースイカのおもちゃ — 1

プロンプト

Build "Whole Melon": a single self-contained HTML file (all JS/CSS inline, no build step, no libraries) with a big whole watermelon made of glossy jelly that you can grab, wobble and cut into pieces with a knife. Render with raw WebGPU (WGSL); if WebGPU is missing, show a clean fallback card.

SHAPE AND MATERIAL
- The melon is a signed distance field: an ellipsoid (~32 cm long) lying on its side with a softly flattened belly.
- Layers by depth under the skin: dark-green skin with irregular darker stripes running pole to pole (seamless all the way around), a pale pith band, then translucent red flesh that brightens toward the rind. Add a pale yellow field spot on the belly, a stem scar at one end and a blossom end at the other.
- About 700 seeds in a three-lobed ring at roughly two thirds of the radius (teardrops, wide end pointing outward), plus tiny air bubbles. Mesh seeds only near cut faces; a seed the knife goes through is kept by one side and eased just under the new face, so it shows through a thin film of jelly.
- Three varieties: Crimson, Golden, Rosé.

PIECES AND CUTTING
- Every piece is the melon SDF clipped by the half-spaces of the cuts that made it, with the fresh edges rounded (smooth max). All pieces share the melon's original rest frame, so rind, pith, stripes and seeds stay exactly where they grew.
- Knife tool: the user draws a line across the melon. Read the stroke on top of what it crosses to get a vertical blade plane. For each piece the plane passes through, fit the piece's best rotation, carry the plane into rest space, and split the piece in two.
- Build the new pieces cooperatively (generators with a per-frame time budget) while a steel knife (brushed blade, wooden handle with rivets) lines up over the stroke and presses a groove into the jelly. Swap the new pieces in the moment the edge breaks through, carrying over the position and velocity of the flesh they came from, and let the blade wedge them apart as it sinks. Allow up to about 24 pieces and reject slivers.
- For each piece: a surface-nets render skin (evaluate only the blocks near the surface, one Newton step onto it), a hex lattice in the piece's principal frame with boundary nodes snapped onto the surface, and a fast barycentric embedding.

PHYSICS (XPBD on the CPU, fixed 60 Hz, 6 substeps)
- Cell-wise co-rotational shape matching (8-node cells, warm-started rotation, strain stiffening), tet volume constraints for near-incompressibility, rind firmer than flesh.
- Edge damping, plus damping of each piece's deformation relative to its rigid motion (never its fall or tumble), rolling resistance on the table, and sleep when calm.
- Piece-to-piece contact against each other's exact SDF in a best-fit frame; sleeping pieces act as walls. Floor contact with Coulomb friction.
- Hand tool: grab any piece and pull (soft patch attachment, with enough reach to drag pieces across a wide table). Scroll or a second finger twists while holding. Pinch or scroll zooms; dragging the empty table orbits the camera.

RENDERING (a photographic product shot)
- Procedural studio: pale paper sweep, overhead softbox, back-left strip light, cool fill card.
- Jelly: front faces refract the scene behind by the view-ray thickness (nearest-back-face pass), with Beer–Lambert absorption per material, milky scattering in the pith, a back-lit glow at thin edges, sugar glints, Fresnel studio reflections and GGX highlights.
- Seeds, bubbles and the knife are drawn before the jelly, so they are seen refracted through it.
- Normals follow the jelly's local deformation (cofactor of the node-averaged deformation gradient).
- A soft key shadow coloured by what the light crossed first (rosy through flesh, dark through rind), plus contact occlusion from a top-down height map. MSAA, Khronos PBR Neutral tone mapping.

UI (editorial, like a material study)
- Kicker "Material Studies / No. 010" and a big italic serif title "Whole / Melon."
- A panel with Tool (Hand / Knife), Variety, Firmness and Internal damping sliders, Nudge, Reset, ¼ speed, Show mesh and Pause.
- Live readouts: mass, volume %, kinetic energy, piece count. A collapsible "Inside the experiment" note.
- Responsive down to phones.

Quality bar: it should look and move like a real glossy jelly watermelon, and every cut face should look like a sliced jelly melon with seeds just under the surface. Test headlessly with screenshots: the whole melon, mid-cut, many pieces, a close-up of a cut face, and mobile.

日本語訳

「Whole Melon」を作成してください:単一の自己完結型 HTML ファイル(すべての JS/CSS はインライン、ビルド手順なし、ライブラリなし)で、光沢のあるゼリーでできた大きな丸ごとのスイカを実装します。つかんで揺らし、ナイフで切り分けられます。生の WebGPU(WGSL)でレンダリングし、WebGPU が利用できない場合は、きれいなフォールバックカードを表示してください。

形状とマテリアル
- メロンは符号付き距離場です:横に寝かせた楕円体(長さ約 32 cm)で、腹部はやわらかく平らになっています。
- 表皮からの深さ方向の層:濃い緑の表皮に、極から極へ走る不規則な濃い縞模様(全周シームレス)、淡い白の果皮層、そして果皮に向かって明るくなる半透明の赤い果肉。腹部には淡い黄色の接地斑(フィールドスポット)、一端にはヘタ跡、もう一端には花落ち痕を加えてください。
- 半径のおよそ 3 分の 2 の位置に、3 つのローブを持つリング状に約 700 粒の種(涙形で、広い端が外側を向く)、さらに小さな気泡。種は切断面の近くでのみメッシュ化します。ナイフが通過した種は片側に保持され、新しい面のすぐ下に収まるため、薄いゼリーの膜越しに見えます。
- 3 つの品種:Crimson、Golden、Rosé。

ピースと切断
- すべてのピースは、メロンの SDF を、そのピースを作った切断の半空間でクリップしたもので、新しいエッジは丸められています(スムースマックス)。すべてのピースはメロンの元の静止座標系を共有するため、果皮、白い層、縞模様、種は育った位置に正確にとどまります。
- ナイフツール:ユーザーがメロンの上に線を描きます。それが横切るものの上でストロークを読み取り、垂直な刃の平面を得ます。平面が通る各ピースについて、そのピースの最適な回転をフィットし、平面を静止空間へ移し、ピースを 2 つに分割します。
- 新しいピースは協調的に(フレームごとの時間予算を持つジェネレーターで)構築し、その間、鋼のナイフ(ヘアライン仕上げの刃、リベット付きの木製ハンドル)がストロークの上に位置を合わせ、ゼリーに溝を押し込みます。刃が貫通した瞬間に新しいピースへ差し替え、元の果肉の位置と速度を引き継ぎ、刃が沈み込むにつれてピースを押し分けます。最大約 24 ピースまで許可し、薄片は却下してください。
- 各ピースについて:サーフェスネットによるレンダリング用スキン(表面付近のブロックのみを評価し、表面へ 1 回のニュートン法ステップ)、ピースの主軸座標系における六面体格子で境界ノードを表面へスナップ、そして高速な重心座標埋め込み。

物理(CPU 上の XPBD、固定 60 Hz、6 サブステップ)
- セル単位の共回転シェイプマッチング(8 ノードセル、ウォームスタート回転、ひずみ硬化)、非圧縮性に近づけるテトラ体積拘束、果肉より硬い果皮。
- エッジ減衰に加え、各ピースの剛体運動に対する変形の減衰(落下や回転は決して減衰させない)、テーブル上の転がり抵抗、静止時のスリープ。
- ピース同士の接触は、ベストフィット座標系で互いの正確な SDF に対して行います。スリープ中のピースは壁として機能します。床との接触にはクーロン摩擦を使用。
- ハンドツール:任意のピースをつかんで引っ張れます(ソフトパッチ接続、広いテーブル上でピースを引きずれるだけのリーチあり)。保持中にスクロールまたは 2 本目の指でひねります。ピンチまたはスクロールでズーム、空のテーブルをドラッグするとカメラが周回します。

レンダリング(写真のような製品撮影)
- プロシージャルなスタジオ:淡いペーパーのスイープ、頭上からのソフトボックス、左後方からのストリップライト、クールなフィルカード。
- ゼリー:前面は視線方向の厚み(最近接背面パス)に応じて背後のシーンを屈折し、マテリアルごとの Beer–Lambert 吸収、白い層での乳白色散乱、薄いエッジでの逆光グロー、砂糖のきらめき、フレネルのスタジオ反射、GGX ハイライトを適用します。
- 種、気泡、ナイフはゼリーより先に描画されるため、ゼリー越しに屈折して見えます。
- 法線はゼリーの局所変形(ノード平均変形勾配の余因子)に従います。
- 光が最初に通過したものによって色づく柔らかなキーシャドウ(果肉を通ればバラ色、果皮を通れば暗色)、さらに上面のハイトマップによるコンタクトオクルージョン。MSAA、Khronos PBR Neutral トーンマッピング。

UI(素材研究のような編集的なデザイン)
- キッカー「Material Studies / No. 010」と、大きなイタリック体セリフのタイトル「Whole / Melon」。
- パネルには Tool(Hand / Knife)、Variety、Firmness、Internal damping のスライダー、Nudge、Reset、¼ speed、Show mesh、Pause。
- ライブ表示:質量、体積 %、運動エネルギー、ピース数。折りたたみ可能な「Inside the experiment」ノート。
- スマートフォンまでレスポンシブ対応。

品質基準:本物の光沢あるゼリースイカのように見え、動くべきです。また、どの切断面も、表面のすぐ下に種がある、切り分けられたゼリーメロンのように見えるべきです。スクリーンショットでヘッドレスにテストしてください:丸ごとのメロン、切断中、多数のピース、切断面のクローズアップ、モバイル。

出典

原作者
vib3coded
公開日
2026-10-02(由推文 ID 反解)
原典
元の投稿を見る ↗
収録元
zhuyansen/awesome-opus-5.5-video · 2106056420131029473 · ライセンス未表明