For my final project in the Become a Technical Artist course taught by Aaron Aikman and Evan Edwards through ELVTR, I chose to look at creating a stylized shader using Blueprints and HLSL in Unreal.
Fundamentally, the material is based around a few simple concepts stacked together - Gooch style shading(as opposed to Lambertian falloff), quantization to produce cel shading/banding effects, a sine operation to produce cross hatching, and an edge detection effect using the normals to create an outline.
The end goal was to produce a shader that was less high contrast/graphic feeling than a standard stylized material, but rather a softer look that would simulate the feeling of bounce lighting and indirect inherently. In particular I was inspired by some of the shading effects seen in The Legend of Zelda: Breath of the Wild, especially the Hyrule Plains, where the trees and hills showed soft transitions from light green in the direct sun to a darker green and secondary blue tones from the sky. Gooch shading was ideal for simulating this effect, as it naturally transitions between 2 or more colors depending on the angle of view and direction of the light.
The above is the equation that describes Gooch shading. Another key resource I looked at for this project was Non Photorealistic Rendering by Bruce and Amy Gooch, which also describes this equation.
Fundamentally it’s very simple, I is a normalized vector in the direction of the light source, in this case the primary sun in Unreal, and n is a normalized vector of the surface normal. 1 + the dot product of these two vectors is divdid by 2, then multiplied against a color value, k. By adding k cool to k warm, the result is color final, which is a blend between the two colors depending on the angle of the surface vs the light source. Effectively, k cool will be shown in the areas exposed to light, and k warm will be shown in the shadowed areas, with a smooth transiton between the two(or vice versa, depending on the color selected; k cool and k warm could both be 2 similar colors).
Gooch shading in Unreal
My goal was to implement a version of this with many additional parameters for stylization that could be enabled by the user to achieve a hand drawn look, specifically an effect that approximately simulated water color painting with pen and ink outlines and hatching, not unlike many comics or the look of Calvin and Hobbes. In part two and beyond I’ll dive into the shader network I built and document it’s functionality.