Kerr Spacetime Black Hole Model in Roblox

The above video is a mathematical model of a spinning black hole, made ENTIRELY in Roblox.
Everything you see in this video — event horizon, ergosphere, accretion discs, warped grid, field lines, arrows, photon paths, etc — is generated from code at runtime.

The model is based on Kerr spacetime, which is a general relativistic solution for an uncharged and rotating black hole. The central shells represent the horizon and ergosphere, moving particles are photon trajectories, the blue warped grid represents spacetime, the surrounding curved cyan lines represents the magnetic field, and the surrounding yellow cones represent a simplified magnetized accretion flow.

This is meant to be a mathematical visualization. Changing the mass, spin, photon impact parameter, source geometry, disk properties, or magnetic parameters rebuilds only the relevant layers so you dont have to recreate 10000 parts every time you change a small detail.

Advanced Implementation Details:

How the geometry is constructed

Parametric surface triangulation

The horizon and ergosphere are generated using parametric surface triangulation.

I sample the angular coordinates theta and phi on a regular grid. Each four corner grid cell is divided into two triangles. The north/south poles are handled as triangle fans so that zero-area quads arent a problem.

The kerr coordinate surface is mapped into the workspace using oblate spheroidal display coordinates:

The final position is multiplied by a display scale of 1.8 studs per geometric unit.

Two WedgePart triangle decomposition

Each triangle is made from two thin WedgeParts:

  1. Find the longest triangle edge and use it as the baseline
  2. Make a local orthonormal basis with dot and cross products
  3. Project the third vertex onto the baseline
  4. Split the original triangle at that projection into two right triangles
  5. Represent each right triangle with a single WedgePart

This is the common two wedge triangle construction. However surface sampling and Kerr coordinate mapping are made specifically for this model.

Straight curves, grids, arrows, field lines, and equation glyphs are made from oriented beam parts whose CFrame is calculated from an orthonormal frame aligned with each sampled line segment.

Kerr spacetime, horizons, and frame dragging

The model uses geometric units:

image

The Kerr metric functions are:

image

M is the mass parameter and a = J/M is the angular momentum. A Kerr black hole has an event horizon whenever M > 0 and |a| <= M.

The inner and outer horizon radii are solved analytically via:

image

The outer stationary limit surface is:

image

The region between that surface and r_plus is the ergosphere. The ring singularity is the r = 0, theta = pi/2 locus, which has display radius |a| before applying to stud scale.

Frame dragging arrows use the locally nonrotating observer angular rate:

image

Light cone overlays come from solving the local azimuthal null condition:

image

The two roots give the prograde and retrograde coordinate-null rates. Their mean controls the visible cone lean and their separation controls its opening.

The warped grid is an embedding style visual aid. Its height is a monotonic function of mass and radius, while its color uses the equatorial Kerr Kretschmann scalar:

image

Photon ray tracing

The photons are traced as Kerr null geodesics using the Hamilton-Jacobi separation

Photon energy is normalized to E = 1. The other two constants are:

image

The separated potentials are:

image

The spatial trajectory is integrated from:

The default simulation uses 280 geodesic samples per path and a second-order midpoint method. Radial and polar turning points reverse the corresponding branch. Polar roots are located by bisection before reflecting the unused part of the step, and axis crossings rotate phi by pi to keep the Cartesian path continuous

We stop integrating when the path reaches approximately r_plus * 1.025, falls into the central cutoff, or escapes beyond the source radius

Source construction

The source can be configured as:

  • 2D or 3D photon geometry;
  • sources distributed all around the black hole or on a one-sided tangent plane;
  • an impact-parameter launch or a nominally straight inward launch

For a 3D one-sided source, points are placed on the tangent disk using a golden angle distribution. This is to avoid visible latitude bands.

The one sided straight launch constants are initialized from an asymptotic cartesian direction of (-1, 0, 0). The oblate display coordinates are inverted to recover r, theta, and phi before we integrate

Client animation

The server calculates and replicates the photon paths, then the client builds a cumulative arc length table, uses binary search to locate the current segment, and linearly interpolates position and intensity. Photon packets and trails are client-rendered for optimiizaton, and do not add networked moving parts every frame

Photon packet motion is only a visualization along the solved spatial path. Its constant arc-length speed is NOT being presented as Boyer-Lindquist coordinate time

Reduced-order accretion and magnetic-field model

The accretion layer is purposely described as a frozen and reduced order GRMHD-like state. It is NOT a finite volume, time evolved solution of the GRMHD PDE system

Disk boundary and ISCO

The inner disk edge is outside both the horizon and the corotating Kerr innermost stable circular orbit

Primitive fields

The disk thickness is
image

Density uses a compact quartic radial window and a Gaussian vertical profile:

image

It is normalized by a stationary mass-flux proxy involving the accretion rate, cylindrical radius, scale height, and inward radial velocity.

Temperature decreases approximately as:

image

The gas uses a gamma-law closure with gamma = 4/3:

The exact Boyer-Lindquist lapse used outside the horizon is:

image

The corotating circular-orbit frequency is:

image

The azimuthal speed shown by the fluid arrows is measured relative to a locally nonrotating observer:

image

Small analytic radial inflow and deterministic turbulent perturbations are then added. The final local three-speed is less than the speed of light

Magnetic field

The large scale poloidal field is derived from an axisymmetric flux function of the form:

image

The toroidal component is wound according to the black hole spin. Two localized Fourier modes are added through the curl of a vector potential. Constructing these perturbations as curls keeps their continuous divergence zero by construction.

The ideal-MHD electric field is:

image

As a diagnostic, i also made the script estimate normalized magnetic and mass-flux divergences with centered finite differences

Approximate radiative transfer

Each ray samples the frozen fluid state at the midpoint of every trajectory segment

An approximate combined gravitational/Doppler redshift factor is:

image

where W is the Lorentz factor and n is the photon direction

Emission is a synchrotron-like proxy based on density, magnetic field strength, and temperature. Absorption depends on opacity, density, and inverse temperature.

For each segment, the scalar transfer equation is solved in its constant-coefficient formal form:

The resulting intensity drives packet size, brightness, transparency, and glow.

This is a stable, interactive approximation for how emission, absorption, gravitational redshift, and Doppler motion affect a traced ray.

Default parameters used in the video

Physical and interactive parameters

Parameter Default Meaning
M 4 Kerr mass parameter
a 2 Spin parameter J/M
b 18 Photon axial impact parameter L_z/E
r0 22 Photon launch radius
Source radius 12 Radius of the one-sided source line/disk; inactive in the default all-around mode
Spawn locations 5 Number of distinct geodesic paths
Photon count 20 Total animated packets distributed across the paths
Photon geometry 2D Equatorial geodesics
Source direction All around Sources distributed around the black hole
Launch behavior Legacy Uses the requested impact parameter directly
Accretion rate 0.35 Density/mass-flux normalization
Magnetization input 4 Magnetic-field normalization
Temperature input 5 Disk temperature scale
H/R 0.22 Disk thickness ratio
Turbulence 0.28 Density, velocity, and field perturbation strength
Opacity 0.18 Absorption normalization

Numerical and display parameters

Setting Default
Geometric-unit display scale 1.8 studs/unit
Horizon tessellation 9 x 24 angular cells
Warped grid 9 x 36 samples
Geodesic steps 280 per path
Disk sampling 8 x 24
Magnetic field lines 12
Steps per magnetic line 30
Packet display speed 15 studs/second
Analytic values for the default state

Substituting M = 4 and a = 2 gives:

Solved quantity Value
Dimensionless spin chi = a/M 0.5
Outer horizon r_plus 7.4641016
Inner/Cauchy horizon r_minus 0.5358984
Equatorial stationary limit 8
Polar stationary limit 7.4641016
Horizon angular velocity Omega_H 0.03349365
Surface gravity kappa 0.05801270
Horizon area 4 pi(r_plus^2 + a^2) 750.37334 geometric units squared
Corotating ISCO radius 16.9320101
Displayed inner disk radius 17.2706503
Displayed outer disk radius 29.2706503
Ring singularity display radius 3.6 studs
Outer-horizon polar display radius 13.4354 studs
Outer-horizon equatorial display radius 13.9093 studs
Equatorial ergosurface display radius 14.8432 studs
Equatorial Kretschmann scalar at r0 = 22 6.77369e-6

For the default equatorial photon with b = 18, Q = 0, and r0 = 22:

The initial negative radial derivative means the ray launches inward. Whether it is captured or scatters is then determined by the roots of the radial potential and the numerical integration

Runtime architecture and layer controls

The server owns the parameters, builds the static geometry, calculates the frozen fluid state, traces the photon paths, and fires path samples to the client via remotes.

The client owns:

  • the screen-space parameter editor;
  • animated photon partsd, trails, and lights;
  • arc-length interpolation along server paths;
  • per-player display-layer visibility.

Layer hiding uses LocalTransparencyModifier for parts and local Enabled states for trails, lights, emitters, and billboardguis. Effects are local only

The independently toggleable layers are:

  • horizon shells
  • ergosphere
  • ring singularity
  • accretion disk
  • fluid-velocity arrows
  • magnetic field
  • photon paths
  • animated photon packets
  • warped grid
  • frame-dragging arrows/particles
  • light cones
  • equation boards

The state remains effective when the server regens a layer after a parameter change

Limitations
  • The black hole spacetime is fixed, so matter and radiation do not back react on the metric
  • The accretion model is a static analytic approximation. Its not a time evolved GRMHD grid
  • The warped grid is only an embedding style graphic. Obviously its not an actual picture of 4D curvature
  • Photon packet animation uses Roblox arc length rather than coordinate time or affine time
  • The transfer model is scalar and not frequency-resolved
  • Boyer-Lindquist coordinates become singular at the horizon, so integration is intentionally stopped just outside it
  • Part thickness, angular resolution, and fixed numerical tolerances impose discretization limits

The goal is visual tool that preserves the important Kerr geometry while still running inside of Roblox. Its not meant to be a viable university grade simulation.

Sources

This took me a lot of time to make, as I had to balance it with my personal life. I struggle a lot with looking at plots and charts in textbooks, matplotlib, and other university approved tools because they are hardly interactive.

Roblox – while its pretty laggy when scaled to this measure – gives me a chance to literally see these models from any angle, makes geometry easy to see, and also provides the easiest programming language.

The only downside to using Roblox is the severe lack of graduate level math functions, so I had to manually write my own integration and higher-order differentiation modules. The ability to organize my project like I did was amazing though.

Overall, I think Roblox is a severely underrated tool. I actually plan on using it in future published works of mine.

6 Likes