1. 11

  2. 5

    It’s also used for lighting calculations because of the same properties that enable this kind of culling. You can almost see how this works in the author’s fish example (imagine the fish is a light source).

    When the direction the light is shining and the surface normal are perfectly aligned, the dot product will be -1 or 1. As the surface normal rotates away from the light, the dot product begins to tend towards zero. Thus you can calculate the lit colour of a surface as something roughly like

    lightAmount = abs(dot(surfaceNormal, lightPosition))

    litColour = lerp(surfaceColour, lightColour, lightAmount)