Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌌 EventHorizon-Java: 3D Black Hole Simulation

A real-time, 3D simulation of a supermassive black hole and its accretion disk, built from scratch using Java and the LibGDX game development framework.

1767203545354

1767203610476 (Note: Upload a screenshot of your sim named 'screenshot.png' to your repo for this image to appear)

🚀 Features

  • High-Count Particle System: Simulates 8,000+ individual particles using 3D Decals for optimized performance.
  • Newtonian Physics: Implements gravity vector math ($F = G \frac{m_1 m_2}{r^2}$) to calculate orbital velocities and trajectories.
  • Visual Effects:
    • Additive Blending: Creates the intense "white-hot" plasma effect where particle density is high.
    • Simulated Redshift: Particles dynamically change color from blue (cold/far) to red/white (hot/close) based on distance and velocity.
    • Procedural Textures: Glow textures are generated via code at runtime—no external assets required.
  • Interactive Camera: Full 3D camera controls to explore the void from any angle.

🛠 Tech Stack

  • Language: Java
  • Library: LibGDX (OpenGL wrapper)
  • Rendering: 3D DecalBatch & ModelBatch
  • Math: Vector3 cross products for orbital planes & relativistic clamping.

🧠 The Physics & Math

The simulation uses a simplified N-Body approach focused on a central massive attractor.

  1. Gravity: Each frame, a centripetal force vector is calculated for every particle pointing toward the singularity $(0,0,0)$.
  2. The Event Horizon: A Schwarzschild radius is defined. Any particle crossing this threshold is reset, simulating matter being consumed.
  3. Relativistic Clamping: To prevent simulation instability, a "speed of light" (Max Speed) is enforced on all particles so they don't glitch through the event horizon.

📦 How to Run

  1. Clone the repository:
    git clone [https://github.com/arvindverma63/EventHorizon-Java.git](https://github.com/arvindverma63/EventHorizon-Java.git)
  2. Open the project:
    • Open in IntelliJ IDEA or Eclipse as a Gradle project.
  3. Run:
    • Locate DesktopLauncher.java in the desktop/src/... folder.
    • Run the main method.

📸 Controls

  • Rotate Camera: Click & Drag Mouse
  • Zoom: Scroll Wheel
  • Speed: Press 1 (Normal), 2 (Fast), 3 (Ultra)
  • Pause: Spacebar
  • Exit: ESC

Created by Arvind Verma

About

High-performance visualization of a supermassive black hole. Simulates 8,000+ glowing particles swirling into a singularity using OpenGL and Newtonian physics.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages