A ray tracer written from scratch based on Phong shading and extended to support reflectiveness and transparency

Chapter 1

A C++ ray tracer written from scratch based on Phong shading and extended to support reflectiveness and transparency. The current version is used for grading in CSCI 5607 Fundamentals of Computer Graphics at UMN, thus the source code is not made public.

Phong Shading

Basic Phong Shading

Spheres rendered with high ambient value (upper), high diffuse value (lower-left), and high specular value (lower-right).

Soft Shadow, Spotlight and Attenuation

Lighting and Shadow

Light sources in the scene cast soft shadows on the spheres. Spotlights with soft shadow boundaries were implemented (illuminated area with circular shape). Light attenuation effect was also included (light sources closer to the surface create brighter illumination).

Texture Mapping

Sphere Texture Mapping A basic textured sphere.

Triangle Texture Mapping A textured scene with more geometric primitives.

Normal Mapping Normal maps are also supported.

Reflection, Refraction & Fresnel Effect

Polished Metal Sphere (reflection only)

The surface acts like a perfect mirror.

Glass Sphere (reflection + refraction)

Light rays pass through the crystal ball. Note that Fresnel effect is implemented, so that the sphere is more transparent in the center, and more reflective towards the boundary.

Hollow Glass Sphere

Note that the scene is upright after the rays entering and exiting the glass surfaces twice (flipped twice). Also the boundary of the sphere appears like a dark ring due to total internal reflection.

Statement: If no specific statement in the content, the copyright belongs to Yuxuan Huang . Reprint please indicate the link of this article.

(The content is authorized with CC BY-NC-SA 4.0 protocol)

Title:《 C++ Ray Tracer 》

Link:https://yuxuan-huang97.github.io/rendering/ray-tracer.html

The last update of this article was days ago, so it may be outdated!