In this assignment, I implemented light reflection for mirror materials and refraction for glass materials. This allows me to render objects that reflect or refract light which creates beautiful looking scenes. In addition, I also implemented microfacet materials with the ability to change the alpha, or roughness, of the material. Altering the alpha makes the material more glossy or matte.
Here are the results of CBspheres.dae rendered with 512 samples per pixel and 8 samples per light.
|
|
|
|
|
|
|
Note that the left sphere resembles a mirror while the right sphere resembles glass.
At a max ray depth of 1, we see the light reflect off the left sphere into the camera. On the other hand, some light is reflected off the right sphere while other light is refracted into it.
At a max ray depth of 2, we now see light that bounces off the wall into the left sphere that is then bounced into the camera. However, we see that the ceiling is still black in the reflective sphere. Also, we start to see some reflected light in the right sphere.
At a max ray depth of 3, we start to see the ceiling in the left sphere due to light possibly bouncing off the floor back to the ceiling and off the left sphere into the camera. Additionally, we see light that is bounced off the walls and refracted into the right sphere which is then reflected into the camera.
At a max ray depth of 4, the left sphere now shows the right sphere properly with light reflecting from the right sphere and bouncing off the left sphere into the camera. The walls get noticeably lighter in the right sphere too.
At a max ray depth of 5, we see more detail in the reflection of the right sphere in the left sphere. The walls refracted into the right sphere and reflected into the camera get lighter as more light bounces into the camera.
At a max ray depth of 100, the shadows are noticeably smoother and not as dark. We see small details in the reflection of the right sphere on the left sphere.
Here are the results of CBdragon_microfacet_au.dae rendered with 256 samples per pixel, 4 samples per light, and max ray depth of 7.
|
|
|
|
At lower alpha values (e.g. 0.005 and 0.05), the dragon is noticeably more glossy. As we increase the alpha values to 0.25 and 0.5, the dragon becomes more matte. Also, at lower alpha values, my code produces this sort of firefly looking artifact where there are many white dots.
Here are the results of CBbunny_microfacet_cu.dae rendered with 64 samples per pixel, 1 sample per light, and max ray depth of 7.
|
|
When compared to importance sampling, the cosine hemisphere sampling produces a bunny with a noticeable dark border around the bunny and lots of black dots on the bunny. To get a similar result as importance sampling, we would need to sample more with the cosine hemisphere sampling. The importance sampling produces a nice clean bunny.
Using an alpha value of 0.5 and pairs of (eta, k): (1.1181, 5.5577), (0.92678, 4.9657), (0.71515, 4.1696) represents the material Zinc.