ai21.net
言語

ブラウザで操作できる3Dゼリーオレンジ

ブラウザで操作できる3Dゼリーオレンジ — 1

プロンプト

Build "Whole Orange Jelly" — a single self-contained HTML file (inline JS/CSS, no libraries): a real-time WebGPU soft-body whole orange made of jelly. The user can grab and stretch it, and cut it with a knife into wheels, wedges and small pieces. Every piece is its own wobbling body.

Shape and pieces
- The orange is a signed distance field: a gently oblate ellipsoid (polar half-length 1.27 along x, equatorial radius 1.36) lying on its side, with a softly flattened seat on the floor.
- Every piece is that field clipped by the half-spaces n·X ≤ c of the cuts that made it, with the fresh edges rounded (smooth max, k ≈ 0.085). All pieces share the orange's original rest frame, so the anatomy stays where it grew.
- Per piece:
- a surface-nets render skin (0.042 grid) projected onto the field;
- a hex lattice for the simulation in the piece's own principal frame, with boundary nodes snapped to the surface;
- barycentric embedding of render vertices into the lattice tets.
- Up to 30 pieces; slivers are rejected.

Anatomy (all in rest space, so every cut shows it where it really is)
- Zest (0.07 deep) with oil-gland pores, a mottled tone, a green stem button at one end and a small navel at the other.
- White pith (to 0.19 deep).
- 11 segments around the stem axis, with thin milky membrane walls (slightly jittered, bowed and wandering along the axis) and a pithy core along the axis.
- Juice vesicles: teardrop sacs fanning out from the core within each segment.
- 16 pale citrus pips near the core, pointed end inward; a few small bubbles in the flesh.
- A pip that a cut goes through is kept by the side holding its centre and eased just under the new face.

Physics (XPBD)
- Per piece: hex cells with co-rotational shape matching plus volume constraints on their five tets.
- Zest and pith firmer than the flesh.
- Edge and deformation damping; floor contact with Coulomb friction and a little rolling resistance.
- Piece–piece contact against each other's exact rest shape in a best-fit frame.
- Sleeping pieces that wake on touch; fixed 60 Hz step with small substeps.

Knife
- A nakiri-style knife: draw a stroke across the orange.
- The stroke, read on the top of what it crosses, fixes a vertical blade plane, carried into each crossed piece's rest frame by its best-fit rotation and added as a half-space.
- The new pieces are built incrementally while the knife lines up, presses a groove and cuts straight down. They take over the position and speed of the jelly they came from, and the blade wedges the faces apart.

Rendering (WebGPU / WGSL)
- Procedural photo studio. Soft PCSS key shadow tinted by the jelly, plus contact AO from a height map.
- Back-face thickness; refraction of the scene, with each tap dimmed by its own path length.
- A volumetric march through the jelly in rest space, using a per-vertex inverse deformation gradient:
- zest, pith, membranes/core and flesh each absorb with their own colour (Beer–Lambert);
- scattering is grey (only absorption is coloured), so light scattered out of orange flesh stays orange.
- The white pith, the membrane star and the core read crisply on cut faces.
- Back-lit glow at thin edges, Fresnel studio reflections, GGX highlights, sugar-crystal glints.
- Post: Khronos PBR Neutral tone mapping, sRGB, dither.

UI (editorial "Material Studies / No. 032", English)
- Italic serif title "Whole / Orange." with the caption "Eleven segments, set in jelly. Zest, pith and juice. Cut it as small as you like."
- Status pill "WEBGPU · LIVE".
- Tools: Hand / Knife. Varieties: Navel, Blood, Cara Cara.
- Firmness and Internal damping sliders; Give it a nudge, Reset, Pause; ¼ speed and Show mesh.
- Readouts: Mass (g, 1 unit ≈ 3 cm at 1.3 g/cm³), Volume (% of rest), Kinetic (mJ), Pieces.
- A collapsible "Inside the experiment" with notes on the method.
- Fallback without WebGPU. Stacked mobile layout with no horizontal scroll.

日本語訳

「Whole Orange Jelly」を作って — 単一の自己完結した HTML ファイル(インライン JS/CSS、ライブラリなし):ゼリーでできた丸ごとのオレンジをリアルタイム WebGPU で動かすソフトボディ。ユーザーはつかんで伸ばしたり、ナイフで輪切り、くし形、小さなかけらに切り分けたりできる。どのピースも、それぞれが独立してぷるぷる震えるボディになる。

形状とピース
- オレンジは符号付き距離場:緩やかに扁平な楕円体(x 方向の極半径 1.27、赤道半径 1.36)を横倒しにしたもので、床に接する座がやわらかく平らになっている。
- 各ピースは、その切断を生んだ半空間 n·X ≤ c でこの場をクリップしたもので、新しい切り口の縁は丸められている(スムーズマックス、k ≈ 0.085)。すべてのピースはオレンジ本来の静止フレームを共有するので、内部構造は育った場所にとどまる。
- ピースごとに:
- 場に投影されたサーフェスネットのレンダー用スキン(0.042 グリッド);
- ピース自身の主フレーム内でシミュレーションを行う六角格子。境界ノードは表面にスナップされる;
- レンダー頂点の、格子の四面体への重心座標埋め込み。
- ピースは最大 30 個。細片は却下される。

内部構造(すべて静止空間内にあるので、どの断面にも本来ある場所に現れる)
- 果皮(深さ 0.07)。油胞の毛穴があり、まだらな色合いで、一端に緑のヘタ、もう一端に小さなへそがある。
- 白い中果皮(深さ 0.19 まで)。
- 軸のまわりに 11 房。薄い乳白色の膜壁(わずかに揺らぎ、軸に沿って弓なりにうねる)と、軸に沿った白い芯を持つ。
- 果汁胞:各房の内側で芯から扇状に広がる涙滴形の袋。
- 芯の近くに 16 個の淡い柑橘の種。先端は内側を向く;果肉の中には小さな気泡がいくつか。
- 切断が通る種は、その中心を保持する側に残され、新しい面のすぐ下に収められる。

物理(XPBD)
- ピースごとに:共回転シェイプマッチング付きの六角セルに加え、5 つの四面体に対する体積拘束。
- 果皮と中果皮は果肉より硬い。
- エッジと変形のダンピング;床との接触にはクーロン摩擦と少しの転がり抵抗。
- ピース同士の接触は、ベストフィットフレーム内で互いの正確な静止形状に対して行う。
- 触れると目覚めるスリーピング状態のピース;60 Hz 固定ステップと小さなサブステップ。

ナイフ
- 菜切り包丁風のナイフ:オレンジを横切るストロークを描く。
- ストロークは、横切る対象の上面で読み取られ、垂直な刃の平面を定める。その平面はベストフィット回転によって横切られる各ピースの静止フレームへ運ばれ、半空間として追加される。
- 新しいピースは、ナイフが狙いを合わせ、溝を押しつけ、まっすぐ下へ切るあいだに段階的に構築される。それらは元のゼリーの位置と速度を引き継ぎ、刃が面を押し開く。

レンダリング(WebGPU / WGSL)
- プロシージャルなフォトスタジオ。ゼリーで色づいた柔らかな PCSS キーシャドウに加え、ハイトマップによるコンタクト AO。
- 裏面の厚み;シーンの屈折。各サンプルは自身の経路長で減衰する。
- 静止空間内でゼリーを通して行うボリューメトリックマーチ。頂点ごとの逆変形勾配を使用:
- 果皮、中果皮、膜/芯、果肉がそれぞれ独自の色で吸収する(ベール・ランベルト);
- 散乱はグレー(色がつくのは吸収のみ)なので、オレンジの果肉から散乱して出る光はオレンジのまま。
- 白い中果皮、膜の星形、芯が切断面にくっきりと浮かぶ。
- 薄い縁の逆光グロー、フレネルのスタジオ反射、GGX ハイライト、砂糖の結晶のきらめき。
- ポスト:Khronos PBR Neutral トーンマッピング、sRGB、ディザ。

UI(エディトリアル調「Material Studies / No. 032」、英語)
- イタリックのセリフ体タイトル「Whole / Orange.」、キャプションは「Eleven segments, set in jelly. Zest, pith and juice. Cut it as small as you like.」。
- ステータスピル「WEBGPU · LIVE」。
- ツール:Hand / Knife。品種:Navel、Blood、Cara Cara。
- Firmness と Internal damping のスライダー;Give it a nudge、Reset、Pause;¼ speed と Show mesh。
- 読み取り値:Mass(g、1 単位 ≈ 3 cm、1.3 g/cm³)、Volume(静止時の %)、Kinetic(mJ)、Pieces。
- 折りたたみ式の「Inside the experiment」。手法に関するメモつき。
- WebGPU がない場合のフォールバック。水平スクロールなしの縦積みモバイルレイアウト。

出典

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