Homework 2 - Part 2: Multisampling
In the second part of the second assignment, we are expected to introduce Multisampling technique to the ray tracer. Multisampling is basically increasing sampling rate for the each pixel for more accurate images.
There are two steps to achieve this. The first part is randomly determining sample points. When sample number is n^2, I divided each dimension of pixel to n equal parts, to get n^2 sub-pixels. For samples, I determined one random point which is inside of the related sub-pixel, for each sub-pixel. After computing color of the each sample, the first part is complete.
In the second part, we need to filter those samples. I used 2D Gaussian Function with sigma=1/3 and mean = 0. By choosing sigma like this, each sample point also contributed to the nearest neighbors. It caused more accurate contributions of each sample. While doing so, I converted my pixels to a monitor pixel class to avoid race conditions. After all the calculations are done, I divided total weighted color value to the total weight of the samples.
Some of the gifs have lower quality for some of the frames. I also shared the lowest and the highest sample rate outputs.
For each example, after some number of samples, changes are minimal for each increase.
- bunny.xml
1 sample (middle of the each pixel):
- chinese_dragon.xml
1 sample (middle of the each pixel):
Specifically, this gif has some quality problems, because of the tool i used.
There are two steps to achieve this. The first part is randomly determining sample points. When sample number is n^2, I divided each dimension of pixel to n equal parts, to get n^2 sub-pixels. For samples, I determined one random point which is inside of the related sub-pixel, for each sub-pixel. After computing color of the each sample, the first part is complete.
In the second part, we need to filter those samples. I used 2D Gaussian Function with sigma=1/3 and mean = 0. By choosing sigma like this, each sample point also contributed to the nearest neighbors. It caused more accurate contributions of each sample. While doing so, I converted my pixels to a monitor pixel class to avoid race conditions. After all the calculations are done, I divided total weighted color value to the total weight of the samples.
Some of the gifs have lower quality for some of the frames. I also shared the lowest and the highest sample rate outputs.
For each example, after some number of samples, changes are minimal for each increase.
- bunny.xml
1 sample (middle of the each pixel):
100 samples:
Scene is parsed
Starting rendering on #8 thread(s)
bunny-001.png(512x512) is saved in: 48 milliseconds 830 microseconds
Starting rendering on #8 thread(s)
bunny-004.png(512x512) is saved in: 231 milliseconds 676 microseconds
Starting rendering on #8 thread(s)
bunny-009.png(512x512) is saved in: 503 milliseconds 837 microseconds
Starting rendering on #8 thread(s)
bunny-016.png(512x512) is saved in: 879 milliseconds 422 microseconds
Starting rendering on #8 thread(s)
bunny-025.png(512x512) is saved in: 1 second 362 milliseconds 659 microseconds
Starting rendering on #8 thread(s)
bunny-036.png(512x512) is saved in: 1 second 945 milliseconds 113 microseconds
Starting rendering on #8 thread(s)
bunny-049.png(512x512) is saved in: 2 seconds 619 milliseconds 302 microseconds
Starting rendering on #8 thread(s)
bunny-064.png(512x512) is saved in: 3 seconds 454 milliseconds 136 microseconds
Starting rendering on #8 thread(s)
bunny-081.png(512x512) is saved in: 4 seconds 327 milliseconds 459 microseconds
Starting rendering on #8 thread(s)
bunny-100.png(512x512) is saved in: 5 seconds 364 milliseconds 493 microseconds
- chinese_dragon.xml
1 sample (middle of the each pixel):
100 samples:
Scene is parsed
Starting rendering on #8 thread(s)
chinese_dragon-001.png(800x800) is saved in: 232 milliseconds 964 microseconds
Starting rendering on #8 thread(s)
chinese_dragon-004.png(800x800) is saved in: 1 second 5 milliseconds 339 microseconds
Starting rendering on #8 thread(s)
chinese_dragon-009.png(800x800) is saved in: 2 seconds 211 milliseconds 262 microseconds
Starting rendering on #8 thread(s)
chinese_dragon-016.png(800x800) is saved in: 3 seconds 826 milliseconds 525 microseconds
Starting rendering on #8 thread(s)
chinese_dragon-025.png(800x800) is saved in: 5 seconds 969 milliseconds 290 microseconds
Starting rendering on #8 thread(s)
chinese_dragon-036.png(800x800) is saved in: 8 seconds 505 milliseconds 391 microseconds
Starting rendering on #8 thread(s)
chinese_dragon-049.png(800x800) is saved in: 11 seconds 496 milliseconds 136 microseconds
Starting rendering on #8 thread(s)
chinese_dragon-064.png(800x800) is saved in: 15 seconds 9 milliseconds 642 microseconds
Starting rendering on #8 thread(s)
chinese_dragon-081.png(800x800) is saved in: 19 seconds 334 milliseconds 753 microseconds
Starting rendering on #8 thread(s)
chinese_dragon-100.png(800x800) is saved in: 23 seconds 787 milliseconds 244 microseconds
- cornellbox.xmlSpecifically, this gif has some quality problems, because of the tool i used.
1 sample (middle of the each pixel):
100 samples:
Scene is parsed
Starting rendering on #8 thread(s)
cornellbox-001.png(800x800) is saved in: 115 milliseconds 690 microseconds
Starting rendering on #8 thread(s)
cornellbox-004.png(800x800) is saved in: 600 milliseconds 509 microseconds
Starting rendering on #8 thread(s)
cornellbox-009.png(800x800) is saved in: 1 second 337 milliseconds 563 microseconds
Starting rendering on #8 thread(s)
cornellbox-016.png(800x800) is saved in: 2 seconds 363 milliseconds 41 microseconds
Starting rendering on #8 thread(s)
cornellbox-025.png(800x800) is saved in: 3 seconds 697 milliseconds 956 microseconds
Starting rendering on #8 thread(s)
cornellbox-036.png(800x800) is saved in: 5 seconds 263 milliseconds 293 microseconds
Starting rendering on #8 thread(s)
cornellbox-049.png(800x800) is saved in: 7 seconds 141 milliseconds 754 microseconds
Starting rendering on #8 thread(s)
cornellbox-064.png(800x800) is saved in: 10 seconds 279 milliseconds 383 microseconds
Starting rendering on #8 thread(s)
cornellbox-081.png(800x800) is saved in: 12 seconds 513 milliseconds 569 microseconds
Starting rendering on #8 thread(s)
cornellbox-100.png(800x800) is saved in: 15 seconds 96 milliseconds 340 microseconds
Specifications:
Excellent!
YanıtlaSil