NatureGL Skyv1.1.0

naturegl-sky v1.1.0

Skies you can fly through

A physically based atmosphere, volumetric clouds at a real altitude and a day/night clock for any three.js scene. It drops in as one mesh, lights everything around it, and holds up while the camera climbs straight through the deck.

$ npm install && npm run dev

#One mesh. The whole sky.

The sky is a far-plane backdrop in your scene, so your geometry covers it with no sorting. Everything expensive, including the cloud march, shadow map and environment bakes, runs inside sky.update(dt). Your render loop stays renderer.render(scene, camera).

Follow the quick start or read how it composes.

Climbing from the cloud base to above the deck at 180 m/s. The temporal reconstruction reprojects every pixel at the cloud's recorded depth, so the bases don't smear.
presets, one file each
15
quality tiers, low to ultra
4
median on high (Apple M5, 1280×720)
~75 fps
mesh added to your scene
1

#What's in the box

#Fifteen skies, ready to load

Every preset is a plain params object in src/config/presets/. Snap to one with loadPreset, ease into it with applyPreset, or print your own with getParams().

MarinemarineThe signature sky: sea cumulus with the sun ahead.
StormstormSquall line, rain veils, lightning, low sun under the deck.
CumulonimbuscumulonimbusOne monumental cell anchored 10 km north.
Golden hourgoldenLow sun behind towering cumulus.
NoctilucentnoctilucentElectric-blue high cloud in deep twilight.
NightnightWaning gibbous moon, stars and the milky way.

See all fifteen presets

#Minutes to a living sky

main.js
import * as THREE from 'three';
import { SkySystem } from 'naturegl-sky';

const renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.toneMapping = THREE.ACESFilmicToneMapping; // the sky writes linear HDR
const sun = new THREE.DirectionalLight();
scene.add(sun, sun.target);

const sky = await SkySystem.create({ renderer, scene, camera, preset: 'marine' });
scene.environment = sky.environment;   // PBR ambient + reflections of the live sky
sky.bindLights(sun);                   // sun by day, moon by night
sky.patchMaterial(ground.material);    // cloud shadows sweep the ground
sky.clock.running = true;

renderer.setAnimationLoop(() => {
  sky.update(timer.getDelta());        // after moving the camera
  renderer.render(scene, camera);
});

#A day in fourteen seconds

sky.clock.speed = 1.35 hours per second, from before dawn to after dusk. The sun colour, ambient, environment map and exposure all follow automatically.

#Part of the NatureGL series

NatureGL Sky is the light source for the rest of the series. NatureGL Water reads its sun, environment and exposure directly. Grass, Weather and NatureGL Island take its lighting too.