-
- 4.1. Prerequisites
- 4.2. Installation
-
- 5.1. Camera Controls
- 5.2. Visual Controls
A real-time 3D visualization of a black hole using React, Three.js, and GLSL shaders. This project simulates gravitational lensing, accretion disk effects, and relativistic beaming around a black hole, inspired by scientifically accurate black hole renderings.
This is one of the possible visualizations that can be generated with this app:
- Real-time gravitational lensing simulation
- Accretion disk with multiple texture options
- natural
- arrows
- stripes
- grid
- blue
- Doppler shift effect
- Relativistic beaming effect
- Photon ring at the event horizon
- Rotation to simulate a Kerr black hole
- frame dragging effect
- Customizable glow effects
- Interactive camera controls with orbit mode
- Performance quality adjustment
- Post-processing effects:
- Bloom with adjustable intensity
- Glow with customizable parameters
- Background options:
- Star field with proper parallax
- Milky Way background
- Persistent settings using local storage
- React + TypeScript
- Three.js
- React Three Fiber
- GLSL Shaders
- Vite
- Local Storage for persistent settings
- Node.js (v20 or higher)
- npm or yarn
- Clone the repository:
git clone https://github.com/rmarchet/blackhole-ts.git
cd blackhole-ts- Install dependencies:
npm install
# or
yarn install- Start the development server:
npm run dev
# or
yarn dev- Open your browser and navigate to
http://localhost:5173
- Left-click + drag: Rotate camera
- Right-click + drag: Pan camera
- Mouse wheel: Zoom in/out
- Toggle orbit mode for automatic camera rotation
- Performance Quality:
- High quality: More accurate ray marching steps
- Low quality: Better performance
- Bloom Effect:
- Adjustable intensity
- Configurable threshold and radius
- Glow Effect:
- Toggle glow
- Adjustable intensity
- Accretion Disk:
- Multiple texture options
- Adjustable intensity
- Toggle Doppler shift
- Background:
- Toggle star field
- Toggle Milky Way
- Adjustable background intensity
The visualization uses advanced ray marching techniques in GLSL shaders to simulate:
- Gravitational lensing around the black hole using geodesic calculations
- Accretion disk with realistic Doppler and relativistic effects
- Photon ring at the event horizon
- Relativistic beaming and light aberration
- Relativistic Jet for a rotating black hole
- Star field and Milky Way background with proper parallax
- Post-processing effects for enhanced visual quality
src/components/: React components including the main BlackHole componentsrc/shaders/: GLSL shader code for the visualizationsrc/hooks/: Custom React hooks for state managementsrc/constants/: Configuration and constant valuessrc/assets/: Textures and static assets
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by the work of Kip Thorne and the visual effects team of "Interstellar"
- Based on scientific papers about black hole visualization
- Thanks to the Three.js and React Three Fiber communities
