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?

  • $\begingroup$ 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." $\endgroup$
    – Cort Ammon
    Commented Jul 6, 2017 at 0:46

3 Answers 3


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.

  • 1
    $\begingroup$ 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. $\endgroup$ Commented Jul 5, 2017 at 16:24

The relevant equation on the Wikipedia page follows:

$$ 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.

  • $\begingroup$ Thank you! Both your answer and Michal's answer explained it to me very well. I'll have to remember this next time a code a shader. $\endgroup$ Commented Jul 5, 2017 at 16:23

I think we should have both and also have a factor based on material

Some material has high diffusive so it will reflect only light of its own color. But some material can also reflect some light as it is. For the phong shader I think we use additive ambient because phong object tends to reflect all light and so ambient light could be lit it with that light's color, but other lights was used to make diffuse color

On the contrary to lambert, if what I know is right, are material with high diffusion, and so the ambient light was added to the lit and multiply by material's color

I guess modern shader should have a parameter to set this factor and write equation like this

float factor; // 0.0 - 1.0 maybe reflectiveness?
float3 light = (factor * ambient.rgb); // ambient light
light += _MainLightColor.rgb * dot(normal,_MainLightDirection); // lambert
// maybe also specular
float3 color = ((1 - factor) * ambient.rgb) + (matColor * light);

Actually I take this concept from PBR material, there was a concept of energy conservation. All the light may lit the object by diffusion or reflection but to conserve energy, more diffuse color means lower reflection. And so ambient light just add more light energy, then get treat as the same as other light


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.