Adaptive Sampling

This page provides information about adaptive sampling as implemented by V-Ray.

Overview

V-Ray is an adaptive sampling engine. This means that whenever V-Ray needs to compute a value, like the color of a pixel, or the light reflected from a surface, V-Ray will take a varying number of samples for that value, depending on the context. The adaptive algorithm that V-Ray uses is very straightforward: for any effect that requires several samples, V-Ray first computes a small amount of samples, and then, if the variance of the samples is too big, it continues to take more samples until the result is good enough.

The samples that V-Ray needs to compute can be broadly classified as image samples and shading samples. Image samples are those directly related to pixel values that compose the final image, including depth of field and motion blur effects. Shading samples are those taken to compute effects like glossy reflections, global illumination, area lights etc. V-Ray employs adaptive sampling in both of these cases. The picture below shows one possible way that a light or a material may be sampled within a given pixel.

images/download/attachments/13835410/image2014-11-30_20_4_51.png

For each value that must be sampled adaptively, there is a certain minimum number of samples that V-Ray always computes, a maximum number of samples, and a noise threshold that controls how many samples between the minimum and the maximum would be actually computed. The minimum number of samples are needed because, like every adaptive algorithm, V-Ray's DMC sampler needs to gather a bit of information about the particular value that is being sampled before it can make any assumptions about it.

images/download/attachments/13835410/image2014-11-30_20_9_3.png

For image sampling, the three values - minimum samples, maximum samples and noise threshold - are directly specified by the user. The VRaySampleRate render element can show how many samples were actually performed, as percentage of the maximum. However for shading effects like glossy reflections, area lights, GI, it would be too cumbersome to have to specify the three values for each effect separately. To simplify the setup, V-Ray allows the user to specify the maximum number of samples using the various subdivs parameters for lights, materials and so on (although importance sampling may modify this maximum number depending on the expected contribution of the value). The noise threshold is specified globally for all values with the DMC noise threshold. What remains then, is to figure out the number of minimum samples that must be taken for a given value:

The minimum number of samples may be specified directly with a fixed number. This is not a bad approach, however it means that increasing the subdivs value for a shading effect might not always lead to improved quality, contrary to what users typically expect.

The minimum number of samples could be specified as percentage of the maximum number of samples. This approach ensures that increasing the subdivs value always results in better quality, but if the maximum number of samples are too low to begin with, it may mean that there is not enough information in those samples for the adaptive algorithm to work reliably.

The V-Ray DMC sampler combines both strategies and takes the bigger value to determine the actual minimum number of samples. Those strategies are controlled by the DMC min. samples parameter and the DMC adaptive amount parameter respectively. Once the minimum number of samples are taken, the DMC sampler continues taking more samples either until the noise threshold is reached, or the maximum number of samples are taken.

To disable any kind of adaptive sampling for shading effects, set the DMC adaptive amount to 0.0.

Built-in DMC calculator

Beginning with V-Ray 3.10, the VRayLight include a built-in DMC calculator that shows how the particular shading effect will be sampled under the current renderer settings. The values update interactively as the user adjusts the renderer settings or the material/light subdivs values.

images/download/attachments/13835410/image2014-11-30_20_34_12.png
The VRayLight showing sampling of a rectangle light.

images/download/attachments/13835410/image2014-11-30_21_10_50.png
The UI of the V-Ray renderer showing sampling for brute force GI.

The DMC calculator shows the minimum/maximum shading samples that will be taken for each AA image sample, and the total mininum/maximum shading samples for one pixel as a whole.