Lighting is calculated by the use of the following formula:
The unit view vector (v) is given by the following equation:
The unit light vector (l) is given by the following equation:
The reflection vector (r) is given by the following equation:
The attenuation factor (p) is given by the following equation:
The attenuation factor is then clipped to a value from 0.0 to 1.0.