September 2018
Intermediate to advanced
472 pages
15h 36m
English
When shading with multiple light sources, we need to evaluate the reflection model for each light, and sum the results to determine the total light intensity reflected by a surface location. The natural choice is to create uniform arrays to store the position and intensity of each light. We'll use an array of structures so that we can store the values for multiple lights within a single uniform variable.
The following image shows a "pig" mesh rendered with five light sources of different colors. Note the multiple specular highlights:

Read now
Unlock full access