BLACKHOLE
This was a fun side project for me as I wanted to do more HLSL shaders and I recently rewatched Interstellar so I was inspired to create a mathematically blackhole shader that respects the laws that tie it to together. It accurately simulates how light and matter behave around a black hole. It raymarches through a curved space, bending light paths based on gravitational pull, just like real gravitational lensing. The accretion disk’s motion, density, and lighting are driven by orbital physics, creating realistic banding, rotation, and falloff near the event horizon. Volumetric fog and self-shadowing add depth, showing how light scatters and fades in high-gravity regions. The best part is this is all parametrised in UE5 so we can customise any aspect and the rest will behave accordingly such as a shift in the mass or even the density.
behind the scenes
Some behind the scenes photos and pictures showing how the parametrisation works inside Unreal Engine 5 and also some HLSL code snippets.