Lighting & Day/Night Cycle
Hyperscape features a dynamic day/night cycle with adaptive lighting and auto exposure that mimics realistic eye adaptation. The lighting system provides atmospheric transitions while maintaining gameplay visibility.Lighting code lives in
packages/shared/src/systems/shared/world/Environment.ts with sky system in SkySystem.ts.Auto Exposure System
The auto exposure system mimics eye adaptation to different light levels, automatically adjusting exposure to keep the game visible during both day and night:How It Works
Initialization
Exposure is initialized based on current time of day to prevent jarring transitions when players join at night:Day/Night Lighting
Sun and Moon
The sun/moon light transitions based on time of day:Moon intensity was increased from 0.4 to 0.6 to improve night visibility while maintaining atmospheric darkness.
Ambient Lighting
Hemisphere and ambient lights provide base visibility:Shadow System
Cascaded Shadow Maps (WebGPU)
WebGPU uses Cascaded Shadow Maps (CSM) for high-quality shadows:WebGL Shadow Fallback
WebGL uses simplified single directional light shadows:- No cascaded shadows (single shadow map)
- Smaller shadow coverage area
- Lower shadow quality
- Still provides functional shadows for gameplay