What it does
There is no sky dome. Every pixel turns its own view ray into a colour, so the gradient is exact at any field of view, costs one triangle, and cannot clip, seam or be flown through. The rays ignore the camera's position, so the sky holds steady however far the player travels.
The time dial resolves a palette of keyframes (the zenith, the horizon, the glow band, the sun's colour and strength,
the hemisphere ambient and the fog) and a sun path. With driveLighting on, the sky writes the sun, ambient and fog
into render-3d's lighting record every step, so the shadows, the fog, the sky and the water all read the same number.
Without render-3d composed it simply draws a sky.
In the sky are two cloud decks, chunky billows below and a thin, faster veil above, with silver linings and parallax as
the camera travels; a dense twinkling star field with four recognisable constellations that wheel about a tilted pole;
a sun with a disc, a glow and a haze; and a moon that lights the scene at deep night. A storm dial thickens and darkens
the clouds and dims the light. Whenever the light changes enough to matter, the sky bakes itself into a 256 by 128
environment map with a full mip chain, which water-3d and physically based materials reflect, sunset, night and
storm included.
Features
- One dial —
time(0 to 1) orhour(0 to 24), withdaySecondsorcycle()to let the day pass. - Drives the lighting — sun, ambient and fog written into
render-3d, so everything agrees about the hour. - Authored days —
palettekeyframes and asunPath(rise, set, peak, depth and lean), checked byvalidatePalette. - Two cloud decks — cover, density, scale, speed and wind direction; zero cover skips the cloud work.
- Stars and constellations — a twinkling field, four constellations that rise and set, and a moon.
- A storm dial — more and darker cloud and a dimmer sun, reaching the scene's light and fog too.
- A baked environment map — mipped and rebaked when the light moves, for water and PBR reflections.
- Sun queries —
sunPosition,sunHeightandsunDirectionfor a sun sprite, a lens flare or lamps that light at dusk. - A headless core —
skyState,bakeEnvandconstellationDirswork without a GPU. - WebGPU and WebGL2 — the same sky on both, including low-end devices.
Good for
- Open-world and exploration games — a day that passes, with light and fog that follow it.
- Driving games and long journeys — a sky that holds steady over any distance.
- Survival and farming games —
sunHeightas a trigger for lamps, spawns or sleep at dusk. - Sea and lake scenes — water that reflects the sky it is lit by.
- Stylised and alien worlds — a palette and sun path of your own, such as a short, dim day under a violet sky.
- Weather moments — a storm rolling in over a level.
Make it yours
Every option is also live on game.sky: the time, the length of a day, the compass bearing of sunrise, brightness,
haze, stars, cloud cover, density, scale, speed and wind, the storm, and whether the sky drives the lighting. The day
itself is data: a palette is a list of keyframes by hour that the sky blends between and wraps round, and a sun path
sets when the sun rises and sets and how high it climbs.
Two very different skies: an Earth-like day lasting ninety seconds that starts at dawn while a storm builds; and a red-dwarf world with a five-hour day, a low, dim sun and a violet palette, set entirely through options.
A quick look
A ninety-second day starting at dawn, a storm rolling in, and lamps that know when it is dusk:
game.sky.hour = 5.5;
game.sky.cycle(90);
game.sky.storm = 0.6;
const lampsOn = game.sky.sunHeight < 0.05;
Works with
world-3d— the 3D world it needs.render-3d— the sky drives its sun, ambient and fog.water-3d— reflects the sky's environment map.god-rays-3d— light shafts and a lens flare, which the sky does not draw.underwater-3d— takes the fog over while the camera is submerged.skymax— the physically based, volumetric alternative on WebGPU; compose one or the other, never both.backdrop-sky— a flat gradient behind a 2D game.
Good to know
- The clouds are two projected decks, not volumes: they compress toward the horizon and cannot be flown through.
Volumetric clouds are
skymax. - The four constellations and the star field are built in, and there are no moon phases or cloud shadows.
- The sun rises and sets once a day, so a midnight sun or a polar night is not something a sun path can describe.
- While
driveLightingis on it writes the lighting every step, so turn it off before setting the renderer's sun yourself.






