|
798 | 798 | <div class='together'>
|
799 | 799 | At 500×500 my code produces this image in 10min on 1 core of my Macbook:
|
800 | 800 |
|
801 |
| -  |
| 801 | +  |
802 | 802 |
|
803 | 803 | Reducing that noise is our goal. We’ll do that by constructing a PDF that sends more rays to the
|
804 | 804 | light.
|
|
941 | 941 | <div class='together'>
|
942 | 942 | And again I _should_ get the same picture except with different variance, but I don’t!
|
943 | 943 |
|
944 |
| -  |
| 944 | +  |
945 | 946 |
|
946 | 947 | </div>
|
947 | 948 |
|
|
1309 | 1310 | <div class='together'>
|
1310 | 1311 | Which produces:
|
1311 | 1312 |
|
1312 |
| -  |
| 1313 | +  |
1314 | 1315 |
|
1315 | 1316 | Is that right? We still don’t know for sure. Tracking down bugs is hard in the absence of reliable
|
1316 | 1317 | reference solutions. Let’s table that for now and get rid of some of that noise.
|
|
1415 | 1416 | <div class='together'>
|
1416 | 1417 | With 10 samples per pixel this yields:
|
1417 | 1418 |
|
1418 |
| -  |
| 1419 | +  |
1420 | 1421 |
|
1421 | 1422 | </div>
|
1422 | 1423 |
|
|
1447 | 1448 | <div class='together'>
|
1448 | 1449 | We also need to flip the light so its normals point in the -y direction. This gives us:
|
1449 | 1450 |
|
1450 |
| -  |
| 1451 | +  |
1452 | 1453 |
|
1453 | 1454 | </div>
|
1454 | 1455 |
|
|
1597 | 1598 | This yields an apparently matching result so all we’ve done so far is refactor where `pdf` is
|
1598 | 1599 | computed:
|
1599 | 1600 |
|
1600 |
| -  |
| 1601 | +  |
1601 | 1603 |
|
1602 | 1604 | </div>
|
1603 | 1605 |
|
|
1725 | 1727 | <div class='together'>
|
1726 | 1728 | At 10 samples per pixel we get:
|
1727 | 1729 |
|
1728 |
| -  |
| 1730 | +  |
1730 | 1732 |
|
1731 | 1733 | </div>
|
1732 | 1734 |
|
|
1817 | 1819 | <div class='together'>
|
1818 | 1820 | 1000 samples per pixel yields:
|
1819 | 1821 |
|
1820 |
| -  |
| 1822 | +  |
1822 | 1824 |
|
1823 | 1825 | </div>
|
1824 | 1826 |
|
|
2149 | 2151 | The resulting image has a noisy reflection on the ceiling because the directions toward the box are
|
2150 | 2152 | not sampled with more density.
|
2151 | 2153 |
|
2152 |
| -  |
| 2154 | +  |
2153 | 2156 |
|
2154 | 2157 | </div>
|
2155 | 2158 |
|
|
2294 | 2297 | sampling the light did for my code. This is probably because those rays that hit the glass are
|
2295 | 2298 | expensive!
|
2296 | 2299 |
|
2297 |
| -  |
| 2300 | +  |
2299 | 2302 |
|
2300 | 2303 | </div>
|
2301 | 2304 |
|
|
2341 | 2344 | <div class='together'>
|
2342 | 2345 | And we get a decent image with 1000 samples as before:
|
2343 | 2346 |
|
2344 |
| -  |
| 2347 | +  |
2346 | 2349 |
|
2347 | 2350 | </div>
|
2348 | 2351 |
|
|
2402 | 2405 | <div class='together'>
|
2403 | 2406 | Happily, the black specks are gone:
|
2404 | 2407 |
|
2405 |
| -  |
| 2408 | +  |
2406 | 2410 |
|
2407 | 2411 | </div>
|
2408 | 2412 |
|
|
0 commit comments