Sub topic 6
Samples and noise in Cycles
Cycles builds an image by averaging many random light measurements per pixel. This chapter covers what a sample is, why noise appears, how adaptive sampling and clamping change the result, and how to pick sample counts. Denoising has its own chapter, so it appears here only where it affects sampling choices.
This chapter assumes you can render a still with F12, assign a Principled BSDF material, and find the Render properties tab. It also assumes you know that Cycles is a path tracer, as the earlier chapters on rasterization versus path tracing explain.
What a sample is
Cycles traces light backwards. For each pixel it fires a ray from the camera into the scene. At each surface the ray hits, Cycles picks a random direction based on the material, and it may also aim a ray directly at a light. The ray keeps bouncing until it reaches a light, escapes to the world, or hits the bounce limit. The brightness it collects is one sample for that pixel.
One sample is a very rough estimate, because the random choices could have gone many ways. A single sample for a pixel lit by a large soft light might be bright or dark, depending on which direction the ray happened to take. Cycles repeats the process and averages the results. Each pass over the whole image adds one more sample to every pixel, so the image sharpens as the render progresses.
Noise is the leftover error in that average. It shows up as grain or speckle, and it is the visible difference between your current estimate and the value you would get with infinite samples.
How fast noise falls
Noise decreases with the square root of the sample count. Quadrupling the samples halves the noise. The table shows what that means for render time.
| Samples | Relative noise | Relative render time |
|---|---|---|
| 64 | 100% | 1x |
| 256 | 50% | 4x |
| 1024 | 25% | 16x |
| 4096 | 12.5% | 64x |
The first samples remove the most noise. Later samples cost the same time but remove less. Past a certain point, extra samples are not worth the wait, and that point depends on the scene.
Where the settings live
Open Render Properties > Sampling. Cycles keeps two separate groups:
- Viewport settings control the Rendered shading mode in the 3D viewport.
- Render settings control F12 renders and command-line renders.
Keeping them separate lets you use a low viewport count for interactive work and a higher count for final output.
The main controls are:
- Max Samples (Python:
preview_samplesfor the viewport,samplesfor the final render). This is the upper limit on samples per pixel. - Noise Threshold (
adaptive_threshold). This is the target noise level for adaptive sampling. - Min Samples (
adaptive_min_samples). This is the number of samples every pixel gets before adaptive sampling may stop it. A value of 0 lets Cycles choose. - Time Limit (
time_limit). This stops the render after a set number of seconds, with 0 meaning no limit.
Recent Blender versions default the final render to a high maximum, and the exact default has changed between versions. Check your own build instead of relying on a remembered number.
Adaptive sampling
Not every pixel needs the same number of samples. A pixel on a diffuse wall facing a large light converges quickly. A pixel in a dark corner lit only by bounced light converges slowly.
With Noise Threshold enabled, Cycles checks each pixel's estimated noise as it renders. When a pixel falls below the threshold and has reached the minimum samples, Cycles stops sampling it and spends the remaining time on noisier areas. Max Samples remains the hard cap.
- A lower threshold (for example 0.001) means a cleaner image and longer render.
- A higher threshold (for example 0.05) means a faster, grainier render.
- A threshold of 0.01 is a common starting point.
In practice, adaptive sampling lets you set a high Max Samples as a safety limit and control quality with the threshold. Simple areas finish early, and difficult areas keep working until they are clean or hit the cap.
Because the stopping decision is made per pixel from an estimate, a pixel can occasionally stop too early. This is why a very high threshold can leave visible blotches, where neighboring areas have different noise levels.
Setting these from Python
All of the above is exposed on scene.cycles.
import bpy
scene = bpy.context.scene
scene.render.engine = 'CYCLES'
cycles = scene.cycles
# Final render
cycles.samples = 512
cycles.use_adaptive_sampling = True
cycles.adaptive_threshold = 0.01
cycles.adaptive_min_samples = 0
cycles.time_limit = 0
# Viewport
cycles.preview_samples = 64
cycles.use_preview_adaptive_sampling = True
# Noise pattern
cycles.seed = 7
cycles.use_animated_seed = False
print("Cycles samples:", cycles.samples, "threshold:", cycles.adaptive_threshold)This sets a 512-sample cap with adaptive stopping at a threshold of 0.01. It also uses a lighter 64-sample cap in the viewport.
Measuring instead of guessing
Judging noise by eye on a small preview often misleads you. A reliable approach is to render the same frame at several sample counts and compare time and result. This script does that for one frame and writes the images next to the .blend file.
import bpy
import time
scene = bpy.context.scene
scene.render.engine = 'CYCLES'
scene.cycles.use_adaptive_sampling = False # fixed counts for a fair comparison
for count in (32, 128, 512):
scene.cycles.samples = count
scene.render.filepath = f"//noise_test_{count}"
start = time.time()
bpy.ops.render.render(write_still=True)
print(f"{count} samples: {time.time() - start:.1f} s")Run it with the .blend file saved, since the // prefix means "relative to the .blend file". Compare the three images at 100% zoom. Pick the lowest count whose remaining noise is acceptable, or one that a denoiser can handle cleanly.
The seed
Cycles uses a random number sequence to choose its ray directions. The Seed value (cycles.seed) selects that sequence. Two renders with the same seed and settings produce the same noise pattern.
For a still image this does not matter. For an animation it does. With a fixed seed, the grain pattern stays in the same place on screen from frame to frame, which looks like a dirty window in front of the camera. Enabling Animated Seed (use_animated_seed) changes the seed each frame, so the grain moves and reads as natural film grain. Animated seed is usually the better choice for animation, and a fixed seed is useful when you need exactly repeatable stills.
Fireflies and clamping
Some noise is not smooth grain. Fireflies are isolated, very bright pixels. They occur when a rare light path carries a huge amount of energy, for example a ray that bounces off a glossy surface and hits a small bright light. Averaging does not remove them quickly, because one extreme sample can outweigh dozens of normal ones.
Clamp Direct (sample_clamp_direct) and Clamp Indirect (sample_clamp_indirect) cap how bright a single sample can be. Setting a value of 10 for indirect light, for example, removes many fireflies. The cost is that clamping discards real energy, so highlights and bright reflections get slightly dimmer and the image loses some contrast. A value of 0 disables clamping.
Clamping treats symptoms. Fireflies often have a cause you can fix instead:
- Reduce the strength of small, very bright lights, or make them larger.
- Raise the Roughness of glossy materials slightly, or enable Filter Glossy (
blur_glossy) under Light Paths. Filter Glossy blurs sharp glossy paths in later bounces, which trades some accuracy for less noise. - Lower the Max Bounces for glossy, transmission and volume paths if the scene does not need them.
Why some scenes are noisier
Noise depends on how hard it is for random rays to find light. Common slow cases:
- Small lights are hard to hit by chance, and indirect-only lighting, such as a room lit through a small window, makes most paths fail to reach a light.
- Glossy and glass surfaces spread paths in many directions.
- Volumes such as fog add scattering events along every ray.
- Caustics, the bright patterns from light focused through glass or off a mirror, take many samples to resolve.
Cycles has features that help, such as sampling lights directly at each hit and light-tree importance sampling for scenes with many lights. These work automatically, but they do not make a hard scene easy. A scene with one tiny bright bulb inside a closed room will always need more samples than an open scene under a large sky.
A working approach
- Render with a low sample count to check composition and lighting.
- Remove fireflies at their cause before raising samples.
- Turn on adaptive sampling and set the threshold for the quality you need.
- Set Max Samples high enough that the threshold, not the cap, ends most pixels.
- If time is still too high, use a time limit as a safety net and add denoising, covered in the next chapter.
Exercise
A Cycles render at 256 samples shows acceptable grain. You need roughly half the noise. About how many samples do you need without changing any other setting, and how does the render time change?
Show answer
Noise falls with the square root of the sample count, so halving it needs four times the samples: about 1024. Render time rises roughly fourfold, because each sample costs about the same time. Adaptive sampling or denoising can reach a similar result for less time.
Exercise
Your animation has grain that stays fixed in place across frames. Which setting causes it, and what do you change?
Show answer
The seed is the same on every frame, so the noise pattern repeats. Enable Animated Seed (scene.cycles.useanimatedseed = True) so the seed changes each frame and the grain moves.