+
Skip to content

ecnivs/black-hole

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Black Hole Simulation

Real-time, interactive black hole visualization written in Rust

swappy-20250813-153940

Overview

This project simulates an accretion disk, particle heating, and stylized spacetime curvature (grid warping) around the black hole, complete with camera controls.

✨ Features

  • Accretion Disk Animation: Particles orbit around the black hole with relativistic time dilation effects.
  • Doppler Shift Rendering: Colors shift based on relative motion using simplified relativistic formula.
  • Temperature-Driven Emission: Particles emit light based on dynamic heating models (gravitational, magnetic, and tidal).
  • Spacetime Warping Grid: A visible mesh is distorted according to Schwarzschild radius curvature.
  • Configurable Black Hole Parameters: Mass, spin, and scale are adjustable in code.
  • Camera Controls: Zoom, rotate, tilt, and toggle auto-rotation in real time.
  • Background stars: Static star field for reference.

Controls

  • W: Zoom in
  • S: Zoom out
  • A: Rotate left
  • D: Rotate right
  • Q: Tilt down
  • E: Tilt up
  • Space: Toggle auto-rotation

⚙️ Installation

  1. Clone the Repository:
git clone https://github.com/ecnivs/blackhole.git
cd blackhole
  1. Run the simulation:
cargo run --release

How It Works

  • The black hole's Schwarzschild radius is computed from its mass.
  • Accretion particles orbit the hole, with thier orbital radius decreasing over time.
  • Relativistic Doppler effect alters their emission color depending on motion relative to camera.
  • The grid mesh is dynamically warped to show spacetime curvature.
  • A simple star field provides background reference.

Possible Improvements

  • Add photon ring and lensing visuals via ray marching
  • Implement Kerr metric spin-based light bending
  • Better color grading for cinematic presentation
  • UI silders for real-time parameter changes

🙌 Contributing

We appreciate any feedback or code reviews! Feel free to:

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Submit a pull request

I'd appreciate any feedback or code reviews you might have!

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载