This week’s project topics are:

  • Instancing
  • Transformation
  • Distibution Ray Tracing including:
    • Depth of Field,
    • Soft Shadow with Area Light,
    • Motion Blur,
    • Glossy Reflection
  • Smooth Shading

Source code will be available on GitHub. It is a private repository for now.

Instancing

Transformation

We need to implement transformation operations in order to achieve transformed objects. In ray tracing this is done with tranformation matrices. We need to add two Matrix class objects ,tranfrmationMatrix and inverseTransformationMatrix, in the ObjectBase class. The reason of creating inverseTransformationMatrix is not to calculate it every time we send a ray, instead we calculate it once at parsing the scene.

When having transformed objects in ray tracing, we only need to transform the initial ray’s eye and direction with the inverseTransformationMatrix of the object we send the ray to. There is nothing more to do. 

Distibution Ray Tracing

Depth of Field

To implement depth of field, we need to send rays from an area of aperture instead of a single point using pixel potision as pivot point. By doing this camera rays on a single pixel make a small amount of angle and every ray gets different color. We firstly should move near plane of the camera to the focus distance, and set the new dimensions of it. Then we should perturb camera position with a random value in [0, aperture size] range. Finally, we should take average of the rays’ resulting color.

 

100 Samples

900 Samples

Soft Shadow with Area Light

Motion Blur

Motion blur is not implemented 🙁

Glossy Reflection

100 samples

900 Samples