|
7 | 7 | Peter Shirley
|
8 | 8 | edited by Steve Hollasch and Trevor David Black
|
9 | 9 | <br>
|
10 |
| - Version 3.0.0, 2020-Mar-23 |
| 10 | + Version 3.0.1-wip, 2020-XXX-XX |
11 | 11 | <br>
|
12 | 12 | Copyright 2018-2020 Peter Shirley. All rights reserved.
|
13 | 13 |
|
|
130 | 130 | Opening the output file (in `ToyViewer` on my Mac, but try it in your favorite viewer and Google
|
131 | 131 | “ppm viewer” if your viewer doesn’t support it) shows this result:
|
132 | 132 |
|
| 133 | + <div class="render"> |
| 134 | + |
133 | 135 | 
|
134 | 136 |
|
| 137 | + </div> |
| 138 | + |
135 | 139 | </div>
|
136 | 140 |
|
137 | 141 | <div class='together'>
|
|
473 | 477 |
|
474 | 478 | with $t$ going from zero to one. In our case this produces:
|
475 | 479 |
|
| 480 | + <div class="render"> |
| 481 | + |
476 | 482 | 
|
477 | 483 |
|
| 484 | + </div> |
| 485 | + |
478 | 486 | </div>
|
479 | 487 |
|
480 | 488 |
|
|
578 | 586 | <div class='together'>
|
579 | 587 | What we get is this:
|
580 | 588 |
|
| 589 | + <div class="render"> |
| 590 | + |
581 | 591 | 
|
582 | 592 |
|
| 593 | + </div> |
| 594 | + |
583 | 595 | </div>
|
584 | 596 |
|
585 | 597 | Now this lacks all sorts of things -- like shading and reflection rays and more than one object --
|
|
651 | 663 | <div class='together'>
|
652 | 664 | And that yields this picture:
|
653 | 665 |
|
| 666 | + <div class="render"> |
| 667 | + |
654 | 668 | 
|
655 | 669 |
|
| 670 | + </div> |
| 671 | + |
656 | 672 | </div>
|
657 | 673 |
|
658 | 674 | Let’s revisit the ray-sphere equation:
|
|
800 | 816 | the sphere, the normal will point outward, but if the ray is inside the sphere, the normal will
|
801 | 817 | point inward.
|
802 | 818 |
|
803 |
| - ![Figure [normal-directions]: Possible directions for sphere surface-normal geometry](../images/fig.normal-possibilities.jpg) |
| 819 | + ![Figure [normal-directions]: Possible directions for sphere surface-normal geometry](../images/fig.normal-possibilities.jpg) |
804 | 820 |
|
805 | 821 | </div>
|
806 | 822 |
|
|
1145 | 1161 | This yields a picture that is really just a visualization of where the spheres are along with their
|
1146 | 1162 | surface normal. This is often a great way to look at your model for flaws and characteristics.
|
1147 | 1163 |
|
| 1164 | + <div class="render"> |
| 1165 | + |
1148 | 1166 | 
|
1149 | 1167 |
|
| 1168 | + </div> |
| 1169 | + |
1150 | 1170 | </div>
|
1151 | 1171 |
|
1152 | 1172 |
|
|
1326 | 1346 | Zooming into the image that is produced, the big change is in edge pixels that are part background
|
1327 | 1347 | and part foreground:
|
1328 | 1348 |
|
| 1349 | + <div class="render"> |
| 1350 | + |
1329 | 1351 | 
|
1330 | 1352 |
|
| 1353 | + </div> |
| 1354 | + |
1331 | 1355 | </div>
|
1332 | 1356 |
|
1333 | 1357 |
|
|
1487 | 1511 | <div class='together'>
|
1488 | 1512 | This gives us:
|
1489 | 1513 |
|
| 1514 | + <div class="render"> |
| 1515 | + |
1490 | 1516 | 
|
1491 | 1517 |
|
| 1518 | + </div> |
| 1519 | + |
1492 | 1520 | </div>
|
1493 | 1521 |
|
1494 | 1522 | <div class='together'>
|
|
1525 | 1553 | <div class='together'>
|
1526 | 1554 | That yields light grey, as we desire:
|
1527 | 1555 |
|
| 1556 | + <div class="render"> |
| 1557 | + |
1528 | 1558 | 
|
1529 | 1559 |
|
| 1560 | + </div> |
| 1561 | + |
1530 | 1562 | </div>
|
1531 | 1563 |
|
1532 | 1564 | <div class='together'>
|
|
1601 | 1633 | <div class='together'>
|
1602 | 1634 | After rendering we get a similar image:
|
1603 | 1635 |
|
| 1636 | + <div class="render"> |
| 1637 | + |
1604 | 1638 | 
|
1605 | 1639 |
|
| 1640 | + </div> |
| 1641 | + |
1606 | 1642 | It's hard to tell the difference between these two diffuse methods, given that our scene of two
|
1607 | 1643 | spheres is so simple, but you should be able to notice two important visual differences:
|
1608 | 1644 |
|
|
1677 | 1713 |
|
1678 | 1714 | Gives us the following image:
|
1679 | 1715 |
|
| 1716 | + <div class="render"> |
| 1717 | + |
1680 | 1718 | 
|
1681 | 1719 |
|
| 1720 | + </div> |
| 1721 | + |
1682 | 1722 | </div>
|
1683 | 1723 |
|
1684 | 1724 | <div class='together'>
|
|
1979 | 2019 | <div class='together'>
|
1980 | 2020 | Which gives:
|
1981 | 2021 |
|
| 2022 | + <div class="render"> |
| 2023 | + |
1982 | 2024 | 
|
1983 | 2025 |
|
| 2026 | + </div> |
| 2027 | + |
1984 | 2028 | </div>
|
1985 | 2029 |
|
1986 | 2030 | <div class='together'>
|
|
2029 | 2073 | <div class='together'>
|
2030 | 2074 | We can try that out by adding fuzziness 0.3 and 1.0 to the metals:
|
2031 | 2075 |
|
| 2076 | + <div class="render"> |
| 2077 | + |
2032 | 2078 | 
|
2033 | 2079 |
|
| 2080 | + </div> |
| 2081 | + |
2034 | 2082 | </div>
|
2035 | 2083 |
|
2036 | 2084 |
|
|
2047 | 2095 | there is a refraction ray at all. For this project, I tried to put two glass balls in our scene, and
|
2048 | 2096 | I got this (I have not told you how to do this right or wrong yet, but soon!):
|
2049 | 2097 |
|
2050 |
| -  |
| 2098 | + <div class="render"> |
| 2099 | + |
| 2100 | +  |
| 2101 | + |
| 2102 | + </div> |
2051 | 2103 |
|
2052 | 2104 | </div>
|
2053 | 2105 |
|
|
2144 | 2196 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2145 | 2197 | [Listing [dielectric]: <kbd>[material.h]</kbd> Dielectric material class that always refracts]
|
2146 | 2198 |
|
| 2199 | + <div class="render"> |
| 2200 | + |
2147 | 2201 | 
|
| 2202 | + |
| 2203 | + </div> |
2148 | 2204 | </div>
|
2149 | 2205 |
|
2150 | 2206 |
|
|
2262 | 2318 |
|
2263 | 2319 | We get:
|
2264 | 2320 |
|
| 2321 | + <div class="render"> |
| 2322 | + |
2265 | 2323 | 
|
| 2324 | + |
| 2325 | + </div> |
2266 | 2326 | </div>
|
2267 | 2327 |
|
2268 | 2328 | <div class='together'>
|
|
2341 | 2401 | <div class='together'>
|
2342 | 2402 | This gives:
|
2343 | 2403 |
|
| 2404 | + <div class="render"> |
| 2405 | + |
2344 | 2406 | 
|
2345 | 2407 |
|
| 2408 | + </div> |
| 2409 | + |
2346 | 2410 | </div>
|
2347 | 2411 |
|
2348 | 2412 |
|
|
2414 | 2478 |
|
2415 | 2479 | gives:
|
2416 | 2480 |
|
| 2481 | + <div class="render"> |
| 2482 | + |
2417 | 2483 | 
|
2418 | 2484 |
|
| 2485 | + </div> |
| 2486 | + |
2419 | 2487 | </div>
|
2420 | 2488 |
|
2421 | 2489 | To get an arbitrary viewpoint, let’s first name the points we care about. We’ll call the position
|
|
2497 | 2565 |
|
2498 | 2566 | to get:
|
2499 | 2567 |
|
| 2568 | + <div class="render"> |
| 2569 | + |
2500 | 2570 | 
|
2501 | 2571 |
|
| 2572 | + </div> |
| 2573 | + |
2502 | 2574 | And we can change field of view to get:
|
2503 | 2575 |
|
| 2576 | + <div class="render"> |
| 2577 | + |
2504 | 2578 | 
|
2505 | 2579 |
|
| 2580 | + </div> |
| 2581 | + |
2506 | 2582 | </div>
|
2507 | 2583 |
|
2508 | 2584 |
|
|
2639 | 2715 |
|
2640 | 2716 | We get:
|
2641 | 2717 |
|
| 2718 | + <div class="render"> |
| 2719 | + |
2642 | 2720 | 
|
2643 | 2721 |
|
| 2722 | + </div> |
| 2723 | + |
2644 | 2724 | </div>
|
2645 | 2725 |
|
2646 | 2726 |
|
|
2714 | 2794 | <div class='together'>
|
2715 | 2795 | This gives:
|
2716 | 2796 |
|
| 2797 | + <div class="render"> |
| 2798 | + |
2717 | 2799 | 
|
2718 | 2800 |
|
| 2801 | + </div> |
2719 | 2802 | </div>
|
2720 | 2803 |
|
2721 | 2804 | An interesting thing you might note is the glass balls don’t really have shadows which makes them
|
|
0 commit comments