Adaptive Super-sampling

Adaptive super-sampling is a technique used to determine whether or not to continue sampling within a pixel, based on the colours sampled thus far. It can greatly increase rendering speed for areas of the canvass that do not differ in intensity.

scene with no adaptive super-sampling
size: 800x700
output: nonadaptiveResult.png
time taken: 203 seconds

scene with adaptive super-sampling enabled
size: 800x700
output: adaptiveResult.png
time taken: 72 seconds


xml file used to create images

difference between the two images. Scaled by a factor of 10 so as to be visible


After perusing methodologies gleaned from articles online, I decided to implement adaptive super-sampling. The way I do this is by considering the point at the centre of each pixel, and casting multiple rays out in a spiral from this point. With jittering, the spiral is not continuous, rather the perturbation is introduced as a result of randomly varying the radius. Without jittering, the radius slowly increases from 0 to 1, with samples being taken at various theta.
This method is made adaptive by continuing to take samples by approximating the variance of the sampled points from the mean. If this variance is below a certain threshold we stop, and if not we continue going, at least until we hit the maximum required number of samples.
While this method could be made better by considering each of the four corners of the pixel, and then adaptively sampling within the pixel if the four corners differ, I thought I would implement it like as this way is more natural.
We consider a minimum number of rays, which is settable in the xml file using the tag The default, if this tag is not set, is four.

In the difference picture we can see how the adaptive sampling is only an approximation to the pure super-sampling method. There is only a non-zero difference at the high-frequency features in the scene, which include for the most part edges, yet also include the soft shadow area. However it should be noted that the soft-shadow rays are in fact jittered by a certain random amount, and so we would expect to get intensity differences between pictures. Given that the differences had to be scaled by a factor of 10 to even be visible, leads me to believe that my adaptive method is a good approximation.

Finally I implement reflections in order to utilise the facililities of the ray-tracer as a rendering technique

Reflections