Skip to content

namuinteractive/black_hole

 
 

Repository files navigation

black_hole

Black hole simulation project (CMake with optimizations)

Here is the black hole raw code, everything will be inside a src incase you want to copy the files

I'm writing this as I'm beginning this project (hopefully I complete it ;D) here is what I plan to do:

  1. Ray-tracing : add ray tracing to the gravity simulation to simulate gravitational lensing

  2. Accretion disk : simulate accreciate disk using the ray tracing + the halos

  3. Spacetime curvature : demonstrate visually the "trapdoor in spacetime" that is black holes using spacetime grid

  4. [optional] try to make it run realtime ;D

I hope it works :/

Edit: After completion of project -

Thank you everyone for checking out the video, if you haven't it explains code in detail: https://www.youtube.com/watch?v=8-B6ryuBkCM

Building Requirements:

  1. C++ Compiler supporting C++ 17 or newer

  2. Cmake

    • sudo pacman -S base-devel cmake
  3. Git

    • sudo pacman -S git

Build Instructions:

  1. Clone the repository:
    • git clone https://github.com/namuinteractive/black_hole.git
  2. CD into the newly cloned directory
    • cd ./black_hole
  3. Install dependencies (Arch Linux), use the equivalents for your distro
    • sudo pacman -S glfw-x11 glew glm
  4. Create a build directory
    • mkdir build
  5. Go to build
    • cd build
  6. Configure project with CMake
    • cmake ..
  7. Build the project
    • make -j$(nproc)
  8. Run the program
    • The executables will be located in the build folder

How the code works:

for 2D: simple, just run 2D_lensing.cpp with the necessary dependencies installed.

for 3D: black_hole.cpp and geodesic.comp work together to run the simulation faster using GPU, essentially it sends over a UBO and geodesic.comp runs heavy calculations using that data.

should work with necessary dependencies installed, tested on Arch Linux, although other distros should work fine.

LMK if you would like an in-depth explanation of how the code works aswell :)

Note: I am not the original creator of the code, I just adapt it to Linux and similar systems. The original repository is here: https://github.com/kavan010/black_hole

About

Black hole simulation project, Linux port.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 89.1%
  • Cuda 10.0%
  • Other 0.9%