Skip to content

Add a Python implementation of the 3D black hole visualizer#41

Open
anshjaiswal12 wants to merge 1 commit into
kavan010:mainfrom
anshjaiswal12:add-python-implementation
Open

Add a Python implementation of the 3D black hole visualizer#41
anshjaiswal12 wants to merge 1 commit into
kavan010:mainfrom
anshjaiswal12:add-python-implementation

Conversation

@anshjaiswal12
Copy link
Copy Markdown

@anshjaiswal12 anshjaiswal12 commented Apr 21, 2026

Summary

  • add a Python implementation of the same 3D black hole visualizer already present in the repository
  • keep the original C++ implementation unchanged while offering a Python alternative for users who prefer Python
  • add a self-contained python/ folder with the application, shader files, dependency list, and usage documentation
  • link the new Python implementation from the main README

Why this change

This project is already a very interesting and popular black hole visualization, so I thought it would be useful to provide a Python version of the same idea as an additional option for contributors and users.

The goal of this PR is not to replace the existing C++ code. Instead, it adds a Python implementation of the same 3D visualizer for people who:

  • prefer working in Python
  • want an easier entry point for reading and experimenting with the project
  • may want to prototype features more quickly before moving them into the C++ version

What the Python implementation includes

  • a glfw window and OpenGL context
  • a compute-shader based rendering path for the black hole visualization
  • the grid overlay used to show spacetime curvature
  • orbit camera controls and the existing gravity toggle behavior
  • local documentation and dependency instructions inside python/README.md

Structure

The new code lives under python/ to keep the contribution isolated and easy to review:

  • python/black_hole.py
  • python/geodesic.comp
  • python/grid.vert
  • python/grid.frag
  • python/requirements.txt
  • python/README.md

Python requirements

Recommended Python version: 3.10+

Dependencies:

  • glfw
  • numpy
  • PyOpenGL

Validation

  • compiled the Python entry point successfully with python -m py_compile
  • organized the contribution as a minimal addition to the repository instead of changing the current C++ build path
  • documented installation and usage steps for the Python version

Future work

I also plan to continue improving the Python version and try adding more black hole-related features over time.

If this direction looks good, I would be happy to build on it in follow-up contributions as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant