GravLensX: Neural Rendering for Black Holes
- GravLensX is a neural rendering method that approximates null geodesics in curved spacetime to simulate gravitational lensing around black holes and thin accretion disks.
- It employs MLPs with Fourier positional encoding to map ray initial conditions to positions, reducing computation time by 15x to 26x compared to traditional integration methods.
- The approach splits the domain into near-field and far-field networks, ensuring high-fidelity multi-black-hole visualization while acknowledging limitations in real-time applications and generalization.
GravLensX is a neural rendering method for black holes that approximates null geodesics in curved spacetime and uses those learned trajectories to render gravitational lensing effects around black holes with optically thin accretion disks. Rather than numerically integrating the geodesic ODE for every ray during rendering, it trains neural networks to map ray initial conditions and affine parameter to ray position, then queries those learned maps during inference. The method is demonstrated on multiple black hole systems with a superposed Kerr metric and is reported to achieve about reduced computational time for full rendering and about for sky-sphere-only rendering while preserving good visual fidelity (Sun et al., 21 Jul 2025).
1. Problem setting and scope
GravLensX addresses the dominant computational bottleneck in general-relativistic black-hole rendering: repeated null-geodesic integration through a metric tensor field. In the baseline formulation, each camera ray requires repeated evaluation of the metric , its derivatives, Christoffel symbols, and numerical integration of the geodesic equations. The paper frames this as especially expensive for rotating black holes, multiple black holes, and scenes requiring many rays, such as volume rendering (Sun et al., 21 Jul 2025).
The method is defined for scenes containing one or more black holes, optically thin accretion disks, and a sky sphere. The spacetime is modeled with the Kerr metric for single rotating black holes and with a superposed Kerr metric approximation for two-black-hole and three-black-hole scenes. Rays terminate when they either cross an inner boundary representing capture by a black hole or reach the sky sphere. The authors explicitly state that the accretion disk is treated as a “simple thin texture,” rather than with full relativistic radiative transfer, absorption, scattering, polarization, or Faraday rotation (Sun et al., 21 Jul 2025).
This design places GravLensX in a distinct category within gravitational-lensing computation. It is a rendering-oriented surrogate model for null-geodesic propagation in strong-field general relativity, rather than a thin-lens cosmology or image-inference package.
2. Geometric and relativistic formulation
The physical core of GravLensX is the null-geodesic equation in curved spacetime. Light rays are constrained by
and evolve according to
The Christoffel symbols are written as
For the Kerr spacetime in Cartesian coordinates, the paper gives the metric in Kerr–Schild form as
with
For multiple black holes, the implementation uses a superposed metric of the form
The learned target is not the metric itself but the geodesic map
where 0 is the initial spatial position, 1 the initial spatial direction, and 2 an affine parameter. A crucial implementation choice is that the spatial ray velocity is normalized at every step so that the spatial speed with respect to 3 is 4. This makes affine-parameter increments correspond directly to distance traveled in space, which simplifies rendering and sampling (Sun et al., 21 Jul 2025).
3. Neural representation of null geodesics
GravLensX approximates the geodesic map with an MLP,
5
where 6 is a Fourier positional encoding,
7
The encoding is introduced because the dependence of ray position on initial conditions is smooth for small 8 but can become highly nonlinear for large 9, especially near strong-lensing regions.
A single global network was reported to perform poorly, so the domain is split into multiple neural fields: one near-field network per black hole and one far-field network. The near-field regions are spherical neighborhoods around each black hole, while the far field is the region inside the sky sphere but outside the near-field interiors, with a small overlap margin. This decomposition reflects the paper’s empirical conclusion that geodesics are substantially harder to approximate near black holes than in the far field (Sun et al., 21 Jul 2025).
Training uses both position and velocity supervision. The position loss is
0
the velocity loss is
1
and the total loss is
2
The networks have 12 hidden layers with residual connections and SoftPlus activations. The near-field networks use 200 neurons per layer; the far-field network uses 128 neurons per layer in the two-black-hole system and 200 in the three-black-hole system. Training data are generated by a classical Euler geodesic solver, and the reported dataset size is 14,400,000 rays from each region. Optimization uses Adam with learning rate 3 (Sun et al., 21 Jul 2025).
4. Rendering pipeline and system design
The pipeline begins by specifying black hole positions, masses, spin parameters, inner capture boundaries, and outer sky-sphere radius. For the two-black-hole scene, the paper uses positions 4 and 5, masses 6, spins 7, 8, 9, and in-black-hole radius 0. For the three-black-hole scene, it uses positions 1, 2, and 3, masses 4, spins 5, 6, 7, and in-black-hole radius 8. The computations are performed in geometric units with
9
Classical training data are generated with Euler integration rather than RK4, because the authors state that RK4 did not outperform Euler at equal step size in their implementation while costing more time. Once trained, the renderer identifies ray segments by region, advances them to the next relevant boundary, and evaluates the appropriate near-field or far-field MLP for each segment. Disk intersections are then found by a coarse-to-fine search: uniformly sample 0 points on each near-field segment, test neighboring sample pairs for disk crossings, then refine with 1 samples where needed. During inference, velocity is computed by finite differences rather than autodiff for speed (Sun et al., 21 Jul 2025).
The rendering step uses front-to-back compositing,
2
The implementation uses Taichi and PyTorch. The reported training hardware is four RTX 3090 GPUs for the far-field network and one RTX 3090 GPU for each near-field network. The approximate training cost is 13.8 GPU hours per near-field network and 33.5 GPU hours for the far-field network (Sun et al., 21 Jul 2025).
In methodological terms, GravLensX differs sharply from thin-lens multiple-plane ray-tracing systems such as GLAMER, which project matter onto discrete lens planes and use inverse ray-shooting through a cosmological light cone (Petkova et al., 2013), and from semi-analytic strong-lensing generators such as MOKA, which synthesize cluster lenses from analytic halo components calibrated on simulations (Giocoli et al., 2011). GravLensX instead learns strong-field null-geodesic propagation directly in black-hole spacetimes.
5. Empirical evaluation
The quantitative evaluation is carried out on 3 images for two-black-hole and three-black-hole scenes, with separate measurements for accretion-disk-only, sky-sphere-only, and combined rendering. The paper reports PSNR and LPIPS for each setting (Sun et al., 21 Jul 2025).
| Configuration | PSNR | LPIPS |
|---|---|---|
| 2 BH, accretion disk + sky sphere | 19.47 | 0.168 |
| 2 BH, sky sphere only | 24.65 | 0.161 |
| 2 BH, accretion disk only | 20.12 | 0.057 |
| 3 BH, accretion disk + sky sphere | 20.52 | 0.143 |
| 3 BH, sky sphere only | 24.98 | 0.133 |
| 3 BH, accretion disk only | 21.70 | 0.042 |
The speed results reported in the paper are the main practical motivation for the method. Full rendering is about 4 faster on average than the Euler-based baseline, while sky-sphere-only rendering is about 5 faster. The speed advantage increases as the camera gets farther from the center because long-distance ray integration is expensive in conventional methods but relatively cheap under neural querying. In an appendix comparison for a single Kerr black hole, GravLensX running on one RTX 3090 is reported to be roughly 6 to 7 faster than kgeo on 16 Xeon Gold 5218 CPU processes, while the paper emphasizes that kgeo’s analytic method is not applicable to the multi-black-hole superposed-Kerr setting (Sun et al., 21 Jul 2025).
Qualitatively, the authors state that the rendered black holes exhibit high-fidelity shadows, visible accretion disks, and strong gravitational-lensing effects, with separate disk-only and sky-sphere-only renders “almost indistinguishable to the naked eye” from Euler ground truth. They also report that the far-field networks converge faster than the near-field networks, which is consistent with the lower geometric complexity of far-field trajectories (Sun et al., 21 Jul 2025).
6. Position within gravitational-lensing research and limitations
GravLensX occupies a different niche from mainstream strong-lensing software. JAXtronomy is a JAX-based reimplementation of lenstronomy intended to preserve an identical API while accelerating strong-lensing simulation and modeling with JIT compilation, autodiff, and GPU execution (Huang et al., 1 Jun 2026). GIGA-Lens is a gradient-informed, GPU-accelerated Bayesian framework for strong gravitational lens modeling that combines multi-start gradient descent, variational inference, and HMC for posterior inference (Gu et al., 2022). Lenstool-HPC is a high-performance implementation of cluster-scale strong-lens map generation and fit evaluation using CPU, GPU, and hybrid execution (Schäfer et al., 2020). By contrast, GravLensX is not a thin-lens inference package, a cosmological light-cone simulator, or a survey-scale Bayesian modeling framework. It is a scene-specific neural surrogate for rendering null geodesics in black-hole spacetimes.
The paper is explicit about its limitations. GravLensX does not achieve real-time rendering. Training is expensive, requiring tens of GPU hours per network and scaling linearly with the number of black holes. The multi-black-hole spacetime is based on a superposed Kerr metric, which the paper describes as an approximation rather than an exact solution of Einstein’s equations. The accretion disk is not modeled with detailed optical or geometric physics. Errors accumulate when rays traverse multiple regions, reducing PSNR through pixel misalignment. The near-field networks are harder to train, particularly for long spiraling trajectories near black holes. The model is trained per scene and is not shown to generalize across masses, spins, or black-hole configurations. The paper also provides no explicit uncertainty estimate or failure-detection mechanism for inaccurate MLP predictions (Sun et al., 21 Jul 2025).
These constraints imply a specific domain of use. GravLensX is well suited when a fixed spacetime configuration must be rendered many times and approximate but visually faithful general-relativistic lensing is acceptable. A plausible implication is that it is most valuable as a reusable surrogate for astronomical visualization and exploratory rendering, rather than as a replacement for exact geodesic solvers in precision strong-field astrophysics.