Time for Action: Directional Point Lights

In Chapter 3, Lights, we compared directional and positional lights:

In point lighting, for every point on the surface of our object, we compute the direction from the light to that point on the surface. We then do the same thing we did for directional lighting. Remember that we took the dot product of the surface normal (the direction the surface is facing) and the light direction. This gave us a value of 1 if the two directions matched, which means the fragment should be fully lit, 0 if the two directions were perpendicular, and -1 if they were opposite. We directly used that value to multiply the ...

Get Real-Time 3D Graphics with WebGL 2 - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.