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(examples): Terrain & Water has a HUD, a beach view and quality levels

yhhe9eab799a1e8
diff --git a/examples/terrain-water/assets/materials/ground.esmaterial b/examples/terrain-water/assets/materials/ground.esmaterial
index 31097f6a7..8847b3e17 100644
--- a/examples/terrain-water/assets/materials/ground.esmaterial
+++ b/examples/terrain-water/assets/materials/ground.esmaterial
@@ -41,6 +41,11 @@
"u_tile3": 1400,
"u_macroVariation": 0.45,
"u_sharpness": 2,
- "u_roughness": 0.95
+ "u_roughness": 0.95,
+ "u_heightBlend": 0.8,
+ "u_antiTile": 0.7,
+ "u_relief": 8,
+ "u_wetLevel": 0,
+ "u_wetBand": 60
}
}
diff --git a/examples/terrain-water/assets/materials/water.esmaterial b/examples/terrain-water/assets/materials/water.esmaterial
index cae6bbd28..01a92717a 100644
--- a/examples/terrain-water/assets/materials/water.esmaterial
+++ b/examples/terrain-water/assets/materials/water.esmaterial
@@ -10,7 +10,8 @@
"u_density": 0.0011,
"u_rippleLength": 220,
"u_rippleStrength": 0.3,
- "u_distortionRange": 900,
+ "u_distortionRange": 300,
+ "u_refractionStrength": 0.6,
"u_foamWidth": 45,
"u_foamCrest": 0.4,
"u_fallbackDepth": 400,
diff --git a/examples/terrain-water/assets/scenes/main.esscene b/examples/terrain-water/assets/scenes/main.esscene
index d630a7d7f..d2f77278b 100644
--- a/examples/terrain-water/assets/scenes/main.esscene
+++ b/examples/terrain-water/assets/scenes/main.esscene
@@ -129,6 +129,33 @@
},
{
"id": 1,
+ "name": "Canvas",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "Canvas",
+ "data": {
+ "designResolution": {
+ "x": 1480,
+ "y": 920
+ },
+ "scaleMode": 2
+ }
+ },
+ {
+ "type": "UINode",
+ "data": {}
+ }
+ ]
+ },
+ {
+ "id": 2,
"name": "Clock",
"parent": null,
"children": [],
@@ -152,7 +179,7 @@
]
},
{
- "id": 2,
+ "id": 3,
"name": "Sun",
"parent": null,
"children": [],
@@ -183,7 +210,7 @@
]
},
{
- "id": 3,
+ "id": 4,
"name": "Sky",
"parent": null,
"children": [],
@@ -210,7 +237,7 @@
]
},
{
- "id": 4,
+ "id": 5,
"name": "Ground",
"parent": null,
"children": [],
@@ -244,7 +271,7 @@
]
},
{
- "id": 5,
+ "id": 6,
"name": "Water",
"parent": null,
"children": [],
@@ -279,7 +306,7 @@
]
},
{
- "id": 6,
+ "id": 7,
"name": "Sea",
"parent": null,
"children": [],
@@ -306,7 +333,7 @@
]
},
{
- "id": 7,
+ "id": 8,
"name": "Lake",
"parent": null,
"children": [],
@@ -529,7 +556,7 @@
]
},
{
- "id": 8,
+ "id": 9,
"name": "River In",
"parent": null,
"children": [],
@@ -595,7 +622,7 @@
]
},
{
- "id": 9,
+ "id": 10,
"name": "River Out",
"parent": null,
"children": [],
@@ -661,7 +688,7 @@
]
},
{
- "id": 10,
+ "id": 11,
"name": "Weather",
"parent": null,
"children": [],
@@ -686,7 +713,7 @@
]
},
{
- "id": 11,
+ "id": 12,
"name": "Meadow",
"parent": null,
"children": [],
@@ -725,7 +752,7 @@
]
},
{
- "id": 12,
+ "id": 13,
"name": "Flowers",
"parent": null,
"children": [],
@@ -764,7 +791,7 @@
]
},
{
- "id": 13,
+ "id": 14,
"name": "Reeds",
"parent": null,
"children": [],
@@ -797,13 +824,14 @@
"heightMin": 660,
"heightMax": 840,
"bladeHeight": 150,
- "bladeWidth": 4
+ "bladeWidth": 4,
+ "waterDepth": 60
}
}
]
},
{
- "id": 14,
+ "id": 15,
"name": "Pines",
"parent": null,
"children": [],
@@ -846,7 +874,7 @@
]
},
{
- "id": 15,
+ "id": 16,
"name": "Crate 1",
"parent": null,
"children": [],
@@ -942,7 +970,7 @@
]
},
{
- "id": 16,
+ "id": 17,
"name": "Crate 2",
"parent": null,
"children": [],
@@ -1038,7 +1066,7 @@
]
},
{
- "id": 17,
+ "id": 18,
"name": "Crate 3",
"parent": null,
"children": [],
@@ -1134,7 +1162,7 @@
]
},
{
- "id": 18,
+ "id": 19,
"name": "Crate 4",
"parent": null,
"children": [],
@@ -1230,7 +1258,7 @@
]
},
{
- "id": 19,
+ "id": 20,
"name": "Crate 5",
"parent": null,
"children": [],
@@ -1326,7 +1354,7 @@
]
},
{
- "id": 20,
+ "id": 21,
"name": "Crate 6",
"parent": null,
"children": [],
@@ -1422,7 +1450,7 @@
]
},
{
- "id": 21,
+ "id": 22,
"name": "Crate 7",
"parent": null,
"children": [],
@@ -1518,7 +1546,7 @@
]
},
{
- "id": 22,
+ "id": 23,
"name": "Crate 8",
"parent": null,
"children": [],
@@ -1614,7 +1642,7 @@
]
},
{
- "id": 23,
+ "id": 24,
"name": "Crate 9",
"parent": null,
"children": [],
diff --git a/examples/terrain-water/assets/textures/grass.png b/examples/terrain-water/assets/textures/grass.png
index f50d3f784..5f1679a61 100644
Binary files a/examples/terrain-water/assets/textures/grass.png and b/examples/terrain-water/assets/textures/grass.png differ
diff --git a/examples/terrain-water/assets/textures/rock.png b/examples/terrain-water/assets/textures/rock.png
index d26246dfd..d4815a86f 100644
Binary files a/examples/terrain-water/assets/textures/rock.png and b/examples/terrain-water/assets/textures/rock.png differ
diff --git a/examples/terrain-water/assets/textures/sand.png b/examples/terrain-water/assets/textures/sand.png
index fd6838c78..645b700e6 100644
Binary files a/examples/terrain-water/assets/textures/sand.png and b/examples/terrain-water/assets/textures/sand.png differ
diff --git a/examples/terrain-water/assets/textures/snow.png b/examples/terrain-water/assets/textures/snow.png
index b992319cf..cfd5b480f 100644
Binary files a/examples/terrain-water/assets/textures/snow.png and b/examples/terrain-water/assets/textures/snow.png differ
diff --git a/examples/terrain-water/project.esproject b/examples/terrain-water/project.esproject
index 940e62de0..4a31a7997 100644
--- a/examples/terrain-water/project.esproject
+++ b/examples/terrain-water/project.esproject
@@ -13,7 +13,10 @@
"features": {
"rendering": {
"colorSpace": "linear",
- "outputTransform": "neutral"
+ "outputTransform": "neutral",
+ "quality": {
+ "mode": "high"
+ }
}
}
}
diff --git a/examples/terrain-water/src/main.ts b/examples/terrain-water/src/main.ts
index 59eae6e0c..8b69d55ff 100644
--- a/examples/terrain-water/src/main.ts
+++ b/examples/terrain-water/src/main.ts
@@ -1,7 +1,8 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-// The scene is authored; keys poke at it: W weather, R a shower, Space a wave per crate, C viewpoint, U dive, 1/2/3 quality.
-import { addPlugin, defineSystem, Res, Query, Mut, Input, Time, Transform, Camera, Quality, Weather,
+// The scene is authored; keys poke at it (the HUD lists them) and the HUD says what the engine is still baking.
+import { addPlugin, defineSystem, GetWorld, Res, Query, Mut, Input, Time, Transform, Camera, Quality, Weather, Text, Name, BakesRes,
+ spawnUIEntity, UIPositionType, px, type Entity,
WEATHER_CLEAR, WEATHER_MIST, WEATHER_OVERCAST, WEATHER_RAIN, WEATHER_STORM } from 'esengine';
import { WatersRes, Floating } from 'esengine/water';
@@ -13,56 +14,105 @@ function pose(x: number, y: number, z: number, yaw: number, pitch: number): Pose
return { position: { x, y, z }, rotation: { x: cy * sp, y: sy * cp, z: -sy * sp, w: cy * cp } };
}
-/** The other places to look from; the first viewpoint is the scene's own camera. */
-/** What W steps through. */
+/** What W steps through, and what the HUD calls them. */
const WEATHERS = [WEATHER_CLEAR, WEATHER_MIST, WEATHER_OVERCAST, WEATHER_RAIN, WEATHER_STORM];
+const WEATHER_NAMES = ['Clear', 'Mist', 'Overcast', 'Rain', 'Storm'];
+
+/** The other places to look from; the first viewpoint is the scene's own camera. */
+const VIEWS: { name: string; pose: Pose }[] = [
+ { name: 'Above the lake', pose: pose(5600, 2100, 700, 1.25, -0.2) },
+ { name: 'Up the river', pose: pose(-700, 3000, -4300, 0.35, -0.16) },
+ { name: 'On the beach', pose: pose(-2600, 260, 7400, 0.6, -0.05) },
+];
-const VIEWS: Pose[] = [
- pose(5600, 2100, 700, 1.25, -0.2),
- pose(-700, 3000, -4300, 0.35, -0.16),
+const KEYS = [
+ 'W next weather (clear, mist, overcast, rain, storm)',
+ 'R a shower on the water in front of you',
+ 'Space a wave round every crate',
+ 'C next viewpoint',
+ 'U dive under the sea, and back up',
+ '1 2 3 quality: low (flat water) / medium / high',
];
+/** A point `ahead` world units in front of the camera, along its heading on the ground plane. */
+function inFront(t: { position: { x: number; z: number }; rotation: { x: number; y: number; z: number; w: number } }, ahead: number): [number, number] {
+ const q = t.rotation;
+ // The camera looks down -z: its forward is the rotation of (0, 0, -1).
+ const fx = -(2 * (q.x * q.z + q.w * q.y)), fz = -(1 - 2 * (q.x * q.x + q.y * q.y));
+ const len = Math.hypot(fx, fz) || 1;
+ return [t.position.x + (fx / len) * ahead, t.position.z + (fz / len) * ahead];
+}
+
addPlugin({
name: 'water-showcase',
build(app) {
let under = false;
- // Rain falls on the water in front of the shore camera: [x, surface, z] at the middle of where it lands.
- const rainAt = [2000, 0, 9800];
let shore: Pose | null = null;
let start: Pose | null = null;
let view = 0;
let rain = 0;
+ let level: 'low' | 'medium' | 'high' = 'high';
+ let hud: Entity | null = null;
+ let status: Entity | null = null;
+ let notice = '';
+ let noticeUntil = 0;
+ const say = (text: string, now: number): void => { notice = text; noticeUntil = now + 3; };
+
app.addSystem(defineSystem([
- Res(Input), Res(Time), Res(Quality), Query(Mut(Transform), Camera), Query(Transform, Floating), Query(Mut(Weather)),
- ], (input, time, quality, cameras, crates, weathers) => {
+ GetWorld(), Res(Input), Res(Time), Res(Quality), Query(Mut(Transform), Camera), Query(Transform, Floating), Query(Mut(Weather)),
+ ], (world, input, time, quality, cameras, crates, weathers) => {
+ const now = time.elapsed;
+ if (hud === null) {
+ const canvas = world.findEntityByName('Canvas');
+ if (canvas !== null) {
+ const panel = { position: UIPositionType.Absolute, insetLeft: px(20), insetTop: px(18), width: px(470), pointerEvents: 0 };
+ hud = spawnUIEntity({ world, parent: canvas, node: { ...panel, height: px(176) },
+ visual: { color: { r: 0.02, g: 0.05, b: 0.08, a: 0.55 } },
+ text: { content: `TERRAIN & WATER\n${KEYS.join('\n')}`, fontSize: 13, color: { r: 0.9, g: 0.94, b: 0.97, a: 1 }, align: 0 } });
+ world.insert(hud, Name, { value: 'Keys' });
+ status = spawnUIEntity({ world, parent: canvas, node: { ...panel, insetTop: px(200), height: px(64) },
+ visual: { color: { r: 0.02, g: 0.05, b: 0.08, a: 0.55 } },
+ text: { content: '', fontSize: 13, color: { r: 0.62, g: 0.86, b: 0.95, a: 1 }, align: 0 } });
+ world.insert(status, Name, { value: 'Status' });
+ }
+ }
+
if (input.isKeyPressed('KeyW')) {
for (const [, w] of weathers) {
- // Turn from where it is toward the next one, and stop the cycle so it stays there.
+ // Turn from where it is toward the next one, over two seconds, and stop the cycle so it stays there.
const at = w.target >= 0 && w.progress > 0.5 ? w.target : w.preset;
const next = WEATHERS[(Math.max(0, WEATHERS.indexOf(at)) + 1) % WEATHERS.length]!;
w.preset = at;
w.target = next;
w.progress = 0;
+ w.duration = 2;
w.sequence = '';
+ say(`Weather turning to ${WEATHER_NAMES[WEATHERS.indexOf(next)]}`, now);
}
}
const waters = app.hasResource(WatersRes) ? app.getResource(WatersRes) : null;
- if (input.isKeyPressed('KeyR')) rain = 2;
- if (waters && rain > 0) {
+ const eye = [...cameras][0]?.[1] ?? null;
+ if (input.isKeyPressed('KeyR')) {
+ rain = 2;
+ say('A shower falls on the water ahead', now);
+ }
+ if (waters && eye && rain > 0) {
rain -= time.delta;
- for (let k = 0; k < 6; k++) {
- const x = rainAt[0] + (Math.random() - 0.5) * 5000, z = rainAt[2] + (Math.random() - 0.5) * 4000;
- waters.disturb(x, rainAt[1], z, 60, -6);
+ const [cx, cz] = inFront(eye, 2500);
+ for (let k = 0; k < 8; k++) {
+ const x = cx + (Math.random() - 0.5) * 4000, z = cz + (Math.random() - 0.5) * 4000;
+ waters.disturb(x, 0, z, 60, -6);
}
}
if (waters && input.isKeyPressed('Space')) {
for (const [, t] of crates) waters.disturb(t.position.x, t.position.y, t.position.z, 260, -40);
+ say('A wave round every crate', now);
}
if (input.isKeyPressed('KeyC') && !under) {
for (const [, t] of cameras) {
start ??= { position: { ...t.position }, rotation: { ...t.rotation } };
view = (view + 1) % (VIEWS.length + 1);
- const next = view === 0 ? start : VIEWS[view - 1]!;
+ const next = view === 0 ? start : VIEWS[view - 1]!.pose;
t.position = { ...next.position };
t.rotation = { ...next.rotation };
}
@@ -82,7 +132,21 @@ addPlugin({
under = !under;
}
for (const [key, mode] of [['Digit1', 'low'], ['Digit2', 'medium'], ['Digit3', 'high']] as const) {
- if (input.isKeyPressed(key)) quality?.setMode(mode);
+ if (!input.isKeyPressed(key)) continue;
+ if (quality) { quality.setMode(mode); level = mode; say(`Quality: ${mode}`, now); } else say('This project has no quality levels', now);
+ }
+
+ if (status !== null) {
+ const w = [...weathers][0]?.[1];
+ const named = (preset: number): string => WEATHER_NAMES[WEATHERS.indexOf(preset)] ?? '?';
+ const weather = w ? (w.target >= 0 ? `${named(w.preset)} → ${named(w.target)}` : named(w.preset)) : '—';
+ const place = under ? 'Under the sea' : view === 0 ? 'Over the sea' : VIEWS[view - 1]!.name;
+ const bakes = app.hasResource(BakesRes) ? app.getResource(BakesRes).active : [];
+ const baking = bakes.length ? `\n${bakes.map((b) => `${b.label} ${Math.round(b.progress * 100)}%`).join(' ')}` : '';
+ const line = now < noticeUntil ? `\n${notice}` : '';
+ const content = `Weather: ${weather} Quality: ${level} View: ${place}${baking}${line}`;
+ const text = world.get(status, Text);
+ if (text.content !== content) world.insert(status, Text, { ...text, content });
}
}, { name: 'WaterShowcase' }));
},
diff --git a/examples/terrain-water/tools/build.mjs b/examples/terrain-water/tools/build.mjs
index 99f6c2e1d..7bd22bef1 100644
--- a/examples/terrain-water/tools/build.mjs
+++ b/examples/terrain-water/tools/build.mjs
@@ -286,19 +286,59 @@ function texture(name, seed, shade) {
meta(`assets/textures/${name}.png`, 'texture', { wrapMode: 'repeat' });
}
+/** Cellular noise that wraps every `period` cells: the distance to the nearest and the second-nearest feature point, for stones and cracks. */
+function cells(u, v, period, seed) {
+ const x = u * period, y = v * period;
+ const ix = Math.floor(x), iy = Math.floor(y);
+ let d1 = 9, d2 = 9, id = 0;
+ for (let j = -1; j <= 1; j++) for (let i = -1; i <= 1; i++) {
+ const cx = ix + i, cy = iy + j;
+ const wx = ((cx % period) + period) % period, wy = ((cy % period) + period) % period;
+ const px = cx + hash(wx, wy, seed), py = cy + hash(wx, wy, seed + 1);
+ const d = Math.hypot(px - x, py - y);
+ if (d < d1) { d2 = d1; d1 = d; id = hash(wx, wy, seed + 2); } else if (d < d2) d2 = d;
+ }
+ return { d1, d2, id };
+}
+
function textures() {
+ // Grass: a meadow seen from standing height. Patches of fresh and dry grass, clumps darker at their roots, blades as short strokes, a little earth between.
texture('grass', 1, (u, v, n) => {
- const broad = n(0, 4, 3), fine = n(40, 5, 24), blade = n(80, 2, 96);
- return mix(mix([52, 82, 30], [104, 140, 52], broad), [70, 108, 38], fine * 0.6).map((c) => c * (0.8 + 0.42 * blade));
+ const patch = n(0, 4, 2), dry = smooth(0.55, 0.8, n(10, 3, 3)), clump = n(20, 4, 12);
+ const blade = tiled(u * 160, v * 40, 160, 91) * 0.5 + tiled(u * 40, v * 160, 40, 92) * 0.5;
+ const earth = smooth(0.78, 0.9, n(30, 3, 20)) * (1 - clump);
+ let c = mix([46, 78, 26], [92, 134, 44], patch);
+ c = mix(c, [146, 140, 70], dry * 0.7);
+ c = mix(c, [86, 70, 44], earth);
+ return c.map((x) => x * (0.62 + 0.38 * clump) * (0.82 + 0.3 * blade));
});
+ // Sand: low ripples the wind combed across it, running one way and only gently bent (a contour of noise reads as rings), fading
+ // in and out in patches; pebbles and broken shell scattered over.
texture('sand', 2, (u, v, n) => {
- const broad = n(0, 4, 3), fine = n(30, 5, 32), pebble = n(70, 2, 64);
- return mix([168, 150, 116], [214, 196, 158], broad).map((c) => c * (0.88 + 0.2 * fine) * (pebble > 0.72 ? 0.84 : 1));
+ const bend = (n(0, 2, 2) - 0.5) * 0.6;
+ const ripple = (Math.sin((v * 24 + u * 3 + bend) * Math.PI * 2) * 0.5 + 0.5) * smooth(0.35, 0.7, n(50, 3, 3));
+ const grain = hash(Math.floor(u * 512), Math.floor(v * 512), 5);
+ const stones = cells(u, v, 18, 21);
+ const pebble = 1 - smooth(0.12, 0.2, stones.d1);
+ let c = mix([170, 150, 114], [222, 204, 164], n(10, 4, 4));
+ c = c.map((x) => x * (0.93 + 0.07 * ripple) * (0.93 + 0.1 * grain));
+ return mix(c, mix([110, 104, 96], [196, 188, 172], stones.id), pebble * (stones.id > 0.55 ? 1 : 0));
+ });
+ // Snow: windblown, bluish in its hollows, with the odd glint.
+ texture('snow', 3, (u, v, n) => {
+ const drift = n(0, 4, 4), sparkle = hash(Math.floor(u * 512), Math.floor(v * 512), 7) > 0.985 ? 1.08 : 1;
+ return mix([196, 210, 230], [252, 253, 255], smooth(0.2, 0.75, drift)).map((x) => Math.min(255, x * sparkle));
});
- texture('snow', 3, (u, v, n) => mix([222, 228, 238], [250, 252, 255], n(0, 4, 8)));
+ // Rock: strata running across it, cracks between blocks, weathered lighter on the faces, lichen in patches.
texture('rock', 4, (u, v, n) => {
- const broad = n(0, 4, 4), ridge = 1 - Math.abs(n(20, 5, 6) * 2 - 1), fine = n(60, 4, 32);
- return mix([62, 64, 68], [112, 114, 118], broad * 0.7 + ridge * 0.4).map((c) => c * (0.82 + 0.36 * fine));
+ const block = cells(u, v, 6, 31);
+ const crack = smooth(0.0, 0.06, block.d2 - block.d1);
+ const strata = Math.sin((v * 9 + n(0, 3, 3) * 1.6) * Math.PI * 2) * 0.5 + 0.5;
+ const face = n(10, 5, 8);
+ const lichen = smooth(0.62, 0.75, n(40, 4, 6));
+ let c = mix([70, 68, 66], [138, 134, 126], face * 0.6 + strata * 0.25 + block.id * 0.25);
+ c = mix(c, [118, 124, 82], lichen * 0.55);
+ return c.map((x) => x * (0.35 + 0.65 * crack) * (0.85 + 0.25 * n(60, 3, 64)));
});
// The pine's colour: bark at the foot, then needles that darken toward the shade under each tier.
const strip = png(8, 128, (x, y) => {
@@ -379,10 +419,11 @@ function materials() {
material('ground', 'builtin:terrain', {
u_layer0: 'assets/textures/grass.png', u_layer1: 'assets/textures/sand.png', u_layer2: 'assets/textures/snow.png', u_layer3: 'assets/textures/rock.png',
u_tint0: white, u_tint1: white, u_tint2: white, u_tint3: white,
- u_tile0: 900, u_tile1: 700, u_tile2: 1100, u_tile3: 1400, u_macroVariation: 0.45, u_sharpness: 2, u_roughness: 0.95,
+ u_tile0: 900, u_tile1: 700, u_tile2: 1100, u_tile3: 1400, u_macroVariation: 0.45, u_sharpness: 2, u_roughness: 0.95, u_heightBlend: 0.8, u_antiTile: 0.7, u_relief: 8,
+ u_wetLevel: WORLD.sea, u_wetBand: 60,
});
// The stock water, scaled from metres to this world's centimetres: the same colours, absorbed over a hundred times the distance.
- const water = { u_density: 0.0011, u_rippleLength: 220, u_rippleStrength: 0.3, u_distortionRange: 900, u_foamWidth: 45, u_foamCrest: 0.4,
+ const water = { u_density: 0.0011, u_rippleLength: 220, u_rippleStrength: 0.3, u_distortionRange: 300, u_refractionStrength: 0.6, u_foamWidth: 45, u_foamCrest: 0.4,
u_fallbackDepth: 400, u_causticScale: 220, u_roughness: 0.04 };
material('water', 'builtin:water', water);
material('crate', 'builtin:model', { u_metallic: 0, u_roughness: 0.8 });
@@ -444,6 +485,8 @@ function scene() {
{ type: 'Camera', data: { projectionType: 0, fov: 55, nearPlane: 10, farPlane: 120000, isActive: true, priority: 0 } },
{ type: 'PostProcessVolume', data: { isGlobal: true, priority: 0, weight: 1, effects: post } },
]);
+ // The HUD's canvas: the keys and what the scene is doing are drawn on it by the script.
+ add('Canvas', [{ type: 'Transform', data: {} }, { type: 'Canvas', data: { designResolution: { x: 1480, y: 920 }, scaleMode: 2 } }, { type: 'UINode', data: {} }]);
add('Clock', [{ type: 'Transform', data: {} }, { type: 'TimeOfDay', data: { hour: 15.5, daySeconds: 0, latitude: 40, declination: 15, north: 180, drive: 31 } }]);
add('Sun', [{ type: 'Transform', data: {} },
{ type: 'Light', data: { type: 1, color: white, intensity: 3, enabled: true, meshShadows: true, shadowExtent: 16000, shadowStrength: 1, sourceAngle: 0.5 } }]);
@@ -492,7 +535,7 @@ function scene() {
plants('Meadow', 'assets/materials/meadow.esmaterial', { count: 1100, heightMin: WORLD.lake.level + 160, heightMax: WORLD.snow - 600, bladeHeight: 55, bladeWidth: 6 });
plants('Flowers', 'assets/materials/flowers.esmaterial', { count: 70, seed: 11, heightMin: WORLD.lake.level + 200, heightMax: 2200, bladeHeight: 45, bladeWidth: 9 });
plants('Reeds', 'assets/materials/reeds.esmaterial', { count: 600, seed: 5, minUp: 0.75, heightMin: WORLD.lake.level - 40, heightMax: WORLD.lake.level + 140,
- bladeHeight: 150, bladeWidth: 4 });
+ bladeHeight: 150, bladeWidth: 4, waterDepth: 60 });
add('Pines', [
{ type: 'Transform', data: { position: { x: 0, y: 0, z: -3000 } } },
{ type: 'Foliage', data: {