泳池水面
WebGL Water,Evan Wallace,2011 年

正在布展…
它是怎么做的
- 第 1 步水面高度场存在浮点纹理里,用相邻像素平均的波动方程逐帧更新
- 第 2 步法线由高度场差分得出,用于反射与折射天空盒/池壁
- 第 3 步焦散:把水面网格按折射光线投影到池底,用面积变化计算亮度
- 第 4 步球体与水的相互作用通过往高度场写入体积位移实现
复刻配方
一段技术配方,可以直接交给 AI 编程助手,也可以自己照着写。想指定技术栈、位置和性能预算,就把它加入实现方案。
Store water height and velocity in a floating-point render target and update it each frame by moving each texel toward the average of its four neighbours (a discrete wave equation), ping-ponging between two targets. Compute normals from height differences and use them to refract rays into a tiled pool box and reflect into a cubemap. For caustics, render the water mesh a second time from the light's view with vertices displaced to where refracted rays hit the pool floor, and set brightness from the ratio of original to projected triangle area using derivatives. Let the user drop ripples by adding a small smooth bump into the height texture at the clicked point.


