The guide explains how to integrate the water implementation with Three.js and its Reflector addon, then configure depth-aware reflections, layered surface effects and lamp highlights. It also covers synchronizing water and hull motion, tracking wakes through turns, and checking visual quality and performance from player camera views.
85%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Start with the view that exposes the effect. Put one piling through the surface, a bright sign on the far quay and a boat between them. At water level the piling should meet its reflection, the sign should break into moving facets and the boat should leave a trail along the route it actually took.
Open the working demo · Water implementation · Boat and quay example · Prompt recipe
Copy the water implementation into the project. It accepts the project's Three.js engine and the matching Reflector addon. The offline demo includes Three.js r180. The implementation assumes WebGL 2, conventional WebGL depth, an above-water perspective camera and a level XZ surface. Keep the water directly under the identity scene root. Size it to cover the navigable water and both camera views.
import * as THREE from 'three';
import { Reflector } from 'three/addons/objects/Reflector.js';
import './harbour-water.js';
const water = globalThis.HarbourWater.create(THREE, Reflector, {
size: 100, segments: 128, level: 0, mirrorWidth: 768, mirrorHeight: 432
});
scene.add(water.mesh);
water.setWeather(0.88, 0.76); // wind and rain intensities
water.setLights([{
position: quayLamp.getWorldPosition(new THREE.Vector3()),
color: 0xffaf64, power: 22, radius: 0.15
}]);Call water.setTime(simulationSeconds) before sampling heights or rendering each frame. Pass the same clock to the hull, wake and renderer. The water uses metres. Set level to the channel elevation and allow sufficient mesh subdivisions for the short swells. Reuse the host renderer, camera and animation loop. Call water.dispose() when unloading the surface.
depth * 2 - 1, and divide by homogeneous W.Use four water.heightAt(x, z) probes at the bow, stern, port and starboard waterline. For a local +Z bow and +X starboard side, use forward (sin(yaw), cos(yaw)) and right (cos(yaw), -sin(yaw)) in XZ. Place the hull at the mean height with its authored waterline offset. Set pitch to -atan2(bow - stern, 2 * halfLength) and roll to atan2(starboard - port, 2 * halfBeam) using Euler order YXZ. Use the vessel's actual half dimensions in metres.
Pass the stern's world coordinates to water.trackStern(x, z) each simulation step. The reference stores one vessel's trail in a fixed buffer, samples about every 0.22 seconds and widens the two wake shoulders as the samples age. It bounds the shader work around the recorded path. Call water.clearWake() on respawn, a district switch or a vessel swap. For multiple boats, maintain a separate bounded trail and lifetime for each active vessel.
The companion open-ocean water skill covers ocean horizons, whitecaps and sun glitter.
MengTo/Skills
30809c8
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.