Sub topic 12
Controlling noise from lights and the World
Noise is the grainy speckle you see in a Cycles render that has not converged. This chapter covers where noise from lamps and the World comes from and which settings reduce it. It assumes you can place lamps, load an HDRI through the World shader, and have rendered a scene in Cycles. The settings below are Cycles settings. EEVEE does not trace paths, so it does not produce this kind of noise.
Why lighting produces noise
Cycles is a path tracer. For each pixel it fires many random light paths and averages the results. Each path bounces off surfaces and tries to reach a light. Whether a given path finds a light is partly luck, so a single sample is a rough guess. Averaging many samples smooths the guesses into a clean image.
Noise is the variance between those guesses. Three situations raise it:
- Small, bright, or hard-to-reach lights. A path that misses the light contributes black. A path that hits it contributes a lot. The mix of the two looks like grain.
- A World with a very bright spot. An HDRI containing the sun as a few very bright pixels is hard to sample. Most paths land on dim sky and a few land on the sun.
- Light that arrives indirectly. A room lit only through a small window, or a surface lit by a bounce off another surface, gives few successful paths.
Sampling settings
Sampling settings are in Render Properties > Sampling. Cycles has separate values for the viewport and the final render.
| Setting | What it does | Typical use |
|---|---|---|
| Max Samples (Render) | Upper limit of samples per pixel in a final render | 128 to 1024 depending on the scene |
| Noise Threshold | Stops sampling a pixel once its estimated noise falls below this value | 0.01 is the default. Lower is cleaner and slower |
| Min Samples | Samples taken before the threshold test can stop a pixel | Leave at default unless you see uneven noise |
| Denoise | Runs a denoiser on the finished render | On for most scenes |
Adaptive sampling is controlled by the noise threshold. It spends samples on noisy pixels, such as shadow edges, and stops early on clean ones, such as a plain wall. A lit scene with a mix of bright and dark regions usually benefits from it.
Doubling samples does not halve noise. Noise falls roughly with the square root of the sample count, so four times the samples gives about half the noise. Past a certain point, changing the lighting is cheaper than adding samples.
The sampling and denoising settings can be set from Python:
import bpy
scene = bpy.context.scene
scene.render.engine = 'CYCLES'
cycles = scene.cycles
cycles.samples = 256 # max samples for the final render
cycles.use_adaptive_sampling = True
cycles.adaptive_threshold = 0.01 # noise threshold
cycles.use_denoising = True
cycles.preview_samples = 64 # viewport samplesDenoising
Denoising removes remaining noise after sampling. Blender offers these denoisers in Sampling > Render > Denoise:
- OpenImageDenoise runs on the CPU and works on any machine. It is the usual choice for final renders.
- OptiX runs on supported NVIDIA GPUs and is fast, which suits the viewport.
The denoiser also reads albedo and normal passes, which helps it keep texture detail and edges. Leave Denoising Data passes at their defaults unless you have a reason to change them.
Denoising can smear fine detail, and it can blur noise that is really a flicker between frames. For animation, use enough samples that each frame is already fairly clean, or check a few frames in sequence before committing to a long render.
Controlling noise from lamps
Lamp settings change how easily paths reach the light.
Size. A larger lamp is easier to hit, so it renders cleaner and has softer shadows. A tiny, very powerful point light gives hard shadows and more noise. If you want soft light, increase the radius or size first.
Distance. A lamp placed very close to a subject concentrates its power on a small area. Pulling it back and raising its power gives a more even result that is easier to sample.
Light threshold. Under Render Properties > Light Paths > Light Threshold (also listed under Sampling in some versions), Cycles ignores lights whose contribution falls below a value. Raising it removes the work spent on faint lights. A value that is too high makes dim lights vanish or darken the scene, so change it in small steps and compare.
Many lights. Scenes with dozens of lamps or emissive faces spend effort choosing which light to sample. Cycles uses a light tree for this, controlled by Light Tree under Sampling > Lights. It is on by default and generally helps scenes with many lights. Turning it off can speed up scenes with only a few lights.
Controlling noise from the World
An HDRI is a light source covering the whole sky, and Cycles has to decide which part of it to sample.
World sampling. Under World Properties > Settings > Surface, the Sampling option has these values:
- None disables importance sampling of the World. Noise rises.
- Automatic picks a method and is a good default.
- Manual lets you set the Max Resolution of the map that guides sampling.
Higher resolution follows the HDRI's bright features more precisely, such as a small sun disc. It uses more memory and setup time. Use a higher value if the HDRI has a bright, small light source and the render is noisy.
Bright small areas. If the sun in an HDRI is only a few pixels but carries most of the energy, the render is noisy and the shadows are broken up. Two common fixes:
- Remove the sun from the HDRI and add a Sun lamp with matching direction and strength. A Sun lamp's angle setting controls shadow softness and is cheap to sample.
- Keep the HDRI and raise the World sampling resolution.
World lighting versus background. If you only need the HDRI for light, you can lower the background's visibility to camera paths. Enabling Film > Transparent hides the HDRI in the image but keeps its light, as in the scene settings below. This does not reduce noise by itself. Its job is separating what is seen from what lights the scene.
import bpy
scene = bpy.context.scene
world = scene.world
# World importance sampling: automatic, or manual with a resolution
world.cycles.sampling_method = 'MANUAL'
world.cycles.sample_map_resolution = 2048
# Transparent film: HDRI lights the scene but is not visible
scene.render.film_transparent = TrueFireflies
Fireflies are isolated, very bright pixels that remain even after many samples. They come from rare paths that carry a huge amount of light, for example a path that bounces off a glossy surface and hits a small bright lamp.
Fixes, from least to most invasive:
- Clamp Indirect and Clamp Direct in Light Paths > Clamping set a maximum value for each sample. A value of 10 for indirect light is a common start. Lower values remove more fireflies and also darken highlights and reflections.
- Filter Glossy in Light Paths blurs glossy reflections slightly. This reduces fireflies from caustic-like paths at the cost of sharp reflections.
- Lower the brightness of the offending source, or enlarge it.
- Reduce Max Bounces if a scene does not need long paths.
import bpy
lp = bpy.context.scene.cycles
lp.sample_clamp_direct = 0.0 # 0 means no clamp
lp.sample_clamp_indirect = 10.0 # limit very bright indirect samples
lp.blur_glossy = 1.0 # Filter GlossyA practical order of work
- Fix the lighting first. Enlarge lamps, avoid tiny bright sources, and replace a hard sun in the HDRI with a Sun lamp if needed.
- Turn on adaptive sampling and denoising.
- Set World sampling appropriately for the HDRI.
- Raise samples until the image is acceptable, using a small render region to test.
- Add clamping only if fireflies remain.
Test with Render Region (Ctrl+B in the camera view) so each experiment takes seconds instead of minutes.
Exercise
A render lit by an HDRI with a small, very bright sun has grainy shadows even at 1024 samples. Name two changes that address the cause, and say why raising samples further is a poor first step.
Show answer
Either remove the sun from the HDRI and add a Sun lamp with an angle that gives the desired shadow softness, or raise the World sampling resolution (Manual, higher Max Resolution) so Cycles samples the sun more accurately. More samples is a poor first step because noise falls only with the square root of the sample count, so a fourfold increase in render time halves the noise. The cause is that few paths reach the small bright region, and better sampling or a different light fixes that directly.
Exercise
After setting Clamp Indirect to 1.0 to remove fireflies, the render looks dull and reflections lack punch. What happened and what should you do?
Show answer
Clamping caps the value of each indirect sample, so a low value removes legitimate bright light as well as fireflies, which lowers energy and flattens highlights. Raise the clamp to a higher value such as 10, compare against an unclamped render, and use other fixes, such as enlarging the bright source or using Filter Glossy, for any remaining fireflies.