This is a final project for CIS 566.
- Name: Jiangping Xu
- PennKey: xjp
https://haco77.github.io/Skecth-Like-Rendering/
- The Sketch
The Flower. Generated by raymarching SDFs. It consists of 3 layers. For each layer, a repetition operation is performed on the petals. Each petal is part of a sphere with a symmetry operation.
Soft Shadow. Cast ray from the ground to the light source to create soft shadows. The shadow parameter is calculated as k * h / t, where h is the nearest distance to an obstacle and t is the distance traveled along the ray at the nearest point. k is a coefficient to control the size of the shadow.
Hatching. Multiply the Lambert shading color and grid color. Grid color is generated from sine functions.
Occluding Contours. Find the first point on a ray with has a local minimum SDF value and this value should be less than a given threshold.
Suggestive Contours. Find the local minimum of n(normal) dot v(view direction) in the projected view direction. \ - Textures. The sketch is rendered into a framebuffer and serves as a texture for the paper. The wood background of the scene is also a texture.
- The Pencil. Generated by raymarching SDFs. It consists of a hexagonal prism, a cone, a cylinder, and a capsule. Sine function noises are added to the radius of the cylinder to create the pattern of the metal part. I use Schlick's approximation to estimate the specular reflection coefficient and shade the metal accordingly.
- Anti-Alias. Compute four neighboring colors and average the result to anti-alias. For the speed of rendering AA is not used by default.
- Bounding Box. I use a bounding box for each SDF geometry to speed up the raymarching process. The bounding boxes are transformed to best fit the geometry. In implementation, rays are transformed instead of the bounding box when checking intersections.
- Vignette. Decay the color of each pixel according to the coordinates of the intersection of the rays to achieve a vignette effect.
