Hacker News new | past | comments | ask | show | jobs | submit login
Raytracing a Black Hole (rantonels.github.io)
368 points by Ohtrahddis on March 9, 2015 | hide | past | favorite | 38 comments



Easy. Take the Schwarzschild metric, find the Christoffel symbols, find their derivative, write down the geodesic equation, change to some cartesian coordinates to avoid endless suffering, get an immense multiline ODE, integrate. That's pretty much it.

The TV and books I consumed as a kid made it seem plausible that people in the future will regularly talk like that.

Now, living in the future, I'm happy that it turned out to be true.


Oddly, the math invoked by that quote is 100 years old.


Were less applications for it back then though!


Performance thought:

I like the way you raytrace the entire image at once. Clever, but you might be able to make it faster...

Right now you process the entire image in one hit. However a 1080p * 4 byte image is 777,600 bytes - from a quick read I believe you have several of these. They're large enough to blow the caches in your CPU.

It might be much faster to break the image into 8,16 or 32 square or rectangular or line shaped "patches" and process each in sequence. That would help you hit the same parts of your working arrays more often and keep them in cache between iterations.

I'm thinking

    for patch in patches
       for iter in iterations <-- currently your outer rendering loop
Might be a quick performance win worth playing with.

Hit me up at tom at gridspy (.co.nz) if you want to discuss further.

Amazing article, thankyou!


I don't get something. Isn't 1080p a 1920x1080 image, which would make it 2073600px * 4 bytes = 8294400 bytes = 7.91 megabytes?


This is really cool! It's a nice explanation of the topic (including some very effective diagrams), and the resulting visualizations are great.

[Side note: In discussing the distortion of the event horizon, the author says "I suspect the punctured sphere → disk map is conformal/biholomorphic". There is a conformal map between the punctured sphere and the plane[0], but there is no conformal bijective map between the open unit disk and the full plane.[1] Thus, the punctured sphere and the unit disk cannot be conformally equivalent.]

[0] http://en.wikipedia.org/wiki/Stereographic_projection [1] http://en.wikipedia.org/wiki/Unit_disk#The_open_unit_disk.2C...


There's nothing better than something that looks beautiful and is precisely specified.

Really nice.


The image "inversion" effect you get near the black hole is very intriguing ... you get an infinite series of inversions with increasing compression corresponding to the number of revolutions light took around the BH. So a few photons getting to you might be really old (could be almost as old as the BH itself!), it's a series of windows into the past...


Wow, I hadn't thought of that. I wonder what the "compression" factor is for each orbit around the black hole.

Edit: Actually, I don't think you get any photons that do a full 360 degrees around the black hole that subsequently escape the black hole.


If you look at the image of geodesics he shows an example of an almost 360 degree trajectory. Simple continuity arguments allow you to conclude you can have an arbitrary number of rotations, I believe.

I would conjecture the contraction is roughly exponential, there's no obvious contradiction with that but it's way over by knowledge to check it ...


By the time a photon has done a complete rotation, it necessarily has to be on a path that takes it into the black hole (instead of outside of it). So yes, you can have an arbitrary number of rotations, but anything that makes a complete rotation or more will never leave the black hole.


It turns out that a photon can describe any real rotation angle around a black hole (I've asked a physicist). The continuity argument I gave is valid: take the critical energy E wherein the photon is attached to the photosphere, then with an adequate E+eps, eps > 0, the photon will describe an according monotonically decreasing angle.


Hmm I'm not so sure anymore. I'll have to ask a physicist I guess.


What I'd really like to see is how this would differ for a Kerr metric[1], since it's assumed that most stellar or galactic core black holes will be rotating. [1] https://en.wikipedia.org/wiki/Kerr_metric


Would be great if they coded this into Elite: Dangerous.


Now that Interstellar brought this image of a black hole into popular culture, I expect many other movies and games adopting it.


Interstellar? How about 'black hole'? http://www.imdb.com/title/tt0078869/


I haven't watched that movie, but I did look at screenshots, and what I see is the bog standard black hole used by everyone everywhere. And I'm not really surprised - after all, Interstellar invented the black hole image this article was talking about, AFAIR it was for this movie that such rendering was attempted the first time ever - so for your reference to be relevant to my comment, we'd have to be dealing with some really serious time travel stuff. ;).


Though not as precise as this implementation, there is an artistic impression of gravitational lensing in the game already[0]

http://youtu.be/7txixfOI0tE?t=1m22s


Exactly! I wouldn't be too surprised if they do… it looks doable.

Although you might not want to get your ship too close to one with an accretion disk - it'll burn up. (If you do, at least use an all-black paint-job and look stylish.)


Wonderful! The descriptions of the accretion disk images are particularly good.

Recently for an abstract art project I wrote a simple gravitational lens simulator to distort an image as if there was a 10 Earth mass black hole between the viewer and the objects: http://www.tjradcliffe.com/wp-content/uploads/2015/03/test1....

It was a quick hack to explore the idea, and I'm pretty sure important details aren't right, but it was good enough for going on with. While doing it I remember thinking, "I wish I had time to explore this whole process properly." Now I don't have to!


One thing I can't forget is a picture of a black hole from telescopes.

We should really call this an artistic rendition of a black whole, because they look nothing like that. At least not as sexy.

I can't find the original but here:

https://thetruthbehindthescenes.files.wordpress.com/2011/01/...


Is it fair to compare this low-res photo to the render? I think they'll be prettier once we have better telescopes.


it's not about fairness, that's what we see currently.


What if "what we see" is not accurate of how it actually looks and works? I think the math behind it would have a more accurate way to describe how it looks and works, which is what the render does.


Well it depends on the viewing distance of course. With a telescope you can only (barely) image the accretion disk, if the BH is not too far and not shrouded by dust. So it's more of an artistic perspective, but accurate rendition :)


Very original! Congrats! It's better looking than the old Möbius strip, and the maths are not that bad :)


This is stunning. Thank you for sharing.


Very beautiful rendering


Nice introduction. My colleague works exclusively in raytracing around black holes (although he uses the Kerr metric) and he has produced some really cool images.

I highly recommend looking at the literature for really cool images with more complicated black holes.


Very cool. Sadly, the link to the interactive demo seems to be broken.



Also interesting, this video of visiting a black hole https://www.youtube.com/watch?v=T_TU6T4-0LU


Great work!

> I suspect the punctured sphere → disk map is conformal/biholomorphic, but I have no sources for this

It doesn't look conformal to me, some right angles become acute...


Very nice work, and the diagram wrt the PS was very instructive & helped very much with visualising the bending of light. Thanks!


I have to wonder if anywhere, in the history of the universe, a sentient being has ever fallen into a black hole.


Clear and beautiful (i.e. elegant).


This is awesome!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: