<p>You are somewhat right: the rightmost image is not the sum of the three images to the left of it. It's easiest to see that the rightmost image doesn't even have the ambient contribution on the left-hand side of the central spheroid.</p>

<p>I've done an experiment with two modes of addition of the three images. In the resulting images below, on the LHS, with the label "Addition", is my result, on the RHS is the rightmost image from the OP.</p>

<ol>
<li>Simple, naive addition — as if the images were in linear RGB space (and retaining the result in this space). Here's the result:</li>
</ol>

<p><a href="https://i.sstatic.net/16AC8.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/16AC8.png" alt="simple addition comparison"></a></p>

<ol start="2">
<li>sRGB addition, i.e. the addition where we consider the images being in sRGB space (the default assumption on the web when no color profile is present), and so undo the sRGB gamma before actually adding color values, and apply it back afterwards. This will give the following result:</li>
</ol>

<p><a href="https://i.sstatic.net/tfGhF.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/tfGhF.png" alt="sRGB addition comparison"></a></p>

<p>So, you can see that both ways of adding colors result in a sharp border from the ambient lighting contribution — the leftmost image in the OP, while the rightmost supposed result doesn't have such a border on some sides.</p>

<p>I'm not really sure how the rightmost "Phong Reflection" image was created. It may have been manipulated, e.g. some gamma adjustment or something like that. But in any case, in both ways of addition above the image didn't get overexposed as you supposed it would.</p>

CC BY-SA 4.0
2019-05-31T21:08:29.187Z
I thought about it a bit, maybe they multiplied the diffuse, added the rest, averaged it out.
AnnoyinC
CC BY-SA 4.0
2019-05-31T21:12:47.437Z
@AnnoyinC well, in that case the product would be much darker.
Ruslan
CC BY-SA 4.0
2019-06-01T12:49:55.067Z
@Rahul that might be indeed. But why would they get negative values in the first place? From some dot product?
Ruslan
CC BY-SA 4.0
2019-05-31T20:53:26.313Z
2019-06-01T14:38:22.987Z
2019-06-01T14:38:22.987Z
Ruslan
<p>With an old-style Phong shader (as in your example), they really are just added together. Each of those things is a <em>contribution</em> to the overall amount of light, so they're just added together, the same way you add together the contribution from each light source.</p>

<p>Your intuition is right that you often end up with overexposed specular highlights with this style of shading. In a modern, physically-based pipeline, it's common to instead use an <em>energy-conserving</em> shader. The contributions of each layer (specular, clear-coat/lacquer, diffuse, subsurface) are still added together, but the amount of light in each layer reduces the <em>input</em> amount of light for the next layer. That is, if the surface is giving a strong specular reflection, it's reflecting most of the light, so less light is available for the diffuse layer. In the same way, any light that's reflected by the diffuse layer reduces the amount of light available for subsurface scattering.</p>

CC BY-SA 4.0
2019-05-31T17:09:30.390Z
You're conflating energy conservation, with light additivity, with the film's sensitivity function. You can have an energy conserving bsdf and still get "overexposed" images. The second paragraph of your answer is simply confusing in the context of the question and the "problem" of overexposure mentioned.
lightxbulb
CC BY-SA 4.0
2019-05-31T13:38:09.373Z
2019-05-31T13:38:09.373Z
Dan Hulme
<p>I'm kind of stuck on this one. When following a conventional, high-level shading tutorial, you'll come across these images that are like ambient + diffuse + specular = result, but I can tell that it's not straight addition (otherwise the picture would seem overexposed).</p>

<p><a href="https://i.sstatic.net/KnXE6.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/KnXE6.png" alt="enter image description here"></a></p>

<p>What's the "formula" for mixing two rgb colors?</p>

<color><shading>
How are colors really mixed?
AnnoyinC
# How are colors really mixed?

(Asked by: username_0 on 2019-05-31)

I'm kind of stuck on this one. When following a conventional, high-level shading tutorial, you'll come across these images that are like ambient + diffuse + specular = result, but I can tell that it's not straight addition (otherwise the picture would seem overexposed).

[![enter image description here](https://i.sstatic.net/KnXE6.png)](https://i.sstatic.net/KnXE6.png)

What's the "formula" for mixing two rgb colors?

**Tags:** color, shading


---

## 2 answers

### Answer by username_2 on 2019-05-31. Score: 4 | Accepted answer

With an old-style Phong shader (as in your example), they really are just added together. Each of those things is a *contribution* to the overall amount of light, so they're just added together, the same way you add together the contribution from each light source.

Your intuition is right that you often end up with overexposed specular highlights with this style of shading. In a modern, physically-based pipeline, it's common to instead use an *energy-conserving* shader. The contributions of each layer (specular, clear-coat/lacquer, diffuse, subsurface) are still added together, but the amount of light in each layer reduces the *input* amount of light for the next layer. That is, if the surface is giving a strong specular reflection, it's reflecting most of the light, so less light is available for the diffuse layer. In the same way, any light that's reflected by the diffuse layer reduces the amount of light available for subsurface scattering.

> **Comments:**
> **username_3**: You're conflating energy conservation, with light additivity, with the film's sensitivity function. You can have an energy conserving bsdf and still get "overexposed" images. The second paragraph of your answer is simply confusing in the context of the question and the "problem" of overexposure mentioned.  

---

### Answer by username_1 on 2019-05-31. Score: 1

You are somewhat right: the rightmost image is not the sum of the three images to the left of it. It's easiest to see that the rightmost image doesn't even have the ambient contribution on the left-hand side of the central spheroid.

I've done an experiment with two modes of addition of the three images. In the resulting images below, on the LHS, with the label "Addition", is my result, on the RHS is the rightmost image from the OP.

1. Simple, naive addition — as if the images were in linear RGB space (and retaining the result in this space). Here's the result:

[![simple addition comparison](https://i.sstatic.net/16AC8.png)](https://i.sstatic.net/16AC8.png)

2. sRGB addition, i.e. the addition where we consider the images being in sRGB space (the default assumption on the web when no color profile is present), and so undo the sRGB gamma before actually adding color values, and apply it back afterwards. This will give the following result:

[![sRGB addition comparison](https://i.sstatic.net/tfGhF.png)](https://i.sstatic.net/tfGhF.png)

So, you can see that both ways of adding colors result in a sharp border from the ambient lighting contribution — the leftmost image in the OP, while the rightmost supposed result doesn't have such a border on some sides.

I'm not really sure how the rightmost "Phong Reflection" image was created. It may have been manipulated, e.g. some gamma adjustment or something like that. But in any case, in both ways of addition above the image didn't get overexposed as you supposed it would.

> **Comments:**
> **username_0**: I thought about it a bit, maybe they multiplied the diffuse, added the rest, averaged it out.  
> **username_1**: @username_0 well, in that case the product would be much darker.  
> **username_1**: @Rahul that might be indeed. But why would they get negative values in the first place? From some dot product?  

---

