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.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
chore(gates): the note, the reference and the API surface for Foliage's far versions; the worker test names them
yhh88e7c8ff6161
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 249b03f1c..5d664811e 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.+- **Foliage thins plant by plant with distance, and is grown only where it is drawn.** A cell of `Foliage` had one far version (every third blade of grass, or a tree's cards), every cell held its full near mesh however far off it stood, and a field ended in a line at its draw distance. A cell now has up to three far versions (`farLevels`), each keeping `farKeep` of the plants of the one before, grown by up to `farGrow` to cover the same ground, and taking over `farStep` times further out. Every plant has a number of its own: the shader thins by it with distance, and a far version holds exactly the plants still drawn where it takes over, so nothing jumps at the switch and the field fades to none at `drawDistance`. With a material, each version is a layer of cells of its own, grown only as far out as it is drawn: a meadow drawn to 300 m is whole within the first tens of metres and a fraction of itself beyond, where before it would not fit in memory. `farCards` says whether a mesh's far version is crossed cards (a tree, as before) or the plant itself, fewer and larger (a flower). The Foliage shader also gains `u_tipFrom`: how far up a plant the tip's colour begins, for a stem under a flower's head. The defaults keep one far version at a third, so a field's look changes only at its far edge, which now fades.- **A meadow: a density map and a colour map for Foliage.** `Foliage` scattered its plants evenly over its area, and every plant of a field was the one colour its material gave. `densityMap` is an image over the area whose red says how many of them stand where (none at black, all of `count` at white), so flowers grow in drifts and grass thins toward a path; a place keeps or loses its plant by a lot of its own, the same on every thread and in every cell. `colorMap` is a picture that colours the plants by where they stand, mixed in by its alpha from `colorMapFrom` up the plant, with `colorMapStrength`: one flower mesh and one material are pink here and yellow there. The density map is numbers (its Use is Data, set when the field is); the colour map is read each frame and grows nothing again.- **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.diff --git a/docs/astro/src/data/components.generated.json b/docs/astro/src/data/components.generated.jsonindex a3960e6a3..535030ba7 100644--- a/docs/astro/src/data/components.generated.json+++ b/docs/astro/src/data/components.generated.json@@ -2443,6 +2443,40 @@"doc": "How far up a plant the colour map begins: 0 colours it whole, higher only its top.","range": "0–1, step 0.01"},+ {+ "key": "farLevels",+ "type": "number",+ "default": "1",+ "doc": "How many far versions a cell has: each is the same plants, fewer and larger, and takes over further out than the last.",+ "range": "1–3, step 1"+ },+ {+ "key": "farKeep",+ "type": "number",+ "default": "0.34",+ "doc": "The share of its plants each far version keeps of the one before. They thin to it plant by plant before it takes over.",+ "range": "0.1–1, step 0.01"+ },+ {+ "key": "farStep",+ "type": "number",+ "default": "2",+ "doc": "How many times further out each far version takes over than the one before. The first takes over at the LOD distance.",+ "range": "1.2–4, step 0.05"+ },+ {+ "key": "farGrow",+ "type": "number",+ "default": "2",+ "doc": "The most a plant kept in a far version is grown by, to cover the ground the ones left out did.",+ "range": "1–6, step 0.1"+ },+ {+ "key": "farCards",+ "type": "boolean",+ "default": "true",+ "doc": "A mesh's far version is crossed cards of its texture (a tree). Off, it is the plant itself, fewer and larger (a flower)."+ },{"key": "sizeX","type": "number",@@ -2608,6 +2642,10 @@"colorMap","colorMapStrength","colorMapFrom",+ "farLevels",+ "farKeep",+ "farStep",+ "farGrow","sizeX","sizeZ","cellSize",diff --git a/sdk/etc/foliage.api.md b/sdk/etc/foliage.api.mdindex 06ddf2477..ee0d8a716 100644--- a/sdk/etc/foliage.api.md+++ b/sdk/etc/foliage.api.md@@ -5,6 +5,7 @@ Symbols: 0 public · 0 beta · 44 experimental · 0 deprecated## BladeParams — interface @experimental```+band: number | undefinedheight: numberpaint: { base: [number, number, number]; tip: [number, number, number]; } | null | undefinedsegments: number@@ -55,6 +56,11 @@ colorMapStrength: numbercount: numberdensityMap: numberdrawDistance: number+farCards: boolean+farGrow: number+farKeep: number+farLevels: number+farStep: numberheightMax: numberheightMin: numberlodDistance: number@@ -345,7 +351,7 @@ size: number## buildInstancedMesh — function @experimental```-(source: MeshData, plants: readonly Plant[], paint?: BladeParams["paint"]): MeshData+(source: MeshData, plants: readonly Plant[], paint?: BladeParams["paint"], band?: number): MeshData```## buildPlacedMesh — function @experimentaldiff --git a/sdk/etc/index.api.md b/sdk/etc/index.api.mdindex 2450feda2..9344dab47 100644--- a/sdk/etc/index.api.md+++ b/sdk/etc/index.api.md@@ -1795,6 +1795,7 @@ value: string | number | boolean | undefined## BladeParams — interface @experimental```+band: number | undefinedheight: numberpaint: { base: [number, number, number]; tip: [number, number, number]; } | null | undefinedsegments: number@@ -4626,6 +4627,11 @@ colorMapStrength: numbercount: numberdensityMap: numberdrawDistance: number+farCards: boolean+farGrow: number+farKeep: number+farLevels: number+farStep: numberheightMax: numberheightMin: numberlodDistance: number@@ -14791,7 +14797,7 @@ MotionDriver<AnimatorBlend2DMotion>## buildInstancedMesh — function @experimental```-(source: MeshData, plants: readonly Plant[], paint?: BladeParams["paint"]): MeshData+(source: MeshData, plants: readonly Plant[], paint?: BladeParams["paint"], band?: number): MeshData```## buildOceanMesh — function @experimentaldiff --git a/sdk/etc/index.native.api.md b/sdk/etc/index.native.api.mdindex 7e22ae75c..f52d26ffe 100644--- a/sdk/etc/index.native.api.md+++ b/sdk/etc/index.native.api.md@@ -1795,6 +1795,7 @@ value: string | number | boolean | undefined## BladeParams — interface @experimental```+band: number | undefinedheight: numberpaint: { base: [number, number, number]; tip: [number, number, number]; } | null | undefinedsegments: number@@ -4634,6 +4635,11 @@ colorMapStrength: numbercount: numberdensityMap: numberdrawDistance: number+farCards: boolean+farGrow: number+farKeep: number+farLevels: number+farStep: numberheightMax: numberheightMin: numberlodDistance: number@@ -15028,7 +15034,7 @@ MotionDriver<AnimatorBlend2DMotion>## buildInstancedMesh — function @experimental```-(source: MeshData, plants: readonly Plant[], paint?: BladeParams["paint"]): MeshData+(source: MeshData, plants: readonly Plant[], paint?: BladeParams["paint"], band?: number): MeshData```## buildOceanMesh — function @experimentaldiff --git a/sdk/etc/index.node.api.md b/sdk/etc/index.node.api.mdindex 5458bac32..a268af947 100644--- a/sdk/etc/index.node.api.md+++ b/sdk/etc/index.node.api.md@@ -1790,6 +1790,7 @@ value: string | number | boolean | undefined## BladeParams — interface @experimental```+band: number | undefinedheight: numberpaint: { base: [number, number, number]; tip: [number, number, number]; } | null | undefinedsegments: number@@ -4621,6 +4622,11 @@ colorMapStrength: numbercount: numberdensityMap: numberdrawDistance: number+farCards: boolean+farGrow: number+farKeep: number+farLevels: number+farStep: numberheightMax: numberheightMin: numberlodDistance: number@@ -14786,7 +14792,7 @@ MotionDriver<AnimatorBlend2DMotion>## buildInstancedMesh — function @experimental```-(source: MeshData, plants: readonly Plant[], paint?: BladeParams["paint"]): MeshData+(source: MeshData, plants: readonly Plant[], paint?: BladeParams["paint"], band?: number): MeshData```## buildOceanMesh — function @experimentaldiff --git a/sdk/etc/minigame.api.md b/sdk/etc/minigame.api.mdindex 9c8e3039f..65db51a99 100644--- a/sdk/etc/minigame.api.md+++ b/sdk/etc/minigame.api.md@@ -1790,6 +1790,7 @@ value: string | number | boolean | undefined## BladeParams — interface @experimental```+band: number | undefinedheight: numberpaint: { base: [number, number, number]; tip: [number, number, number]; } | null | undefinedsegments: number@@ -4621,6 +4622,11 @@ colorMapStrength: numbercount: numberdensityMap: numberdrawDistance: number+farCards: boolean+farGrow: number+farKeep: number+farLevels: number+farStep: numberheightMax: numberheightMin: numberlodDistance: number@@ -15089,7 +15095,7 @@ MotionDriver<AnimatorBlend2DMotion>## buildInstancedMesh — function @experimental```-(source: MeshData, plants: readonly Plant[], paint?: BladeParams["paint"]): MeshData+(source: MeshData, plants: readonly Plant[], paint?: BladeParams["paint"], band?: number): MeshData```## buildOceanMesh — function @experimentaldiff --git a/sdk/etc/wechat.api.md b/sdk/etc/wechat.api.mdindex ca3cfe279..c88e2be6a 100644--- a/sdk/etc/wechat.api.md+++ b/sdk/etc/wechat.api.md@@ -1790,6 +1790,7 @@ value: string | number | boolean | undefined## BladeParams — interface @experimental```+band: number | undefinedheight: numberpaint: { base: [number, number, number]; tip: [number, number, number]; } | null | undefinedsegments: number@@ -4621,6 +4622,11 @@ colorMapStrength: numbercount: numberdensityMap: numberdrawDistance: number+farCards: boolean+farGrow: number+farKeep: number+farLevels: number+farStep: numberheightMax: numberheightMin: numberlodDistance: number@@ -14820,7 +14826,7 @@ MotionDriver<AnimatorBlend2DMotion>## buildInstancedMesh — function @experimental```-(source: MeshData, plants: readonly Plant[], paint?: BladeParams["paint"]): MeshData+(source: MeshData, plants: readonly Plant[], paint?: BladeParams["paint"], band?: number): MeshData```## buildOceanMesh — function @experimentaldiff --git a/sdk/tests/worldgen-worker.test.ts b/sdk/tests/worldgen-worker.test.tsindex e2f6ab880..d0f8e0f15 100644--- a/sdk/tests/worldgen-worker.test.ts+++ b/sdk/tests/worldgen-worker.test.ts@@ -235,7 +235,7 @@ describe("a Foliage's cells made in a worker", () => {};const cell: FoliageCellSpec = {centerX: 8, centerZ: 8, size: 16, count: 600, seed: 11, cellKey: 3004, minScale: 0.8, maxScale: 1.25, minUp: 0.3, heightMin: -1e5, heightMax: 1e5,- waterDepth: 0, zonePadding: 0, tags: ['foliage', 'grass'], baseY: 0, paint: null, look: { kind: 'grass', bladeHeight: 1.4, bladeWidth: 0.16 },+ waterDepth: 0, zonePadding: 0, tags: ['foliage', 'grass'], baseY: 0, paint: null, far: { levels: 1, keep: 0.34, grow: 2, cards: true }, look: { kind: 'grass', bladeHeight: 1.4, bladeWidth: 0.16 },};const here = (spec: FoliageCellSpec) => {const zones = new Zones();diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjsindex 0f16abcd0..a37bd9c9b 100644--- a/tools/releaseNotes.mjs+++ b/tools/releaseNotes.mjs@@ -4546,6 +4546,8 @@ export const NOTED = {{"note": "A meadow: a density map and a colour map for Foliage."},"fix(foliage): a field of any size is cut into cells no wider than its cell size - past 200 cells a side each cell was left wider than the plants scattered in it, so a meadow over a large terrain grew in clumps with bare ground between":{"note": "A Foliage field of any size is cut into cells no wider than its cell size."},+ "feat(foliage): far versions that thin plant by plant and are grown only where they are drawn - up to three, each the same plants fewer and larger, chosen by each plant's own number so nothing jumps where one takes over; with a material each is a layer of cells of its own, so a meadow is whole near the eye and a tenth of itself far off, and it fades to none at its draw distance":+ {"note": "Foliage thins plant by plant with distance, and is grown only where it is drawn."},"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."},};