Aureliengmz/clearwater
关于
在单个 HTML 文件中实现实时、照片级真实感的浅水效果。使用 WebGL2,无需库,也无需构建步骤。
网站与应用开发实测星标增长
- 24小时
- +2
- 7天
- +4
- 15天
- +8
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文Clearwater
Real-time, photoreal shallow water in a single HTML file. WebGL2, no libraries, no build step, no external assets.
Live demo · drag to look around · tap the water

Run
Open index.html in a browser, from disk or any static host. Nothing to install.
Needs WebGL2 with float render targets (EXT_color_buffer_float). Resolution adapts to keep the frame rate up.
| URL option | Effect |
|---|---|
?debug |
Frame rate, resolution, quality level |
?noglare |
Disable lens-diffraction glare |
?t=5 |
Freeze time at 5 s (screenshots) |
?yaw=0.5&pitch=-0.4 |
Initial camera direction, radians |
?view=caus |
Show the raw caustics texture |
Code map
Everything lives in index.html, in sections marked /* ---- Name ---- */:
| Section | What to tweak |
|---|---|
| Ocean spectrum (FFT) | L patch size, DEPTH, TARGET_SLOPE wave steepness |
| Interactive ripples | RN, RSIZE simulation grid |
| Caustics | G ray grid, C caustics resolution, IORS per-channel refraction |
| Main water shader | Fresnel, absorption, seabed shading (GLSL) |
| Post / Lens diffraction glare | Bloom, glare, tone curve, grain |
| Camera & input | SUN_EL, SUN_AZ sun position, VFOV |
| Loop | Frame loop, adaptive quality |
The seabed texture is base64 in <script id="pebbles-texture"> at the end of the file. To regenerate it: python tools/make_pebbles.py (numpy, scipy, pillow), then paste the base64 JPEG into that block.
References
- Jerry Tessendorf, Simulating Ocean Water: FFT waves
- Evan Wallace, WebGL Water: refracted-grid caustics
- Inigo Quilez, Texture repetition: seabed tiling
- Marc Olano & Dan Baker, LEAN Mapping: distant highlights
Credits
MIT License, see LICENSE.
探索相关项目
加载中…