Advanced Computer Graphics: Laboratory Project

<< PREV | INDEX | NEXT >>

Task 1B: Calculate the Diffuse Lighting Term

Solution (Example)

float intensity = max(0, dot(normal, directionToLight));

return light0diffuse * materialDiffuse * intensity;

Notice how the diffuse lighting term affects the model:

Figure 3: Resulting image with diffuse and ambient lighting.

<< PREV | INDEX | NEXT >>