The Gargantua Black Hole

The other day I watched the movie Interstellar by Christopher Nolan. The CG effects in the movie were so mesmerizing that I could not forget when I walked out of the cinema, especially the visualization of the Gargantua black hole.
The Garganta black hole appeared in the movie (Photo: Interstellar)
Unusual phenomenon of light around the black hole, part of the disc supposed to be hidden behind the black hole is bent upwards due to gravitational lensing (Photo: Interstellar)
Then I had the idea of writing a GLSL shader to reproduce that black hole effect. After some searches on ShaderToy, I found someone already implemented this idea, using gravity-bent ray marching method. Nevertheless, I was not satisfied with that and decided to write my own using ray tracing. After one day's reading on black hole and gravitational lensing, I decided to use the weak gravitational lensing for my task, to make my life easier. Simply put, light ray passing the compact black hole is bent by a deflection angle, which can be calculated as: $$ α = {4GM}/{c^2b} $$

where G is the gravitational constant, M is the mass of the deflecting object (black hole), c is the speed of light, and b is the impact parameter. In weak gravitational lensing model, b is just the smallest distance of the deflecting object to the light ray without deflection.


However, this formula only works for light that comes from and escapes to infinitely far way. Although it yields pretty good results for light coming behind the black hole to the observer, it's not easy to extend it to the case where source is in front of the black hole, which requires integrating the deflection angle from source to observer. Since photon passing a black hole follows a trajectory of hyperbola, I decided to directly trace a bunch of hyperbola 'rays' from the observer. The 3D hyperbola-disc intersection may seem daunting, but by performing the intersection in appropriate coordinate system, it turns out to be pretty simple. Below are the details.
  1. We are going to transform everything into a coordinate system where the hyperbola will have the standard form, and black hole is placed at the foci on +x axis.
    $$ x^2/a^2 - y^2/b^2 = 1 $$ $$ c^2=a^2+b^2 $$
  2. Determine the asymptotic line of hyperbola by the deflection angle α, where $ tan(α/2)=a/b $.
  3. Construct a local standard coordinate system for the hyperbola, the coordinate system origin is found by simple geometry between the closest distance $rm$ and deflection angle $α$, and the x-axis is determined by connecting the origin and the black hole.
  4. Find the intersection line of ray-blackhole plane and disc plane, by a simple cross product of normals, and a shared point on two planes is just the black hole.
  5. Transform the intersection line to local hyperbola coordinate system, and the line will have the form: $$ y = k(x-c) $$ where k is the slope after transformation and c is the distance from origin to focus. The intersection of that line and the hyperbola is found by substituting y into the hyperbola equation.
  6. Transform the intersection point back to world coordinate system and we're done.
And here comes the result.

See the full demo and shader code here.

Reference

  1. Getting the physics details right results in black hole breakthrough for 'Interstellar' crew, by Michael d'Estries
  2. A guide to the science behind Interstellar, by Conrad Quilty-Harper
  3. Black hole, Wikipedia
  4. Weak gravitational lensing, Wikipedia
  5. Bozza, Valerio. "Gravitational lensing by black holes." General Relativity and Gravitation 42.9 (2010): 2269-2300.

Last updated 11/27/2014