$npx -y skills add scottstts/Threejs-Awesome-Graphics-Agent-Skills --skill threejs-water-opticsBuild production analytic and bounded water in Three.js. Use for shared multi-wave displacement and normals, bounded RGBA heightfield pool simulation, local drops, object-driven ripples, differential-area caustics, ray-traced pool/water/sphere volume optics, derivative-filtered n
| 1 | # Water Optics |
| 2 | |
| 3 | Treat water as geometry motion, surface orientation, and a participating optical layer. A blue transparent material is not a water system. |
| 4 | |
| 5 | For large stochastic seas driven by directional spectra and GPU FFTs, use |
| 6 | `$threejs-spectral-ocean` instead. |
| 7 | |
| 8 | ## Analytic surface build order |
| 9 | |
| 10 | 1. Define wave bands and evaluate displacement. |
| 11 | 2. Derive the normal analytically from the same waves. |
| 12 | 3. Choose displaced geometry or explicitly normal-only water. |
| 13 | 4. Establish scene-color ownership for heuristic refraction. |
| 14 | 5. Declare whether absorption uses true depth or a fallback path-length estimate. |
| 15 | 6. Blend analytic reflection/refraction through side-aware Fresnel. |
| 16 | 7. Derive foam and glints from the shared wave response. |
| 17 | 8. Filter unresolved normal bands from derivatives. |
| 18 | |
| 19 | Read [references/water-surface-system.md](references/water-surface-system.md) |
| 20 | for the exact five-wave displaced ocean, six-band normal-only water, optical |
| 21 | hierarchy, and the limits that distinguish both from the spectral-ocean skill. |
| 22 | |
| 23 | Read the |
| 24 | [analytic wave optics implementation](examples/analytic-wave-optics/water-system.js) for |
| 25 | shared displacement/normals, derivative filtering, reflection, screen-space |
| 26 | refraction, absorption, Fresnel, and crest-linked foam diagnostics. |
| 27 | |
| 28 | Read the |
| 29 | [interactive pool volume implementation](examples/interactive-pool-volume/water-volume-system.js) |
| 30 | for bounded RGBA height/velocity/normal simulation, local drops, moving-sphere |
| 31 | displacement suitable for draggable objects, differential-area caustics, and |
| 32 | in-shader pool/water/sphere ray tracing against the pool bounds and sphere. |
| 33 | |
| 34 | ## Failure conditions |
| 35 | |
| 36 | - normal texture motion does not agree with displaced crests; |
| 37 | - heuristic refraction can sample foreground objects but the limitation is undisclosed; |
| 38 | - fallback path length is presented as reconstructed scene thickness; |
| 39 | - bounded pool caustics are a decorative projection detached from simulated |
| 40 | height normals; |
| 41 | - micro-waves alias into sparkling noise; |
| 42 | - foam is a scrolling texture unrelated to the shared crest metric; |
| 43 | - Fresnel is replaced by constant opacity; |
| 44 | - reflection, refraction, and transparency are all added without energy control. |
| 45 | |
| 46 | ## Routing boundary |
| 47 | |
| 48 | Use `$threejs-spectral-ocean` for stochastic directional spectra, FFT |
| 49 | cascades, Jacobian breaking, and persistent ocean foam. Use |
| 50 | `$threejs-precipitation-surfaces` for rain-driven puddle wetness, ripple masks, |
| 51 | and weather-coupled splashes on ground surfaces. This skill owns authored |
| 52 | analytic waves, bounded heightfield simulation, ray-traced pool-volume optics, |
| 53 | and bounded-water optics. |