ai21.net
言語

港のクラゲ水体物理エフェクト比較

港のクラゲ水体物理エフェクト比較 — 1

プロンプト

Build "Harbor Jelly" — a single self-contained HTML file (no external requests, no libraries) that renders an interactive 3D diorama with WebGPU/WGSL: a small working container harbor set inside a square block of wobbly, translucent jelly sea, sitting on a paper studio backdrop. It belongs to a series called "Material Studies", so match that look: warm paper background, serif italic display title ("Harbor Jelly."), small uppercase eyebrow "MATERIAL STUDIES", a status pill top-right ("WebGPU · Live"), a frosted control panel on the right, and a "How to play" line bottom-left. English UI. Light theme only, by design.

THE BLOCK
- A 5.2 × 5.2 block seen from a 3/4 orbit camera. The ground and sea are cut flat at the block's sides, so you see candy-coloured soil strata in cross-section, and the sea's cut faces show everything underwater through the jelly.
- The water is a real-time linear shallow-water simulation on a staggered grid (heights at cell centres, velocities on faces) with a little surface tension, so it feels like jelly. Render it with refraction, absorption by depth, caustics projected onto the floor, light shafts, a Fresnel studio reflection, foam (wakes, splashes, a shoreline lace) and a bright meniscus on the cut edges.
- The whole block can be tipped by dragging its side. The water sloshes to the low side, the jelly shears and quivers, then it settles flat again.

THE HARBOR (layout)
- Along the back runs a vertical concrete quay wall, with rubber fenders, bollards, ladders, and mussels and weed crusting it below the waterline.
- Left part: a container terminal. A flat asphalt yard with painted lines, concrete strips with two crane rails, light towers, and a small terminal office. Hundreds of colourful containers are stacked in neat rows. Each is a ribbed steel box with door ends and darker corner posts, drawn as GPU instances in about ten liveries.
- Right part: an old stone fishing quay with a cobbled promenade, a corrugated fish-market shed and lamp posts. A timber pier stands on mussel-covered piles with cross-bracing, with two small fishing boats moored alongside.
- Behind it all, a town climbs a grassy hill: three rows of gabled houses in Nordic harbour colours (falu red, ochre, white, pale blue, mint, pink) with tiled or slate roofs, white-framed windows, doors and chimneys. There is a white church with a green copper spire, and some round trees.
- A rubble breakwater shelters the fishing harbour, with a concrete crown wall. Big rocks sit near the crest, smaller weedy ones tumble down under water. On its head stands a red-and-white banded lighthouse with a gallery and a glass lantern, whose lamp slowly turns.
- In the open basin: two small yachts swinging on their moorings (white hulls, coloured stripe, fin keels visible through the jelly, furled sails), yellow mooring buoys, and a green channel buoy, all bobbing on the waves.
- On the floor: pale sand with drifts of silt, weed tufts, stones, starfish, an old anchor with chain, a lost tyre.

THE SHIP'S DAY (fully automatic loop, about 100 s)
1. A small feeder container ship (navy topsides, red antifouling, white accommodation block at the stern with bridge wings, funnel with a yellow band, turning radar, visible propeller) lies alongside with containers on deck, 6 bays × 4 rows × 2 tiers.
2. Two ship-to-shore gantry cranes on the rails, one red and one blue, each with portal legs, a backreach with a machinery house, an A-frame with forestays, a hinged boom, a trolley with a hanging cab, and a yellow spreader on four wire falls. They lower their booms and swap boxes: unload from the tops of the ship's stacks into yard stacks, then load other boxes aboard. Every move is a smooth sequence: travel, trolley out, lower onto the box (tracking the ship's bobbing), latch, hoist, trolley across, lower, unlatch. Cranes never get closer than their leg width; an idle crane moves out of the other's way.
3. When the work is done the trolleys park, the booms swing up, and a tug comes round to the bow. The tug has a black hull, white and red superstructure, a tyre fender all round, a big bow fender, and puffs of funnel smoke. It passes a tow line and backs away, pulling the bow off the quay while the ship swings out. Then the line is cast off, the tug pivots on the spot and goes home, and the ship sounds her horn.
4. The ship sails a lap of the harbour along a smooth path, past the lighthouse. She rides the water on several sample points (heave, pitch, roll) and hands the displaced water back to the sim, so she leaves a real bow wave, wake and white water.
5. Meanwhile the tug goes out to a standby spot. When the ship stops off the quay, the tug noses in and pushes her sideways onto the fenders, with prop wash churning. Then it backs off, the booms come down, and the cranes start again.
- Keep everything collision-free (ship and tug vs. quay, breakwater, pier, yachts and buoy; no grounding). Check it with a headless node test.

LIFE
- Fish schools (mackerel, herring, small orange wrasse) as boids that stay in the water and under the hulls, scatter from fingers, splashes and moving ships, and come to food.
- Moon jellyfish: glassy pulsing bells with four pink rings, frilly oral arms and a fringe of tentacles. They drift with the water flow.
- Herring gulls (white body, grey mantle, black wingtips, yellow bill with a red spot). They circle, bank and glide, and land on perches: lamps, roof ridges, the church spire, the lighthouse gallery, the crane apexes, the ship's mast, the tug, the yachts' masthead. Perches on moving things move with them. They all take off when the horn sounds, and some dive at food.
- Steam puffs from the ship's funnel on the horn; tiny bubbles caught in the jelly.

CONTROLS (right panel; bottom sheet on phones)
- "Cast off" sends the ship early (cranes finish the box in hand). At sea the button becomes "Call her in" and hurries her home; it greys out while busy.
- "Horn" (also Space) plays a synthesized WebAudio ship horn: two low detuned sawtooth reeds a fifth apart, low-passed, starting only after a user gesture. It also blows steam and scatters the gulls.
- "Feed the fish" scatters pellets off the end of the pier; fish rush in and gulls swoop down.
- Tally: Boxes moved / Voyages / Fed. A ship status line ("Unloading 3 / 8", "Loading", "Booms up", "Tug coming", "Casting off", "At sea 40%", "Coming in", "Berthing"). A small activity meter.
- Flavour swatches change the water colour and strata: Sea glass (teal-mint), Blueberry (deep blue), Lime.
- Sliders: Firmness, Wave damping, Tide (±10 cm; the sea level, ships and floating things follow).
- Buttons: Reset, Pause, Sound on/off, Reset view.

POINTER INTERACTION
- Drag across the water to make waves (with a crosshair cursor).
- Drag the side of the block to tip it.
- Pick up an orange-and-white lifebuoy and throw it. Lifebuoys float flat on the waves, bounce off the pier, buildings and breakwater, and are shoved aside by the ship and tug.
- Drag empty space or right-drag to orbit; scroll or pinch to zoom.
- On phones: touch orbit, pinch zoom, and a collapsible bottom sheet for the controls.

RENDERING DETAILS
- Pipeline: shadow map → caustics pass → opaque scene (with a distance buffer) → back-face pass of the water → water pass over a copy of the scene → tone map + dither.
- Moving rigs are static vertex buffers whose vertices carry an object id; about 24 object transforms (position + quaternion) live in the uniform buffer. Cables are drawn with one end in each object's frame, so they stretch: crane falls, forestays, the tow line.
- Material kinds in the prop shader: matte paint, glass, gloss steel, roof tiles, timber grain, corrugated sheet (normal-perturbed ribs), dressed-stone masonry, rubber, rock, glowing lamps, swaying weed, and hulls with antifouling below a boot-top line.
- The jelly shear and squash wobble applies to everything inside the block.

QUALITY BAR
- Smooth on a laptop; simulation under about 2 ms per frame.
- A friendly fallback screen if WebGPU is missing or the adapter fails.
- No console errors, no page scroll. Respect prefers-reduced-motion.
- Ship it with a headless test of the choreography and a Playwright end-to-end test.

日本語訳

「Harbor Jelly」を制作する — 単一の自己完結型 HTML ファイル(外部リクエストなし、ライブラリなし)で、WebGPU/WGSL を用いてインタラクティブな 3D ジオラマをレンダリングする。小さく稼働するコンテナ港が、ぷるぷると半透明のゼリーの海の正方形のブロックの中に収まり、紙のスタジオ背景の上に置かれている。これは「Material Studies」シリーズの一部なので、その見た目に合わせること:温かい紙の背景、セリフ体イタリックの表示タイトル(「Harbor Jelly.」)、小さな大文字のアイブロー「MATERIAL STUDIES」、右上のステータスピル(「WebGPU · Live」)、右側のすりガラス調コントロールパネル、左下の「How to play」の行。UI は英語。デザイン上、ライトテーマのみ。

ブロック
- 3/4 オービットカメラから見た 5.2 × 5.2 のブロック。地面と海はブロックの側面で平らにカットされているので、断面にはキャンディ色の土壌層が見え、海のカット面ではゼリー越しに水中のすべてが見える。
- 水はスタッガードグリッド上のリアルタイム線形浅水シミュレーション(高さはセル中心、速度はフェイス上)で、表面張力を少し効かせているため、ゼリーのように感じられる。屈折、深さによる吸収、床に投影されるコースティクス、光の筋、フレネルのスタジオ反射、泡(航跡、しぶき、岸辺のレース状の泡)、カットエッジの明るいメニスカスでレンダリングする。
- ブロック全体は側面をドラッグして傾けられる。水は低い側へちゃぷんと寄り、ゼリーはせん断して震え、やがて平らに戻る。

港(レイアウト)
- 奥に沿って垂直なコンクリートの岸壁が走り、ゴムフェンダー、ボラード、はしご、そして喫水線より下にはムール貝や海藻がこびりついている。
- 左側:コンテナターミナル。塗装されたラインの入った平らなアスファルトのヤード、2本のクレーンレールを備えたコンクリート帯、照明塔、小さなターミナル事務所。何百ものカラフルなコンテナが整然と列をなして積まれている。それぞれがドアエンドと色の濃いコーナーポストを持つリブ付きの鋼製ボックスで、約10種類の塗装で GPU インスタンスとして描画される。
- 右側:古い石造りの漁港で、石畳のプロムナード、波板の魚市場小屋、街灯がある。木材の桟橋がムール貝に覆われた杭の上に交差ブレースで立ち、2隻の小さな漁船が横付けされている。
- そのすべての背後では、町が草の生えた丘を登っていく:北欧の港町の色(ファルーレッド、オーカー、白、淡い青、ミント、ピンク)の切妻屋根の家が3列、瓦屋根またはスレート屋根、白い枠の窓、ドア、煙突。緑青の尖塔を持つ白い教会と、いくつかの丸い木々。
- 瓦礫の防波堤が漁港を守り、コンクリートのクラウンウォールがある。頂部付近に大きな岩が、水中へは海藻の付いた小さな岩が転がり落ちている。その先端には赤白の縞模様の灯台が立ち、ギャラリーとガラスのランタンを備え、その灯りはゆっくりと回転する。
- 開けた入り江には、係留索で揺れる2隻の小さなヨット(白い船体、色の付いたストライプ、ゼリー越しに見えるフィンキール、畳まれた帆)、黄色い係留ブイ、緑の航路ブイがあり、すべて波に揺られている。
- 床には、淡い砂と漂うシルト、海藻の房、石、ヒトデ、鎖の付いた古い錨、捨てられたタイヤ。

船の一日(完全自動ループ、約100秒)
1. 小型のフィーダーコンテナ船(紺色の舷側、赤い防汚塗装、船尾に白い居住区ブロックとブリッジウィング、黄色い帯の付いたファンネル、回転するレーダー、見えるプロペラ)が、甲板にコンテナを積んで(6ベイ × 4列 × 2段)横付けしている。
2. レール上の2基の船岸ガントリークレーン、1基は赤、1基は青。それぞれにポータルレッグ、機械室付きのバックリーチ、フォアステー付きの A フレーム、ヒンジ式ブーム、吊り下げキャビン付きのトロリー、4本のワイヤーフォールに吊られた黄色いスプレッダーを備える。ブームを下ろして箱を交換する:船のスタックの上からヤードのスタックへ荷降ろしし、その後ほかの箱を船に積み込む。すべての動きは滑らかなシーケンス:走行、トロリー前進、箱の上へ降下(船の上下動を追従)、ラッチ、巻き上げ、トロリー横移動、降下、ラッチ解除。クレーン同士は脚幅より近づかない。待機中のクレーンはもう一方の邪魔にならないよう退く。
3. 作業が終わるとトロリーは所定位置に収まり、ブームが上がり、タグボートが船首へ回ってくる。タグボートは黒い船体、白と赤の上部構造、全体を囲むタイヤフェンダー、大きな船首フェンダー、ファンネルからの煙を備える。曳航索を渡して後退し、船が振り出すあいだ船首を岸壁から引き離す。その後索が放され、タグボートはその場で旋回して帰り、船は汽笛を鳴らす。
4. 船は滑らかな経路に沿って港を一周し、灯台のそばを通る。船は複数のサンプルポイント(ヒーブ、ピッチ、ロール)で水面に乗り、押しのけた水をシミュレーションに返すので、本物の船首波、航跡、白波を残す。
5. その間、タグボートは待機地点へ向かう。船が岸壁の沖で止まると、タグボートは接近して横から押し、フェンダーに当てる。プロペラ後流がかき混ぜる。その後後退し、ブームが下りてクレーンが再び動き出す。
- すべてを衝突なしに保つ(船とタグボート対岸壁、防波堤、桟橋、ヨット、ブイ;座礁なし)。ヘッドレスの node テストで確認すること。

生き物
- 魚群(サバ、ニシン、小さなオレンジ色のベラ)はボイドとして、水中および船体の下にとどまり、指、しぶき、動く船から散り、餌に集まる。
- ミズクラゲ:ガラスのように脈打つ傘に4つのピンクのリング、ひらひらの口腕と触手の房。水の流れに乗って漂う。
- セグロカモメ(白い体、灰色のマント、黒い翼端、赤い斑点のある黄色いくちばし)。旋回し、バンクして滑空し、止まり木に降りる:街灯、屋根の棟、教会の尖塔、灯台のギャラリー、クレーンの頂部、船のマスト、タグボート、ヨットのマストヘッド。動くものの上の止まり木はそれと一緒に動く。汽笛が鳴るとすべて飛び立ち、一部は餌へ急降下する。
- 汽笛のときに船のファンネルから蒸気が噴き出し、ゼリーの中に小さな気泡が捕まる。

操作(右パネル;スマートフォンではボトムシート)
- 「Cast off」は船を早めに発たせる(クレーンは手元の箱を終わらせる)。海上ではボタンが「Call her in」になり、船を急いで帰港させる。作業中はグレーアウトする。
- 「Horn」(Space も)は WebAudio で合成した船の汽笛を鳴らす:低くデチューンされた2本のノコギリ波のリードを5度離して重ね、ローパスを通し、ユーザーのジェスチャーの後にだけ開始する。蒸気も吹き出し、カモメを散らす。
- 「Feed the fish」は桟橋の端からペレットを撒く。魚が殺到し、カモメが舞い降りる。
- 集計:Boxes moved / Voyages / Fed。船のステータス行(「Unloading 3 / 8」「Loading」「Booms up」「Tug coming」「Casting off」「At sea 40%」「Coming in」「Berthing」)。小さなアクティビティメーター。
- フレーバーのスウォッチは水の色と地層を変える:Sea glass(teal-mint)、Blueberry(deep blue)、Lime。
- スライダー:Firmness、Wave damping、Tide(±10 cm;海面、船、浮遊物が追従する)。
- ボタン:Reset、Pause、Sound on/off、Reset view。

ポインター操作
- 水面をドラッグして波を作る(クロスヘアカーソル付き)。
- ブロックの側面をドラッグして傾ける。
- オレンジと白の救命浮環を持ち上げて投げる。救命浮環は波の上に平らに浮き、桟橋、建物、防波堤で跳ね返り、船とタグボートに押しのけられる。
- 空の空間をドラッグするか右ドラッグでオービット;スクロールまたはピンチでズーム。
- スマートフォンでは:タッチでオービット、ピンチでズーム、コントロール用の折りたたみ式ボトムシート。

レンダリングの詳細
- パイプライン:シャドウマップ → コースティクスパス → 不透明シーン(距離バッファ付き)→ 水の裏面パス → シーンのコピーに対する水パス → トーンマップ + ディザ。
- 動くリグは静的頂点バッファで、頂点はオブジェクト ID を持つ;約24個のオブジェクト変換(位置 + クォータニオン)がユニフォームバッファにある。ケーブルは両端がそれぞれのオブジェクトのフレームにあるように描かれるので伸縮する:クレーンのフォール、フォアステー、曳航索。
- プロップシェーダーのマテリアル種別:マットペイント、ガラス、光沢鋼、屋根瓦、木目、波板(法線でリブを付ける)、加工石の石積み、ゴム、岩、光るランプ、揺れる海藻、ブートトップラインより下が防汚塗装の船体。
- ゼリーのせん断とスカッシュの揺れはブロック内のすべてに適用される。

品質基準
- ラップトップで滑らかに動く;シミュレーションは1フレームあたり約2 ms 未満。
- WebGPU がない、またはアダプターが失敗した場合の親切なフォールバック画面。
- コンソールエラーなし、ページスクロールなし。prefers-reduced-motion を尊重する。
- 振り付けのヘッドレステストと Playwright のエンドツーエンドテストを付けて出荷する。

出典

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