본문으로 건너뛰기
Skillpedia
웹사이트 및 UI (프런트엔드)7.2k · #13324

3d-ultra-realistic-water

하는 일

이 스킬은 Three.js에서 가까운 파도부터 먼 수평선까지 사실적인 바다를 만드는 과정을 안내합니다. 바다 장면, 배, 해변 체험을 만드는 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓배나 파도 위에서 실제처럼 보이는 바다가 필요할 때.
  • ✓3D 바다에 햇빛 반짝임, 거품, 수평선이 필요할 때.
  • ✓배나 떠 있는 물체가 파도 위에 올라앉아야 할 때.

스킬 링크

https://github.com/MengTo/Skills/blob/main/agent-skills/3d/3d-ultra-realistic-water/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/MengTo/Skills/blob/main/agent-skills/3d/3d-ultra-realistic-water/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“제 일몰 배 장면에 햇빛 반짝임과 물마루의 거품이 있는 넘실거리는 바다를 만들어 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 준비된 파도 모듈을 사용하는데, 이 모듈은 표면을 픽셀 단위로 음영 처리하고, 먼 파도를 흐리게 해 깜박임을 막으며, 반사와 거품을 더합니다. 이 모듈은 프로젝트의 렌더러에 맞게 조정됩니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

3D Ultra-Realistic Water

Use this for an open sea seen by a moving camera, with a horizon and a sun. Reach for something else in these cases:

  • Mirror-flat water seen from the waterline with no mesh: a full-screen analytic water plane is cheaper.
  • Ripples that follow the cursor on a UI surface: use shaders-cursor-ripples.
  • A small pool that reacts to touch: use a ping-pong height field.

Source: extracted from Pirate Ship Sunset, a single-file Three.js r169 scene in which a three-masted ship sails a rolling sea at sunset under an auto-cycling camera. The water had to stay convincing from 2 m above the waves out to a 12 km horizon.

The mechanism

Shade the sea per pixel from the analytic derivatives of a deep-water Gerstner sum, and fade each wave out once its wavelength falls below the pixel footprint. The per-pixel derivatives keep the glitter and foam sharp on a mesh whose triangles are 30 m wide at the horizon. The footprint fade stops the far sea from boiling into moiré.

Reuse the working effect

Copy assets/ocean.mjs. You pass in the project's own THREE, and the module does not import a second copy. Before you integrate it, read references/ocean.md, which covers the full constants, render order, buoyancy and post. The demo runs this same module inside the original scene. demo/build.mjs rebuilds it from the reference page.

import { createWaves, bakeOceanDetail, createOcean, createWake, createPlanarReflection } from './ocean.mjs';

const waves = createWaves({ direction: 1.22 });                 // wind heading, radians
const ocean = createOcean(THREE, {
  waves,
  detailTexture: bakeOceanDetail(THREE, renderer),              // baked once, 512²
  skyCube,                                                      // cube rendered from YOUR sky shader
  hazeGLSL: SKY_GLSL + 'vec3 oceanHaze(vec3 d){ return hazeColor(d); }',
  hazeUniforms: skyUniforms,                                    // may include uSunDir
  wake: createWake(THREE, renderer, { shipLength: 34 }),        // optional
  hull: { halfWidths, zMin: -18, zMax: 18, bowZ },              // optional, ship-local metres
});
scene.add(ocean.mesh);
const reflection = createPlanarReflection(THREE, renderer, { layer: 1 });
ocean.setReflection(reflection);

// every frame, in this order
waves.update(dt);                                  // CPU phases, before any height() query
ship.y = waves.height(ship.x, ship.z);             // buoyancy uses the same spectrum
ocean.update({ time, camera, ship: { x, z, fx, fz } });
wake.update(x, z, fx, fz, speed * dt);
reflection.render(scene, camera);                  // before the main pass
renderer.render(scene, camera);                    // into a HalfFloat target, then bloom + ACES

The stack, with the numbers that shipped

layer what it does constants
Spectrum 8 Gerstner waves, deep-water dispersion ω = √(g·k) L 78 → 3.1 m (×0.63 per step), A 0.8 → 0.02 m, headings 0, +23, −17, +38, −31, +12, −49, +64° off the wind, Q 0.17 → 0.03 (Σ 0.77)
Grid exponential rings centred under the camera r = 11.92·(e^(0.033·i) − 1), 210 rings × 400 segments = 84,001 verts, 167,600 tris, reaches ~12.2 km; spacing 0.033·(r + 12)
Footprint fade per wave, in both shaders fade = 1 − smoothstep(0.18·L, 0.5·L, footprint); vertex footprint 1.2 × ring spacing, pixel footprint 2 × (fwidth(x) + fwidth(z))
Normal per pixel, normalize(cross(dP/dz, dP/dx)) Jacobian J = dPdx.x·dPdz.z − dPdx.z·dPdz.x drives crest foam
Micro detail baked 512² tile: 48 sines with integer wave vectors, amplitude ∝ |k|^−1.35 two octaves at 19 m and 7.3 m (the second rotated 90°), strength 0.4·e^(−d/500) + 0.08
Reflection Schlick with water F0 = 0.02; 256² sky cube re-rendered every 0.25 s; half-res planar pass for the ship and islands planar UV nudged by N.xz · (0.06, 0.03) · clamp(30/d, 0.2, 1)
Body deep colour plus sunlit subsurface through the wave crests deep (0.006, 0.03, 0.048), scatter (0.035, 0.3, 0.27) linear; scatter × toward-sun² × crest height × (0.35 + 4·(1 − N.y))
Glitter HDR specular, left for the bloom to catch pow(R·L, 90)·1.2 + pow(R·L, 12)·0.06 + pow(R·L, 1400)·40, sun colour (4.2, 2.3, 1.1); bloom threshold 1.6, knee 0.8
Foam thresholds a Worley lattice by a mask, so the foam stays lacy crest smoothstep(0.6, 0.28, J); `foam = s
자주 묻는 질문

프로젝트의 Three.js를 쓸 수 있나요?

네. 스킬은 두 번째 복사본을 불러오지 않도록 프로젝트 자체의 Three.js를 넘기라고 설명합니다.

파도 위에 떠 있는 물체도 다루나요?

네. 스킬은 물체가 물 위에 앉을 수 있도록 부력 쿼리를 포함합니다.

볼 수 있는 데모가 있나요?

네. 스킬에는 원래 장면 안에서 같은 모듈을 실행하는 데모가 포함되어 있습니다.

상세 정보

작성자의 원본 설명

Build an ultra-realistic open ocean in Three.js with a deep-water Gerstner spectrum shaded per pixel from analytic derivatives, each wave faded at its own pixel footprint, plus Fresnel sky-cube and planar reflections, subsurface light through the crests, HDR sun glitter, Jacobian lace foam, a Kelvin wake, hull foam, buoyancy queries and aerial perspective into the sky's horizon haze. Use for seas, oceans, sunset or daylight water, sun glitter paths, ship or boat scenes, wakes, coastal flyovers and any 3D scene with a moving camera and a water horizon. Includes the approved water from Pirate Sh

repo: MengTo/Skills

인기도

GitHub 스타
7.2k
순위
#13324
라이선스
MIT
업데이트
2026. 11. 1.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬