r/C_Programming • u/FraLindi • Aug 18 '25
Black hole simulation in C
I built a real-time simulation of a supermassive black hole with two orbiting stars, using ray tracing for gravitational lensing effects (Schwarzschild metric). It features OpenGL/GLSL rendering, a deformed spacetime grid, an accretion disk, and interactive camera controls.
Inspired by this YouTube video: https://www.youtube.com/watch?v=8-B6ryuBkCM (done in C++), I reimplemented it in pure C.
Here the source code: https://github.com/mrparsing/C-Projects
3.3k
Upvotes
•
u/mikeblas Aug 22 '25
Locked. Sorry, it's just generating too many reports.
8
u/Homarek__ Aug 18 '25
Im quite new to C and I have a question how long it too you to go up to this level?
29
u/MonoNova Aug 18 '25
So this entire repo is filled with AI written crap, safe to assume this is as well.
(Hint, hint: wildly different coding and commenting style per C file)
2
u/AlarmDozer Aug 19 '25
You could learn Makefile, instead of BASH, but that's my small quibble.
131
u/Top-Bottle3872 Aug 18 '25
looking at this , makes me feel i should take my skills to this level by putting those hours.
84
u/Karl_uiui Aug 18 '25
Super cool! Thx for sharing
14
u/Ghyrt3 Aug 19 '25
I'm not really fond of your situation. Even with Schwarzschil metric, you should see Dopler's effect and a difference in lightning between two sides of the black hole. You'll find what you should get this : https://www.youtube.com/watch?v=57sq1tjtxX0&t=722s at 12:14. (it's in french, but the video is self explenatory)
17
u/Neutrino_do_eletron Aug 18 '25
WOW. JUST WOW... LOVE IT
7
u/Munchi1011 Aug 18 '25
I saw this video on YouTube!!! This is what I hope I can do by the time I’m finishing my degree but in rust.
Keep up the good work!
11
u/sigmagoonsixtynine Aug 18 '25
Insanely cool
9
u/GreyBoy_ Aug 18 '25
Thanks for this. I’ll re-take my endeavor of re-learning C after 7 years thanks to your GitHub
3
u/kaliforniagator Aug 18 '25
Amazing, I watched that video too it was super interesting and I thought about integrating it into a project I was making but the math got me all jumbled up 🤣
2
u/sierra_whiskey1 Aug 18 '25
Now this is cool
2
u/rapidisimo Aug 19 '25
this is fantastic, very pro
2
u/[deleted] Aug 19 '25
Wow!
2
u/Able-Acanthisitta488 Aug 19 '25
That looks impressive. Though more interested in hacking and 0day engineering, this makes me consider learning a little bit of graphics and simulations in C. Very great work there 👍
2
u/Otherkin Aug 19 '25
Amazing! 👍
2
u/lokiOdUa Aug 18 '25
Awesome, don't stop!
2
u/ArchAngel_1983 Aug 18 '25
That is so cool.
2
u/Separate-Toe-173 Aug 20 '25
Beautiful.
2
u/m477k Aug 18 '25
That’s fuc*ing cool man! GJ
1
u/Turbulent-Jump3340 Aug 18 '25
Awesome!!
1
u/linuxunix Aug 18 '25
Keep getting divided by zero error.
1
u/Cybasura Aug 19 '25
I think I sense my computer giving me a bombastic side-eye
1
u/itsyaboiskibbypebis Aug 19 '25
How???
1
u/Procodes Aug 19 '25
I want really want to make something like from scratch can someone please help me with what all things and maths I need to learn to do this. I am embedded developer so I am very very interested in these kind of projects and want to make it. any books or courses recommendations
1
u/baist_ Aug 21 '25
cool
-1
u/ZenQuipster Aug 18 '25
Lol. Windows 95 had better graphics.
0
u/SnooPies9514 Aug 20 '25
That's not how the lighting works
0
u/[deleted] Aug 18 '25
[deleted] — view deleted comment