Gen Herres
Lab 3: Sampling Patterns
I choose the multijittered sampling implementation. My implementation when compared with the Stratified sampler ran in almost the same time (multijittered took approx 1-2% longer on images). The only modifications that I made were to create a multijittered.cpp file and add it to the framework under samplers. The usage is identical to the stratified sampler:
Sampler "multijittered" "integer xsamples" [2] "integer ysamples" [2]
The code is located here.
With the combination of latin hypercube and stratified sampling, is still possible to get a "bad" sampling pattern. For example, all of the samples could form a diagonal line across the pixel. This is obviously not what we want. Even with random shifting, we could still end up with not much change (especially on small sample sizes). So instead of generating the samples along the diagonal, generate patterns in a well distributed manner to start with. Then randomly shuffle them. While it is theoretically possible to still get a very bad sampling pattern, starting with a good pattern tends to yield a little better odds of ending up with a good pattern. The pattern is below. It satisfies the latin hypercube property and within each of the grey cells it randomly jitters the sample. The following would be used for a 4x4 grid and a 2x4 grid. The inputs are m x n. m columns, each of which is subdivided into n mini-columns to satisfy the latin hypercube property. The same is done with the rows.

Results:
The image on the left is done with the stratified sampler, taking 2 xsamples and 2 ysamples. The image on the right has the same number of samples but is using the multijittered approach. The images have been zoomed in on to highlight the subtle differences. Note that the multijittered reproduces the image slightly farther towards the horizon and also note the horizontal lines in the image are cleaner.

Here the top image is from the stratified sampler and the bottom from the multijittered sampler. I couldn't get pbrt to load in the .exr files on my machine, so instead of the lines on the bottom I only have a checkerboard. One of the clearest spots where you can see a difference between the two images is the shadows on the floor.

Closeup of the stratified and the multijittered (stratified on top again). Some of the differences I highlighted in green.


Another image which shows the differences in sampling styles of the two samplers is the depth of field example. On the left is the multijittered sampler while on the right is the stratified. The reference image is in the middle. This is done with 4x4 sampling. Note that while the stratified sampler has a lot of noise which is undesireable, the multijittered removes a lot of the noise, but replaces it with a small amount of aliasing. This is because the multijittered pattern provides a more even sampling of the space. I tried changing the shuffling, but that didn't lead to any change in the result.

I did try to use the diagonal pattern to start the multijittered pattern, and it overall gave worse results, as an example:
