4

I am trying to draw a black hole in tikz, and then overlay it on a real astronomical image with stars in the background. So I take a real image and then plug in a black hole in between the stars, and the goal is that it ideally should look like in this image here:

The difficult part is the lensing effect, so the aura of light around the black hole. I really don't know how to go about this to make it look realistic.

My first naive attempt is:

\documentclass{article}

\usepackage{tikz}

\usepackage[active,tightpage]{preview}  %generates a tightly fitting border around the work
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{2mm}


\begin{document}

\begin{tikzpicture}

\draw [orange,fill=white,very thin] (0,0) circle (.515);
\shade[ball color = black] (0,0) circle (.5);

\end{tikzpicture}

\end{document}

When overlayed with a crop of this astronomical image (scroll down for download links in different qualities), this not yet really satisfying image:

enter image description here

How can I improve this, in particular the light aura around the black hole?

It does not need to be photo-realistic. But an improvement from what I got so far would be great! Thanks a lot for help and suggestions!

8
  • 2
  • 1
    Hi @Sebastiano . I did not overlay the black hole with the background in tikz. I only drew the blackhole in tikz, and then did the overlaying in Apple Keynote for the lack of a better software to do so. If I can do all of that in tikz, then that would be great! I am not sure how to do it. Do you know by chance? – Britzel Apr 28 at 20:40
  • 2
    "I really don't know how to go about this to make it look realistic." What exactly does "realistic" mean here? We have relatively few actual pictures of black holes, and all I think are in false colors, with the glow coming from matter inflow (not gravitational lensing). :-) If may help if you add a more precise description of what you think should be captured by a good illustration. – Willie Wong Apr 28 at 21:37
  • 1
    Hi @WillieWong ! Yes, you are right of course. Realistic is the wrong term. I linked an image in my question, which looks like what I would like to achieve about. So I would like to draw this lensing ring effects around it. – Britzel Apr 28 at 21:49
  • 1
    @Sebastiano Thanks, I will have a look! Yes, you are right, it is a secondary issue. ; ) – Britzel Apr 28 at 21:50
1

enter image description here

I use a random generation of white dots and multiple passages (\foreach loops that make the code rather long) for the stars, and some circles with various transparencies for the black hole lens effect. I don't know if this is close to what you were looking for.

The code

\documentclass[11pt, border=.5cm]{standalone}
\usepackage{tikz} 
\usetikzlibrary{fadings}

\xdefinecolor{B}{RGB}{2, 17, 34}

\begin{document}

\tikzfading[name=fade out, inner color=transparent!0,
outer color=transparent!100]
\tikzset{
  star/.style={B, fill=white, path fading=fade out}
}
\begin{tikzpicture}
  % background color
  \clip (-4, -4) rectangle (4, 4);
  \draw[white, shading=mradial, inner color=black,
  middle color=B!60!black, outer color=B]
  (-4, -4) rectangle (4, 4);

  % stars foreground
  \foreach \i in {1, ..., 40}{%
    \pgfmathparse{random()}
    \pgfmathsetmacro{\a}{\pgfmathresult}
    \pgfmathparse{random()}
    \pgfmathsetmacro{\d}{\pgfmathresult}
    \filldraw[star] ({\a*360}: 1+\d/6) circle (.75pt);
  }
  \foreach \i in {1, ..., 30}{%
    \pgfmathparse{random()}
    \pgfmathsetmacro{\a}{\pgfmathresult}
    \pgfmathparse{random()}
    \pgfmathsetmacro{\d}{\pgfmathresult}
    \pgfmathparse{random()}
    \pgfmathsetmacro{\r}{\pgfmathresult}
    \draw[star] ({\a*360}: 1+1/6+\d) circle (\r pt);
  }
  \foreach \i in {1, ..., 30}{%
    \pgfmathparse{random()}
    \pgfmathsetmacro{\a}{\pgfmathresult}
    \pgfmathparse{random()}
    \pgfmathsetmacro{\d}{\pgfmathresult}
    \pgfmathparse{random()}
    \pgfmathsetmacro{\r}{\pgfmathresult}
    \draw[star] ({\a*360}: 2+1/6+\d) circle (1.5*\r pt);
  }
  \foreach \i in {1, ..., 30}{%
    \pgfmathparse{random()}
    \pgfmathsetmacro{\a}{\pgfmathresult}
    \pgfmathparse{random()}
    \pgfmathsetmacro{\d}{\pgfmathresult}
    \pgfmathparse{random()}
    \pgfmathsetmacro{\r}{\pgfmathresult}
    \draw[star] ({\a*360}: 3+1/6+\d) circle (1.25*\r pt);
  }

  stars background
  \foreach \i in {1, ..., 180}{%
    \pgfmathparse{rand}
    \pgfmathsetmacro{\x}{\pgfmathresult}
    \pgfmathparse{rand}
    \pgfmathsetmacro{\y}{\pgfmathresult}
    \filldraw[white] (4*\x, 4*\y) circle (.3 pt);
  }

  % black hole
  \foreach \i [evaluate=\i as \t using 1/\i] in {2, 3, ..., 20}{%
    \draw[white, thick, opacity=\t] (0, 0) circle (.9+\i/100);
  }
  \fill[black, opacity=.9] (0, 0) circle (1);
\end{tikzpicture} 
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.