Skip to content

A 3D diorama built with Three.js and custom WebGL shaders. Explore season transitions (spring, summer, autumn, winter), realtime weather (rain, snow, wind and particle effects. ๐ŸŒฑ๐Ÿโ„๏ธโ›ˆ๏ธ

Notifications You must be signed in to change notification settings

SahilK-027/Elemental-Serenity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

55 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Elemental Serenity

An interactive 3D nature diorama built with WebGL and Three.js.

๐Ÿš€ Getting Started

Prerequisites

  • Node.js 18+
  • npm or yarn

Installation

npm install

Development

npm run dev

Build for Production

npm run build

Preview Production Build

npm run preview

Host on Local Network

npm run host

๐ŸŽฎ Debug Mode

Add ?mode=debug to the URL to enable:

  • Performance monitoring (FPS, draw calls)
  • lil-gui controls for tweaking parameters
  • Verbose console logging

๐Ÿ—๏ธ Project Structure

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

๐Ÿ› ๏ธ Tech Stack

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

๐Ÿ“ฑ Mobile Support

  • Touch-friendly UI controls
  • Haptic feedback for button presses and lightning effects
  • Responsive canvas sizing

About

A 3D diorama built with Three.js and custom WebGL shaders. Explore season transitions (spring, summer, autumn, winter), realtime weather (rain, snow, wind and particle effects. ๐ŸŒฑ๐Ÿโ„๏ธโ›ˆ๏ธ

Topics

Resources

Stars

Watchers

Forks