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(render): the dusk sky is dimmer and warmer, the moon is a disc, and an overcast sky hides the moon and stars

yhh42ad8ab804ea
diff --git a/README.md b/README.md
index 0b07f06cc..86df7c65c 100644
--- a/README.md
+++ b/README.md
@@ -24,7 +24,7 @@
Estella is a **2D and 3D game engine** — sprites, tilemaps and UI as much as lit, shadowed, physically simulated 3D worlds — with a TypeScript SDK driven by a high-performance **C++** core — as WebAssembly on the web, and compiled ahead of time on native platforms. It outputs games that run in **web browsers**, on the **desktop**, in **WeChat MiniGames**, as single-file **playable ads**, and as native **Android / iOS** apps. A visual editor is available as a separate, free download.
<div align="center">
- <img src="docs/assets/day-d24e90e8.webp" alt="A Paris street corner rendered in real time by the Estella engine, through a whole day: morning mist, sun, rain with puddles, and a night of lamps" width="900" />
+ <img src="docs/assets/day-43870a6c.webp" alt="A Paris street corner rendered in real time by the Estella engine, through a whole day: morning mist, sun, rain with puddles, and a night of lamps" width="900" />
<br/>
<sub><i>Amazon Lumberyard Bistro, rendered in real time by Estella (a sun that follows the sky, baked bounce light and reflections, the Neutral output transform). Scene © Amazon Lumberyard, <a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>, modified.</i></sub>
</div>
diff --git a/desktop b/desktop
index 048c4529e..e84c96d99 160000
--- a/desktop
+++ b/desktop
@@ -1 +1 @@
-Subproject commit 048c4529e6587177179a63d271cd21610b8e7dab
+Subproject commit e84c96d9956cacf9f20164b2c6a108b60cf4a2b4
diff --git a/docs/assets/day-43870a6c.webp b/docs/assets/day-43870a6c.webp
new file mode 100644
index 000000000..a778afbad
Binary files /dev/null and b/docs/assets/day-43870a6c.webp differ
diff --git a/docs/assets/day-d24e90e8.webp b/docs/assets/day-d24e90e8.webp
deleted file mode 100644
index c575e894c..000000000
Binary files a/docs/assets/day-d24e90e8.webp and /dev/null differ
diff --git a/docs/landing/day-249c47d9.webm b/docs/landing/day-249c47d9.webm
deleted file mode 100644
index 0e8dca59d..000000000
Binary files a/docs/landing/day-249c47d9.webm and /dev/null differ
diff --git a/docs/landing/day-2866a6b6.mp4 b/docs/landing/day-2866a6b6.mp4
deleted file mode 100644
index d19199e3a..000000000
Binary files a/docs/landing/day-2866a6b6.mp4 and /dev/null differ
diff --git a/docs/landing/day-a2d1a583.mp4 b/docs/landing/day-a2d1a583.mp4
new file mode 100644
index 000000000..57690a6a2
Binary files /dev/null and b/docs/landing/day-a2d1a583.mp4 differ
diff --git a/docs/landing/day-c3f82849.webm b/docs/landing/day-c3f82849.webm
new file mode 100644
index 000000000..ae2bc1557
Binary files /dev/null and b/docs/landing/day-c3f82849.webm differ
diff --git a/docs/landing/index.html b/docs/landing/index.html
index b067a5179..f6a76e3ba 100644
--- a/docs/landing/index.html
+++ b/docs/landing/index.html
@@ -452,8 +452,8 @@
<video id="hero-loop" width="1280" height="720" autoplay muted loop playsinline preload="metadata"
poster="/hero-5df1f015.png"
aria-label="A Paris street corner rendered in real time by the Estella engine, through a whole day: morning mist, a sunlit noon with long shadows, rain with wet cobbles and puddles that mirror the scene, and a night lit by lamps">
- <source src="/day-249c47d9.webm" type="video/webm" />
- <source src="/day-2866a6b6.mp4" type="video/mp4" />
+ <source src="/day-c3f82849.webm" type="video/webm" />
+ <source src="/day-a2d1a583.mp4" type="video/mp4" />
<img src="/hero-5df1f015.png" width="1742" height="980"
alt="A Paris street corner in daylight, rendered in real time by the Estella engine: a cafe, a scooter, cobbles and sun shadows" />
</video>
diff --git a/sdk/src/postprocess/postProcessEffects.ts b/sdk/src/postprocess/postProcessEffects.ts
index 8b8c3402d..10b757de6 100644
--- a/sdk/src/postprocess/postProcessEffects.ts
+++ b/sdk/src/postprocess/postProcessEffects.ts
@@ -1583,6 +1583,7 @@ void main() {
float haze = pow(1.0 - up, 3.0);
vec3 dayCol = mix(lin(vec3(0.12, 0.30, 0.72)), lin(vec3(0.60, 0.74, 0.92)), haze) * 2.0 * u_intensity;
+ dayCol *= mix(0.12, 1.0, smoothstep(-0.12, 0.35, se));
vec3 nightCol = mix(lin(vec3(0.003, 0.006, 0.02)), lin(vec3(0.016, 0.024, 0.06)), haze);
vec3 col = mix(nightCol, dayCol, day);
@@ -1590,7 +1591,7 @@ void main() {
vec2 flatDir = dir.xz / max(length(dir.xz), 1e-4);
vec2 flatSun = sun.xz / max(length(sun.xz), 1e-4);
float side = max(dot(flatDir, flatSun), 0.0);
- col += lin(vec3(1.0, 0.42, 0.16)) * (twi * haze * (0.25 + 0.75 * side * side) * 1.6 * u_twilight);
+ col += lin(vec3(1.0, 0.42, 0.16)) * (twi * haze * (0.25 + 0.75 * side * side) * 1.8 * u_twilight);
float overcast = clamp(u_overcast, 0.0, 1.0);
float clear = 1.0 - overcast;
@@ -1602,7 +1603,7 @@ void main() {
float halo = pow(max(cosd, 0.0), 16.0) * 0.25 + pow(max(cosd, 0.0), 256.0);
vec3 sunCol = mix(lin(vec3(1.0, 0.55, 0.25)), lin(vec3(1.0, 0.96, 0.88)), smoothstep(0.0, 0.35, se));
float above = smoothstep(-0.02, 0.02, dir.y) * smoothstep(-0.05, 0.0, se);
- col += sunCol * (disc * u_sunBrightness * clear + halo * (0.4 + 0.6 * clear)) * above;
+ col += sunCol * (disc * u_sunBrightness * clear + halo * (0.15 + 0.85 * clear)) * above;
// The moon stands opposite the sun and a little above where it would be, so it is up when the sun is well down.
float sAz = atan(sun.x, sun.z);
@@ -1613,9 +1614,9 @@ void main() {
float md = dot(dir, moon);
float moonR = radians(0.26 * 2.5);
float moonDisc = smoothstep(cos(moonR * 1.1), cos(moonR * 0.9), md);
- float moonGlow = pow(max(md, 0.0), 300.0) * 0.5 + pow(max(md, 0.0), 24.0) * 0.03;
+ float moonGlow = pow(max(md, 0.0), 2500.0) * 0.5 + pow(max(md, 0.0), 60.0) * 0.015;
float night = 1.0 - day;
- col += lin(vec3(0.80, 0.88, 1.0)) * ((moonDisc * 3.0 + moonGlow) * u_moon * night * clear * smoothstep(-0.02, 0.04, dir.y));
+ col += lin(vec3(0.80, 0.88, 1.0)) * ((moonDisc * 3.0 + moonGlow) * u_moon * night * clear * clear * smoothstep(-0.02, 0.04, dir.y));
// Stars: a point in some of the cells of a lattice over the sphere, brighter and more coloured at random.
if (night > 0.02 && dir.y > 0.0 && u_stars > 0.0) {
@@ -1628,7 +1629,7 @@ void main() {
float spot = smoothstep(0.22, 0.02, length(fr - c));
float bright = (0.4 + hash13(id + 1.7) * 1.6) * (h > 0.995 ? 3.0 : 1.0);
vec3 tint = mix(lin(vec3(1.0, 0.85, 0.7)), lin(vec3(0.7, 0.8, 1.0)), hash13(id + 5.3));
- float seen = night * night * clear * smoothstep(0.0, 0.15, dir.y) * (1.0 - 0.9 * smoothstep(0.97, 0.999, md));
+ float seen = night * night * clear * clear * smoothstep(0.05, -0.15, se) * smoothstep(0.0, 0.15, dir.y) * (1.0 - 0.9 * smoothstep(0.97, 0.999, md));
col += tint * (spot * bright * 2.5 * u_stars * seen);
}
}
@@ -1678,14 +1679,14 @@ fn lin(c : vec3f) -> vec3f {
let up = max(dir.y, 0.0);
let haze = pow(1.0 - up, 3.0);
- let dayCol = mix(lin(vec3f(0.12, 0.30, 0.72)), lin(vec3f(0.60, 0.74, 0.92)), haze) * 2.0 * mc.u_intensity;
+ let dayCol = mix(lin(vec3f(0.12, 0.30, 0.72)), lin(vec3f(0.60, 0.74, 0.92)), haze) * 2.0 * mc.u_intensity * mix(0.12, 1.0, smoothstep(-0.12, 0.35, se));
let nightCol = mix(lin(vec3f(0.003, 0.006, 0.02)), lin(vec3f(0.016, 0.024, 0.06)), haze);
var col = mix(nightCol, dayCol, day);
let flatDir = dir.xz / max(length(dir.xz), 1e-4);
let flatSun = sun.xz / max(length(sun.xz), 1e-4);
let side = max(dot(flatDir, flatSun), 0.0);
- col = col + lin(vec3f(1.0, 0.42, 0.16)) * (twi * haze * (0.25 + 0.75 * side * side) * 1.6 * mc.u_twilight);
+ col = col + lin(vec3f(1.0, 0.42, 0.16)) * (twi * haze * (0.25 + 0.75 * side * side) * 1.8 * mc.u_twilight);
let overcast = clamp(mc.u_overcast, 0.0, 1.0);
let clear = 1.0 - overcast;
@@ -1696,7 +1697,7 @@ fn lin(c : vec3f) -> vec3f {
let halo = pow(max(cosd, 0.0), 16.0) * 0.25 + pow(max(cosd, 0.0), 256.0);
let sunCol = mix(lin(vec3f(1.0, 0.55, 0.25)), lin(vec3f(1.0, 0.96, 0.88)), smoothstep(0.0, 0.35, se));
let above = smoothstep(-0.02, 0.02, dir.y) * smoothstep(-0.05, 0.0, se);
- col = col + sunCol * (disc * mc.u_sunBrightness * clear + halo * (0.4 + 0.6 * clear)) * above;
+ col = col + sunCol * (disc * mc.u_sunBrightness * clear + halo * (0.15 + 0.85 * clear)) * above;
let sAz = atan2(sun.x, sun.z);
let sEl = asin(clamp(sun.y, -1.0, 1.0));
@@ -1706,9 +1707,9 @@ fn lin(c : vec3f) -> vec3f {
let md = dot(dir, moon);
let moonR = radians(0.26 * 2.5);
let moonDisc = smoothstep(cos(moonR * 1.1), cos(moonR * 0.9), md);
- let moonGlow = pow(max(md, 0.0), 300.0) * 0.5 + pow(max(md, 0.0), 24.0) * 0.03;
+ let moonGlow = pow(max(md, 0.0), 2500.0) * 0.5 + pow(max(md, 0.0), 60.0) * 0.015;
let night = 1.0 - day;
- col = col + lin(vec3f(0.80, 0.88, 1.0)) * ((moonDisc * 3.0 + moonGlow) * mc.u_moon * night * clear * smoothstep(-0.02, 0.04, dir.y));
+ col = col + lin(vec3f(0.80, 0.88, 1.0)) * ((moonDisc * 3.0 + moonGlow) * mc.u_moon * night * clear * clear * smoothstep(-0.02, 0.04, dir.y));
if (night > 0.02 && dir.y > 0.0 && mc.u_stars > 0.0) {
let p = dir * 180.0;
@@ -1721,7 +1722,7 @@ fn lin(c : vec3f) -> vec3f {
var bright = 0.4 + hash13(id + 1.7) * 1.6;
if (h > 0.995) { bright = bright * 3.0; }
let tint = mix(lin(vec3f(1.0, 0.85, 0.7)), lin(vec3f(0.7, 0.8, 1.0)), hash13(id + 5.3));
- let seen = night * night * clear * smoothstep(0.0, 0.15, dir.y) * (1.0 - 0.9 * smoothstep(0.97, 0.999, md));
+ let seen = night * night * clear * clear * smoothstep(0.05, -0.15, se) * smoothstep(0.0, 0.15, dir.y) * (1.0 - 0.9 * smoothstep(0.97, 0.999, md));
col = col + tint * (spot * bright * 2.5 * mc.u_stars * seen);
}
}