Advanced Computer Graphics: Laboratory Project

<< PREV | INDEX | NEXT >>

Task 1B: Calculate the Diffuse Lighting Term

Preparation

Locate $TASK 1B in the CgFX file 'carscene-1.fx'.

Description

When light strikes a diffuse surface the different wavelengths of the light is either absorbed or re-emitted in an arbitrary direction depending on the material properties. The final color that reaches the eye is the result of the wavelenghts emitted by the light source and reflected by the material. Since light is sent in all directions with equal probability the diffuse lighting term is view-independent.

For a more detailed description, see Chapter 4.3.1 in the course book.

Hint

The intensity of the diffuse lighting term should be zero if the angle between the normal and the directionToLight vectors is greater than Pi/2 (since photons emitted at these angles would be emitted into the material itself). You might want to use two of the intrinsic functions in Cg in order to complete this task:

dot - Returns the dot product of two vectors (the cosine of the angle between the vectors)
max - Returns a vector of the maximum value of each component from two vectors

Build/run the application when you have completed this task.


<< PREV | INDEX | NEXT >>