Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,8 @@ _deps

# Vcpkg
vcpkg_installed

##### Python
__pycache__/
*.py[cod]
.venv/
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,9 @@ for 3D: black_hole.cpp and geodesic.comp work together to run the simuation fast
should work with nessesary dependencies installed, however I have only run it on windows with my GPU so am not sure!

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

## **Python Version**

A Python implementation of the 3D visualizer is available in the [`python/`](./python) folder.

See [`python/README.md`](./python/README.md) for setup and run instructions.
50 changes: 50 additions & 0 deletions python/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Python Implementation

This directory contains a Python port of the 3D black hole visualizer.

It keeps the same high-level rendering approach as the C++ version:

- a `glfw` window and OpenGL context
- a compute shader for geodesic-based black hole rendering
- a grid overlay to visualize spacetime curvature
- orbit camera controls around the black hole

## Python Version

Python 3.10 or newer is recommended.

## Dependencies

The Python version uses:

- `glfw`
- `numpy`
- `PyOpenGL`

Install them with:

```bash
python -m venv .venv
.venv/bin/pip install -r python/requirements.txt
```

## Running

Run the Python version from the repository root:

```bash
.venv/bin/python python/black_hole.py
```

On Wayland systems that need an X11/GLX path for this OpenGL setup:

```bash
GLFW_PLATFORM=x11 .venv/bin/python python/black_hole.py
```

## Controls

- Left mouse drag: orbit camera
- Mouse wheel: zoom
- `G`: toggle gravity updates
- Right mouse button: hold to enable gravity temporarily
Loading