Skip to content

Sky & Volumetrics Demo

Physically-based atmospheric scattering with dynamic day/night cycle, stars, volumetric clouds, and god rays.

  • Atmospheric Scattering - Rayleigh and Mie scattering
  • Day/Night Cycle - Sun position affects all lighting
  • Dynamic Stars - Stars visible at night with twinkle
  • Moon Phases - Accurate moon phase rendering
  • Volumetric Fog - Height-based atmospheric fog
  • God Rays - Volumetric light shafts
import { Canvas } from '@react-three/fiber';
import { ProceduralSky, VolumetricFogMesh, createTimeOfDay } from '@strata-game-library/core';
import { OrbitControls } from '@react-three/drei';
import { useState, useEffect } from 'react';
function SkyDemo() {
const [hour, setHour] = useState(14);
// Animate time of day
useEffect(() => {
const interval = setInterval(() => {
setHour(h => (h + 0.02) % 24);
}, 50);
return () => clearInterval(interval);
}, []);
return (
<Canvas camera={{ position: [0, 10, 30], fov: 60 }}>
<ProceduralSky
timeOfDay={createTimeOfDay(hour, 0)}
stars
moon
moonPhase={0.5}
/>
<VolumetricFogMesh
density={0.015}
color="#8899aa"
/>
<ambientLight intensity={0.2} />
<OrbitControls />
</Canvas>
);
}
ControlAction
Left Click + DragRotate camera
Time SliderChange time of day
UI ControlsAdjust atmospheric parameters
ParameterEffect
timeOfDaySun/moon position
turbidityAtmospheric haziness
rayleighBlue scattering intensity
mieCoefficientSun halo size
starsEnable starfield
moonEnable moon rendering
moonPhaseCurrent moon phase
TimeHourVisual
Dawn6:00Pink/orange horizon
Morning9:00Clear blue sky
Noon12:00Bright, sun overhead
Afternoon15:00Warm golden light
Sunset18:00Orange/red sky
Dusk20:00Purple twilight
Night0:00Stars and moon
  • Sky shader is very efficient
  • Stars can be disabled on mobile
  • Volumetric fog uses ray marching (more expensive)
  • God rays require additional render pass