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.

chore(gates): the note on water's reflections says what is in it

yhh220339257b82
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d85f59155..22b72ba5c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -34,7 +34,7 @@ published separately; it ships inside the editor.
### Fixed
- **The ground's lengths follow the project's units.** A `Terrain`'s size, height, cell, draw distance and collision distance were plain numbers, and so were its shaders' layer tiles, relief and wet line and a layer file's default tile: a new terrain in a default project was ten metres of ground on 2 cm cells with collision built 64 cm round a body. They are lengths now (`worldUnitFields`, `unit(length)`), written at 100 units a metre: a kilometre of ground on 2 m cells, collision 64 m round a body, a layer 24 m across, in a centimetre project and a metre one. What a scene, a material or a layer file states is untouched; a scene that left `collisionDistance` or `drawDistance` to the default gets the new one, so state the old (64, 4000) to keep it. Ground with `layers` is also no longer sent the four layer colours of the plain shader, which warned four times a load.
-- **Water mirrors only what is there.** Over open sea with no ground behind it the water's reflection went black: the ray through the picture took a sky pixel for something it had met, and the sky is painted after that picture is taken. From above, the sea darkened along the edge of the terrain under it, a line across the water. And a ripple steep enough to send the ray down met the sea bed in the picture, undimmed by its water: white flecks all over a shallow sea. The copy of the scene's distances now marks where the picture holds nothing, a ray sent down goes on up as off the next wave, and waves finer than a pixel widen the sun's highlight instead of flashing pixel by pixel. The ray's step and the thickness of what it meets are shares of the distance to the water, where they were a number of units (a centimetre in one project, a metre in another).
+- **Water mirrors only what is there.** Over open sea with no ground behind it the water's reflection went black: the ray through the picture took a sky pixel for something it had met, and the sky is painted after that picture is taken. From above, the sea darkened along the edge of the terrain under it, a line across the water. And a ripple steep enough to send the ray down met the sea bed in the picture, undimmed by its water: white flecks all over a shallow sea. The copy of the scene's distances now marks where the picture holds nothing, a ray sent down goes on up as off the next wave. (A first version also widened the highlight by how far the normal turns across a pixel; that made a distant sea rough and took most of its glancing reflection of the sky away, and is not in this release: the ripple map's mips keep far water from flashing.) The ray's step and the thickness of what it meets are shares of the distance to the water, where they were a number of units (a centimetre in one project, a metre in another).
- **A mesh shader's eighth texture finds a unit.** A material's textures past the seventh take an engine unit the shader never reads. A shader that named `u_textures` at all was counted as reading all eight batch units, though a mesh shader reads only its base texture, `u_textures[0]`: so anything built on Model had seven textures and no more. Ground Blend has eight, lost the last (the wet-ground map), and did not compile on WebGPU (`unresolved value 'u_wetMask'`); voxel ground had dropped its wet map to stay under. A literal index now counts as that one unit, so a Lit mesh shader has eight, Ground Blend draws on WebGPU, and voxel ground is wet where the weather says, as other ground is.
- **A Foliage field of any size is cut into cells no wider than its cell size.** An area was cut into at most 200 cells a side. Past that each cell was left wider than `cellSize`, and its plants were still scattered over `cellSize` of it: a field over a six-kilometre terrain grew in clumps 12 m across with 19 m of bare ground between. The cap dated from when every cell was made at once; cells are grown round the eye now, so it is gone, and a field of any size is covered.
- **Water is as deep as it is, not as far as the eye's line through it.** The water a pixel's light had crossed was measured along the eye's straight line to the bed. Seen low across the sea that line is ten or twenty times the depth, so shallows turned deep and blue a short way out and a lagoon was only turquoise from above. Light bends down as it enters water and is never more than 49 degrees off straight down in it: the path is now the depth over that slope, at most half as long again as the depth. The bed is also dimmed by the water its light came down through (`u_bedShade`, 1; 0 is the old look, lit as if dry), and how soon the water's own colour turns from shallow to deep is `u_deepening` (0.5 of the density, what was fixed before). A scene's shallows will read clearer from low angles and a little darker from above.
diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjs
index 5639c8d0a..6dd17dc17 100644
--- a/tools/releaseNotes.mjs
+++ b/tools/releaseNotes.mjs
@@ -4556,6 +4556,8 @@ export const NOTED = {
{"note": "A baked occlusion over the ground."},
"fix(water): water is as deep as it is, not as far as the eye's line through it - the light a pixel shows crossed the depth under it at the slope light takes in water, where the straight line to the bed made any sea seen low across it deep and blue; the bed is dimmed by the water its light came down through too, and how soon the water's colour deepens is a param":
{"note": "Water is as deep as it is, not as far as the eye's line through it."},
+ "fix(water): a far sea mirrors the sky again - the widening of the highlight by how the normal turns across a pixel made distant water as rough as chalk and took most of its glancing reflection away; it is gone, and the ripple map's own mips are what keep far water from flashing":
+ {"note": "Water mirrors only what is there."},
"fix(terrain): a splatmap is numbers too - cooked as a picture its three weights were overwritten wherever the fourth was 0, and the whole ground was painted as grass; it is marked Data when it is set, as the heightmap is":
{"note": "A texture says whether it is a picture or numbers."},
"perf(lighting): a lit sprite is lit by its own short function - the general model's sums term for term, the two 2D masks read once for the pixel where each light read them again, and none of the highlight carried along; 32 screen-filling lit layers under four lamps go from 5.4 ms to 4.7 on WebGL2 and from 8.8 to 6.5 on WebGPU, and the note prices what is left":