diff-gaussian-rasterization: The GPU Rasterizer That Made 3D Gaussians Trainable

How a PyTorch-backed CUDA pipeline, tile sorting, and differentiable splatting turned a point cloud of anisotropic Gaussians into a real-time graphics primitive.

9 min read • View on GitHub • More from graphdeco-inria

A wide technical scene shows translucent Gaussian splats being routed through a tiled GPU pipeline. The splats are sorted into narrow bins, blended front to back, and then stopped early when opacity fills the frame. It explains how explicit scene elements can still behave like a fast renderer.
The key move is not just splatting. It is sorting splats into tiles so the GPU can blend them in a cheap, early-exit order.
Key Takeaways

The renderer that turned splats into a pipeline

`diff-gaussian-rasterization` is the engine room behind 3D Gaussian Splatting. The interesting part is not that it renders fast. It is that it takes a familiar graphics idea, tiled rasterization, and makes it trainable end to end.

That changes the category. Instead of pushing a scene through a neural field and hoping the output is sharp enough, the repo treats the scene as explicit Gaussian primitives. Each one has position, scale, rotation, and color. The renderer then does what GPUs are already good at: sort, blend, and stop early.

This repository contains the code for the rasterization engine used in the paper "3D Gaussian Splatting for Real-Time Radiance Field Rendering".

Bernhard Kerbl, Maintainer · graphdeco-inria/diff-gaussian-rasterization

The trick: sort by tile, blend front to back, stop early

The core optimization is almost old-fashioned. Each Gaussian can touch more than one screen tile, so the renderer expands it into tile-key pairs, sorts those pairs by tile and depth, and then processes each tile in a front-to-back order.

That order matters because alpha blending is cumulative. Once a pixel is effectively opaque, later splats are wasted work. Early exit is the difference between a beautiful idea and a practical renderer.

The renderer gets its speed from a very specific sequence. Expand, sort, blend, and quit early when the pixel is already done.

StepWhat happensWhy it helps
Frustum cullingReject Gaussians outside the camera view.Avoids work before the expensive part starts.
Tile expansionDuplicate each Gaussian for every tile it overlaps.Turns a messy overlap problem into smaller local lists.
Radix sortOrder the tile-key pairs by tile and depth.Makes blending coherent and GPU-friendly.
Front-to-back alphaAccumulate opacity in order.Lets the kernel stop once the pixel is saturated.

How the Python layer hands control to CUDA

The Python side is intentionally thin. A `torch.autograd.Function` wraps the extension boundary, so PyTorch sees a normal differentiable op while the heavy lifting happens in C++ and CUDA.

The unusual detail is the buffer strategy. Geometry, binning, and image buffers are passed as raw scratch space through the forward and backward passes. That avoids repeated allocations and lets the CUDA code keep a grip on performance without leaving PyTorch's memory world.

This is the sort of engineering that disappears when it works. The public API looks tidy. The internals are a carefully staged handoff between autograd and kernels that want to own the schedule.

A small but important design choice

The repo does not try to make the GPU look abstract. It lets the GPU be a GPU. The Python layer schedules work, the extension manages tensors, and the kernels manage the math.

From 3D Gaussians to pixels

A close technical cross-section shows one Gaussian being projected from 3D into 2D. Scale and rotation feed into an ellipse, the ellipse lands on a pixel grid, and a view-dependent color term emerges from spherical harmonics. It explains how the renderer turns scene parameters into screen-space splats.
The math is less mysterious than it looks. Shape becomes covariance, covariance becomes a screen-space ellipse, and view direction shapes color.

Under the hood, the renderer turns scale and rotation into a 3D covariance, then projects that covariance into screen space with an EWA-style splat. A small low-pass bias keeps tiny Gaussians from turning into shimmering aliasing artifacts.

Color comes from spherical harmonics, which makes appearance depend on view direction without turning the whole system into a giant MLP. That is a big part of why the method stays explicit and fast.

Why this beat NeRF in the places people cared about

The comparison is not subtle. NeRF-style systems made novel view synthesis look plausible, but they paid for it with heavy volumetric sampling and expensive inference. `diff-gaussian-rasterization` won attention because it made the output look good while keeping the runtime close to a graphics pipeline.

MethodScene representationRender pathSpeed profileStrengthsWeaknessesBest fit
NeRFImplicit density fieldRaymarching through a volumeOften slow to renderHigh fidelity, flexible scene modelingExpensive inference, less direct editabilityResearch on view synthesis and neural fields
Instant NGPHash-grid neural fieldFast neural volume renderingMuch faster than classic NeRFExcellent training speed, strong baselineStill an implicit field, still not a graphics pipelineFast neural reconstruction
3D Gaussian SplattingExplicit anisotropic GaussiansTiled rasterization with alpha blendingReal-time renderingFast, editable, GPU-native, trainableLess naturally suited to some volumetric effectsInteractive scenes and real-time rendering
Traditional point renderingExplicit points or splatsPoint-based projection and blendingUsually fastSimple, direct, hardware-friendlyOften lower quality or less differentiableLegacy point visualization and rendering

The decisive advantage is not that the method is more neural. It is that it is less neural in the right places. The scene stays explicit, the GPU gets a coherent workload, and the renderer can exploit the same tricks graphics has used for decades.

What the backward pass buys you

Differentiability is the whole point. The backward pass sends gradients back through projection, blending, color, scale, and rotation, so the model can move and reshape the Gaussians until the rendered image matches the target.

That turns splatting into optimization. The renderer is no longer just a display path. It becomes the mechanism by which the scene learns itself.

Our method allows real-time rendering of photorealistic scenes learned from small sets of images, with training times comparable to the fastest existing methods.

Bernhard Kerbl, Georgios Kopanas, Thomas Leimkühler, George Drettakis, Authors · 3D Gaussian Splatting for Real-Time Radiance Field Rendering

A research codebase that became infrastructure

This repo reads like research code, but it behaves like infrastructure. It is tightly optimized, deeply specific, and easy to reuse as the core of a larger system.

That is why it seeded so many follow-ons. Libraries like gsplat and integrations in Nerfstudio all inherit the same basic lesson: if you want neural rendering to feel real-time, the renderer has to look more like graphics again.