Fact-checked by Grok 2 weeks ago

Ray marching

Ray marching is a rendering in that estimates intersections between rays and implicit surfaces by iteratively advancing the ray in discrete steps, sampling a to determine safe step sizes and detect surface crossings without explicit geometric representations. This approach is particularly suited for scenes defined by signed (SDFs), where the at a point indicates the shortest to the nearest surface, enabling efficient traversal that skips empty space and converges to intersections. A foundational variant, known as sphere tracing, was introduced by John C. Hart in 1996 as a geometric for antialiased ray tracing of implicit surfaces, marching rays using bounded distances to avoid penetration and support robust rendering of complex, non-smooth geometries. Unlike traditional ray tracing, which solves intersection equations analytically for polygonal or parametric surfaces, ray marching relies on numerical iteration, making it ideal for procedural, volumetric, or amorphous objects where closed-form solutions are unavailable or inefficient. It excels in GPU-accelerated real-time applications, such as shader-based procedural generation in games and visual effects, by representing entire scenes compactly within fragment shaders. Key advantages include simplicity in modeling organic or fractal-like structures via mathematical functions and the ability to handle deformations or constructive solid geometry (CSG) operations directly on SDFs. In modern contexts, ray marching has evolved with neural representations, where deep learning models approximate SDFs for high-fidelity novel view synthesis and reconstruction from images, often combined with volumetric rendering techniques to optimize for photorealism and efficiency. Applications span volume rendering for medical imaging and scientific visualization to immersive graphics in virtual reality, though challenges like step count limitations and aliasing persist, addressed through adaptive stepping or hybrid methods. Overall, ray marching democratizes advanced rendering by leveraging implicit functions for expressive, compute-bound scene description.

Fundamentals

Definition and Principles

Ray marching is a rendering technique used in to approximate the intersection of rays with implicit surfaces or volumetric data by advancing rays in discrete steps along their path, rather than computing exact analytic intersections. This method is particularly suited for geometries defined procedurally or through distance functions, where closed-form solutions are unavailable or computationally prohibitive. In contrast to traditional ray tracing, which solves or higher-order equations for precise hit points, ray marching iteratively samples the , making it an efficient approximation for complex, non-algebraic shapes. The core of ray marching involves a that propagates a from its in the direction of travel, using a estimate to determine the step size at each . Step sizes are typically derived from a signed field (), which provides the minimum from the current point to the nearest surface, ensuring safe advancement without overshooting intersections. The process terminates when the ray position is sufficiently close to the surface (within a small threshold) or exceeds a maximum . A basic outline for surface intersection is as follows:
function march(ray_origin, ray_direction, max_dist, [epsilon](/page/Epsilon)):
    t = 0.0  // current [distance](/page/Distance) along [ray](/page/Ray)
    while t < max_dist:
        pos = ray_origin + t * ray_direction
        dist = distance_function(pos)  // e.g., from SDF
        if dist < [epsilon](/page/Epsilon):
            return t  // intersection found
        t += dist  // advance by safe step
    return no_intersection
This loop guarantees progress toward the surface while bounding the computational cost, though the specific implementation, such as sphere tracing, refines the stepping for antialiasing and efficiency. One key advantage of ray marching is its ability to handle intricate, non-intersectable geometries, such as fractals or procedural models, without requiring explicit mesh generation or storage, enabling real-time rendering of infinite detail in applications like scientific visualization. However, it can introduce artifacts from undersampling, including missed thin features or incorrect topology if step sizes are too coarse, necessitating careful tuning of parameters for accuracy. The origins of ray marching trace to the late 1980s in the context of volume rendering and implicit surfaces, with an early formulation appearing in the 1989 SIGGRAPH paper "Hypertexture" by Ken Perlin and Eric M. Hoffert, which applied iterative ray stepping to accumulate density in procedural volumes for phenomena like clouds and fur. The technique gained prominence for surface rendering in the 1990s, notably through John C. Hart's 1995 work on sphere tracing, which formalized distance-based marching for antialiased implicit surfaces in computer-aided design.

Signed Distance Fields

Signed distance fields (SDFs) provide a compact implicit representation of geometric shapes in computer graphics, particularly suited for ray marching due to their ability to encode spatial relationships efficiently. An SDF is defined as a continuous scalar function f: \mathbb{R}^n \to \mathbb{R} that, for any point \mathbf{p} in n-dimensional space (typically n=2 or $3), returns the signed minimum Euclidean distance from \mathbf{p} to the nearest point on the surface of the represented shape. The sign of this value indicates the position relative to the surface: positive for points outside the shape, negative for points inside, and exactly zero on the surface itself. This signed nature allows SDFs to distinguish interior and exterior regions, enabling robust handling of solid geometries without explicit boundary storage. A key mathematical property of true SDFs is their Lipschitz continuity with constant 1, expressed as |f(\mathbf{p}) - f(\mathbf{q})| \leq \|\mathbf{p} - \mathbf{q}\| for all points \mathbf{p}, \mathbf{q}. This condition ensures that the function gradient has magnitude at most 1 almost everywhere, satisfying the eikonal equation \|\nabla f(\mathbf{p})\| = 1 away from the surface, which guarantees that the returned value is a conservative estimate of the actual distance. Such properties prevent overstepping in traversal algorithms, as the difference in function values bounds the possible change in distance over any displacement. SDFs for basic primitive shapes are constructed analytically using closed-form distance formulas. For example, the SDF of a sphere centered at \mathbf{c} with radius r is given by f(\mathbf{p}) = \|\mathbf{p} - \mathbf{c}\| - r, where \|\cdot\| denotes the Euclidean norm; similar explicit formulas exist for other primitives like boxes, cylinders, and tori. More complex shapes are built via constructive solid geometry (CSG) operations on these primitives, which combine SDFs using simple pointwise functions: the union of two shapes is f_1 \cup f_2 = \min(f_1, f_2), the intersection is f_1 \cap f_2 = \max(f_1, f_2), and the difference (subtraction) is f_1 \setminus f_2 = \max(f_1, -f_2). These operations are closed under the distance property when the inputs are exact SDFs, though in practice, they often yield lower bounds that remain safe for applications like ray marching. In practice, SDFs are applied to generate 2D fields for curve rendering or 3D fields for volumetric shapes, including procedural geometries such as fractals. For instance, the 3D employs an iteratively estimated SDF derived from power-2 iterations in spherical coordinates to represent its intricate bulbous structure. Regarding error bounds, the Lipschitz condition of SDFs ensures conservative stepping: advancing along a ray by exactly the SDF value at the current point guarantees that no surface intersection is skipped, as any closer feature would violate the distance bound; this may lead to slightly larger steps near the surface but maintains topological correctness without undershooting. In the context of ray marching, the SDF value directly informs the step size in the traversal loop, while extensions to unsigned or density fields support volumetric rendering without signed surfaces.

Distance-based Algorithms

Sphere Tracing

Sphere tracing is a distance-guided variant of ray marching specifically designed for rendering implicit surfaces defined by signed distance fields (SDFs). Introduced by John C. Hart, the method advances a ray along its direction by placing a sphere at the current position with radius equal to the SDF value at that point, ensuring the next step does not overshoot or miss surface intersections. This conservative stepping leverages the geometric properties of the SDF to guarantee convergence to the nearest intersection point. The algorithm proceeds iteratively as follows: starting from the ray origin and initial parameter t = 0, compute the position p = \text{origin} + t \cdot \text{dir}, where \text{dir} is the normalized ray direction. The step size is then set to the SDF value at p, denoted d = \text{[SDF](/page/SDF)}(p), and t is updated by t \leftarrow t + d. This process repeats until d < \epsilon, where \epsilon is a small positive threshold (typically on the order of 0.001 times the scene scale) to account for numerical precision and terminate near the surface. The method provides conservative guarantees for intersection safety when the SDF satisfies the Lipschitz condition with constant 1, meaning the distance function does not change faster than the Euclidean distance (i.e., |\text{SDF}(x) - \text{SDF}(y)| \leq \|x - y\|). Under this condition, advancing by at most h \leq \text{SDF}(p) ensures the ray cannot jump over the surface, as the sphere of radius \text{SDF}(p) centered at p is guaranteed to be empty of intersections. A proof sketch involves showing that if the ray intersects the surface at some t^* > t, then \text{SDF}(p) \geq t^* - t, preventing penetration; the sequence of t_i is monotonically increasing and bounded above by t^*, hence converges to it. In scenes where the SDF violates the Lipschitz condition (e.g., due to non-smooth or approximations), overstepping artifacts can occur, leading to missed intersections or tunneling. Mitigation typically involves tuning \epsilon smaller to detect closer to or conservatively scaling steps by a factor less than 1, though this increases and computational cost.

Grid-accelerated Ray Marching

Grid-accelerated ray marching is an acceleration technique for rendering implicit surfaces defined by signed distance fields (s), where the distance field is voxelized into a uniform 3D . Each stores the minimum distance to the nearest surface within its bounds, providing a conservative lower bound for safe stepping during traversal. This precomputation allows the ray to skip large portions of empty space by querying the voxel's minimum value instead of evaluating the full at every point, significantly reducing computational cost in sparse environments. The is typically constructed by sampling the at multiple points per and taking the minimum value, ensuring the bound is tight enough for while remaining conservative to avoid missing intersections. The traversal begins with a , such as the Digital Differential Analyzer (DDA), which efficiently computes the sequence of voxels intersected by the ray through incremental updates to the ray position and direction components. Upon entering a voxel, the ray steps forward by a determined by the stored minimum in that voxel, often using a formula like h = \min(d_{\min} + \epsilon, \text{distance to voxel boundary}) where d_{\min} is the minimum distance in the current and \epsilon is a small positive to prevent overshooting due to numerical . If the step would exit the current , a diagonal traversal adjustment may be applied to advance to the next relevant boundary. Once the is sufficiently close to (e.g., within a ), a finer evaluation or analytic intersection within the voxel refines the hit point. This hybrid approach combines discrete grid skipping with continuous for robustness. Compared to pure sphere tracing, grid-accelerated ray marching offers substantial speedups in sparse scenes by leveraging the to avoid redundant SDF queries in vast empty regions. Recent studies show speedups of 2–5× over pure sphere tracing depending on scene complexity and . However, the technique introduces memory overhead proportional to the (e.g., a 128^3 storing a single float per requires about 8 MB), and low- can cause or popping artifacts at voxel boundaries due to abrupt changes in step sizes.

Volumetric Techniques

Basic Volumetric Ray Marching

Basic volumetric ray marching adapts the ray marching technique to render participating media by integrating along rays through volumes, rather than seeking surface intersections. This involves sampling and emission color at intervals along the path, then accumulating and contributions according to the Beer-Lambert law, which describes exponential attenuation of light due to and in the medium. The method enables visualization of effects like , , and clouds by treating the volume as a continuous field of varying opacity and color. The roots of volumetric ray marching trace to early volume rendering techniques in the 1980s, such as Marc Levoy's 1988 work on displaying surfaces from sampled volume data using and splatting to composite contributions along rays. This approach was adapted in the for implicit volumes, incorporating step-wise integration to handle procedural or analytically defined density fields without explicit grids, as seen in extensions of ray tracing for implicit surfaces. The core accumulation follows the volume rendering equation for emission and absorption, approximated discretely: C = \int_{0}^{d} \sigma_t(s) \, c(s) \, \exp\left( -\int_{0}^{s} \sigma_t(u) \, du \right) ds where C is the outgoing radiance, \sigma_t(s) is the (density), c(s) is the color, and d is the ray length. In practice, this integral is approximated by marching the ray in steps of size \Delta t, either fixed or adaptive, sampling \sigma_t and c at each point s_i = i \Delta t, and updating accumulated color C and transmittance T iteratively: C \leftarrow C + T \cdot \sigma_t(s_i) \, c(s_i) \, \Delta t, \quad T \leftarrow T \cdot \exp(-\sigma_t(s_i) \, \Delta t). This front-to-back compositing accumulates contributions from near to far, allowing early termination when T falls below a threshold for efficiency. Sampling strategies influence accuracy and performance; uniform steps with fixed \Delta t are simple but can lead to over- or under-sampling in varying densities. For media with high opacity, importance sampling based on transmittance can reduce wasted samples by biasing toward optically thin areas, particularly in homogeneous media using an exponential distribution. Jittering sample positions randomly within each step further mitigates discretization errors. Common artifacts include banding, arising from regularly spaced uniform samples that create visible slicing in low-density regions, and noise from undersampling high-frequency details or sparse rays. These can be alleviated by increasing step count or using -based jittering, though at higher computational cost.

Density-based Variations

Density-based variations of volumetric ray marching utilize unsigned density functions to represent participating media, where the extinction coefficient \sigma_t(\mathbf{p}) at a point \mathbf{p} quantifies the medium's opacity due to both and per unit length. Unlike signed distance fields for surfaces, these densities are non-negative and spatially varying, allowing for smooth gradients in media like or clouds. During ray marching, the \tau along a ray from origin \mathbf{o} in direction \mathbf{d} up to distance t is approximated by numerically integrating \tau(\mathbf{o}, \mathbf{d}, t) = \int_0^t \sigma_t(\mathbf{o} + s \mathbf{d}) \, ds, typically via trapezoidal over discrete steps to compute T = e^{-\tau}. This enables realistic of light through the volume. To account for light redirection within the medium, these techniques extend the accumulation loop with in-scattering contributions, where incoming radiance from direction \mathbf{\omega}_i is weighted by the phase function P(\theta), with \theta between \mathbf{\omega}_i and the ray direction \mathbf{\omega}_o. The phase function models anisotropic patterns observed in natural media, such as forward-peaking in clouds. A seminal and widely adopted model is the Henyey-Greenstein phase function, P(\theta) = \frac{1 - g^2}{4\pi (1 + g^2 - 2g \cos\theta)^{3/2}}, parameterized by the asymmetry factor g \in [-1, 1], where g > 0 favors forward scattering and g < 0 backward scattering; g = 0 yields isotropic behavior. This function is analytically invertible for efficient importance sampling during Monte Carlo integration. Approximating multiple scattering in density-based marching often limits to single scattering for efficiency, computing direct in-scattering from light sources along the primary ray while ignoring re-scattered light. Higher-order effects, essential for dense media like milk or skin, can be approximated via iterative marching: after a scattering event, a secondary ray is spawned in the sampled direction, with its contribution back-propagated and accumulated in subsequent primary ray steps. Full multiple scattering requires unbiased volumetric path tracing, but iterative approximations balance realism and performance in real-time contexts. For efficient traversal of sparse density fields, where low-density regions represent near-empty space, variants employ hierarchical acceleration structures to skip segments with negligible extinction, reducing sample counts while preserving accuracy. Modern developments in density-based ray marching are comprehensively detailed in Pharr et al.'s fourth edition of Physically Based Rendering (2023), particularly in chapters on volume scattering and rendering equations, which integrate these techniques into production path tracers supporting both single- and multiple-scattering models for photorealistic media simulation. Recent advances as of 2025 include Gaussian-based ray marching for accelerated real-time volumetric rendering, incorporating empty-space skipping and adaptive sampling.

Pipeline Integrations

Deferred Shading

In deferred shading pipelines, ray marching integrates by leveraging the geometry pass to populate G-buffers with depth, normals, and material properties, followed by a shading pass where rays are marched from screen-space pixel positions using the stored data to compute effects like ambient occlusion, shadows, and reflections. This separation allows complex lighting and visibility computations without re-rasterizing geometry, enabling efficient handling of dynamic scenes. Ray origins are derived in screen space from the G-buffer's depth and position reconstruction, with directions computed from view vectors and surface normals; step sizes are determined by querying signed distance fields (SDFs) stored in volume textures, allowing safe traversal without missing intersections. For reflections, a secondary ray is traced from the surface point along the , typically formulated as \mathbf{r}(t) = \mathbf{p} + t \cdot \mathbf{d}, where \mathbf{p} is the pixel's world position, t is the parameter scaled by SDF distances, and \mathbf{d} = \text{reflect}(-\mathbf{v}, \mathbf{n}) with \mathbf{v} as the view direction and \mathbf{n} the normal; intersections are evaluated via SDF sampling during . This approach supports multi-bounce effects by iteratively querying the for occlusion or color sampling. The primary benefits include decoupling geometry complexity from effect computation, yielding soft shadows and occlusions independent of triangle counts, as demonstrated in Unreal Engine integrations from the 2010s, such as the UE3-based 2011 Samaritan demo and the 2015 Kite demo in UE4, using SDF ray marching for reflection shadowing. Performance scales with volume resolution rather than scene geometry, achieving real-time rates on consumer hardware (e.g., 0.1ms for culling 2 million instances to 50,000 on PS4). Challenges arise from the limited resolution of screen-space origins and SDF volumes, potentially causing inaccuracies near surfaces or in sparse regions, which can introduce aliasing; mitigation often involves temporal reprojection across frames to accumulate samples and reduce noise, alongside clipmap hierarchies for finer detail.

Screen-space Ray Marching

Screen-space ray marching is an efficient approximation technique for ray tracing effects that operates entirely within 2D screen coordinates, leveraging the depth buffer from a deferred shading pipeline to reconstruct 3D positions along the ray path. This approach avoids full 3D world-space computations by marching rays in UV (texture coordinate) space, unprojecting sample points to world space using the stored depth values, and checking for intersections against the scene geometry encoded in the depth buffer. It is particularly suited for real-time applications like reflections, shadows, and ambient occlusion, where full ray tracing would be too costly, as it exploits the perspective projection to linearize ray steps in screen space. The algorithm begins by initializing a ray origin at the current pixel's position, derived from the camera's view and the pixel's depth. The ray direction is computed in screen space, often as a reflection or shadow vector projected onto the UV plane. For each marching step, the UV coordinates are advanced by a fixed or adaptive increment: \Delta u = t \cdot \frac{\mathrm{dir}_{uv}}{f}, where t is the step distance in world space, \mathrm{dir}_{uv} is the normalized direction in UV space, and f is the focal length of the projection (derived from the field of view). This scaling ensures perspective-correct progression, with larger steps near the horizon to account for increasing pixel coverage in 3D space. At each sample point, the world position is reconstructed via unprojection: \mathbf{P} = \mathrm{unproject}(uv, z_{\mathrm{buffer}}), where z_{\mathrm{buffer}} is the depth value at the sampled UV, and unprojection inverts the view-projection matrix to obtain Cartesian coordinates. An intersection is detected if the marched ray's z-depth falls within an epsilon threshold of the buffer's depth: |z_{\mathrm{marched}} - z_{\mathrm{buffer}}| < \epsilon, typically with \epsilon on the order of 0.01 to 0.1 world units to tolerate precision errors. If no hit is found after a maximum number of steps (e.g., 16-32), the ray terminates without intersection. This technique was introduced in 2011 by Tiago Sousa at Crytek, initially for screen-space reflections and self-shadowing in the CryENGINE 3 pipeline, marking a shift from simple sampling-based methods to iterative marching for more robust occlusion handling. Common optimizations include binary search refinement along the final step to precisely locate the hit point, reducing aliasing by bisecting the interval between the last non-intersecting and first intersecting samples. Additionally, stride-based stepping (sampling every N pixels) with temporal jitter mitigates banding artifacts while improving performance by up to 4x on modern GPUs. However, the method suffers from view-dependent artifacts, such as missing intersections for geometry outside the current frustum or behind the camera, leading to incomplete effects like "leaking" reflections on edges. These limitations necessitate hybrid approaches, such as fallback to cubemaps for missed rays.

Applications

Procedural Rendering

Ray marching enables the rendering of procedural geometry by evaluating signed distance fields (SDFs) directly in shaders, allowing for the construction of complex, non-polygonal shapes without traditional mesh generation. Basic primitives such as spheres, boxes, and cylinders can be combined using operations that mimic constructive solid geometry (CSG), including unions via the minimum function, intersections via the maximum, and differences via subtraction of SDF values, to form intricate models. These combinations extend to deformations like twisting and bending, where primitives are transformed through mathematical mappings—such as rotating coordinates around an axis for twisting or applying sinusoidal offsets for bending—before evaluating the distance function, enabling dynamic, parametric modeling of organic or architectural forms. A prominent application involves fractal geometry through distance-estimated iterated function systems (DE-IFS), which generate self-similar structures by iteratively applying transformations while estimating distances for efficient ray marching. The , a 3D discovered in 2010, exemplifies this approach, where points are iterated via a folding operation that and inverts coordinates within a cubic boundary to produce bounded, intricate surfaces. The iteration proceeds as \mathbf{p}_{n+1} = \text{fold}(\mathbf{p}_n), with the fold function typically defined as first the point, then applying inversions when it exceeds box limits (e.g., if |x| > 1, set x = 2 - x for the positive side), followed by a power-2 to create the fractal repetition. Distance estimation in DE-IFS approximates the surface proximity by the norm after iterations, allowing sphere tracing variants to march rays conservatively toward the fractal boundary. Infinite terrains represent another procedural domain, where ray marching adapts steps based on heightfields derived from noise functions to simulate vast, detailed landscapes without explicit geometry. Heightfield marching evaluates a scalar height function h(x, z) along the ray, advancing by the minimum of the ray's vertical progress and the estimated terrain slope, often using Perlin or Simplex noise for natural variations in elevation. Perlin noise, generated via layered gradient interpolations, provides coherent, continuous heights that prevent aliasing during marching, with step sizes dynamically adjusted to the noise's Lipschitz constant for accuracy. This method supports unbounded worlds by procedurally sampling noise at arbitrary positions, enabling seamless exploration of procedural environments like mountains or oceans. The popularization of SDF-based procedural rendering in real-time contexts traces to Inigo Quilez's shader demonstrations from 2007 to 2010, which showcased GLSL implementations of fractal terrains and deformed primitives, influencing GPU-based graphics in tools like Shadertoy. These works highlighted ray marching's efficiency for infinite, mathematical scenes, bridging demoscene artistry with practical shader programming. Shading in procedural ray marching often derives surface normals directly from the SDF gradient at intersection points, computed numerically as the normalized difference of distances along perturbation axes: \mathbf{n} = \normalize\left( \nabla \text{SDF}(\mathbf{p}) \right) = \frac{ \left( \text{SDF}(\mathbf{p} + h \mathbf{x}) - \text{SDF}(\mathbf{p} - h \mathbf{x}), \ \text{SDF}(\mathbf{p} + h \mathbf{y}) - \text{SDF}(\mathbf{p} + h \mathbf{y}), \ \text{SDF}(\mathbf{p} + h \mathbf{z}) - \text{SDF}(\mathbf{p} + h \mathbf{z}) \right) }{2h} where h is a small epsilon (typically $0.001). This approximation enables Phong or physically-based lighting without precomputed geometry, enhancing the realism of procedurally generated surfaces.

Real-time Graphics Effects

Ray marching has become a staple in graphics for rendering complex effects that traditional rasterization struggles with, leveraging GPU compute capabilities to simulate through volumes or signed distance fields (SDFs) at interactive frame rates. In modern game engines and pipelines, it enables phenomena such as volumetric fog, god rays, and without requiring precomputed , allowing dynamic environmental interactions. This approach is particularly suited to deferred rendering setups where ray marching occurs in screen-space or compute passes, balancing visual fidelity with performance constraints typical of 60 targets on consumer hardware. Shader integration of ray marching primarily occurs in fragment or compute shaders using languages like GLSL or HLSL, where developers implement iterative distance evaluations to trace rays from the camera or light sources. For instance, in GLSL fragment programs, god rays—simulating crepuscular beams through scattering media—are achieved by marching rays from centers toward the light position, accumulating based on sampled values along the path. A simplified GLSL snippet for such an effect might initialize a ray direction and step through the volume:
glsl
vec3 rayDir = normalize(worldPos - lightPos);
float t = 0.0;
for(int i = 0; i < maxSteps; i++) {
    vec3 pos = lightPos + rayDir * t;
    float density = sampleVolumeDensity(pos);
    if(density > threshold) transmittance *= exp(-density * stepSize);
    t += stepSize;
    if(t > maxDist) break;
}
This code, adapted from common implementations, highlights the loop-based marching core, with early termination to avoid over-sampling empty space. Similarly, water caustics in water use ray marching to propagate light rays through refractive surfaces, bending them via SDF perturbations for patterns on submerged objects. Hardware considerations for ray marching emphasize GPU parallelism, as the technique distributes ray evaluations across thousands of shader invocations, exploiting SIMD architectures in modern GPUs like NVIDIA's Turing or AMD's RDNA series. In with SPIR-V, ray marching for evaluation is compiled into compute shaders that leverage descriptor sets for efficient texture sampling of distance fields, enabling scalable parallelism for effects in large scenes. This integration allows -based engines to handle ray marching in parallel pipelines, reducing synchronization overhead compared to older fixed-function paths. Optimizations are crucial for maintaining performance, with adaptive stepping adjusting march distances based on local SDF gradients to skip empty regions—reducing average steps per ray from 100 to under 20 in sparse volumes. Early ray termination checks for intersections or opacity thresholds, halting computation once a sufficient contribution is accumulated, which is vital for effects like where full ray extents are unnecessary. Level-of-detail () techniques further enhance efficiency by using coarser SDF resolutions for distant objects, preserving detail near the viewer while minimizing fill-rate demands. In the 2020s, ray marching powers advanced effects in engines like Unity's High Definition Render Pipeline (HDRP), where it renders volumetric clouds by marching through noise-based density fields to simulate scattering and absorption, achieving 60 FPS at 1080p on mid-range GPUs with temporal accumulation over frames. For example, Unreal Engine 5's Lumen system employs ray marching for real-time global illumination, complementing Nanite's geometry virtualization for advanced scene rendering, including terrain effects. As of 2025, ray marching supports advanced volumetric effects in games like Assassin's Creed Shadows for realistic lighting and scattering, and is integrated with neural methods for efficient novel view synthesis in AR/VR applications. Despite these advances, ray marching faces limitations in real-time contexts, primarily fill-rate bottlenecks from high iteration counts overwhelming shaders on bandwidth-limited . Post-2015 GPU developments, such as NVIDIA's RT cores, have begun hybridizing ray marching with hardware-accelerated ray tracing, using marching for volumetric components while RT cores handle primary visibility, though full adoption remains limited by shader complexity. Screen-space variants briefly reference by marching in depth buffers for local shadowing.

References

  1. [1]
    Ray Marching - The Graphics Codex
    The simplest form of ray marching begins at the ray origin and samples the implicit surface at regular intervals, terminating when the function crosses zero.Intersection AlgorithmsGPU... · Marching · Sphere Tracing · - GLSL Ray Setup
  2. [2]
    Chapter 34. Signed Distance Fields Using Single-Pass GPU Scan ...
    In this chapter we address the practicalities in computing a signed distance field. We present a method that accelerates the computation by using graphics ...34.1. 1 Overview Of Signed... · 34.2 Leaking Artifacts In... · 34.3 Our Tetrahedra Gpu Scan...<|separator|>
  3. [3]
    [PDF] A Geometric Method for the Antialiased Ray Tracing of Implicit ...
    Jul 28, 2015 · Sphere tracing is a new technique for rendering implicit surfaces using geometric distance. Distance-based models are common in ...
  4. [4]
    [PDF] GPU Ray Marching of Distance Fields - DTU
    In computer graphics in order to visualize a surface one needs, first of all, to define its representation and based on that how the rendering process will be.
  5. [5]
    Constructive Solid Geometry on Neural Signed Distance Fields
    Dec 12, 2023 · ... signed distance function. Our method is based on the closest point ... ray marching will still converge to a correct result as the ...2 Related Work · 3 Pseudo-Sdfs · 5 Loss Functions For Neural...
  6. [6]
    [PDF] SDF-3DGAN: A 3D Object Generative Method Based on Implicit ...
    Mar 13, 2023 · The zero-level set of a signed distance function is the surface of an object. ... procedure after ray marching. We denote such two points.
  7. [7]
    The Ray-Marching Algorithm - Volume Rendering
    1. Find the value for t0 and t1, the points where the camera/eye ray enters and leaves the volume object. · 2. Divide the segment defined by t0-t1 into X number ...Missing: computer graphics
  8. [8]
    Ray Marching - The Graphics Codex
    Ray marching is an algorithm for numerical estimation of arbitrary ray-surface intersections. It works for arbitrary implicit surfaces.
  9. [9]
    [PDF] 3D Distance Fields: A Survey of Techniques and Applications
    The distance field has been found to be a useful construction within the areas of Computer Vision, Physics and Computer Graphics. This paper serves as a timely ...
  10. [10]
    [PDF] Designing with Distance Fields
    This overview reviews pre- vious work in distance fields, discusses the properties and advantages of distance fields that make them suitable for digital design, ...Missing: construction | Show results with:construction
  11. [11]
    [PDF] Efficiency of 3D Fractal Generation Through Raymarching
    The basic advantage of raymarching is saving the memory needed to store data about the fractal model. All necessary output is calculated on the fly, all is ...<|control11|><|separator|>
  12. [12]
    a geometric method for the antialiased ray tracing of implicit surfaces
    Hart, J. Sphere tracing: a geometric method for the antialiased ray tracing of implicit surfaces. The Visual Computer 12, 527–545 (1996).
  13. [13]
    Raymarching Distance Fields - Inigo Quilez
    Raymarching SDFs (Signed Distance Fields) is slowly getting popular, because it's a simple, elegant and powerful way to represent 3D objects and even render 3D ...
  14. [14]
    [PDF] Rendering Worlds with Two Triangles with raytracing on the GPU in ...
    The trick is to be able to compute or estimate (a lower bound of) the distance to the closest surface at any point in space. • This allows for marching in large ...Missing: grid acceleration
  15. [15]
    [PDF] Volumetric Scattering - CSE 168: Rendering Algorithms
    Ray Marching. • As a ray passes through a volume, we need to accumulate the changes in radiance along the ray due to emission, absorption, out- scattering ...
  16. [16]
    [PDF] Efficient Ray Tracing of Volume Data
    This paper presents a front-to-back image-order volume-rendering algorithm and discusses two techniques for improving its performance. The first technique ...
  17. [17]
    [PDF] Display of Surfaces from Volume Data
    The application of volume rendering techniques to the display of surfaces from sampled scalar func- tions of three spatial dimensions is explored.Missing: history | Show results with:history
  18. [18]
    [PDF] Volumetric Path Tracing - Cornell: Computer Science
    Instead of just evaluating an exponential, we have to some- how sample proportional to the spatially varying attenuation coefficient along the ray.
  19. [19]
    Ray Marching: Getting it Right! - Volume Rendering
    Find the distance light travels through the volumetric sphere to the sample. // Then use Beer's law to attenuate the light contribution due to in-scattering. if ...In-Scattering And... · The Phase Function · Reading Other People's Code!<|separator|>
  20. [20]
    Ray Marching Fog With Blue Noise - The blog at the bottom of the sea
    May 10, 2020 · Here's an algorithm for ray marching fog, which can give some simple scattering effects, like crepuscular lighting aka “god rays”.<|control11|><|separator|>
  21. [21]
  22. [22]
  23. [23]
    Chapter 18. Relaxed Cone Stepping for Relief Mapping
    Relaxed cone stepping forces cones to intersect the surface, using wider cones for space-leaping and binary search for accuracy, reducing artifacts.
  24. [24]
    [PDF] Dynamic Occlusion With Signed Distance Fields
    – Focus on lighting features and rendering optimization. SIGGRAPH 2015 ... • Used SDF (Signed Distance Field) ray marching for reflection shadowing in.
  25. [25]
    Mesh Distance Fields in Unreal Engine - Epic Games Developers
    Navigate to the Engine section and select Rendering. Under the Software Ray Tracing category, toggle the checkbox next to Generate Mesh Distance Fields.
  26. [26]
    [PDF] Efficient GPU Screen-Space Ray Tracing
    Dec 9, 2014 · The current state of the art for screen-space ray tracing on a GPU was presented by. Sousa et al. [2011] of Crytek, for the application of ...Missing: Lagae | Show results with:Lagae
  27. [27]
    3D SDFs - Inigo Quilez
    I explain how to compute SDFs and raymarch more complex objects such as recursive primitives, fractals or acceleration structure based meshes.Missing: voxels | Show results with:voxels<|control11|><|separator|>
  28. [28]
    [1809.01720] Extending Mandelbox Fractals with Shape Inversions
    Sep 5, 2018 · In this paper we introduce a new extension to Mandelbox fractals which replaces spherical inversion with a more generalized shape inversion. We ...
  29. [29]
    Distance Estimated 3D Fractals (VI): The Mandelbox - Syntopia
    Nov 11, 2011 · In this post I'll focus on the distance estimator, and try to make some more or less convincing arguments about why a scalar derivative works in this case.
  30. [30]
    Distance Estimated 3D Fractals (Part I) - Syntopia
    Jun 3, 2011 · In this paper Hart describe how Distance Estimation may be used to render a Quaternion Julia 3D fractal. The paper is very well written and ...
  31. [31]
    raymarching terrains - 2002 - Inigo Quilez
    An incredibly simple code that produces interesting images. It's perfect for small size demos, that's why it has been used so much.