Toon Shading with Ramp, Diffuse, Hard-Edge Specular, Rim Light, and Dual Outlines
- Haoran Jia — Haoranji@usc.edu banded specular + rim light tuning, integration/support
- Shengjie Lin — slin0570@usc.edu rim integration, cleanup/documentation
- Weibo Xu — weiboxu@usc.edu ramp diffuse, depth buffer + depth edge support
- Raymond Zhang — yanzhezh@usc.edu toon shader core, silhouette integration
This project extends the CSCI 580 ray tracing homework framework with a stylized toon shading model.
We replace the original shading, adjust several modules, and add a depth-based post-processing step since the original pipeline does not provide a depth buffer.
- Toon diffuse with color ramp (colors + positions)
- Hard-Edge Specular with two thresholds
- Rim Light (Fresnel-like, view-dependent)
- Outlines
- Silhouette using |N·V|
- Depth Edge using Sobel on a generated depth buffer
- OBJ mesh support + basic primitives (e.g., spheres)
- Set up camera and allocate buffers
- Parse OBJ into triangles (retain simple primitives)
- Fire primary rays → intersection → toon shading
- Fill fragment buffer
- Apply depth-based outline post-process in place
Configured in main.cpp via ToonParams:
- Ramp:
rampColors,rampPositions - Specular:
specularThreshold1/2,specColorA/B, materialshininess - Rim:
enableRim,rimColor,rimIntensity,rimPower,rimThreshold - Outlines:
silhouetteThreshold,outlineColor,enableDepthEdges,depthEdgeThreshold
clang++ -std=gnu++17 -O2 src/*.cpp -o toon
./toon