diff --git a/hw3/index.html b/hw3/index.html index dbcbf22..de6027d 100644 --- a/hw3/index.html +++ b/hw3/index.html @@ -422,7 +422,7 @@

Task 3: Direct Lighting with Uniform Hemisphere Shading

- Below are images of running `./pathtracer -t 8 -s 16 -l 8 -H -f CBbunny_H_16_8.png -r 480 360 ../dae/sky/CBbunny.dae`, `./pathtracer -t 8 -s 64 -l 32 -m 6 -H -f CBbunny_H_64_32.png -r 480 360 ../dae/sky/CBbunny.dae` and `./pathtracer -t 8 -s 64 -l 32 -m 6 -H -f CBempty.png -r 480 360 ../dae/sky/CBspheres_lambertian.dae` with uniform hemisphere sampling. + Below are images of running ./pathtracer -t 8 -s 16 -l 8 -H -f CBbunny_H_16_8.png -r 480 360 ../dae/sky/CBbunny.dae, ./pathtracer -t 8 -s 64 -l 32 -m 6 -H -f CBbunny_H_64_32.png -r 480 360 ../dae/sky/CBbunny.dae and ./pathtracer -t 8 -s 64 -l 32 -m 6 -H -f CBempty.png -r 480 360 ../dae/sky/CBspheres_lambertian.dae with uniform hemisphere sampling.

@@ -430,31 +430,83 @@

Task 3: Direct Lighting with Uniform Hemisphere Shading

- CBbunny_H_16_8-3.3.png + CBbunny_H_16_8.png

- CBbunny_H_64_32-3.3.png + CBbunny_H_64_32.png



+
+ +

Screenshot of ../dae/sky/CBspheres_lambertian.dae

+
+ +
+ +

Task 4: Direct Lighting by Importance Sampling Lights

+
+

+ Importance sampling is similar to uniform hemisphere sampling with the exception of now iterating through all the lights via scene->lights.begin(). First, we need to check whether is_delta_light() returns true if the light is a point light source. This is because if we sample a point light source, the ray's direction doesn't matter since the outgoing light is the same, hence why only one sample is needed. Otherwise, num_samples is equal to ns_area_light. +

+ +

+ While still iterating through the lights, we now need to iterate through all of the samples for that light. We created a new vector L assigned to the output of calling sample_L, which also sets wi, distToLight and pdf. Following the same steps in uniform hemisphere sampling, we generated a new sample Ray (new_ray) and set it's min_T and max_T values to EPS_F and dist - EPS_F respectively. Afterwards, we created a new Intersection and checked if there was an intersection by using intersect. +

+ +

+ If there isn't an intersection, we calculated the \( f_r \) to compute the reflection equation to get the outgoing lighting. This is because if there was an intersection, we don't want to illuminate it because of the previous intersection. We added \( \frac{{L_i \times f_r \times \cos(\theta)}}{{\text{pdf}}} \) to \( L_{\text{out}} \) and after iterating through all of the samples per light, we normalized the outgoing light by dividing by \( \text{num_samples} \). This was then added to \( \text{result} \) (final \( L_{\text{out}} \)) and returned. +

+ +

+ Below are images generated when running ./pathtracer -t 8 -s 64 -l 32 -m 6 -f {filename}.png -r 480 360 ../dae/sky/{filename}.dae for importance sampling lights. +

+ +
+ +
+ +

+ ../dae/sky/CBbunny.dae +

+
+
+ +

+ ../dae/sky/CBbunny.dae, 4 light rays +

+
+
+ +

+ +
+ +

Screenshot of ../dae/sky/dragon.dae

+
+ +

+ Using light importance sampling, we can also compare the noise levels in soft shadows when rendering with 1, 4, 16, and 64 light rays (the -l flag) and 1 sample per pixel (the -s flag) for ../dae/sky/CBbunny.dae. When there are more light rays, we can see that there is less noise in the rendered images. The shadows become more smooth and the edges are less rigid because with less light rays, each shadow point is clearer. With more light rays, there is a greater range, allowing for more variation in the shadows. +

+

- CBbunny-sample1.png + ../dae/sky/CBbunny.dae, 1 light ray

- CBbunny-sample4.png + ../dae/sky/CBbunny.dae, 4 light rays

@@ -466,39 +518,16 @@

Task 3: Direct Lighting with Uniform Hemisphere Shading

- CBbunny-sample16.png + ../dae/sky/CBbunny.dae, 16 light rays

- CBbunny-sample64.png + ../dae/sky/CBbunny.dae, 64 light rays

-
- -

Task 4: Direct Lighting by Importance Sampling Lights

-
-

- Importance sampling is similar to uniform hemisphere sampling with the exception of now iterating through all the lights via scene->lights.begin(). First, we need to check whether is_delta_light() returns true if the light is a point light source. This is because if we sample a point light source, the ray's direction doesn't matter since the outgoing light is the same, hence why only one sample is needed. Otherwise, num_samples is equal to ns_area_light. -

- -

- While still iterating through the lights, we now need to iterate through all of the samples for that light. We created a new vector L assigned to the output of calling sample_L, which also sets wi, distToLight and pdf. Following the same steps in uniform hemisphere sampling, we generated a new sample Ray (new_ray) and set it's min_T and max_T values to EPS_F and dist - EPS_F respectively. Afterwards, we created a new Intersection and checked if there was an intersection by using intersect. -

- -

- If there isn't an intersection, we calculated the \( f_r \) to compute the reflection equation to get the outgoing lighting. This is because if there was an intersection, we don't want to illuminate it because of the previous intersection. We added \( \frac{{L_i \times f_r \times \cos(\theta)}}{{\text{pdf}}} \) to \( L_{\text{out}} \) and after iterating through all of the samples per light, we normalized the outgoing light by dividing by \( \text{num_samples} \). This was then added to \( \text{result} \) (final \( L_{\text{out}} \)) and returned. -

- -

- Below are images generated when running ./pathtracer -t 8 -s 64 -l 32 -m 6 -f {filename}.png -r 480 360 ../dae/sky/{filename}.dae for importance sampling lights. -

- -

- Using light importance sampling, we can also compare the noise levels in soft shadows when rendering with 1, 4, 16, and 64 light rays (the -l flag) and 1 sample per pixel (the -s flag) for ../dae/sky/CBbunny.dae. When there are more light rays, we can see that there is less noise in the rendered images. The shadows become more smooth and the edges are less rigid because with less light rays, each shadow point is clearer. With more light rays, there is a greater range, allowing for more variation in the shadows. -

Uniform Hemisphere Sampling vs Light Sampling @@ -513,13 +542,13 @@

Task 4: Direct Lighting by Importance Sampling Lights

- bunny_1_1-3.4.png + ../dae/sky/CBbunny.dae with uniform hemisphere sampling

- bunny_64_32-3.4.png + ../dae/sky/CBbunny.dae with direct lighting sampling