Light in Mirror, Metal, Glass & Gem
By Faraaz AhmedI set up a scene with five skulls to show off the new features I implemented for the raytracing pipeline where two are tinted glass (teal and pink), one is clear glass, one is polished mirror, and one is a brushed gold metal. The glass skulls use refraction (ior/kt) so we get colored caustics and warped interiors, the mirror and metal pick up crisp highlights and reflections due to the newly implemented glossy/reflective shading with roughness control. Soft shadows from the area lights pool under each skull due to the new light control to get soft shadows instead of harsh ones, the glossy floor picks up subtle reflections, and adding the new tone mapping plus anti aliasing keep the edges clean and the highlights under control. The simple wall backdrop keeps the focus on the materials, so we can clearly see the contrast between glass, mirror, and metal. The skulls were also rotated, scaled and translated to different angles, sizes and distances respectively to show the different shadows and reflections using the new code to transform objects in the json file. Also, implementing BVH with AABB trees for triangle soups to render the scene sped up the process exponentially. The following additional features were added (The files mentioned in the brackets are where the changes were made in the code):
BVH for triangle soups: Triangle soups now build an AABB tree so triangle hits skip most geometry and intersect faster (Merging code from A4 into A3). This update caused the scenes to render way faster, for example, the raytraced bunny scene took 4 seconds on my laptop instead of 8 minutes. ( include/TriangleSoup.h, src/TriangleSoup.cpp, include/read_json.h, All files in the directories include/BVH and src/BVH).
Anti-aliasing jitter: Added multiple jittered subpixel samples per pixel to smooth edges and reduce jagged edges ( main.cpp, include/viewing_ray.h, src/viewing_ray.cpp).
Soft shadows: Point lights now accept radius and samples, casting many shadow rays for soft penumbra instead of hard edges ( include/PointLight.h, parsing in include/read_json.h, sampling in src/blinn_phong_shading.cpp).
Glossy reflections: Material roughness jitters reflection directions so highlights can blur for brushed and metal looks ( include/Material.h, include/read_json.h, src/raycolor.cpp ).
Refraction with Fresnel: Materials with index of refraction (ior) and material transmission colour (kt) refract using Snell’s law and mix with Schlick Fresnel for realistic glass ( include/Material.h , include/read_json.h, src/raycolor.cpp ).
Acknowledgements
Code:
- The starter code used was from the CSC317 A3 (Ray Tracing) with my implemented functions then I took chunks of my implemented CSC317 A4 (BVH) code to merge these two projects together to create Ray Tracing that utlisies BVH.
- The scene uses the skull.stl which is taken from the CSC317 A3 starter code.
Concepts: Used the concepts and formulae from the following:
- Anti aliasing (supersampling): https://en.wikipedia.org/wiki/Supersampling
- Soft shadows (used the idea of using multiple samples): https://www.cs.unc.edu/~gelliott/main/comp870_assignment2_p1.html
- Reinhard tone mapping: https://en.wikipedia.org/wiki/Tone_mapping
- Gamma correction: https://en.wikipedia.org/wiki/Gamma_correction
- Schlick Fresnel: https://en.wikipedia.org/wiki/Schlick%27s_approximation
- Material roughness/ glossiness: https://raytracing.github.io/books/RayTracingInOneWeekend.html#metal/fuzzyreflection
