# Ambient Lighting

On the Wikipedia page for the Phong model, it says that the ambient term is a constant, and just gets added on to the other terms. But on other pages like LearnOpenGL it says you should take the ambient term and multiply it by the color of the object. Which one is correct?

• Note that later in the article, wikipedia says "When the color is represented as RGB values, as often is the case in computer graphics, this equation is typically modeled separately for R, G and B intensities, allowing different reflections constants k a , {\displaystyle k_{\text{a}},} k_{\text{a}}, k d {\displaystyle k_{\text{d}}} k_{\text{d}} and k s {\displaystyle k_{\text{s}}} k_{\text{s}} for the different color channels." – Cort Ammon Jul 6 '17 at 0:46

Correct is the OpenGL way. If you had a white light ( let's say vec3(255,255,255) ) and just simply added it to a blue object ( vec3(0,0,255) ), the object would seem to be white, which is wrong. But if you were to multiply these colors, the object would be fully illuminated and correctly blue (which is the desired product).

The thing with ambient light is that it is only influenced by the ambient light intensity and by the color of the object, which means it is not influenced by the lights position, direction or anything of the sort. That is why you can think of it as "simply adding it as a constant".

We use ambient light mostly to simulate reflected light in the scene, which is very hard to simulate otherwise (without raytracing). It's a fairly good and cheap alternative.

• Thank you! Your answer as well as Dan's answer covered my question very well. I'll make sure to use this new piece of knowledge. – Daniel Kareh Jul 5 '17 at 16:24

$$I_\text{p} = k_\text{a} i_\text{a} + \sum_{m\;\in\;\text{lights}} (k_\text{d} (\hat{L}_m \cdot \hat{N}) i_{m,\text{d}} + k_\text{s} (\hat{R}_m \cdot \hat{V})^{\alpha}i_{m,\text{s}})$$
In this equation, all the $k$ and $i$ terms are not numbers but colours (RGB intensities). This includes $k_a$ and $i_a$: the ambient colour of the object, and the ambient illumination colour, respectively. The ambient term isn't a constant: it's a product of an intensity and albedo, just like the specular and diffuse terms. The only difference is that the lighting and view directions aren't a factor in this term.
It's very unusual to have $k_a$ different from the diffuse colour, so you can think of it as multiplying by "the colour of the object". That said, it's quite common for $i_a$ to be a distinct colour: for example, if you're using a yellowish directional light for direct sunlight, you might want the ambient light to be blueish to stand in for skylight.