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, the component reference and the API surface for the ground's colour map

yhh73c152f3997d
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7673a1729..2911685ce 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,6 +19,7 @@ published separately; it ships inside the editor.
- **A texture says whether it is a picture or numbers.** Import settings have a **Use**: Colour, or Data for an image read a number a texel (a heightmap, a mask of measured values, a lookup table). A build treats Data as what it is: never compressed, never decoded as sRGB or filled, kept at its depth, and at its own size unless Max Size (which now offers Source size) says otherwise, in which case it is resampled at 16 bits and not through 8. Nobody has to know to set it: a PNG of 16 bits a sample is imported as Data from the editor and the CLI alike, a texture put in a `Terrain`'s heightmap or splatmap is marked Data there and then (a splatmap cooked as a picture had its weights overwritten wherever the fourth was 0, and the ground fell back to grass everywhere), and Project Health lists textures a component reads as numbers that are still set up as pictures, with the fix on the row.
- **An ocean reaches the horizon.** The sea's surface is rings of mesh round the camera, and it ended where they did: from a hill, or with a small `cells` and `rings`, a straight edge with nothing past it. A flat apron now carries it on to 80 km, at the cost of one row of quads.
- **A sea is eight waves spread about the wind.** Water's waves were four peaked sines, the longest far taller than the rest, and from any height the sea read as regular curved bands. The set is now eight: the first heads with the wind, each after it is 0.78 of the length before, nearly as steep, and off the wind by a golden-ratio step within 65 degrees, each at the speed its length gives deep water. Their heights add up to what the four's did, so `waveHeight` raises a crest as high as before and nothing built on the old bound moves. `Waters.sample`, `Floating` and the drawn surface still share one formula: the shader's waves are now written out from the table in `water/waves.ts` (`WAVE_SET`) when its source is assembled, where the same numbers were kept by hand in five places. A quality level's `waterWaves` is 3 / 5 / 8 (was 2 / 3 / 4), longest first. A scene tuned against the old four will look different: the same height spread over more, smaller waves.
+- **A colour map over the ground.** Layers paint a terrain by kind of ground, and a meadow painted with one grass layer is one green from end to end. `Terrain.colorMap` is a picture laid over a whole area and mixed into the ground's colour by its alpha (the flowers of a meadow, the regions of a map, scorched ground), on the plain Terrain shader and on Terrain Layers alike; `colorMapStrength` says how much, and is read each frame. It is one more texture on the ground's material (the seventh on Terrain Layers, whose eight layers are three arrays). A material of your own on those shaders has it as `u_colorMap`, `u_colorMapStrength` and `u_colorMapArea`.
- **Water is a body and a surface.** The water's own colour was lit by the ripples' normal, as a painted surface is, so every ripple had a dark far side and a sea was blotched with dark patches no real water has. It is two layers now, as Unreal's single-layer water is: the body is lit as light from under the surface, and the surface is a coat over it that mirrors by the ripples (a coat may now state its reflectance, `coat.z` in a shader's `SurfaceExt`; 0 stays a varnish's 0.04). `u_bodyShading` says how much the ripples still shade the colour (0.25; 1 is the old look), `u_reflectance` what the surface mirrors seen straight on.
- **The wind's ripples are a map of many waves.** The small ripples on water were six straight wave trains summed in the shader. Low across the water the short ones faded and the two longest crossed in a regular board of dark spots. They are now three layers of a tiling normal map the engine makes from 96 waves at every heading, read with mips at sizes that share no multiple (so no one size's repeat shows) and scrolled downwind, as Unreal's water reads its normal maps, with gusts across them: slow patches where the wind ruffles the water and slicks where it does not. No lattice, nothing finer than a pixel, three texture reads where there were six waves. Every number of it is a material param: `u_rippleTile`, `u_rippleFineSize`, `u_rippleWideSize`, the three weights, `u_rippleTurn`, `u_rippleGusts`, `u_gustCalm`, `u_gustRuffle`, `u_gustSize`. `u_rippleStrength`, `u_rippleLength`, the wind's direction and speed mean what they did. The map is `default(ripples)`, a built-in a shader of your own can name; water's `u_detailMap` defaults to it, so a material that sets its own detail map gets its ripples from that map.
- **A shader param's range is where its slider runs.** `range(min,max)` on a `#pragma param` set the slider in the material inspector and also clamped the number typed beside it, so a value the shader's author had not thought of could not be entered. The range is now the slider's reach only, as a UI range is in Unreal: the box takes any number, and the thumb rests at the end of the track.
diff --git a/docs/astro/src/data/components.generated.json b/docs/astro/src/data/components.generated.json
index 972b5e400..c1a79ebf9 100644
--- a/docs/astro/src/data/components.generated.json
+++ b/docs/astro/src/data/components.generated.json
@@ -7901,6 +7901,19 @@
"default": "none",
"doc": "An image whose red, green, blue and alpha are the weights of layers 5 to 8."
},
+ {
+ "key": "colorMap",
+ "type": "Asset<texture>",
+ "default": "none",
+ "doc": "A picture laid over the whole area and mixed into the ground's colour by its alpha. Its Use is Colour."
+ },
+ {
+ "key": "colorMapStrength",
+ "type": "number",
+ "default": "1",
+ "doc": "How much of the colour map is mixed in where its alpha is whole.",
+ "range": "0–1, step 0.01"
+ },
{
"key": "layers",
"type": "array",
@@ -8089,6 +8102,8 @@
"heightmapFormat",
"splatmap",
"splatmap2",
+ "colorMap",
+ "colorMapStrength",
"material",
"sizeX",
"sizeZ",
diff --git a/sdk/etc/index.api.md b/sdk/etc/index.api.md
index a0deb1c67..72158459d 100644
--- a/sdk/etc/index.api.md
+++ b/sdk/etc/index.api.md
@@ -11477,6 +11477,8 @@ cellSize: number
collision: boolean
collisionDistance: number
collisionLayer: number
+colorMap: number
+colorMapStrength: number
detail: number
dirtHeight: number
drawDistance: number
diff --git a/sdk/etc/index.native.api.md b/sdk/etc/index.native.api.md
index 28719a198..e4ebc1982 100644
--- a/sdk/etc/index.native.api.md
+++ b/sdk/etc/index.native.api.md
@@ -11699,6 +11699,8 @@ cellSize: number
collision: boolean
collisionDistance: number
collisionLayer: number
+colorMap: number
+colorMapStrength: number
detail: number
dirtHeight: number
drawDistance: number
diff --git a/sdk/etc/index.node.api.md b/sdk/etc/index.node.api.md
index 081c9604b..8b221a7ef 100644
--- a/sdk/etc/index.node.api.md
+++ b/sdk/etc/index.node.api.md
@@ -11472,6 +11472,8 @@ cellSize: number
collision: boolean
collisionDistance: number
collisionLayer: number
+colorMap: number
+colorMapStrength: number
detail: number
dirtHeight: number
drawDistance: number
diff --git a/sdk/etc/minigame.api.md b/sdk/etc/minigame.api.md
index 90651f0a5..18f0be98e 100644
--- a/sdk/etc/minigame.api.md
+++ b/sdk/etc/minigame.api.md
@@ -11769,6 +11769,8 @@ cellSize: number
collision: boolean
collisionDistance: number
collisionLayer: number
+colorMap: number
+colorMapStrength: number
detail: number
dirtHeight: number
drawDistance: number
diff --git a/sdk/etc/terrain.api.md b/sdk/etc/terrain.api.md
index 5b9e1510f..e93e93674 100644
--- a/sdk/etc/terrain.api.md
+++ b/sdk/etc/terrain.api.md
@@ -471,6 +471,8 @@ cellSize: number
collision: boolean
collisionDistance: number
collisionLayer: number
+colorMap: number
+colorMapStrength: number
detail: number
dirtHeight: number
drawDistance: number
diff --git a/sdk/etc/wechat.api.md b/sdk/etc/wechat.api.md
index d7d8a2b99..9a9d5952e 100644
--- a/sdk/etc/wechat.api.md
+++ b/sdk/etc/wechat.api.md
@@ -11479,6 +11479,8 @@ cellSize: number
collision: boolean
collisionDistance: number
collisionLayer: number
+colorMap: number
+colorMapStrength: number
detail: number
dirtHeight: number
drawDistance: number
diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjs
index 11f5561cd..cc2b9e973 100644
--- a/tools/releaseNotes.mjs
+++ b/tools/releaseNotes.mjs
@@ -4538,6 +4538,8 @@ export const NOTED = {
{"note": "A sea is eight waves spread about the wind."},
"feat(water): water is a body and a surface, and its ripples do not repeat - the body's colour is lit as light from under the surface instead of darkening on the far side of every ripple, the surface is a coat of water's reflectance over it, the ripples are three layers of the map at sizes that share no multiple with gusts and slicks across them, and every number of it is a material param":
{"note": "Water is a body and a surface."},
+ "feat(terrain): a colour map over the ground - Terrain.colorMap is a picture laid over a whole area and mixed into the ground's colour by its alpha, on the plain shader and on the layered one, with colorMapStrength read each frame":
+ {"note": "A colour map over the ground."},
"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."},
};