top | item 11271772

Show HN: Rendering black holes with Haskell

88 points| flannelhead | 10 years ago |flannelhead.github.io | reply

13 comments

order
[+] flannelhead|10 years ago|reply
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...

[+] spacehome|10 years ago|reply
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.

[+] biot|10 years ago|reply
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?
[+] semi-extrinsic|10 years ago|reply
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.
[+] vc98mvco|10 years ago|reply
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.
[+] jsprogrammer|10 years ago|reply
At the end you say:

>Let me remind you that these are not the real equations of motion for the photon. The real equations of motion would have been achieved by calculating all of the geodesic equations from the Lagrangian. There are four of them instead of the three equations (in vector form) above. However, the three spatial equations will generate the exact same spatial curve as the real geodesic equations would, and they were relatively easily achieved.

What do you mean that these are not the real equations of motion for the photon, but that they give the exact same spatial curve as the real geodesic equations? Are there cases where these equations would not give the exact same curve as the real geodesic equations?

[+] flannelhead|10 years ago|reply
That statement is indeed a bit vague. Let me elaborate:

In the process of deriving the said equations, an equation for the radial coordinate of the photon was achieved. This was identified with a classical, Newtonian system of one particle with unity mass. As the real, massless photon lives in four-dimensional spacetime and the said massive "test particle" lives in three-dimensional space, these systems just can't be dynamically the same (in spacetime, the massive particle would take a timelike curve).

To reword the statement, the derived "equation of motion" will yield the same trajectory in the spacelike components (x, y, z), but possibly with a different parametrization - in the classical system, we're integrating the equations of motion with respect to the time. However, this has nothing to do with the "coordinate time" of the four-vectors nor the proper time of the particle (for the photon, proper time doesn't even make sense).

Hope this helps! You could also see [0] for an alternative take on this derivation. I will try and clarify my article a bit as well.

[0] http://rantonels.github.io/starless/

[+] pizza|10 years ago|reply
GIFs? ;)
[+] flannelhead|10 years ago|reply
Maybe in the future, and in small resolution. Right now the renderer doesn't have any animation functionality, but this is definitely something I've been considering.