Skip to content

feat: procedural sky ESM script with day/night cycle and dynamic IBL#8943

Merged
mvaligursky merged 1 commit into
mainfrom
mv-procedural-sky
Jun 23, 2026
Merged

feat: procedural sky ESM script with day/night cycle and dynamic IBL#8943
mvaligursky merged 1 commit into
mainfrom
mv-procedural-sky

Conversation

@mvaligursky

Copy link
Copy Markdown
Contributor

Adds a ProceduralSky ESM script and a graphics example showcasing a full day/night cycle with dynamic image-based lighting. The daytime atmosphere is a port of the three.js Sky shader (Preetham analytic daylight); this is expanded with an original procedural night-sky model (deep gradient, warm twilight glow, stars, and a moon disk) blended in by time of day, plus a moon key light. Addresses #4378.

Changes:

  • scripts/esm/sky/procedural-sky.mjs - reusable ESM script. Renders the visible sky via a skyboxPS chunk override (no custom mesh) and bakes the lighting into the scene env-atlas (RGBM, so no float-renderable dependency). Drives a linked directional light's direction/color/intensity across the day and crossfades to a configurable moon key light at night. The night sky (gradient, twilight glow, stars, moon disk) is an original addition on top of the ported daytime model.
  • Graphics example procedural-sky (.example.mjs + .controls.jsx) - a laboratory in a desert with SSAO, HDR bloom, PCSS soft shadows, torch lights at night, and editable time-of-day curves.
  • New asset dry-sand-terrain.glb (+ attribution) and example thumbnails.

Examples:

  • New: Graphics / Procedural Sky

Credits:

  • Daytime atmosphere ported from three.js Sky (MIT) - Simon Wallner, Martin Upitis, Joshua Koo / zz85; underlying model by Preetham, Shirley, Smits (1999).
  • "FREE - Dry Sand Terrain" by josevega (CC BY 4.0); "Laboratory" by Sketchfab (CC BY 4.0).

Depends on: #8942 (PCSS hardware-bias fix) for correct WebGPU PCSS shadows.

Adds a ProceduralSky ESM script (daytime atmosphere ported from the three.js Sky shader, expanded with an original procedural night sky) and a graphics example showcasing a day/night cycle with dynamic image-based lighting. Addresses #4378.
@github-actions

Copy link
Copy Markdown

Build size report

This PR does not change the size of the minified bundles.

Bundle Minified Gzip Brotli
playcanvas.min.js 2282.7 KB — 585.4 KB — 455.3 KB —
playcanvas.min.mjs 2280.1 KB — 584.7 KB — 454.6 KB —

@MAG-AdrianMeredith

Copy link
Copy Markdown
Contributor

Oh Nice this will save me some time!

@mvaligursky mvaligursky added the area: graphics Graphics related issue label Jun 23, 2026
@mvaligursky mvaligursky merged commit 4ebb89c into main Jun 23, 2026
10 checks passed
@mvaligursky mvaligursky deleted the mv-procedural-sky branch June 23, 2026 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: graphics Graphics related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants