Skip to content

Commit

Permalink
Done with Task 3 writeup
Browse files Browse the repository at this point in the history
  • Loading branch information
ianhdong committed Mar 13, 2024
1 parent 076f663 commit e79baee
Showing 1 changed file with 57 additions and 16 deletions.
73 changes: 57 additions & 16 deletions hw3/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -207,21 +207,21 @@ <h3>
<tr align="center">
<td>
<img src="./Images/Task1/sp24-raytracer-task1-empty.png" align="middle" width="400px" />
<figcaption><code>CBempty.dae</code></figcaption>
<figcaption><code class="highlighter-rouge">CBempty.dae</code></figcaption>
</td>
<td>
<img src="./Images/Task1/sp24-raytracer-task1-spheres.png" align="middle" width="400px" />
<figcaption><code>CBspheres.dae</code></figcaption>
<figcaption><code class="highlighter-rouge">CBspheres.dae</code></figcaption>
</td>
</tr>
<tr align="center">
<td>
<img src="./Images/Task1/sp24-raytracer-task1-coil.png" align="middle" width="400px" />
<figcaption><code>CBcoil.dae</code></figcaption>
<figcaption><code class="highlighter-rouge">CBcoil.dae</code></figcaption>
</td>
<td>
<img src="./Images/Task1/sp24-raytracer-task1-gems.png" align="middle" width="400px" />
<figcaption><code>CBgems.dae</code></figcaption>
<figcaption><code class="highlighter-rouge">CBgems.dae</code></figcaption>
</td>
</tr>
</table>
Expand Down Expand Up @@ -366,7 +366,34 @@ <h3>
Walk through both implementations of the direct lighting function.
</h3>
<p>
Direct lighting is zero bounce lighting, the light that comes directly from the light source, plus one bounce lighting, the light that comes back to the camera after reflecting off the scene once. We will need to sample the light that comes
Direct lighting is zero bounce lighting, the light that comes directly from the light source, plus one bounce
lighting, the light that comes back to the camera after reflecting off the scene once. For zero bounce, we only
need to return the light from the light source without any bounces. However, for one bounce, we need to determine
how much light is reflected back to the camera after the ray intersects with the scene. Because we cannot compute
an infinite integral, we instead used a Monte-Carlo Estimator of the reflectance.
</p>
<p>
For uniform hemisphere sampling, we iterated through the number of samples and sampled a vector uniformly from the
hemisphere and converted it into the world space. Afterwards, we created the ray with this vector as the
direction. If the ray intersected the scene, we would calculate the BSDF $f(\text{w_out}, \text{w_in})$, the
emitted radiance $L_i$, and the
angle
between the
surface normal and the sampled vector. Finally, we computed the sample mean of the reflectance calculations from
lecture using the following formula and previous calculations:
$$\frac{1}{N} \sum_{i = 1}^{n} \frac{f_r(\text{p}, \omega_i \rightarrow \omega_r) L_i(\text{p},
\omega_j) \text{cos}\theta_j}{p(\omega_j)}$$
</p>
<p>
For importance lighting sampling, instead of sampling from a uniform hemisphere we iterated through each of the
light sources and calculated the number of
samples needed based on if it was a delta light and sampled uniformly from each light source. Then, we iterated
through the number of samples and
calculated
the emitted radiance along with the sampled world space vector for our ray. If the ray intersected the scene, we
would calculate the BSDF and the angle between the surface normal and the sampled vector and rejected rays that
were on the opposite side of the surface. For each light, we computed the mean reflectance using the formula from
above. Finally, we added this mean reflectance to the total reflectance and returned the total reflectance.
</p>
</div>
<br>
Expand All @@ -375,6 +402,8 @@ <h3>
<h3>
Show some images rendered with both implementations of the direct lighting function.
</h3>
Here are some images rendered with both implementations of the direct lighting function:
<br><br>
<!-- Example of including multiple figures -->
<div align="middle">
<table style="width:100%">
Expand Down Expand Up @@ -426,37 +455,49 @@ <h3>
<tr align="center">
<td>
<img src="./Images/Task3/sp24-raytracer-task3-CBspheres_lambertian-1.png" align="middle" width="400px" />
<figcaption>1 Light Ray (example1.dae)</figcaption>
<figcaption>1 Light Ray <code class="highlighter-rouge">(CBspheres_lambertian.dae)</code></figcaption>
</td>
<td>
<img src="./Images/Task3/sp24-raytracer-task3-CBspheres_lambertian-4.png" align="middle" width="400px" />
<figcaption>4 Light Rays (example1.dae)</figcaption>
<figcaption>4 Light Rays <code class="highlighter-rouge">(CBspheres_lambertian.dae)</code></figcaption>
</td>
</tr>
<tr align="center">
<td>
<img src="./Images/Task3/sp24-raytracer-task3-CBspheres_lambertian-16.png" align="middle" width="400px" />
<figcaption>16 Light Rays (example1.dae)</figcaption>
<figcaption>16 Light Rays <code class="highlighter-rouge">(CBspheres_lambertian.dae)</code></figcaption>
</td>
<td>
<img src="./Images/Task3/sp24-raytracer-task3-CBspheres_lambertian-64.png" align="middle" width="400px" />
<figcaption>64 Light Rays (example1.dae)</figcaption>
<figcaption>64 Light Rays <code class="highlighter-rouge">(CBspheres_lambertian.dae)</code></figcaption>
</td>
</tr>
</table>
</div>
<p>
YOUR EXPLANATION GOES HERE
Shown in the images above, when there are low amount of light rays there are more noise in the soft shadows with
individual dots making it up. As we increase the number of light rays, however, we noticed that the noise
decreased dramatically. At 64 light rays, the noise was almost completely gone and the soft shadows were much
smoother. This is because with more light rays, we are able to sample more points on the light source and thus get
a better estimate of the light intensity at a point on the surface. This is especially important for area lights,
where the light intensity can vary across the light source. Thus, the more light rays we have, the more accurate
our estimate of the light intensity at a point on the surface and the smoother the soft shadows will be.
</p>
</div>
<br>

<h3>
Compare the results between uniform hemisphere sampling and lighting sampling in a one-paragraph analysis.
</h3>
<p>
YOUR RESPONSE GOES HERE
</p>
<div class="bounding-box">
<h3>
Compare the results between uniform hemisphere sampling and lighting sampling in a one-paragraph analysis.
</h3>
<p>
We noticed that importance sampling converged much faster than uniform hemisphere sampling. The soft shadow noise
in
hemisphere sampling comes from the fact that only a small portion of the rays cast actually hit the scene. In
contrast, importance lighting sampling only considers the rays that actually contribute to the illumination of the
scene and thus has much less noise. This leads to much more smoother shadow scene renderings as shown in the above images.
</p>
</div>
<hr>
<br><br>

Expand Down

0 comments on commit e79baee

Please sign in to comment.