Sub topic 7
Denoising: Trading Samples for Cleanup
This chapter assumes you can render a still with F12 and that you know what the Samples setting does in Cycles. You should also know that low sample counts produce visible grain, called noise. Here you will learn how denoising removes that grain and what it costs in image quality. You will also learn how to configure it and how to diagnose the artifacts it produces.
What denoising does
Cycles is a path tracer. It estimates each pixel by averaging many random light paths, and the error of that estimate shrinks slowly as you add samples. Halving the visible noise takes roughly four times as many samples, so the last bit of grain is the most expensive to remove.
A denoiser is a filter that looks at a noisy image and predicts what the converged image would look like. It does not add light information. It guesses, using neighbouring pixels and extra data about the scene. That is why a denoised 128-sample render can look close to a 2,000-sample one in a fraction of the time. The same guess can also smear detail that was never fully sampled.
The trade-off is this: you spend fewer samples, and in exchange you accept a small risk that the filter invents or erases fine detail.
The denoisers in Cycles
Cycles offers two final-render denoisers.
| Denoiser | Runs on | Strengths | Limitations |
|---|---|---|---|
| OpenImageDenoise (OIDN) | CPU, and on supported GPUs in recent versions | Works on any hardware. Good quality and detail preservation. | Slower than OptiX on a fast GPU. |
| OptiX | NVIDIA RTX GPUs | Very fast, so well suited to viewport use. | Needs an NVIDIA RTX card and the OptiX device enabled. Can look softer on fine detail. |
Which option appears in the menu depends on your Blender version and hardware. If OptiX is not available on your machine, the enum value is rejected or hidden. Always check what you can use before you script it.
Viewport denoising is configured separately from final-render denoising. This lets you use a fast denoiser while you work and a higher-quality one for the final frame.
Where the settings live
In the Properties editor, open Render Properties with Cycles active.
- Sampling > Viewport > Denoise controls the interactive preview.
- Sampling > Render > Denoise controls the final render (F12 and animation).
- Under the render Denoise panel you choose the Denoiser, the Passes it uses as guides, and the Prefilter.
The Passes setting is the most important quality control. The denoiser can use up to three inputs:
- Color only (
RGB). The denoiser sees just the noisy image and must guess where edges and textures are. - Color and Albedo (
RGB_ALBEDO). The albedo pass is the flat surface color without lighting, so texture detail is easy to tell from noise. - Color, Albedo and Normal (
RGB_ALBEDO_NORMAL). The normal pass adds surface orientation, which protects geometric edges and shading detail.
More guide data generally means better detail retention, with a small extra cost. The Prefilter controls how those guide passes are cleaned before use. Accurate is slowest and best. Fast is cheaper. None assumes the guide passes are already clean, which is rarely true when using few samples.
How the pieces connect
Configuring denoising from Python
This script enables final-render denoising with OIDN, uses all guide passes, and chooses the accurate prefilter. It also turns on viewport denoising.
import bpy
scene = bpy.context.scene
scene.render.engine = 'CYCLES'
cycles = scene.cycles
cycles.samples = 64
cycles.use_denoising = True
cycles.denoiser = 'OPENIMAGEDENOISE'
cycles.denoising_input_passes = 'RGB_ALBEDO_NORMAL'
cycles.denoising_prefilter = 'ACCURATE'
cycles.use_preview_denoising = True
print("Denoiser:", cycles.denoiser)
print("Samples:", cycles.samples)To compare denoised and undenoised output, time the same scene both ways. The script writes both images next to the .blend file. It needs a saved file, because // paths are relative to it.
import time
import bpy
scene = bpy.context.scene
scene.render.engine = 'CYCLES'
scene.cycles.samples = 64
for use_denoise in (False, True):
scene.cycles.use_denoising = use_denoise
name = "denoised" if use_denoise else "raw"
scene.render.filepath = f"//compare_{name}.png"
start = time.perf_counter()
bpy.ops.render.render(write_still=True)
elapsed = time.perf_counter() - start
print(f"{name}: {elapsed:.1f} s")Denoising time is added once per frame, after sampling finishes. It does not grow with sample count. At very low sample counts the denoiser is a large fraction of the total time. At high counts it is a small one.
Choosing the sample count with a denoiser
The practical workflow is to lower samples until the denoiser starts to fail, then step back.
- Render a representative frame at a high sample count without denoising. This is your reference.
- Enable denoising and reduce samples step by step (for example 512, 256, 128, 64).
- Compare each result to the reference at 100% zoom. Look at fine textures, thin geometry, hard shadow edges and glossy reflections.
- Pick the lowest count where nothing important is lost.
Two other settings help here. Adaptive sampling (use_adaptive_sampling, with a noise threshold) stops sampling pixels that have already converged. It concentrates samples where the image is still noisy. Denoising works well alongside it, because the noisy regions get more samples and the clean ones are left alone. A minimum samples value prevents adaptive sampling from stopping too early on pixels that looked converged by chance.
Common artifacts and fixes
Denoisers fail in recognisable ways. Match the symptom to a cause before changing settings.
| Symptom | Likely cause | Fix |
|---|---|---|
| Textures look blurry or painted | Too few samples, or guide passes missing | Use `RGB_ALBEDO_NORMAL`, raise samples |
| Blotchy low-frequency patterns or "swimming" in animation | Each frame denoised from different noise | Raise samples, or use a fixed seed only for tests, not for final animation |
| Bright isolated pixels (fireflies) survive or smear | Rare high-energy paths | Reduce the light path **Clamping** values, add light-path bounces carefully, or increase samples |
| Fine detail in mirrors or glass is smeared | Albedo and normal passes describe the mirror surface, not the reflected scene | Use more samples for those objects, or accept a slight loss |
| Thin hair or fine geometry disappears | Sub-pixel detail looks like noise | Raise samples, or denoise without prefilter blur on those layers |
Animation flicker deserves special attention. Cycles uses a different noise pattern per frame by default, which is good, because averaging in the eye hides the grain. A denoiser then removes it, but it may remove it differently on each frame. If you see crawling in flat areas, raise the sample count first, since that makes every frame's input more similar.
Denoising in the compositor and as a separate step
The render-time denoiser is the simplest option, but you can also denoise in the compositor with the Denoise node. This is useful when you render to multilayer EXR files and want to adjust denoising later without re-rendering. To do this, enable the Denoising Data pass on the view layer. The node then takes the Image, Albedo and Normal inputs.
This approach has a cost: the file sizes grow, and you must keep the extra passes through your pipeline. It pays off for expensive scenes, where re-rendering to change a denoise setting would take hours.
Denoising and EEVEE
EEVEE does not use a path-traced sample budget the way Cycles does, so this chapter's denoisers do not apply to it in the same way. EEVEE does accumulate samples for soft shadows, ambient occlusion and some effects, and it can show grain at low settings. You fix that by raising its own sample settings, which a later chapter covers. If your goal is a clean image with almost no waiting, that is one reason to consider EEVEE at all.
Setting it from the command line
You can control the engine and sample count from the command line, but denoiser choice is stored in the .blend file. Set it in the file or with a short script passed through --python, and then render:
blender -b scene.blend --python set_denoise.py -E CYCLES -o //render_#### -f 1Here set_denoise.py contains the configuration code from earlier. Blender runs the options in the order given, so the script runs before the frame renders.
Exercise
You render a character with fine fabric texture at 32 samples with the denoiser set to color only. The texture looks smeared. Name two changes that could improve it without simply raising the sample count much, and say why each helps.
Show answer
First, set the denoiser passes to Color, Albedo and Normal. The albedo pass shows the denoiser where texture detail is real, so it keeps it instead of treating it as noise. The normal pass also preserves surface and edge structure. Second, set the prefilter to Accurate, which cleans the guide passes before use so they give the denoiser better information. A modest sample increase can then be added only if the result is still soft.
Exercise
Why does denoising save the most time on a fast-converging scene rendered at low samples, and the least time when you render at very high samples?
Show answer
Denoising adds a roughly fixed cost per frame after sampling ends. At low sample counts, sampling time is small, so cutting samples while the denoiser handles the grain saves a large share of total time. At very high sample counts the image is already nearly clean, so the denoiser removes little noise, and its fixed cost buys almost nothing. Sampling time dominates and the savings are small.