3d-ultra-realistic-water

Implements an ultra-realistic open ocean in Three.js using per-pixel Gerstner wave shading.

6.3k|743|Updated Feb 3, 2026
One-click install
npx skills add https://github.com/MengTo/Skills --skill 3d-ultra-realistic-water-mengto
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: 3d-ultra-realistic-water
Source: https://github.com/MengTo/Skills/tree/main/agent-skills/3d/3d-ultra-realistic-water
Command: npx skills add https://github.com/MengTo/Skills --skill 3d-ultra-realistic-water-mengto

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires three, and includes references (resource) and assets (resource) components.

What problem does it solve? Rendering convincing open-ocean water in Three.js is hard: distant waves alias into moiré, glitter smears across mesh facets, and the horizon shows a hard line against the sky. This Skill provides a production-tested ocean module extracted from a shipped scene, with every constant and failure mode documented. ## Core Features & Use Cases - Per-pixel Gerstner shading: 8 deep-water waves shaded from analytic derivatives, with each wave faded at its own pixel footprint to stop far-field aliasing. - Full water stack: Fresnel sky-cube and planar reflections, subsurface light through crests, HDR sun glitter for bloom, Jacobian lace foam, a Kelvin wake, hull foam, and buoyancy queries. - Reusable module and demo: Copy assets/ocean.mjs into any Three.js r150+ WebGL2 project; the demo runs the same module in the original Pirate Ship Sunset scene. - Use Case: Add a rolling sunset sea with a sailing ship, sun glitter path, and spreading wake to a 3D scene with a moving camera and a water horizon. ## Quick Start Ask your agent to use the 3d-ultra-realistic-water skill to add an open ocean with per-pixel Gerstner shading, Fresnel sky reflection, and Jacobian foam to your Three.js scene.

Frequently Asked Questions about 3d-ultra-realistic-water

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I render realistic ocean water in Three.js?▼

Use a deep-water Gerstner wave spectrum shaded per pixel from analytic derivatives, fading each wave at its own pixel footprint. Add Fresnel sky-cube reflection, HDR sun glitter, and Jacobian-based foam, then tone-map with ACES in an HDR pipeline.

How to stop distant ocean waves from aliasing in WebGL?▼

Fade each wave out once its wavelength falls below the pixel footprint, in both vertex and fragment shaders, using 1 − smoothstep(0.18·L, 0.5·L, footprint). Without this fade, short waves are sampled below their wavelength and the far sea boils into moiré.

Does this ocean module work with any Three.js version?▼

The module targets Three.js r150 or later with WebGL2 and GLSL ShaderMaterials. You pass in your project's own THREE namespace, so it never imports a second copy of three.js.

Why does my Gerstner ocean fold through itself at high wave steepness?▼

The surface self-intersects when the sum of steepness values ΣQ exceeds about 1, making the Jacobian negative and saturating foam into white slabs. Cap steepness so ΣQ stays below 0.95 while letting amplitude keep rising.

When should I not use a Gerstner wave ocean mesh?▼

Avoid it for mirror-flat water seen from the waterline with no mesh, where a full-screen analytic water plane is cheaper, and for cursor ripples on UI surfaces or small touch-reactive pools, where a ping-pong height field fits better.

How do I make floating objects bob correctly on Gerstner waves?▼

Query height with the same spectrum you render, inverting the horizontal displacement with about 4 fixed-point steps before reading y. Reading the displacement y directly is off by up to 1.17 m on steep crests because Gerstner waves move points sideways.