Exploring sampling techniques and anti-aliasing methods
Jitter refers to the intentional introduction of small, random variations in the sampling positions when rendering computer graphics. This technique is primarily used to combat aliasing artifacts that occur when converting continuous signals (like smooth curves) to discrete pixels.
In traditional regular sampling, samples are taken at fixed intervals, which can lead to visible patterns and artifacts. Jittered sampling randomizes these sample positions within each pixel's area, breaking up these patterns and creating a more natural appearance.
Key Concept: Jitter is not just random noise - it's a carefully controlled randomization that improves image quality by distributing sampling errors more evenly.
| Technique | Sample Pattern | Result | 
|---|---|---|
| Regular Sampling | Uniform grid | Aliasing artifacts | 
| Jittered Sampling | Random within pixel | Noise instead of patterns | 
| Stratified Sampling | Jitter within sub-regions | Better distribution | 
Sampling is the process of converting a continuous signal (like a mathematical curve or real-world scene) into a discrete representation (pixels on a screen). The quality of this conversion depends heavily on how we choose our sample points.
This demo shows how regular sampling can create aliasing artifacts when rendering a diagonal line. Samples are taken on a fixed grid within each pixel. Notice the jagged staircase pattern (aliasing). The thin black line shows the ideal smooth result.
Aliasing Problem: Regular sampling at fixed intervals creates visible patterns (moire effects) and jagged edges, especially with high-frequency details or diagonal lines. The staircase pattern is called "jaggies".
The Nyquist-Shannon sampling theorem states that to accurately reconstruct a signal, you need to sample at least twice the highest frequency present in the signal. In graphics terms, this means:
For a pixel grid, any detail smaller than half a pixel will cause aliasing unless you use additional sampling techniques.
This is why jitter and other anti-aliasing techniques are essential - they help mitigate the visual impact of undersampling by distributing the sampling error.
Jittered sampling introduces controlled randomness to break up the regular patterns that cause aliasing. Instead of sampling at fixed positions within each pixel, we add small random offsets to each sample point.
Jitter appears as a scattering of sample points within each pixel area rather than a perfect grid. The points are randomly distributed but constrained to stay within their pixel boundaries (especially in stratified jitter). This creates a more organic distribution that:
Compare how jittered sampling affects the appearance of the same diagonal line. The noise from jittered samples is more visually acceptable than the regular patterns of aliasing. The thin black line shows the ideal smooth result.
A common implementation of jittered sampling is Stratified Sampling. Instead of placing samples purely randomly over the whole pixel, we divide the pixel into smaller sub-regions (strata) and place exactly one jittered sample within each sub-region. This ensures more even distribution of samples across the pixel while still breaking up regular patterns. The "Samples/side" slider in the demo controls the number of sub-regions per side (e.g., 4 samples/side means 16 sub-regions).
Best of both worlds: Stratified sampling combines the pattern-breaking benefits of jitter with the sample distribution benefits of a grid, often requiring fewer samples than pure random jitter for similar quality.
This demo simulates how a simple moving object is sampled over multiple consecutive frames, each with a slightly different sub-pixel jitter offset applied to the sampling grid. Notice how the appearance of the low-resolution grid changes ("flickers") from frame to frame. Techniques like TAA and DLSS analyze these changes over time to reconstruct a smoother, higher-resolution image.
Click "Next Frame" to see how the sampled pixel values change for a blue square moving diagonally across the canvas, with jitter applied to each frame's sample positions. The pixel color represents a single sample's hit/miss (no anti-aliasing applied *within* the frame, just the jitter changing *between* frames).
Temporal Aliasing: When objects move, the fixed sampling points in a low-resolution grid can jump between covering and not covering edges, causing a shimmering or flickering effect. Temporal jitter helps spread this error over time, providing different sample values in the same pixel location across frames.
Supersampling (also known as Super Sample Anti-Aliasing, or SSAA) is an anti-aliasing technique that takes multiple samples *per pixel* and averages them together to determine the final pixel color. When combined with jitter (specifically, stratified jitter), it produces even better results by ensuring the samples aren't all clustered in the same positions, providing a more accurate representation of what's covered by the pixel.
Applying jitter to supersamples is particularly valuable because:
This demo shows how increasing the total number of jittered samples per pixel improves image quality. More samples allow for a more accurate estimation of the portion of the pixel covered by the line, resulting in smoother edges. The pixel colors here directly represent the anti-aliased output (with alpha blending).
To optimize performance, modern graphics often use Adaptive Supersampling, taking more samples only in areas of high detail or contrast (like edges). More advanced techniques include Multisample Anti-Aliasing (MSAA), which samples geometry coverage at multiple points but shades only once per pixel (or at specific sample points), and Temporal Anti-Aliasing (TAA), which accumulates and jitters samples across multiple frames, often paired with motion vectors to reduce flickering and noise.
Modern GPUs use sophisticated variants of these techniques, combining spatial sampling (within a pixel) with temporal sampling (across frames) and smart filtering to achieve high-quality anti-aliasing efficiently.
Jittered sampling techniques are used throughout computer graphics to improve image quality and reduce aliasing artifacts. Here are some key applications:
Modern game engines use jitter in:
Production renderers for film/VFX use advanced sampling:
Jitter helps create natural-looking patterns:
Sampling techniques help with:
Sampling techniques continue to evolve with advancements in: