Hacker News new | ask | show | jobs
by flannelhead 3745 days ago
Hello HN!

I thought I would share this little writeup on a project I'm quite proud of. The code can be found on GitHub [0]. This article is mostly about the implementation of the simulation in Haskell. I've also written another article [1] on the physics of the simulation. It should be approachable even for those without any general relativity background.

[0] https://github.com/flannelhead/blackstar

[1] https://flannelhead.github.io/posts/2016-03-06-photons-and-b...

4 comments

Very cool work! You should be proud of it.

One idea that you might think about adding is redshifting the light that comes off the accretion disk. If the light is monochromatic coming off the disk, then the areas of the disk closer to the horizon should look more red to a distant observer.

Thanks for the compliment and suggestion! The redshift would be interesting to do, I'll consider that.
What's the physics behind the accretion disk and its look? I would have expected black holes to look more like the last few images where it's just a black hole distorting light around it. Is it just pure eye candy, or do black holes actually output a significant amount of light outside their event horizons?
My take on the accretion disk isn't very physically-based. It's really mostly meant as eye candy. However, the distortion (the form it takes) is physical and due to the Schwarzschild geometry.

The physical explanation of an accretion disk would be some matter that is orbiting the black hole and emitting radiation, so it makes some sense at least. https://en.wikipedia.org/wiki/Accretion_disk

Nice work! Did you consider using an RK method with fewer stages but "better" properties? I'm thinking in particular of symplectic methods like velocity Verlet. Depending on the details, it could give you both speedup and improved accuracy.
Thank you!

A comparison between different integrators is in the plans. It would be certainly interesting to try e.g. velocity Verlet and some other symplectic integrators.

Any suggestions to fake the appearance? Think of distorting background images, for 2d video game purposes. And it doesn't have to be very accurate, just a general resemblance.
At least there's a simple equation [0] for the deflection of light rays caused by a black hole. If your background is a UV map (for example), then it should be easy to compute the distortion effect. rantonels (whose raytracer was the source of inspiration for mine) has done a realtime version [1] -- I believe this should be close to what you're talking about.

[0] https://en.wikipedia.org/wiki/Gravitational_lens#Explanation... [1] http://spiro.fisica.unipd.it/~antonell/schwarzschild/