A toon (or cel
)
shader creates a cartoon-like image. A
common approach to toon shading is to limit the output colours to a set of
fixed intensity levels, implemented in a fragment shader.
Try writing your own toon shader to
output three different levels of red based on the light intensity (fIntensity)
at the fragment. For example,
- if
the intensity is greater than 0.75, output pure bright red (r = 1).
- else
if the intensity is greater than 0.5, output medium red (r = 0.6)
- otherwise,
output dark red (r = 0.3)
Hint: Output colour (call it fragColour)
is a vec4 – the last component is 1.0, i.e., (R, G, B, 1)
