← Gallery
Simathon 02Has videoHas code

Procedural Stellar System

Om Prakash Sahu

A procedural, star and planets generator of a multiplanetary stellar system.

Still from Procedural Stellar System

What it does

I built a procedural star system and N-body gravity simulator using Python and Taichi. The entire system is automatically generated from a single input: Stellar Mass. I used main-sequence scaling laws (L= M^(3.5)) and the Stefan-Boltzmann law to calculate temperatures, to calculate emission wavelengths/colors at the temperature radiated by a star in system of particular Stellar mass. Orbital motion is driven by a Leapfrog N-body integrator which calculates approximate gravitational forces among all bodies, preserving Hamiltonian phase-space and strictly obeying Kepler's laws. What I Had to Figure Out: I referred to the handbook to create the Yale Bright Star Catalog (bsc5_stars.csv). I had to figure out how to convert Right Ascension (RA) and Declination (Dec) into a 3D Cartesian skybox and map the B-V color index to RGB using Planck curve sampling. A true-scale Earth at 1 AU is smaller than a single pixel. I had to figure out how to visually log-compress planetary radii so the user can see them, while ensuring the underlying N-body gravity loop still calculates forces using true Astronomical Units (AU).Physics Verification: To prove the math works, I built an automated unit test python script(test_physics.py) that runs the engine for 10,000 steps to verify energy conservation and Kepler's Third Law.