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 · 未声明许可