Advanced Computer Graphics: Laboratory Project

<< PREV | INDEX | NEXT >>

Task 1A: Calculate the Ambient Lighting Term

Preparation

Locate $TASK 1A in the file carscene-1.fx. This is where you will do your changes in this task.

Description

The ambient lighting term is an approximation of indirect lighting. Indirect lighting is independent of lighting position and/or direction and therefore illuminates all sides of an object, even sides that face away from the light source. The material ambient color should be modulated with the ambient light value of the light source.

Hint

As seen in section 4.3.3 in the course book, the contribution of the ambient term can be written as:

    iambient = mambient * sambient

where we use * for modulation since this is how it is done in Cg. To calculate the dot product (scalar product) we instead use the intrinsic dot.

Build/run the application when you think you have completed this task. The final result should look like Figure 2.

Figure 2: Resulting image with ambient lighting enabled.

<< PREV | INDEX | NEXT >>