Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

feat(render): a Water material with waves, refraction, depth absorption and foam

yhh6df8e14b9b2c
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9f3c137b2..c0e1544f1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,6 +17,7 @@ published separately; it ships inside the editor.
### Added
- **Contact shadows and screen-space bounce light.** Contact Shadows and Screen Space GI effects add small sharp shadows at contacts and one bounce of colour between surfaces, and the weather softens the sun's shadows. `contactShadows` marches a short ray toward the scene's sun in the depth buffer; `ssgi` gathers eight rays a pixel over the G-buffer's normals at half size into a float target and averages the neighbours on the same surface before laying the light, times the receiver's colour, over the picture. The Weather component raises the sun's `sourceAngle` and lowers its `shadowStrength` as the sky clouds over.
+- **Water.** A Water material: waves that travel, the scene seen through it bent and tinted by how deep the water is, reflections, and foam at the shore and on the crests. Give a horizontal plane a material on the built-in **Water** shader. The depth is measured, not guessed: the frame takes a copy of how far each pixel of the opaque scene is from the eye, so water over a shelf goes from the shore's pale teal to deep blue, with red absorbed first. It needs the same engine-copied scene as glass (a post-process chain running) and a float target for the depth; the waves are drawn in the surface's shading, not as displaced geometry, and the surface is taken to lie flat.
- **Cloud shadows.** The Sky Atmosphere's clouds can now cast shadows on the scene. **Cloud Shadows** marches the sun's ray up through the same cloud slab the sky draws, so the ground is darker and patchier under cloud; it also pins the clouds to the world instead of the camera, and **World Units per km** says how large a kilometre of sky is in the scene. The default is 0, which leaves every existing scene as it was. Ambient light is not shadowed, and the clouds are still only drawn where there is sky.
- **Voxel GI on WebGL2.** Voxel GI now runs on WebGL2: the world-space bounce light is built with fragment passes where there is no compute stage. The result matches the WebGPU one in the editor check; the gather is fixed at half size, grazing surfaces are thinner in the cache, a 32 MB half-float atlas is used, and the `low` quality tier leaves the effect out. Its cost on real GPUs has not been measured.
- **Cyber Rooftop example.** Cyber Rooftop adds a rooftop survival-base example with a 2D HUD and a first-person build tool. The world is editable 3D models (a rooftop shelter, planters, containers, pipework, a water plant, city buildings, a train) with rain, steam and puddle reflections; the HUD is built from Canvas, UINode, UIVisual and Text. It is a runnable reconstruction of a reference image, not a pixel match, and its survival systems (inventory, saving) are not implemented.
diff --git a/desktop b/desktop
index 27ae222d1..02fc76368 160000
--- a/desktop
+++ b/desktop
@@ -1 +1 @@
-Subproject commit 27ae222d1ce6877b0f992fdde8749da15be547e0
+Subproject commit 02fc76368d7e8840e52dfdc3e9bfa8293c9838d5
diff --git a/docs/astro/src/content/docs/graphics/materials.mdx b/docs/astro/src/content/docs/graphics/materials.mdx
index b71c2bf89..59848c8b9 100644
--- a/docs/astro/src/content/docs/graphics/materials.mdx
+++ b/docs/astro/src/content/docs/graphics/materials.mdx
@@ -34,6 +34,8 @@ creates a material from a built-in template — the same list ships in code as
| **UV Scroll** | `sprite-uv-scroll` | Scrolls the texture by `u_scrollSpeed` × time. |
| **Model** | `model` | What a glTF material says beyond base color: `u_normalMap`, `u_emissive`(`Map`), `u_occlusionMap` + `u_occlusionStrength`, `u_alphaCutoff`, `u_metallic` / `u_roughness` (+ `u_metallicRoughnessMap`), and the [shading layers](#shading-layers) — clear coat, sheen, anisotropy, translucency, thin film, index of refraction, transmission. Written by model import. |
+| **Water** | `water` | A horizontal body of water: travelling waves and ripples, the scene behind it bent and tinted by how deep the water is, reflections, and foam. See [Water](#water). |
+
A new material **references** its template by id — it stores `shader: "builtin:sprite-unlit"`
and writes **no shader file** to disk. The engine compiles the built-in from in-code source
(the runtime loader, the cook step, and the editor all resolve `builtin:<id>` the same way),
@@ -41,6 +43,24 @@ so a fresh material draws immediately with nothing extra to manage. A real `.ess
lands on disk when you **convert** the material to a unique shader (below) or **create a
shader** yourself.
+## Water
+
+The **Water** shader (`builtin:water`) turns a horizontal plane into a body of water.
+
+- **Waves.** Four waves a few directions apart, each with a sharper crest than trough, travel at the speed their length gives them (`u_waveLength`, `u_waveHeight`, `u_waveSpeed`, `u_waveDirection`); small ripples (`u_rippleStrength`, `u_rippleLength`) ride on them. They are drawn in the surface's normal, not as displaced geometry, and fade out with distance so far water is calm rather than aliased.
+- **Refraction and depth.** What is under the water is the picture of the opaque scene, shifted by the waves in proportion to how much water there is. The depth is **measured**: before the water is drawn the frame takes a copy of how far each pixel of the scene is from the eye, so the water at a pixel is the difference between that and the water's own distance. The light is absorbed along that column — red first (`u_absorption`, `u_density`) — and the water gives back its own colour, from `u_shallowColor` to `u_deepColor` as it deepens.
+- **Reflection.** The sky, the lights and the environment reflect off it with a Fresnel term (water is 1.333), so it is clear looking down and mirror-like at a grazing angle. Add Screen Space Reflections to the volume for reflections of the scene itself.
+- **Foam.** Where the column is shallower than `u_foamWidth` (the shore, a rock, a pier's legs) and on the crests of the waves (`u_foamCrest`), broken up by moving noise.
+
+Parameters are in world units: a scene in metres wants the defaults, one in centimetres wants the lengths and `u_density` scaled.
+
+**Limits.**
+
+- It needs the same engine-copied scene as glass (a post-process chain is running) and a device whose render targets can hold floats for the depth. Without the chain the water is drawn over the scene as a translucent surface; without float targets the depth is `u_fallbackDepth` everywhere, so there is no shore foam and no change of colour with depth.
+- Like glass, it refracts the opaque scene only: a boat's hull seen through it is, but another transparent surface is not.
+- The surface is taken to lie flat: a water plane that is tilted or curved will shade as if it were level.
+- The waves do not move the geometry, so a wave does not break the shoreline or lift a floating object, and the silhouette against the sky is a straight line.
+
## Shading layers
The **Model** shader is a metal/rough surface with layers on top. Each is off at its default, a layer at zero costs the surface nothing, and a material that says none of them is the plain surface it always was.
diff --git a/docs/astro/src/content/docs/zh-cn/graphics/materials.mdx b/docs/astro/src/content/docs/zh-cn/graphics/materials.mdx
index fd6654593..120cb1a1c 100644
--- a/docs/astro/src/content/docs/zh-cn/graphics/materials.mdx
+++ b/docs/astro/src/content/docs/zh-cn/graphics/materials.mdx
@@ -30,11 +30,31 @@ std140 uniform 块,于是 CPU 能按名字设置、并安全地送到 GPU。一
| **UV Scroll** | `sprite-uv-scroll` | 按 `u_scrollSpeed` × 时间滚动纹理。 |
| **Model** | `model` | glTF 材质在 base color 之外说的东西:`u_normalMap`、`u_emissive`(`Map`)、`u_occlusionMap` + `u_occlusionStrength`、`u_alphaCutoff`、`u_metallic` / `u_roughness`(以及 `u_metallicRoughnessMap`),还有[着色层](#着色层)——清漆、绒面、各向异性、半透、薄膜干涉、折射率、透射。模型导入会写出它。 |
+| **Water** | `water` | 水平的水体:传播的波浪和涟漪、被折射并按水深染色的背后场景、反射与泡沫。见[水](#水)。 |
+
新建材质是**按 id 引用**其模板的——它存的是 `shader: "builtin:sprite-unlit"`,并**不会**在磁盘上
写出 shader 文件。引擎从内置源码编译该模板(运行时加载器、cook 步骤、编辑器三处以同样方式解析
`builtin:<id>`),所以新材质立即就能绘制,无需额外管理。只有当你把材质**转为独立着色器**(见下文)
或自己**新建着色器**时,才会有真正的 `.esshader` 落到磁盘上。
+## 水
+
+**Water** 着色器(`builtin:water`)把一个水平面变成一片水体。
+
+- **波浪。** 四道相差几个方向的波,波峰比波谷更尖,以各自波长决定的速度传播(`u_waveLength`、`u_waveHeight`、`u_waveSpeed`、`u_waveDirection`);小涟漪(`u_rippleStrength`、`u_rippleLength`)骑在它们上面。波浪画在表面法线里,不是位移几何体,并且随距离淡出,所以远处的水是平静的而不是闪烁的。
+- **折射与水深。** 水下看到的是不透明场景的画面,被波浪按水量多少偏移。水深是**量出来的**:绘制水之前,帧会拷贝一份场景每个像素离眼睛多远,水在某个像素处的深度就是那个距离与水面自己的距离之差。光沿着这段水柱被吸收——红色最先(`u_absorption`、`u_density`)——水再还给你它自己的颜色,随水变深从 `u_shallowColor` 过渡到 `u_deepColor`。
+- **反射。** 天空、灯光和环境按菲涅尔项反射(水是 1.333),所以俯视时清澈、掠射时像镜子。想要场景本身的倒影,在体积里加上屏幕空间反射。
+- **泡沫。** 水柱浅于 `u_foamWidth` 的地方(岸边、礁石、桥墩脚下)和波峰上(`u_foamCrest`)出现泡沫,由流动的噪声打散。
+
+参数以世界单位计:以米为单位的场景用默认值,以厘米为单位的要把长度和 `u_density` 相应缩放。
+
+**限制。**
+
+- 它需要与玻璃相同的、由引擎拷贝的场景(有后处理链在运行),以及渲染目标能存浮点数的设备来存深度。没有链时,水作为半透明表面画在场景上;没有浮点目标时,深度处处是 `u_fallbackDepth`,所以没有岸边泡沫,颜色也不随水深变化。
+- 与玻璃一样,它只折射不透明场景:透过它能看到船体,但看不到另一个透明表面。
+- 表面被当作是平的:倾斜或弯曲的水面会按水平来着色。
+- 波浪不移动几何体,所以波不会冲破海岸线,也不会托起漂浮的物体,和天空交界的轮廓是一条直线。
+
## 着色层
**Model** shader 是一个金属/粗糙度表面,上面可以叠层。每一层默认关闭,强度为零的层不消耗任何开销,一个什么都不写的材质就是它一直以来的那个普通表面。
diff --git a/sdk/src/render/builtinShaders.ts b/sdk/src/render/builtinShaders.ts
index 080e9b3d1..85673e9df 100644
--- a/sdk/src/render/builtinShaders.ts
+++ b/sdk/src/render/builtinShaders.ts
@@ -689,6 +689,343 @@ fn packNormal(n : vec3f) -> vec2f {
#pragma end
`;
+// A horizontal body of water: waves that travel, the scene seen through it bent and tinted by how much water lies in front of it, the sky
+// and the lights reflected off it, and foam where it meets what it lies on and on the crests. It reads the picture of the opaque scene
+// behind it and how far each pixel of that is from the eye, which the frame takes before it draws a material that declares them, so
+// the depth of the water at a pixel is what is measured, not a number the author guessed. Where the device cannot hold the distances
+// (no float target) it falls back to `u_fallbackDepth` as the depth everywhere.
+const WATER = `#pragma shader "Water"
+#pragma version 300 es
+#pragma domain Lit
+// The colour the water scatters back: lighter where it is shallow, darker where it is deep.
+#pragma param u_shallowColor color default(0.10,0.42,0.46,1)
+#pragma param u_deepColor color default(0.01,0.08,0.15,1)
+// How fast each colour is absorbed along the way through the water (red goes first), and how thick the water is, per world unit.
+#pragma param u_absorption color default(0.45,0.09,0.05,1)
+#pragma param u_density float default(0.12) range(0,4) ui(slider)
+// The waves: height, length of the longest, how sharp their crests are drawn, how fast they travel and which way (degrees).
+#pragma param u_waveHeight float default(0.3) range(0,8) ui(slider)
+#pragma param u_waveLength float default(14) range(0.5,300) ui(slider)
+#pragma param u_waveSpeed float default(1) range(0,4) ui(slider)
+#pragma param u_waveDirection float default(30) range(0,360) ui(slider)
+// The small ripples the long waves carry: how steep and how long each is.
+#pragma param u_rippleStrength float default(0.3) range(0,1) ui(slider)
+#pragma param u_rippleLength float default(2.5) range(0.1,40) ui(slider)
+#pragma param u_roughness float default(0.04) range(0,1) ui(slider)
+// How far what is seen through the water is shifted by its waves, and the depth of water at which that stops growing.
+#pragma param u_refractionStrength float default(1) range(0,4) ui(slider)
+#pragma param u_distortionRange float default(12) range(0.1,200) ui(slider)
+// Foam: its colour, how deep the water is where it begins at the shore (world units), and how much of the wave crests carry it.
+#pragma param u_foamColor color default(0.95,0.97,1,1)
+#pragma param u_foamWidth float default(1.2) range(0,20) ui(slider)
+#pragma param u_foamCrest float default(0.5) range(0,1) ui(slider)
+// The depth taken where the device could not measure one.
+#pragma param u_fallbackDepth float default(4) range(0,200) ui(slider)
+#pragma param u_sceneColor texture default(white)
+#pragma param u_sceneDepthMap texture default(white) texel(data)
+
+#pragma fragment
+precision highp float;
+
+in vec4 v_color;
+in vec2 v_texCoord;
+in highp vec2 v_worldPos;
+#ifdef MESH_NORMALS
+in highp vec3 v_worldNormal;
+in highp vec3 v_worldXYZ;
+#endif
+
+#ifdef ES_GBUFFER
+layout(location = 0) out vec4 fragColor;
+layout(location = 1) out vec4 fragSurface;
+
+vec2 packNormal(vec3 n) {
+ n /= (abs(n.x) + abs(n.y) + abs(n.z));
+ vec2 sgn = vec2(n.x >= 0.0 ? 1.0 : -1.0, n.y >= 0.0 ? 1.0 : -1.0);
+ vec2 e = n.z >= 0.0 ? n.xy : (1.0 - abs(n.yx)) * sgn;
+ return e * 0.5 + 0.5;
+}
+#else
+out vec4 fragColor;
+#endif
+
+float waterHash(vec2 p) {
+ p = fract(p * vec2(0.1031, 0.1030));
+ p += dot(p, p.yx + 33.33);
+ return fract((p.x + p.y) * p.x);
+}
+float waterNoise(vec2 p) {
+ vec2 i = floor(p);
+ vec2 f = fract(p);
+ f = f * f * (3.0 - 2.0 * f);
+ return mix(mix(waterHash(i), waterHash(i + vec2(1.0, 0.0)), f.x),
+ mix(waterHash(i + vec2(0.0, 1.0)), waterHash(i + vec2(1.0, 1.0)), f.x), f.y);
+}
+/// The ripples' height at p: two layers of noise drifting in different directions.
+float ripples(vec2 p, float time) {
+ return waterNoise(p / u_rippleLength + vec2(0.31, 0.12) * time) * 0.6
+ + waterNoise(p / (u_rippleLength * 0.43) - vec2(0.17, 0.4) * time) * 0.4;
+}
+
+/// The slope of the water's surface at p (d height / d x, d height / d z) and how near the waves are to a crest, 0 to 1.
+/// Four waves a few directions apart, each a peaked sine (exp(sin - 1)) whose crests are narrower than its troughs.
+vec2 waveSlope(vec2 p, float time, float dist, out float crest) {
+ const vec4 SET[4] = vec4[4](vec4(0.0, 1.0, 1.0, 1.0), vec4(28.0, 0.62, 0.55, 1.1), vec4(-37.0, 0.37, 0.3, 1.2), vec4(71.0, 0.21, 0.15, 1.35));
+ vec2 slope = vec2(0.0);
+ float crestSum = 0.0;
+ float weightSum = 0.0;
+ float base = radians(u_waveDirection);
+ for (int i = 0; i < 4; ++i) {
+ float length_ = u_waveLength * SET[i].y;
+ float k = 6.2831853 / length_;
+ float a = base + radians(SET[i].x);
+ vec2 d = vec2(sin(a), cos(a));
+ float omega = sqrt(9.8 * k) * u_waveSpeed * SET[i].w;
+ float theta = k * dot(d, p) - omega * time;
+ float e = exp(sin(theta) - 1.0);
+ // A wave much shorter than a pixel is noise, not a wave: it fades out with distance.
+ float seen = clamp(1.0 - dist / (length_ * 220.0), 0.0, 1.0);
+ slope += d * (u_waveHeight * SET[i].z * e * cos(theta) * k * seen);
+ crestSum += e * SET[i].z;
+ weightSum += SET[i].z;
+ }
+ crest = crestSum / weightSum;
+ return slope;
+}
+
+void main() {
+#ifdef MESH_NORMALS
+ highp vec3 P = v_worldXYZ;
+#else
+ highp vec3 P = vec3(v_worldPos.x, 0.0, v_worldPos.y);
+#endif
+ float time = u_time.x;
+ vec3 viewDir = viewDirection(P);
+ float waterDist = u_camera.w > 0.5 ? length(P - u_camera.xyz) : -dot(P, u_camera.xyz);
+
+ // The surface: the long waves, then the ripples they carry, flattened with distance so the far water is calm rather than aliased.
+ float crest;
+ vec2 slope = waveSlope(P.xz, time, waterDist, crest);
+ float rippleFade = clamp(1.0 - waterDist / (u_rippleLength * 180.0), 0.0, 1.0);
+ float e = u_rippleLength * 0.1;
+ vec2 ripple = vec2(ripples(P.xz + vec2(e, 0.0), time) - ripples(P.xz - vec2(e, 0.0), time),
+ ripples(P.xz + vec2(0.0, e), time) - ripples(P.xz - vec2(0.0, e), time)) / (2.0 * e);
+ slope += ripple * (u_rippleStrength * u_rippleLength * rippleFade);
+ vec3 N = normalize(vec3(-slope.x, 1.0, -slope.y));
+ vec3 Ngeo = vec3(0.0, 1.0, 0.0);
+ // Seen from below, the surface turns over.
+ if (viewDir.y < 0.0) { N = -N; Ngeo = -Ngeo; }
+
+ // What is behind the water: the picture and the distance, where the frame took them.
+ bool haveColor = texture(u_sceneColor, vec2(0.5)).a < 0.75;
+ bool haveDepth = haveColor && texture(u_sceneDepthMap, vec2(0.5)).a < 0.75;
+ vec4 clip0 = u_projection * vec4(P, 1.0);
+ vec2 uv0 = clip0.xy / max(clip0.w, 1e-4) * 0.5 + 0.5;
+ float behindDist = haveDepth ? texture(u_sceneDepthMap, clamp(uv0, vec2(0.001), vec2(0.999))).r : waterDist + u_fallbackDepth;
+ float column0 = max(behindDist - waterDist, 0.0);
+
+ // Bent by the waves: the ray through the tilted surface against the ray through a flat one, over as much water as there is.
+ const float RATIO = 1.0 / 1.333;
+ vec3 bentWave = refract(-viewDir, N, RATIO);
+ vec3 bentFlat = refract(-viewDir, Ngeo, RATIO);
+ float reach = min(column0, u_distortionRange) * u_refractionStrength;
+ vec4 clip1 = u_projection * vec4(P + (bentWave - bentFlat) * reach, 1.0);
+ vec2 uv1 = clip1.xy / max(clip1.w, 1e-4) * 0.5 + 0.5;
+ vec3 behind = vec3(0.0);
+ float column = column0;
+ if (haveColor) {
+ uv1 = clamp(uv1, vec2(0.001), vec2(0.999));
+ float dist1 = haveDepth ? texture(u_sceneDepthMap, uv1).r : behindDist;
+ // Something standing in front of the water cannot be what is seen through it: keep the straight-through lookup.
+ if (dist1 < waterDist) { uv1 = clamp(uv0, vec2(0.001), vec2(0.999)); dist1 = behindDist; }
+ behind = texture(u_sceneColor, uv1).rgb;
+ column = max(dist1 - waterDist, 0.0);
+ }
+
+ // The water in between takes the light out of it, red first, and gives back its own colour: more of it the deeper it goes.
+ vec3 transmit = exp(-u_absorption.rgb * (u_density * column));
+ float murk = 1.0 - dot(transmit, vec3(1.0 / 3.0));
+ vec3 scatterColor = mix(u_shallowColor.rgb, u_deepColor.rgb, 1.0 - exp(-column * u_density * 0.5));
+
+ // Foam: along the shore, where the water is shallow, broken by noise that moves; and on the crests of the waves.
+ float vertical = column * max(abs(viewDir.y), 0.15);
+ float foamScale = 1.0 / (u_rippleLength * 1.2);
+ float breakup = waterNoise(P.xz * foamScale + vec2(time * 0.07, time * 0.05)) * 0.6 + waterNoise(P.xz * foamScale * 3.0 - vec2(time * 0.13, 0.0)) * 0.4;
+ float pulse = 0.65 + 0.35 * sin(time * 0.9 + breakup * 6.0);
+ float shore = haveDepth && u_foamWidth > 0.0 ? clamp((1.0 - vertical / (u_foamWidth * pulse)) * 1.5 - breakup * 0.8, 0.0, 1.0) : 0.0;
+ float onCrest = u_foamCrest > 0.0 ? smoothstep(1.0 - 0.3 * u_foamCrest, 1.0, crest) * smoothstep(0.35, 0.75, breakup) : 0.0;
+ float foam = clamp(max(shore, onCrest * u_foamCrest), 0.0, 1.0);
+
+ SurfaceExt ext = surfaceExtNone(N);
+ ext.misc.x = 0.0204;
+ vec3 albedo = mix(scatterColor * murk, u_foamColor.rgb, foam);
+ float roughness = mix(u_roughness, 0.7, foam);
+ vec3 lit = applyLightingSurface(albedo, N, P, viewDir, 0.0, roughness, 1.0, 1.0, ext);
+ float cosV = clamp(dot(N, viewDir), 0.0, 1.0);
+ float fresnel = 0.0204 + (1.0 - 0.0204) * pow(1.0 - cosV, 5.0);
+ vec3 seen = behind * transmit * (1.0 - fresnel) * (1.0 - foam);
+ fragColor = vec4(lit + seen, haveColor ? 1.0 : 0.85);
+#ifdef ES_GBUFFER
+ fragSurface = vec4(packNormal(normalize(N)), roughness, 0.75);
+#endif
+}
+#pragma end
+
+#pragma fragment wgsl
+#ifdef ES_GBUFFER
+struct FragOut {
+ @location(0) color : vec4f,
+ @location(1) surface : vec4f,
+};
+
+fn packNormal(n : vec3f) -> vec2f {
+ let a = n / (abs(n.x) + abs(n.y) + abs(n.z));
+ let sgn = vec2f(select(-1.0, 1.0, a.x >= 0.0), select(-1.0, 1.0, a.y >= 0.0));
+ var e = a.xy;
+ if (a.z < 0.0) { e = (vec2f(1.0) - abs(a.yx)) * sgn; }
+ return e * 0.5 + 0.5;
+}
+#endif
+
+fn waterHash(p0 : vec2f) -> f32 {
+ var p = fract(p0 * vec2f(0.1031, 0.1030));
+ p = p + dot(p, p.yx + 33.33);
+ return fract((p.x + p.y) * p.x);
+}
+fn waterNoise(p : vec2f) -> f32 {
+ let i = floor(p);
+ var f = fract(p);
+ f = f * f * (3.0 - 2.0 * f);
+ return mix(mix(waterHash(i), waterHash(i + vec2f(1.0, 0.0)), f.x),
+ mix(waterHash(i + vec2f(0.0, 1.0)), waterHash(i + vec2f(1.0, 1.0)), f.x), f.y);
+}
+fn ripples(p : vec2f, time : f32) -> f32 {
+ return waterNoise(p / mc.u_rippleLength + vec2f(0.31, 0.12) * time) * 0.6
+ + waterNoise(p / (mc.u_rippleLength * 0.43) - vec2f(0.17, 0.4) * time) * 0.4;
+}
+
+struct Waves { slope : vec2f, crest : f32 };
+
+fn waveSlope(p : vec2f, time : f32, dist : f32) -> Waves {
+ var wave = array<vec4f, 4>(vec4f(0.0, 1.0, 1.0, 1.0), vec4f(28.0, 0.62, 0.55, 1.1), vec4f(-37.0, 0.37, 0.3, 1.2), vec4f(71.0, 0.21, 0.15, 1.35));
+ var slope = vec2f(0.0);
+ var crestSum = 0.0;
+ var weightSum = 0.0;
+ let base = radians(mc.u_waveDirection);
+ for (var i : i32 = 0; i < 4; i = i + 1) {
+ let spec = wave[i];
+ let span = mc.u_waveLength * spec.y;
+ let k = 6.2831853 / span;
+ let a = base + radians(spec.x);
+ let d = vec2f(sin(a), cos(a));
+ let omega = sqrt(9.8 * k) * mc.u_waveSpeed * spec.w;
+ let theta = k * dot(d, p) - omega * time;
+ let e = exp(sin(theta) - 1.0);
+ let seen = clamp(1.0 - dist / (span * 220.0), 0.0, 1.0);
+ slope = slope + d * (mc.u_waveHeight * spec.z * e * cos(theta) * k * seen);
+ crestSum = crestSum + e * spec.z;
+ weightSum = weightSum + spec.z;
+ }
+ var out : Waves;
+ out.slope = slope;
+ out.crest = crestSum / weightSum;
+ return out;
+}
+
+#ifdef ES_GBUFFER
+@fragment fn fs_main(v : VSOut) -> FragOut {
+#else
+@fragment fn fs_main(v : VSOut) -> @location(0) vec4f {
+#endif
+ g_probeSlot = v.v_probeSlot;
+#ifdef MESH_LIGHTMAP
+ g_lightmap = v.v_lightmap;
+#endif
+#ifdef MESH_NORMALS
+ let P = v.v_worldXYZ;
+#else
+ let P = vec3f(v.v_worldPos.x, 0.0, v.v_worldPos.y);
+#endif
+ let time = tc.u_time.x;
+ let viewDir = viewDirection(P);
+ var waterDist = -dot(P, frame.camera.xyz);
+ if (frame.camera.w > 0.5) { waterDist = length(P - frame.camera.xyz); }
+
+ let waves = waveSlope(P.xz, time, waterDist);
+ var slope = waves.slope;
+ let rippleFade = clamp(1.0 - waterDist / (mc.u_rippleLength * 180.0), 0.0, 1.0);
+ let eps = mc.u_rippleLength * 0.1;
+ let ripple = vec2f(ripples(P.xz + vec2f(eps, 0.0), time) - ripples(P.xz - vec2f(eps, 0.0), time),
+ ripples(P.xz + vec2f(0.0, eps), time) - ripples(P.xz - vec2f(0.0, eps), time)) / (2.0 * eps);
+ slope = slope + ripple * (mc.u_rippleStrength * mc.u_rippleLength * rippleFade);
+ var N = normalize(vec3f(-slope.x, 1.0, -slope.y));
+ var Ngeo = vec3f(0.0, 1.0, 0.0);
+ if (viewDir.y < 0.0) { N = -N; Ngeo = -Ngeo; }
+
+ let haveColor = textureSampleLevel(u_sceneColor, u_sceneColor_s, vec2f(0.5), 0.0).a < 0.75;
+ let haveDepth = haveColor && textureSampleLevel(u_sceneDepthMap, u_sceneDepthMap_s, vec2f(0.5), 0.0).a < 0.75;
+ let clip0 = frame.projection * vec4f(P, 1.0);
+ let w0 = max(clip0.w, 1e-4);
+ // This device's rows run down the texture, so clip y is flipped on the way to a uv.
+ let uv0 = vec2f(clip0.x / w0 * 0.5 + 0.5, 0.5 - clip0.y / w0 * 0.5);
+ var behindDist = waterDist + mc.u_fallbackDepth;
+ if (haveDepth) { behindDist = textureSampleLevel(u_sceneDepthMap, u_sceneDepthMap_s, clamp(uv0, vec2f(0.001), vec2f(0.999)), 0.0).r; }
+ let column0 = max(behindDist - waterDist, 0.0);
+
+ let ratio = 1.0 / 1.333;
+ let bentWave = refract(-viewDir, N, ratio);
+ let bentFlat = refract(-viewDir, Ngeo, ratio);
+ let reach = min(column0, mc.u_distortionRange) * mc.u_refractionStrength;
+ let clip1 = frame.projection * vec4f(P + (bentWave - bentFlat) * reach, 1.0);
+ let w1 = max(clip1.w, 1e-4);
+ var uv1 = vec2f(clip1.x / w1 * 0.5 + 0.5, 0.5 - clip1.y / w1 * 0.5);
+ var behind = vec3f(0.0);
+ var column = column0;
+ if (haveColor) {
+ uv1 = clamp(uv1, vec2f(0.001), vec2f(0.999));
+ var dist1 = behindDist;
+ if (haveDepth) { dist1 = textureSampleLevel(u_sceneDepthMap, u_sceneDepthMap_s, uv1, 0.0).r; }
+ if (dist1 < waterDist) { uv1 = clamp(uv0, vec2f(0.001), vec2f(0.999)); dist1 = behindDist; }
+ behind = textureSampleLevel(u_sceneColor, u_sceneColor_s, uv1, 0.0).rgb;
+ column = max(dist1 - waterDist, 0.0);
+ }
+
+ let transmit = exp(-mc.u_absorption.rgb * (mc.u_density * column));
+ let murk = 1.0 - dot(transmit, vec3f(1.0 / 3.0));
+ let scatterColor = mix(mc.u_shallowColor.rgb, mc.u_deepColor.rgb, vec3f(1.0 - exp(-column * mc.u_density * 0.5)));
+
+ let vertical = column * max(abs(viewDir.y), 0.15);
+ let foamScale = 1.0 / (mc.u_rippleLength * 1.2);
+ let breakup = waterNoise(P.xz * foamScale + vec2f(time * 0.07, time * 0.05)) * 0.6 + waterNoise(P.xz * foamScale * 3.0 - vec2f(time * 0.13, 0.0)) * 0.4;
+ let pulse = 0.65 + 0.35 * sin(time * 0.9 + breakup * 6.0);
+ var shore = 0.0;
+ if (haveDepth && mc.u_foamWidth > 0.0) { shore = clamp((1.0 - vertical / (mc.u_foamWidth * pulse)) * 1.5 - breakup * 0.8, 0.0, 1.0); }
+ var onCrest = 0.0;
+ if (mc.u_foamCrest > 0.0) { onCrest = smoothstep(1.0 - 0.3 * mc.u_foamCrest, 1.0, waves.crest) * smoothstep(0.35, 0.75, breakup); }
+ let foam = clamp(max(shore, onCrest * mc.u_foamCrest), 0.0, 1.0);
+
+ var ext = surfaceExtNone(N);
+ ext.misc.x = 0.0204;
+ let albedo = mix(scatterColor * murk, mc.u_foamColor.rgb, vec3f(foam));
+ let roughness = mix(mc.u_roughness, 0.7, foam);
+ let lit = applyLightingSurface(albedo, N, P, viewDir, 0.0, roughness, 1.0, 1.0, ext);
+ let cosV = clamp(dot(N, viewDir), 0.0, 1.0);
+ let fresnel = 0.0204 + (1.0 - 0.0204) * pow(1.0 - cosV, 5.0);
+ let seen = behind * transmit * (1.0 - fresnel) * (1.0 - foam);
+ var alpha = 0.85;
+ if (haveColor) { alpha = 1.0; }
+#ifdef ES_GBUFFER
+ var frag : FragOut;
+ frag.color = vec4f(lit + seen, alpha);
+ frag.surface = vec4f(packNormal(normalize(N)), roughness, 0.75);
+ return frag;
+#else
+ return vec4f(lit + seen, alpha);
+#endif
+}
+#pragma end
+`;
+
export const BUILTIN_SHADER_TEMPLATES: readonly BuiltinShaderTemplate[] = [
template('sprite-unlit', 'Unlit', 'Texture × vertex color × tint, no lighting.', SPRITE_UNLIT),
template('sprite-lit', 'Lit', 'Lit by the scene\'s 2D lights; optional normal map.', SPRITE_LIT),
@@ -704,6 +1041,8 @@ export const BUILTIN_SHADER_TEMPLATES: readonly BuiltinShaderTemplate[] = [
template('model', 'Model',
'What an imported model\'s material says: normal map, emission, occlusion, alpha cutoff.',
MODEL),
+ template('water', 'Water',
+ 'Waves, refraction, reflection, depth absorption and foam for a horizontal body of water.', WATER),
];
export function builtinShaderTemplate(id: string): BuiltinShaderTemplate | undefined {
diff --git a/src/esengine/data/shaders/blit.esshader b/src/esengine/data/shaders/blit.esshader
index 5df152e0c..ecfc913ec 100644
--- a/src/esengine/data/shaders/blit.esshader
+++ b/src/esengine/data/shaders/blit.esshader
@@ -7,6 +7,9 @@ precision highp float;
in vec2 v_texCoord;
uniform sampler2D u_texture;
+#ifdef ES_COPY_DEPTH
+uniform highp sampler2D u_sceneDepth;
+#endif
out vec4 fragColor;
#ifdef ES_UPSCALE
@@ -45,6 +48,16 @@ vec4 upscale(vec2 uv) {
#endif
void main() {
+#ifdef ES_COPY_DEPTH
+ // How far each pixel of the opaque scene is from the eye, in world units, for a surface that measures the column of water or
+ // glass in front of it. A sky pixel is far. Alpha 0.5 is the same "a real copy" mark as the colour copy's.
+ ivec2 depthSize = textureSize(u_sceneDepth, 0);
+ float rawDepth = texelFetch(u_sceneDepth, clamp(ivec2(v_texCoord * vec2(depthSize)), ivec2(0), depthSize - ivec2(1)), 0).r;
+ vec3 scenePoint = worldFromDepth(v_texCoord, rawDepth);
+ float eyeDistance = u_camera.w > 0.5 ? length(scenePoint - u_camera.xyz) : -dot(scenePoint, u_camera.xyz);
+ fragColor = vec4(rawDepth >= 1.0 ? 60000.0 : eyeDistance, 0.0, 0.0, 0.5);
+ return;
+#endif
#ifdef ES_UPSCALE
vec4 c = upscale(v_texCoord);
#else
@@ -112,6 +125,14 @@ fn upscale(uv : vec2f) -> vec4f {
#endif
@fragment fn fs_main(v : VSOut) -> @location(0) vec4f {
+#ifdef ES_COPY_DEPTH
+ let depthSize = vec2i(textureDimensions(t7, 0));
+ let rawDepth = textureLoad(t7, clamp(vec2i(v.v_texCoord * vec2f(depthSize)), vec2i(0), depthSize - vec2i(1)), 0);
+ let scenePoint = worldFromDepth(v.v_texCoord, rawDepth);
+ var eyeDistance = -dot(scenePoint, frame.camera.xyz);
+ if (frame.camera.w > 0.5) { eyeDistance = length(scenePoint - frame.camera.xyz); }
+ return vec4f(select(eyeDistance, 60000.0, rawDepth >= 1.0), 0.0, 0.0, 0.5);
+#endif
#ifdef ES_UPSCALE
var c = upscale(v.v_texCoord);
#else
diff --git a/src/esengine/renderer/draw/DrawList.cpp b/src/esengine/renderer/draw/DrawList.cpp
index c6ae26b07..ca2a56cb9 100644
--- a/src/esengine/renderer/draw/DrawList.cpp
+++ b/src/esengine/renderer/draw/DrawList.cpp
@@ -362,6 +362,13 @@ bool DrawList::anyUsesSceneColor(const MaterialStore& materials) const {
return false;
}
+bool DrawList::anyUsesSceneDepth(const MaterialStore& materials) const {
+ for (u32 i = 0; i < merged_draw_calls_; ++i) {
+ if (commands_[i].material_id != 0 && materials.usesSceneDepth(commands_[i].material_id)) return true;
+ }
+ return false;
+}
+
void DrawList::execute(GfxDevice& device, TransientBufferPool& buffers,
MaterialStore& materials, u32 white_texture_id,
FrameCapture* capture, const PerDrawBlockSet& blocks, Phase phase) {
diff --git a/src/esengine/renderer/draw/DrawList.hpp b/src/esengine/renderer/draw/DrawList.hpp
index 76f37c9cd..427ad1822 100644
--- a/src/esengine/renderer/draw/DrawList.hpp
+++ b/src/esengine/renderer/draw/DrawList.hpp
@@ -65,6 +65,8 @@ public:
/// Whether any merged draw reads the picture behind it.
bool anyUsesSceneColor(const MaterialStore& materials) const;
+ /// Whether any merged draw reads the distance to the opaque scene behind it.
+ bool anyUsesSceneDepth(const MaterialStore& materials) const;
/** Append one draw's bone matrices; returns where they start. Frame-scoped,
* like the vertex pool: a command references an offset, not a copy. */
diff --git a/src/esengine/renderer/frame/PostProcessPipeline.cpp b/src/esengine/renderer/frame/PostProcessPipeline.cpp
index c503b31b5..2adb645bd 100644
--- a/src/esengine/renderer/frame/PostProcessPipeline.cpp
+++ b/src/esengine/renderer/frame/PostProcessPipeline.cpp
@@ -231,6 +231,10 @@ void PostProcessPipeline::shutdown() {
resourceManager_.releaseShader(copyShader_);
copyShader_ = resource::ShaderHandle{};
}
+ if (copyDepthShader_.isValid()) {
+ resourceManager_.releaseShader(copyDepthShader_);
+ copyDepthShader_ = resource::ShaderHandle{};
+ }
for (auto& shader : upscaleShaders_) {
if (!shader.isValid()) continue;
resourceManager_.releaseShader(shader);
@@ -1024,6 +1028,28 @@ void PostProcessPipeline::grabScene() {
drawScreenQuad();
}
+bool PostProcessPipeline::canGrabDepth() {
+ return device_.supportsFloatTargets();
+}
+
+void PostProcessPipeline::grabDepth() {
+ if (!copyDepthShader_.isValid()) {
+ copyDepthShader_ = compileBlit({"ES_COPY_DEPTH"});
+ if (!copyDepthShader_.isValid()) {
+ ES_LOG_ERROR("PostProcessPipeline: no depth copy shader; water sees no depth behind it");
+ return;
+ }
+ }
+ Shader* shader = resourceManager_.getShader(copyDepthShader_);
+ if (!shader) return;
+ applyPassPipeline(*shader);
+ shader->setUniform("u_texture", 0);
+ if (shader->hasUniform("u_sceneDepth")) shader->setUniform("u_sceneDepth", static_cast<i32>(kSceneDepthUnit));
+ shader->commitParams();
+ device_.bindTexture(kSceneDepthUnit, graph_ ? graph_->depthTextureOf(sceneResource_) : TextureHandle::Invalid);
+ drawScreenQuad();
+}
+
void PostProcessPipeline::blitPass() {
Shader* shader = resourceManager_.getShader(outputShader());
if (!shader) return;
diff --git a/src/esengine/renderer/frame/PostProcessPipeline.hpp b/src/esengine/renderer/frame/PostProcessPipeline.hpp
index fe6e9fa0d..d59d5d1f6 100644
--- a/src/esengine/renderer/frame/PostProcessPipeline.hpp
+++ b/src/esengine/renderer/frame/PostProcessPipeline.hpp
@@ -268,6 +268,18 @@ public:
/// encode: a copy, with the alpha set to a marker (0.5) a shader can tell from the white a texture param falls back to.
void grabScene();
+ /// Whether this device can hold the distances a depth copy is made of: a float target. Without one a surface that measures
+ /// the water in front of what is behind it gets no depth and falls back to a fixed column.
+ bool canGrabDepth();
+ /// The shape of the copy of the opaque scene's depth: how far each pixel is from the eye, in the red channel of a float target.
+ rg::TargetDesc grabDepthTarget() {
+ rg::TargetDesc desc = chainTarget(/*withDepth=*/false);
+ desc.format = GfxPixelFormat::RGBA16F;
+ return desc;
+ }
+ /// Draws, into the target being drawn, the distance to the opaque scene at every pixel (the scene's depth, read at its unit).
+ void grabDepth();
+
/**
* @brief Whether the scene is to be cleared to nothing (all four channels zero) so that its alpha says how much of each pixel geometry covers.
*
@@ -607,6 +619,7 @@ private:
/// The same three blits (plain, neutral, ACES) with the resampling upscaler, compiled when a present first needs one.
resource::ShaderHandle upscaleShaders_[3];
resource::ShaderHandle copyShader_;
+ resource::ShaderHandle copyDepthShader_;
std::vector<PostProcessPass> passes_;
u32 width_ = 0;
diff --git a/src/esengine/renderer/frame/RenderFrame.cpp b/src/esengine/renderer/frame/RenderFrame.cpp
index 245e2fc9f..cddd838c7 100644
--- a/src/esengine/renderer/frame/RenderFrame.cpp
+++ b/src/esengine/renderer/frame/RenderFrame.cpp
@@ -653,16 +653,25 @@ void RenderFrame::end() {
#endif
rg::PassDesc glassPass;
rg::ResourceId grab = rg::kNoResource;
+ rg::ResourceId grabDepth = rg::kNoResource;
if (glass) {
#ifdef ES_ENABLE_POSTPROCESS
grab = graph_.createTarget(post_process_->grabTarget());
+ // The distance to what stands behind, for a surface that measures the water in front of it: only when one asks, and
+ // only where a float target can hold distances.
+ if (draw_list_.anyUsesSceneDepth(context_.materials()) && post_process_->canGrabDepth()) {
+ grabDepth = graph_.createTarget(post_process_->grabDepthTarget());
+ }
glassPass = scene;
glassPass.name = "scene-glass";
glassPass.dependencies.push_back(grab);
- glassPass.execute = [this, grab](const rg::PassContext&) {
+ if (grabDepth != rg::kNoResource) glassPass.dependencies.push_back(grabDepth);
+ glassPass.execute = [this, grab, grabDepth](const rg::PassContext&) {
context_.materials().setSceneColor(graph_.textureOf(grab));
+ if (grabDepth != rg::kNoResource) context_.materials().setSceneDepth(graph_.textureOf(grabDepth));
drawScene(DrawList::Phase::SceneColorOnly);
context_.materials().setSceneColor(TextureHandle::Invalid);
+ context_.materials().setSceneDepth(TextureHandle::Invalid);
if (presented_overlay_draw_) presented_overlay_draw_->flushDeferred();
};
#endif
@@ -680,6 +689,14 @@ void RenderFrame::end() {
copy.write = grab;
copy.execute = [this](const rg::PassContext&) { post_process_->grabScene(); };
graph_.addPass(std::move(copy));
+ if (grabDepth != rg::kNoResource) {
+ rg::PassDesc copyDepth;
+ copyDepth.name = "scene-grab-depth";
+ copyDepth.reads = {scene_resource_};
+ copyDepth.write = grabDepth;
+ copyDepth.execute = [this](const rg::PassContext&) { post_process_->grabDepth(); };
+ graph_.addPass(std::move(copyDepth));
+ }
#endif
graph_.addPass(std::move(glassPass));
}
diff --git a/src/esengine/renderer/rhi/ShaderEmbeds.generated.hpp b/src/esengine/renderer/rhi/ShaderEmbeds.generated.hpp
index 3bbca8e6e..1e78b6ac5 100644
--- a/src/esengine/renderer/rhi/ShaderEmbeds.generated.hpp
+++ b/src/esengine/renderer/rhi/ShaderEmbeds.generated.hpp
@@ -247,6 +247,9 @@ precision highp float;
in vec2 v_texCoord;
uniform sampler2D u_texture;
+#ifdef ES_COPY_DEPTH
+uniform highp sampler2D u_sceneDepth;
+#endif
out vec4 fragColor;
#ifdef ES_UPSCALE
@@ -285,6 +288,16 @@ vec4 upscale(vec2 uv) {
#endif
void main() {
+#ifdef ES_COPY_DEPTH
+
+
+ ivec2 depthSize = textureSize(u_sceneDepth, 0);
+ float rawDepth = texelFetch(u_sceneDepth, clamp(ivec2(v_texCoord * vec2(depthSize)), ivec2(0), depthSize - ivec2(1)), 0).r;
+ vec3 scenePoint = worldFromDepth(v_texCoord, rawDepth);
+ float eyeDistance = u_camera.w > 0.5 ? length(scenePoint - u_camera.xyz) : -dot(scenePoint, u_camera.xyz);
+ fragColor = vec4(rawDepth >= 1.0 ? 60000.0 : eyeDistance, 0.0, 0.0, 0.5);
+ return;
+#endif
#ifdef ES_UPSCALE
vec4 c = upscale(v_texCoord);
#else
@@ -352,6 +365,14 @@ fn upscale(uv : vec2f) -> vec4f {
#endif
@fragment fn fs_main(v : VSOut) -> @location(0) vec4f {
+#ifdef ES_COPY_DEPTH
+ let depthSize = vec2i(textureDimensions(t7, 0));
+ let rawDepth = textureLoad(t7, clamp(vec2i(v.v_texCoord * vec2f(depthSize)), vec2i(0), depthSize - vec2i(1)), 0);
+ let scenePoint = worldFromDepth(v.v_texCoord, rawDepth);
+ var eyeDistance = -dot(scenePoint, frame.camera.xyz);
+ if (frame.camera.w > 0.5) { eyeDistance = length(scenePoint - frame.camera.xyz); }
+ return vec4f(select(eyeDistance, 60000.0, rawDepth >= 1.0), 0.0, 0.0, 0.5);
+#endif
#ifdef ES_UPSCALE
var c = upscale(v.v_texCoord);
#else
diff --git a/src/esengine/renderer/store/MaterialStore.cpp b/src/esengine/renderer/store/MaterialStore.cpp
index 961a5826b..79e3042a8 100644
--- a/src/esengine/renderer/store/MaterialStore.cpp
+++ b/src/esengine/renderer/store/MaterialStore.cpp
@@ -276,6 +276,7 @@ void MaterialStore::bindForDraw(u32 materialId) {
TextureHandle gpu = builtinDefault(slot.defaultTexture);
// What stood behind this draw, where the frame took a copy of it; a material that named a texture there keeps its own.
if (sceneColor_ != TextureHandle::Invalid && slot.name == "u_sceneColor") gpu = sceneColor_;
+ if (sceneDepth_ != TextureHandle::Invalid && slot.name == "u_sceneDepthMap") gpu = sceneDepth_;
for (const auto& b : rec.textures) {
if (b.unit != slot.unit) continue;
// Resolved HERE rather than cached at set time. A pool lookup is
diff --git a/src/esengine/renderer/store/MaterialStore.hpp b/src/esengine/renderer/store/MaterialStore.hpp
index d7f2a86ee..b49ba2849 100644
--- a/src/esengine/renderer/store/MaterialStore.hpp
+++ b/src/esengine/renderer/store/MaterialStore.hpp
@@ -328,6 +328,16 @@ public:
/// `u_sceneColor` unit unless the material was given a texture of its own there.
void setSceneColor(TextureHandle texture) { sceneColor_ = texture; }
+ /// Whether @p materialId's shader reads how far the opaque scene behind it is (declares `u_sceneDepthMap`): water measuring its
+ /// own depth, a fade where a surface meets what it lies on. Such a draw is also made after the scene's copy.
+ bool usesSceneDepth(u32 materialId) const {
+ const MaterialRecord* m = find(materialId);
+ const MaterialUniformLayout* layout = m ? layoutFor(m->shaderRef) : nullptr;
+ return layout && layout->findTexture("u_sceneDepthMap") != nullptr;
+ }
+ /// The copy of the opaque scene's distances the frame took, or invalid when it took none. Bound to a material's `u_sceneDepthMap` unit.
+ void setSceneDepth(TextureHandle texture) { sceneDepth_ = texture; }
+
/// Whether @p materialId's output alpha is coverage now: its shader names a
/// coverage param and this material holds it above zero.
bool alphaIsCoverage(u32 materialId) const {
@@ -388,6 +398,7 @@ private:
/// Programs compiled with ES_GBUFFER (see programWritesGBuffer).
mutable std::unordered_set<u32> gbuffer_programs_;
TextureHandle sceneColor_ = TextureHandle::Invalid;
+ TextureHandle sceneDepth_ = TextureHandle::Invalid;
public:
/** @brief How many material program variants have been built. A prewarm counts
diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjs
index 57f368252..1e204a988 100644
--- a/tools/releaseNotes.mjs
+++ b/tools/releaseNotes.mjs
@@ -2505,6 +2505,10 @@ export const NOTED = {
{"note":"The Sky Atmosphere's clouds can now cast shadows on the scene."},
"chore(editor-checks): a cloud-shadow check":
{"internal":"the editor check for the cloud shadows entry above"},
+ "feat(render): a Water material with waves, refraction, depth absorption and foam":
+ {"note":"A Water material: waves that travel, the scene seen through it bent and tinted by how deep the water is, reflections, and foam at the shore and on the crests."},
+ "chore(editor-checks): a water-look check":
+ {"internal":"the editor check for the Water material entry above"},
"fix(render): a wire narrower than a pixel is no longer painted over by the sky in dashes":
{"note":"A wire or railing thinner than a pixel stays one line against the sky instead of breaking into dashes."},
"fix(render): contact shadows no longer speckle a surface the sun does not reach, and a temporal pass placed before a noisy effect is flagged":