Summary Files Commits Branches @commit @diff @stats
path: root / src / blog / the-physics-behind-a-black-hole-shader / algorithm.tex
diff options
context:
space:
mode:
1 files changed, 25 insertions, 0 deletions
-rw-r--r--src/blog/the-physics-behind-a-black-hole-shader/algorithm.tex25
diff --git a/src/blog/the-physics-behind-a-black-hole-shader/algorithm.tex b/src/blog/the-physics-behind-a-black-hole-shader/algorithm.tex
new file mode 100644
index 0000000..3e33a11
--- /dev/null
+++ b/src/blog/the-physics-behind-a-black-hole-shader/algorithm.tex
@@ -0,0 +1,25 @@
+\begin{align*}
+ & p_{cbh} = \text{position of center of black hole}\\
+ & r_s = \text{Schwarzchild distance from } p_{cbn} \\
+ & r_{ps} = \frac{2}{3}r_s \quad \text{(photon sphere)}\\
+ & r_{ISCO} = 3 r_s \\
+ \\
+ & p_l = \text{position of light "particle"}\\
+ & v_l = \text{velocity of light "particle"}\\
+ \\
+ & r_l = \| p_l-p_{cbh} \| \quad \text{(distance between black hole and light)}\\
+ & \text{If } r_l \leq r_{ISCO} : \\
+ & \quad h = \| r_l \cross v_l \|\\
+ & \quad \text{LightMovesLimit} = \infty \\
+ & \quad \text{Repeat maximum LightMovesLimit times}:\\
+ & \qquad \text{If } r_l \leq r_s : \\
+ & \qquad \quad \text{return "Light never escapes"} \\
+ & \qquad \text{If } r_l \leq r_{ps} : \\
+ & \qquad \quad \text{LightMovesLimit} = 100 \\
+ & \qquad \text{If } r_l > r_{ISCO} : \\
+ & \qquad \quad \text{return "Light escaped black hole"} \\
+ & \qquad p_l = p_l + v_l \quad \text{(move light)}\\
+ & \qquad r_l = \| p_l-p_{cbh} \| \quad \text{(update distance to $p_{cbh}$)}\\
+ & \qquad v_l = v_l + \overrightarrow{F}(r_l,h) \quad \text{(update light velocity)} \\
+ & \quad \text{return "Light stuck in photon sphere, never escapes"}
+\end{align*}