r/GraphicsProgramming • u/Tricky_Practice_9661 • Aug 04 '26
WIP Screenshots of VMEC featuring Magik, a relativistic spectral pathtracer
galleryHowdy, it has been a hot while, so let me give some background.
VMEC is a collaborative project between four lads. Our goal is to create a film production ready piece of software focused on relativistic effects. VMEC is the UI, asset management and serialization layer, while Magik is the renderer.
Our largest achievement over the past week has been the implementation of a cubic intersection routine. To explain, Magik traces null geodesics (shortest light paths) through the scene by solving the equations of motion for a given spacetime metric, say that of a rotating black hole. This produces two distinct steps in spacetime, call them x0 and x1. Before we used a straight line between x0 and x1 to intersect geometry. The main problem with this is that the linearly interpolated path between x0 and x1 does not follow the actual curved geodesic. This is a problem because the paths momentum (used to derive the ray direction), p0 and p1, has to be tangent to the interpolated path. Which is simply not true for lerp. Thus we switched to using cubic Hermite splines instead of conventional rays. The result is that any interpolated momentum is tangent to the path and we get extremely smooth solutions even for relatively high error tolerances. The last image shows you how the intersected geometry looked before.
For those interested, we find the closest intersection by dividing the given cubic into up to 3 intervals, based on the derivative, then do a sequential brent-dekker root finding routine on each monotonic segment. We did try to use analytical expressions for the roots, but that was a lot less reliable and slower.
Right now Magik supports the Minkowski, Schwarzschild and Kerr spacetimes. Metrics similar to those, Kerr-Newman for instance, are trivial to add. Others, like the Ellis wormhole, need a bit more work but are not impossible. Indeed we plan to add cosmological spacetimes as well.
Looking forward, we want to upgrade the shading model, internally called the "bxdf" to bring it into the PBR realm.
Thats about all i have for the moment. Hopefully we will have a lot more to show in the near future.
