# Raytracer

The Raytracer is a program that lets you distort an arbitrary image as if there was a black hole in front of it.

The interface:

• "Select background" - this button lets you select the image that will be used as the background.
• "Resolution" - the resolution of the resulting image, max. 512x512.
• "Angular momentum/mass" - the ratio of the angular momentum of the black hole to its mass. The maximal value is one (and it is also the maximal physically meaningful value).
• "FoV" - the field of view in degrees.
• "Observer position" - the position of the observer. The numbers are: the distance from the black hole in Schwarzschild radii and two spherical angles (from 0 to $\pi$ and from 0 to $2\pi$) - please refer to the Wikipedia article.
• "Observer velocity" - the three components of the velocity of the observer: front-back, up-down and left-right.
• "Observer orientation" - allows you to rotate the camera in place. The numbers correspond to the angles of up-down and left-right rotations. The setting (0,0) causes the camera to look straight at the black hole.
• "Run" - starts rendering.

The background is treated as a panoramic photo of the whole field of view in all directions. So, first, it should have 2:1 proportions (if it doesn't, it will be stretched accordingly). Second, by default you see the fragment of the picture in the center. The left and right edges correspond to what is behind the observer, and up and down - to what is above and below them. It can be changed with the settings of position and orientation of the observer.

After the rendering is started, the program calculates the light deflection in the gravitational field of the black hole pixel by pixel. It does that by simulating the trajectories of light rays going in different directions. For increased performance it is done in multiple threads - as many as there are CPU cores in the running machine.