Shader Learn

07 Surfaces and light

Highlights: the view joins in

Diffuse only looks at the light; a highlight also depends on where you look from. Turn the sphere and compare.

2256
01
-22

Runs once per pixelDrag numbers, or edit the code

JS sidegl.uniformMatrix4fv(uModel, …) // rotation -0.35 / 0.10

Highlights depend on the view: H is halfway between light and view, and the closer N is to H the brighter; a larger exponent makes a smaller, sharper spot.

Try it

  • Raise shininess from 8 to 128
  • Turn the sphere: does the highlight move?