An interactive 3D nature diorama built with WebGL and Three.js.
- Node.js 18+
- npm or yarn
npm installnpm run devnpm run buildnpm run previewnpm run hostAdd ?mode=debug to the URL to enable:
- Performance monitoring (FPS, draw calls)
- lil-gui controls for tweaking parameters
- Verbose console logging
src/
โโโ main.js # Entry point and UI initialization
โโโ reveal.js # Shader-based reveal transition
โโโ config/ # Asset paths and configuration
โโโ utils/ # Console styling utilities
โโโ Game/
โ โโโ Game.class.js # Main game orchestrator
โ โโโ Core/ # Renderer and camera setup
โ โโโ UI/ # Music controls, lightning button, toasts
โ โโโ Utils/ # Audio, events, resource loading, timing
โ โโโ World/
โ โโโ Components/ # Bridge, bush, camp, fire, fog, rain, etc.
โ โโโ Managers/ # Biome, grass, bush, season, environment
โ โโโ Systems/ # Lightning and particle systems
โโโ Shaders/
โโโ Chunks/ # Chunks to modify builtin shaders from three.js (grass, ground, rocks, water)
โโโ Materials/ # Full shader materials (fire, fireflies, skydome, etc.)
public/
โโโ audio/ # Music and sound effects
โโโ draco/ # Draco decoder for compressed models
โโโ map/ # Environment maps (day, day2, night)
โโโ models/ # GLB 3D models
โโโ textures/ # Texture assets organized by type
| Layer | Technology | Purpose |
|---|---|---|
| Build | Vite 6.0 | Fast dev server with HMR |
| 3D Engine | Three.js 0.182 | WebGL rendering |
| Animation | GSAP 3.14 | Smooth tweening and timelines |
| Shaders | GLSL | Custom visual effects |
| Debug UI | lil-gui | Runtime parameter controls |
| Performance | three-perf | FPS and draw call monitoring |
| Styles | Sass | SCSS preprocessing |
| RNG | Mersenne Twister | Deterministic randomness |
- Touch-friendly UI controls
- Haptic feedback for button presses and lightning effects
- Responsive canvas sizing
