Raytracer - NPR Toon/Cel Shading with Feature Lines

Nick Teng - CSC 473 - Fall 2020 - Dr. Zoe Wood

Project Description

For my final project in CSC 473 I implemented a non photorealisitic raytracer. This project includes usage of raytracing to render feature lines and combines raytracing with a blinn phong approximation to achieve a more toonlike rendering of various scenes.


Implementation

Feature Lines


To achieve feature lines, I implemented the use of a ray stencil for each sample ray being shot from the camera by the raytracer. The ray stencil surrounds the sample ray with a circle of rays that will be shot in a cone. By determining whether these ray stencils hit the same geometry or a different one determines whether there is a feature line along that sample ray. With the use of ray stencils I was also able to visualize meshes by distinguishing each triangle in the mesh as a separate geometry to create feature lines dividing every triangle. In addition, when there is a self-occluding silhoutte on an object, the algorithm for feature lines will detect these lines by checking whether there is a large parametric difference in distance between the sample ray and stencil rays.

Render with self-occluding silhouttes


Shading


In order to attain a more toonlike visualization of my renders I opted to utilize recursive raytracing to attenuate materials for diffuse, specular, and dielectric surfaces and mix the attenuations with a simplified phong diffuse approximation that generalizes intensity of light based on the angle between the light position and the normal.

Lambertian shading with raytracing

Only using phong approximation for diffuse surfaces


Other Features


From previous iterations of this project throughout CSC 473, transformations of spheres and objects, texture mapping for spheres, and material shading for specular, dielectric, and diffuse surfaces had already been implmented

Resources