micheledallerive / raytracer

A C++ raytracer
0 stars 0 forks source link

Photon Mapping - 15 points #4

Open micheledallerive opened 7 months ago

micheledallerive commented 7 months ago

Using described during lecture raytracer is difficult to simulate the light originating from a light source penetrating transparent object and forming caustic on diffuse surfaces. Moreover, treating transparent objects as light blockers during shadow computations leads to unrealistic effects. To address this limitation implement a simple photon mapping. For this case you can consider a simple point light source with a simple object, e.g., a sphere. Your photon mapping should trace photons from the light source through the transparent object until they reach the ground, i.e., plane. You can use raytracing to trace the photons. You will need to shoot many photons that are send in the random direction but towards the transparent object. Once the photons reach the ground you will need to store them in some efficient structure, e.g., 2D grid. To incorporate the traced photons into your light computation, you will need:

  1. Perform regular raytracing from the camera.
  2. When the primary ray hits the ground you will need to count how many photons are in the vicinity of the intersection.
  3. You should assume that each photon carries same amount of light, which you can adjust.
  4. After counting the number of photons in a small vicinity of the intersection, treat the amount of carried energy by the photons as an additional illumination. To be more correct, with each photon you can keep a direction from which it comes. One way of looking at photons is as if each of them was a separate light source. The final step of the photon mapping is called final gathering.
  5. You are not asked to compute physically-correct results, but rather interesting effects. So do not be too much concerned about the math that you will see when reading about photon mapping.
micheledallerive commented 7 months ago

https://www.icorsi.ch/mod/book/view.php?id=1003388&chapterid=24722