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.

fix(examples): Terrain & Water's viewpoints look at the lake, the river mouths and the river in the hills

yhhcdca80716bfe
diff --git a/examples/terrain-water/assets/materials/water.esmaterial b/examples/terrain-water/assets/materials/water.esmaterial
index 01a92717a..92a976341 100644
--- a/examples/terrain-water/assets/materials/water.esmaterial
+++ b/examples/terrain-water/assets/materials/water.esmaterial
@@ -12,6 +12,7 @@
"u_rippleStrength": 0.3,
"u_distortionRange": 300,
"u_refractionStrength": 0.6,
+ "u_edgeSoftness": 35,
"u_foamWidth": 45,
"u_foamCrest": 0.4,
"u_fallbackDepth": 400,
diff --git a/examples/terrain-water/src/main.ts b/examples/terrain-water/src/main.ts
index 8b69d55ff..b37b16317 100644
--- a/examples/terrain-water/src/main.ts
+++ b/examples/terrain-water/src/main.ts
@@ -20,10 +20,10 @@ 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) },
-];
+ { name: 'By the lake', pose: pose(-1200, 1500, 1800, 0.25, -0.15) },
+ { name: 'The lake and the river mouths', pose: pose(4200, 2600, -2500, 1.9, -0.18) },
+ { name: 'Up the river', pose: pose(-3600, 3000, -6200, -0.15, -0.12) },
+]
const KEYS = [
'W next weather (clear, mist, overcast, rain, storm)',
diff --git a/examples/terrain-water/tools/build.mjs b/examples/terrain-water/tools/build.mjs
index c9b8035ba..2b839d0f3 100644
--- a/examples/terrain-water/tools/build.mjs
+++ b/examples/terrain-water/tools/build.mjs
@@ -423,7 +423,7 @@ function materials() {
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: 300, u_refractionStrength: 0.6, 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_edgeSoftness: 35, 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 });