ai21.net
語言

3D西瓜毛髮渲染對比

示範影片

3D西瓜毛髮渲染對比 — 1

提示詞

Build a single self-contained HTML page (no build step) showing an interactive 3D "Fluffy Watermelon" covered in long fur, rendered with WebGL using three.js r147 (UMD build: https://cdn.jsdelivr.net/npm/[email protected]/build/three.min.js). All UI text in English.

SCENE & LOOK
- Full-screen canvas on a soft watermelon-flesh pink studio background: vertical gradient #ECB3AB → #F7CFC7 (lighter band in the middle) → #E8A9A0, used as the scene background.
- A big oblong watermelon lying on its side along the X axis: half-length 1.38, radius 0.98, blunt barrel-like ends, small dimples at both ends, slightly flattened belly, subtle surface unevenness. Start in a 3/4 view (about -0.32 rad around Y, 0.1 rad tilt), camera FOV 30°, framed to fill ~80% of the height.
- Rind pattern under the fur: light green (#A8D66B) with 16 dark green (#1C4D1C) stripes running stem to blossom, with ragged finger-like edges (sine meander + value noise), plus a pale cream "field spot" on the underside. Each hair takes the colour of its own root, so the stripes stay crisp through the fur.
- A short, dried, ribbed stem stub at one end with a slightly domed pale cut cap, and a thin curly helical tendril springing from beside it.
- One directional light from upper-left-front, wrap diffuse, Kajiya-Kay anisotropic highlight along the hair tangent, darker roots (occlusion by hair height), slight per-hair brightness variation.

FUR (most important: it must look crisp, never blurry)
- Fur length 0.2 units. Hairs grow out along the normal, then bend: combed from the stem end toward the blossom end and draped down the flanks (no whorls at the ends), plus slight gravity.
- Undercoat: shell texturing with ~64 instanced shells of the body mesh that reach only 50% of the fur length. Procedural hair cells in UV space (density scaled so one cell is ~3.4 device pixels at the default view), two hair populations (long + fine underfur), hairs gathering into locks toward their tips, analytic anti-aliased coverage, alpha blending, shells write depth. Fade shells out where the surface is seen edge-on and discard faint fragments, so no dotted rim appears at the outline.
- Guard hairs: ~90,000 individual tapered, camera-facing ribbon strands (instanced, 7 segments each) that follow exactly the same bend function, with a minimum width of ~0.75 px so they stay sharp. Draw them twice: once before the shells and once after (depth-tested), so faint edge fur never hides them and they always lie crisply on top.
- Always render at the device's full pixel ratio (capped at 2) and NEVER lower it for performance. If frames are slow, reduce the shell count first (down to 32), then the guard-hair count.

INTERACTION
- Drag to rotate freely (trackball style) with inertia after a flick. The fur lags behind the rotation through a damped spring and flops back. Gentle idle breeze in the fur; after 3 s without input, a slow auto-turn.
- Mouse wheel / pinch to zoom (smooth dolly). Double-click or "0" resets with an eased animation. Arrow keys rotate.
- Custom cursor: the native grab hand plus a thin dark 46 px ring that follows the pointer and shrinks while dragging. Hovering gently parts the fur under the cursor, as if stroking it.
- Respect prefers-reduced-motion (no idle spin, no breeze).

UI & ROBUSTNESS
- Bottom-left caption: "Fluffy Watermelon" and a hint "Drag to rotate · Scroll to zoom · Double-click to reset" (on touch devices: "Drag to rotate · Pinch to zoom") that fades after the first interaction. Font: Onest from Google Fonts with system fallbacks.
- Guard against a zero-sized container at load: clamp width/height to at least 1 and, every frame, recover from any non-finite camera distance or rotation state.
- Show a small on-page note if the WebGL context is lost or a shader fails to compile, and a fallback message if WebGL is unavailable.

中文翻譯

構建一個單一的自包含 HTML 頁面(無需構建步驟),展示一個覆蓋長毛的交互式 3D“Fluffy Watermelon”,使用 three.js r147(UMD 構建:https://cdn.jsdelivr.net/npm/[email protected]/build/three.min.js)通過 WebGL 渲染。所有 UI 文字使用英文。

場景與外觀
- 全屏 canvas,置於柔和的西瓜瓤粉色攝影棚背景上:垂直漸變 #ECB3AB → #F7CFC7(中間爲較亮的色帶)→ #E8A9A0,用作場景背景。
- 一個大型長橢圓形西瓜沿 X 軸側躺:半長 1.38,半徑 0.98,鈍圓的桶狀兩端,兩端各有一個小凹坑,腹部略微扁平,表面有細微的不平整。初始爲 3/4 視角(繞 Y 軸約 -0.32 rad,傾斜 0.1 rad),相機 FOV 30°,構圖使其佔據約 80% 的高度。
- 毛髮之下的瓜皮圖案:淺綠色(#A8D66B),帶 16 條深綠色(#1C4D1C)條紋,從果柄端延伸到花蒂端,邊緣呈參差不齊的手指狀(正弦蜿蜒 + value noise),底面還有一塊淡奶油色的“field spot”。每根毛髮取自身根部的顏色,因此條紋透過毛髮依然清晰。
- 一端有一小截短小、乾燥、帶棱紋的果柄,切口處有微微拱起的淺色蓋面,旁邊還伸出一根細長捲曲的螺旋狀卷鬚。
- 一盞來自左上前方的平行光,wrap 漫反射,沿毛髮切線的 Kajiya-Kay 各向異性高光,根部更暗(受毛髮高度遮蔽),每根毛發的亮度略有變化。

毛髮(最重要:必須看起來銳利清晰,絕不能模糊)
- 毛髮長度 0.2 單位。毛髮沿法線向外生長,然後彎曲:從果柄端向花蒂端梳理,並沿兩側披垂(兩端沒有毛旋),再加上輕微重力。
- 底絨:使用 shell texturing,由身體網格約 64 個實例化殼層構成,僅達到毛髮長度的 50%。在 UV 空間中程序化生成毛發單元(密度經過縮放,使默認視角下一個單元約爲 3.4 個設備像素),兩種毛髮羣(長毛 + 細軟底絨),毛發向尖端聚集成簇,解析式抗鋸齒覆蓋,alpha 混合,殼層寫入深度。在表面以邊緣視角被觀察處淡出殼層,並丟棄微弱的片元,這樣輪廓處不會出現點狀邊緣。
- 護毛:約 90,000 根獨立的、逐漸變細的、面向相機的帶狀毛絲(實例化,每根 7 段),嚴格遵循相同的彎曲函數,最小寬度約 0.75 px,以保持銳利。繪製兩次:一次在殼層之前,一次在殼層之後(進行深度測試),這樣邊緣處淡色的毛髮永遠不會遮住它們,它們也始終清晰地覆蓋在最上層。
- 始終以設備的完整像素比渲染(上限爲 2),絕不爲了性能降低它。如果幀率變慢,先減少殼層數量(最低到 32),再減少護毛數量。

交互
- 拖動可自由旋轉(軌跡球式),快速甩動後帶慣性。毛髮通過阻尼彈簧滯後於旋轉,並回彈擺動。毛髮中有輕柔的空閒微風;無輸入 3 秒後,緩慢自動旋轉。
- 鼠標滾輪 / 雙指捏合縮放(平滑推拉)。雙擊或按“0”以緩動動畫重置。方向鍵旋轉。
- 自定義光標:原生抓取手型光標,外加一個跟隨指針的 46 px 細深色圓環,拖動時會縮小。懸停時會輕輕分開光標下方的毛髮,如同撫摸一般。
- 遵循 prefers-reduced-motion(無空閒旋轉,無微風)。

UI 與健壯性
- 左下角說明文字:“Fluffy Watermelon”,以及提示“Drag to rotate · Scroll to zoom · Double-click to reset”(在觸屏設備上:“Drag to rotate · Pinch to zoom”),首次交互後淡出。字體:來自 Google Fonts 的 Onest,帶系統回退字體。
- 防範加載時容器尺寸爲零:將寬/高限製爲至少 1,並在每一幀從任何非有限的相機距離或旋轉狀態中恢復。
- 如果 WebGL 上下文丟失或着色器編譯失敗,在頁面上顯示一條小提示;如果 WebGL 不可用,顯示回退消息。

溯源

原作者
vib3coded
發佈日期
2026-10-17(由推文 ID 反解)
原始出處
查看原帖 ↗
收錄來源
zhuyansen/awesome-opus-5.5-video · 2111501344750059978 · 未聲明授權