YouTube

Got a YouTube account?

New: enable viewer-created translations and captions on your YouTube channel!

English subtitles

← Two Tone Shading - Interactive 3D Graphics

Get Embed Code
2 Languages

Showing Revision 2 created 05/25/2016 by Udacity Robot.

  1. Here's one way to code the answer. We still compute the diffuse component, but
  2. no longer take a maximum value, since we're going to compare it to uBorder. The
  3. comparison here then changes the diffuse value so it gives a cartoony effect.
  4. Here's a more compact solution, using a conditional operator instead of a
  5. full-blown if, then, else statement. This critical angle rule is entirely
  6. arbitrary of course. You could even try more elaborate rules. For example, this
  7. code gives three levels of illumination. It gives an image with a different
  8. feel, a bit more depth and a little less cartoony. This type of effect was
  9. almost impossible with the old fixed function pipeline. With shaders it's easy
  10. to experiment with different illumination models.