From samples on a ray to Gaussians on a ray
A NeRF renders the pixel with ray from samples at depths . Sample has density , color and spacing . The rendered color is is the probability that the ray stops in interval given that it reached it, and is the probability that it reached interval at all. The weights sum to at most one. Gaussian splatting uses the same sum. The samples are replaced by the Gaussians whose footprint covers the pixel, sorted by the depth of their centers. For Gaussian with opacity and projected 2D density , evaluated at pixel , Nothing is sampled along the ray. The list of Gaussians plays the role of the samples, and their order along the ray comes from sorting. Sorting by the center is an approximation: two Gaussians that overlap in depth are still blended as if one were entirely in front of the other.Code
Code
A Gaussian in three dimensions
Each Gaussian has a mean and a covariance , a symmetric matrix that sets its size and orientation. Gradient descent on the six entries of could produce a matrix with a negative eigenvalue, which is not a covariance. The parameterization avoids this. Each Gaussian stores a rotation as a unit quaternion and three log-scales , and the covariance is built from them: For any vector , , so every parameter value gives a valid covariance. The eigenvectors of are the columns of , and its eigenvalues are the squared scales. The quaternion is normalized before use, so its length does not matter either. The opacity is for an unconstrained number , which keeps it in . Color may depend on the viewing direction, because a surface can look brighter from one side. Each Gaussian stores the color as a short expansion in spherical harmonics, functions on the sphere of directions. With degree 0 and degree 1 terms, the color seen along the unit direction from the camera to the Gaussian is with and , clipped below at zero. The vectors are learned per Gaussian. is the view-independent color, and the degree 1 terms add a color that changes linearly with direction. The original method uses degree 3. Degree 1 keeps the parameter count small at this image size.Projecting a Gaussian onto the image
A camera with rotation and translation maps a world point to camera coordinates, . The pinhole model of Camera Modeling then maps to the pixel The mean of the Gaussian goes to . The shape is harder, because a Gaussian pushed through a nonlinear map is no longer Gaussian. Around the mean, the projection is replaced by its first-order Taylor expansion, as in EWA splatting (Zwicker2005-au). The Jacobian of at is A linear map sends a Gaussian with covariance to one with covariance . The map from world coordinates to pixels is approximately , so the projected covariance is The Taylor expansion is poor for a Gaussian whose center lies far outside the field of view, where or is large. In , these ratios are therefore clamped to a little beyond the image border, of the half field of view past each edge. The mean itself is projected exactly. The term widens every footprint by about half a pixel. It acts as a low-pass filter, so that a Gaussian smaller than a pixel still covers at least one pixel center instead of slipping between them. With and for pixel , the opacity of the Gaussian at that pixel is The cap at keeps away from zero, so the gradient can still reach the Gaussians behind. Values below are set to zero, because they cannot change an 8-bit pixel. The footprint is cut off at three standard deviations along its long axis, a radius of pixels.Compositing in depth order
Your renderer follows the formulas directly. It projects all Gaussians, drops those behind the camera or outside the image, sorts the rest by camera depth , and evaluates the compositing sum at every pixel. The product is an exclusive cumulative product of over the sorted list. Evaluating every Gaussian at every pixel would need memory proportional to their product. The image is therefore split into square tiles of pixels. A Gaussian is assigned to every tile that its three-sigma square touches, which gives one pair per tile and Gaussian. Sorting the pairs by tile, with a sort that keeps the depth order of equal keys, lists every tile’s Gaussians front to back. Tiles with lists of similar length are then processed together, each list padded to the longest one in its batch. The rasterizer of the original paper does the same computation on the GPU. It builds the same pairs, encodes each as one 64-bit key from the tile index and the depth, and sorts all keys with one radix sort. Each tile is then a contiguous run of the sorted keys. One thread block handles one tile, one thread handles one pixel, and a thread stops as soon as its transmittance falls below . The backward pass walks the same list from back to front. The result is the same image, computed much faster, as the timing at the end of this section shows.Code
Code
The garden scene
The scene is the garden of the Mip-NeRF 360 dataset: 185 photos of a table with a vase, taken on a circle around it, together with the camera poses and sparse 3D points that Structure from Motion recovered from them. You read the three binary files of that reconstruction directly: the camera intrinsics, one pose per image, and the 3D points with their colors. The photos are used at one sixteenth of their full width, pixels, with the intrinsics scaled to match. Every eighth image, in name order, is held out for testing, and the rest are used for training. Neural Radiance Fields uses the same images and the same split, so the test scores of the two pages compare directly.Code
Code
Code
Code
Starting from the sparse points
Fitting Gaussians from random positions works poorly, because a Gaussian far from any surface receives almost no gradient. The sparse points of structure from motion already lie on the surfaces, so each point becomes one Gaussian. Its mean is the point, its color is the point’s color, its opacity is , and it starts as a sphere whose radius is the mean distance to its three nearest neighbors. Dense regions get small Gaussians and sparse regions get large ones, so the scene starts out roughly covered. The figure shows the sparse points projected into a training view next to the photo, and the image that the initial Gaussians render from the same camera.Code
Code
The loss
Training compares the rendered image with the photo from the same camera. The loss mixes a per-pixel error with a structural one: The term is the mean absolute difference over pixels and channels. SSIM, the structural similarity index, compares local means, variances and covariances of the two images inside a Gaussian window of standard deviation pixels. For local statistics , and , averaged over the image, with and . It rewards renders whose edges and textures line up with the photo even where the absolute colors differ slightly.Adding and removing Gaussians
The initial Gaussians are too few in some places and too many in others. Every 100 steps, training changes the set itself. The rule uses the gradient of the loss with respect to each projected mean . A large gradient means that the Gaussian keeps being pulled to cover an area that it cannot cover alone. Each step adds to a running sum for every visible Gaussian, with the gradient expressed in normalized image coordinates, where the image spans . When the average exceeds , the Gaussian is changed:- If its largest scale is at most of the scene extent, it is cloned. The copy starts at the same place and moves apart under later gradients. This fills regions that are under-reconstructed.
- If it is larger, it is split into two Gaussians drawn from the original as a distribution, each with its scales divided by . This breaks up large Gaussians that cover detail they cannot represent.
Training
Each step picks one training view at random, renders it, and takes one Adam step on all parameters. The learning rate of the means decays exponentially by a factor of 100 over training, so that the positions settle at the end. The training loop takes the renderer as an argument, which lets you run it later with a different rasterizer.Code
Code
Checking the renderer against gsplat
gsplat implements the tiled rasterizer of the paper in CUDA (Ye et al., 2024). Given the same Gaussians and the same camera, it should produce the same image as your renderer. It projects with the same clamped Jacobian, adds the same and uses the same cutoff. Two details differ. gsplat stops compositing a pixel once its transmittance falls below , while your renderer adds every remaining Gaussian, and the two add their terms in a different order in floating point. The mean difference stays far below one gray level of an 8-bit image, and the largest is a few gray levels.Code
Code
The same training with a tiled CUDA rasterizer
The training loop runs unchanged with gsplat as the renderer: same initial Gaussians, same loss, same density control, same number of steps. Only the rasterizer differs, so any difference in training time comes from it.Code
Code
Gaussians and radiance fields compared
Both representations are fitted with the same compositing rule, so the comparison is about what each stores.- Rendering speed. A NeRF evaluates a network at every sample on every ray. Gaussians are projected once per frame and blended, which is fast enough for real-time display.
- Explicit and editable. Each Gaussian is a small object with a position and a color. You can select, delete, move or recolor parts of the scene directly, which a network’s weights do not allow.
- Memory. A NeRF network is a few megabytes whatever the scene. A Gaussian scene grows with its detail, often to millions of Gaussians and hundreds of megabytes.
- View-dependent effects. Spherical harmonics of low degree capture gentle changes of color with direction. A NeRF’s network can represent sharper reflections, at the cost of evaluating it everywhere.
- Empty space. A NeRF must learn that most of space is empty and spends samples there. Gaussians exist only where the scene has content.
References
- Kerbl, B., Kopanas, G., Leimkühler, T., Drettakis, G. (2023). 3D Gaussian splatting for real-time radiance Field rendering. arXiv [cs.GR]. Link
- Ye, V., Li, R., Kerr, J., Turkulainen, M., Yi, B., et al. (2024). gsplat: An Open-Source Library for Gaussian Splatting. DOI
Found an error on this page? Report an issue.

