This project is a WebGL-based (non scientific) simulation of particle behavior inside a black hole singularity, created using Three.js and GLSL shaders. It demonstrates complex particle systems, GPU-based computations, and advanced rendering techniques.
- Real-time simulation of thousands of particles
- GPU-accelerated computations using Three.js GPUComputationRenderer
- Custom GLSL shaders for particle behavior and rendering
- Customizable simulation parameters
- Interactive camera controls
- Three.js: A powerful 3D graphics library for WebGL
- WebGL: Web Graphics Library for rendering interactive 2D and 3D graphics
- GLSL: OpenGL Shading Language for custom shaders
- Webpack: Module bundler for managing dependencies and building the project
- Babel: JavaScript compiler for using next generation JavaScript
Before you begin, ensure you have met the following requirements:
- You have installed the latest version of Node.js and npm
- You have a Windows/Linux/Mac machine with a modern web browser that supports WebGL
To install the project, follow these steps:
-
Clone the repository:
git clone https://github.com/your-username/black-hole-sim.git
-
Navigate to the project directory:
cd black-hole-sim
-
Install the dependencies:
npm install
To use the simulation, follow these steps:
-
Start the development server:
npm run start
-
Open your web browser and navigate to
http://localhost:9000
(or the port specified in your webpack configuration). -
You should now see the particle simulation running in your browser. You can interact with the simulation using your mouse to rotate and zoom the camera.
You can customize various aspects of the simulation by modifying the constants at the top of the src/index.js
file. These include:
TEXTURE_SIZE
: Determines the number of particles (TEXTURE_SIZE^2)CAMERA_FOV
,CAMERA_NEAR
,CAMERA_FAR
: Camera settingsPOINT_SIZE
,PARTICLE_COLOR
: Particle appearanceCENTER_MASS
,PARTICLE_MASS
,VELOCITY_TERMINAL
: Physics parametersCURL_RADIUS
,CURL_FORCE_FACTOR
,PULL_FORCE_FACTOR
: Force field parametersINITIAL_RADIUS_FACTOR
,INITIAL_RADIUS_EXPONENT
: Initial particle distribution- ...
After modifying these values, restart the development server to see the changes.