Intro
This is a short article intended to provide a more user friendly approach on how to optimise sample settings in Redshift render engine. It is structured in 3 sections, starting with some friendly definitions, a how it works part (with a nice analogy there) and the good part, actual practice.
Credits
All information below is based on Saul Espinosa’s video and reference image.
Definitions
Samples Min / Samples Max = Camera Samples (Rays fired by camera at each pixel)
Adaptive Error Threshold = a bias that tells the Camera to fire more or less samples based on acceptable noise. Lower values = less acceptable noise.
Camera Samples are used for: Anti-aliasing, Texture Filtering, Depth of Field and Motion Blur
Local Samples = material / object based samples, eg Reflection, Refraction, SSS, Light, etc.
GI Samples = Brute force Rays (fixed number) / IC Rays (variable number, based on IC Adaptive settings / Rate
Local Samples are used for calculating how a material reacts to direct light and other materials.
Calculations
Local samples define the maximum possible number of Local Samples fired at that pixel for each channel (Reflections, Refractions, etc. ). This number is divided by Camera Samples to find out how many Local Samples are fired per Camera Sample.
Example:
Samples Min= 4
Samples Max= 32
Adaptive Error Threshold (AET) = 0.01
Reflection Samples = 256
Refraction Samples = 1
Light Samples = 8
Local Samples (256) / Samples Max(32) = 8 Local Samples per Camera Sample
Based on the AET, adaptive engine will fire between 4*8 … 32*8 Reflection Samples at any given pixel, in increments of 8 (4*8, 5*8, 6*8 …. 32*8)
Every Camera Sample has at least 1 Local Sample for each channel (Refraction, SSS, AO, Light, etc.), only positive integer numbers.
Think at the following analogy:
- Camera samples are buckets with fruits (apples, oranges, strawberries, lemons, etc.)
- Every pixel is a consumer, thats based on the AET, has a unique demand for a specific number of apples, a specific number of oranges, strawberries and so on.
- You may send a minimum/maximum number of baskets to a consumer (Samples Min. / Samples Max.), but each basket has to have a number from every fruit.
- You may not send fruits to a consumer more than your local samples unless you force the AET to send more camera samples (than your local samples value)
You can see now how much effective is to keep Camera Samples under control and adjust Local Samples instead (lower number of baskets, with more fruits that are in demand). On the other hand, a low min/max interval of camera samples (baskets) will waste more fruits as the AET will have a small threshold of baskets to adapt between fruits that are higher in demand vs. fruits that are not in demand.
Workflow
The best way to find how many Local Samples are needed for each scenario is looking at AOV’s. Corresponding passes to samples:
DiffuseLightingRaw = Light Samples
ReflectionsRaw = Reflection Samples
RefractionsRaw = Refraction Samples / Single Scattering
SSS Raw =SSS Samples
Volume Lighting = Volume Samples
Global Illumination Raw = GI Brute Force Rays, IC Rays /Rate, IPC samples per pixel (and other tuning)
There are 2 starting methods:
- Going with some default Camera Sample settings and dialing in Local Samples overrides. Here are some rough values for scenarios that work for me, without DoF,MB:
- Simple studio lighting scene with abstract materials: 8/32..64 ; AET 0,01
- Simple studio lighting scene with PBR detailed materials: 16/64..128 AET 0,008
- Outdoor foliage environment, sun&sky lighting: 32/64..128 AET 0,015
- Interior with photorealistic materials, complex lighting (sun&sky environment, portals, local lights): 32/128…256 AET 0,003
Increase each Local Samples channel until you are happy with the amount of noise in each AOV.
- This method starts with AET disabled; Samples Min = Samples Max, eg. 4/4 (minimum for 2x Anti-Aliasing Filter)
- Increase each Local Sample channel until you are happy with the amount of noise in each AOV
- increase the Samples Max. until you are happy with the render time/ noise ratio (increasing Samples Max will introduce noise back into image and cut render times, due to the AET factor)
Some considerations
A pixel might pass the AET test (the AET tells the engine to stop firing samples) even with some noise (error) in a channel. The same is true for “visual” image noise, there are times when you don’t need every AOV to be perfectly noise free. There are also times when noise is not visible in a specific AOV, but composing the final image will give you a visible noise result. In this case you might have to adjust every AOV image result with an exposure filter (in Picture Viewer or Editing app).
Dome Light has a special adaptive samples distribution that favors bright spots on the HDRI texture so it requires A LOT of Local Samples (samples are gathered towards the “sun” for example, and are less distributed across the “sky”)
In comparison, Environment Map Shader offers only GI Illumination, its samples are controlled by the GI engine.
If you have mixed lights in the scene it is better to use Local Samples for each light object instead of Overrides.
Volume indirect illumination is always calculated using Brute Force. So if you have volume emission or other source of secondary rays that light your volume you should always adjust BF rays even if you have IC as main GI method.
Conclusion
A large range between Samples Min and Max allows the adaptive engine to fine tune how much time is spent on a pixel, however, this creates unused Local Samples for channels that don’t need that many samples. So a balance between adaptive sampling range and number of camera samples fired is desired. On the other hand, a low interval between min. and max. camera samples will reduce the adaptive sampler effectiveness, resulting in longer render times.