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.
- This repo matters because it makes a classic tiled graphics pipeline differentiable, which is what turned 3D Gaussian Splatting into a trainable rendering primitive.
- Its speed comes from a simple but ruthless order of operations: bin by tile, sort by depth, blend front to back, and stop as soon as opacity is saturated.
- The Python layer is thin on purpose. PyTorch hands tensors to a custom CUDA backend, while scratch buffers let the renderer keep control over memory and throughput.
- The result is not a neural field that happens to render well. It is a graphics engine that learns, which is why it changed the comparison with NeRF.
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".
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.
| Step | What happens | Why it helps |
|---|---|---|
| Frustum culling | Reject Gaussians outside the camera view. | Avoids work before the expensive part starts. |
| Tile expansion | Duplicate each Gaussian for every tile it overlaps. | Turns a messy overlap problem into smaller local lists. |
| Radix sort | Order the tile-key pairs by tile and depth. | Makes blending coherent and GPU-friendly. |
| Front-to-back alpha | Accumulate 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
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.
| Method | Scene representation | Render path | Speed profile | Strengths | Weaknesses | Best fit |
|---|---|---|---|---|---|---|
| NeRF | Implicit density field | Raymarching through a volume | Often slow to render | High fidelity, flexible scene modeling | Expensive inference, less direct editability | Research on view synthesis and neural fields |
| Instant NGP | Hash-grid neural field | Fast neural volume rendering | Much faster than classic NeRF | Excellent training speed, strong baseline | Still an implicit field, still not a graphics pipeline | Fast neural reconstruction |
| 3D Gaussian Splatting | Explicit anisotropic Gaussians | Tiled rasterization with alpha blending | Real-time rendering | Fast, editable, GPU-native, trainable | Less naturally suited to some volumetric effects | Interactive scenes and real-time rendering |
| Traditional point rendering | Explicit points or splats | Point-based projection and blending | Usually fast | Simple, direct, hardware-friendly | Often lower quality or less differentiable | Legacy 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.
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.





