A real-time 3D water simulation with physics-based buoyancy, Gerstner waves, and screen-space reflections.
-
Open the live demo hosted on GitHub Pages: WBSim
-
You can find the report in the
/docsfolder.
Two objects can float on the water. Switch between them using the Complex Model toggle in the top-right panel.
| Mode | Object | Description |
|---|---|---|
| Off (default) | Cube | Simple box with full buoyancy simulation |
| On | Sailboat | Full model with dynamic sail, boom, and pennant |
| Key | Action |
|---|---|
W |
Thrust forward |
A |
Steer left (yaw) |
D |
Steer right (yaw) |
← / → |
Orbit camera left / right around the object |
↑ / ↓ |
Orbit camera up / down around the object |
The
Skey is intentionally unbound — the water and buoyancy slow the object naturally.
- Left-drag — orbit around the object
- Scroll wheel — zoom in / out
- Auto-chase — after 4 seconds of no camera input the camera smoothly eases behind the boat
The sail and pennant react to wind in real time:
- At rest the sail aligns with the wind.
- Steering left (
A) or right (D) swings the boom toward perpendicular and billows the sail. - The pennant at the top of the mast always streams directly downwind.
| Control | Range | Effect |
|---|---|---|
| Waves | 1 – 16 | Number of Gerstner wave components superimposed |
| Wave Height | 0.1 – 1.8 | Master amplitude of the waves |
| Gerstner Effect | 0 – 2 | Steepness / lateral displacement of wave crests |
| Wind Angle | 0° – 360° | Primary wind direction; waves and sail track this value |
| Use Scattering | on / off | Toggles subsurface scattering on the water; uncheck for flat diffuse shading |
| Complex Model | on / off | Switches between the cube and the sailboat |
