Interactive flocking (boids) simulation rendered with React Three Fiber, Drei and postprocessing. Features animated koi fish models, configurable flocking rules, and cinematic post effects (Bloom, DOF, GodRays) tuned for performance.
- Boids flocking rules: wander, alignment, avoidance, cohesion
- Animated GLTF koi models with shadow casting
- Post-processing: Bloom, Depth of Field, God Rays (configurable)
- Adaptive performance tuning (DPR clamp, reduced shadows, fixed-step physics)
- Theme switcher (Underwater, Space)
- Live tweaking via Leva control panel
- React + Vite
- @react-three/fiber, @react-three/drei
- @react-three/postprocessing
- jotai, leva, tailwindcss
- Install dependencies
npm install
# or
yarn- Run dev server
npm run dev
# or
yarn dev- Build for production
npm run build
npm run preview
# or
yarn build && yarn previewsrc/App.jsx: Canvas setup (DPR clamp, fog, loader, UI)src/components/Experience.jsx: scene, lighting, postprocessing, textsrc/components/Boids.jsx: flocking simulation, models, animationssrc/components/UI.jsx: theme switching, preloadingpublic/models: GLB models for koipublic/fonts: 3D font JSON
- OrbitControls: mouse/touch to rotate, pan, zoom
- Leva (panel): adjust boundaries, flocking and effect parameters in real-time
- UI buttons: switch themes
- General settings
NB_BOIDS(count)MIN_SCALE/MAX_SCALEMIN_SPEED/MAX_SPEEDMAX_STEERING
- Boid Rules: enable/disable
ALIGNEMENT,AVOIDANCE,COHESION, 3D movement - Radii/Strength per rule: ALIGN/AVOID/COHESION
- Wander: radius/strength
- Depth of Field:
focusRange,focusDistance,focalLength,bokehScale
- Models:
public/models/*.glb(koi variants) - Font:
public/fonts/Poppins Black_Regular.json
This project is for learning/demo purposes. Review asset licenses before reuse.