<p>The specular of metals is a product of the light color and the albedo of the material. Only for non-metals is the color of the specular independent of the albedo, but it's also rather dim. A perfect mirror would therefore be a perfectly smooth metallic surface with an albedo of 1. So, you could say such a mirror would be white, rather than having no color.</p>

<p>A more realistic mirror would use something like silver for coating, with an albedo of (0.972, 0.960, 0.915). This color represents the percentage of the light of each frequency that is reflected by silver, so it needs to be multiplied with the color of the reflected light.</p>

CC BY-SA 3.0
2016-10-10T13:10:59.947Z
2016-10-10T13:10:59.947Z
Quinchilion
<p>In this context, "perfect mirror" refers to a perfectly flat surface with a 0% (pure black) diffuse color. It is still possible though to have a specular color: for example a Christmas tree ball behaves like a perfect mirror, but still tints the reflection. If you replace the 99% white color with a red tint, you will get the red Christmas ball look.</p>

<p>In <em>SmallPT</em>, spheres have two colors: <code>e</code> the emissive color and <code>c</code>. The trick is that <code>c</code> has two different meanings which depend on the material type <code>refl</code>:</p>

<ol>
<li>When <code>refl</code> is <code>DIFF</code>, <code>c</code> is interpreted as the diffuse color.</li>
<li>When <code>refl</code> is <code>SPEC</code>, <code>c</code> is interpreted as the specular color.</li>
</ol>

<p>So in the case #2, the diffuse is left out, which is equivalent to a 0%, pure black, diffuse color.</p>

<p>In case you haven't checked it already, this presentation is an excellent code explanation of <em>SmallPT</em>, dense but thorough: <a href="https://drive.google.com/file/d/0B8g97JkuSSBwUENiWTJXeGtTOHFmSm51UC01YWtCZw/view"><em>smallpt: Global Illumination in 99 lines of C++</em></a>.</p>

CC BY-SA 3.0
2016-10-11T15:14:28.313Z
I'm thinking how the concept of a specular colour makes sense when talking about perfect mirrors? Are you saying it's possible for all incoming light to be reflected at the interface and have it's colour (frequency) changed? Would the angle in incidence = angle of reflection? What physical process would bring about the change of colour? Sorry if I sound like a kid that asks more questions after just been given an answer.
PeteUK
CC BY-SA 3.0
2016-10-11T15:27:29.477Z
It's a bit more complicated. To try and fit the explanation in this comment: when light hits a surface, some will enter it (refraction), some will not and bounce (reflection). Whether it enters or not can depend on the light wavelength (hence the graphs in @JarkkoL's answer) and that's what gives gold its yellow appearance.
Julien Guertault
CC BY-SA 3.0
2016-10-11T15:34:50.497Z
In case that wasn't clear, I was referring to the copper and aluminum triple graphs: they represent the reflectance for red, green and blue wavelengths.
Julien Guertault
CC BY-SA 3.0
2016-10-11T18:52:47.273Z
Thanks for your replies. Regarding the light hitting the surface that doesn't bounce and gets refracted: we're not talking about perfect mirror (or ideal specular surface) anymore, right? Is this refraction and re-emission called a specular highlight (i.e. a bright spot)? Back to the contrived ideal specular surface where **all** light gets reflected: is there a possibility for the incident and reflected light to have different colours?
PeteUK
CC BY-SA 3.0
2016-10-10T14:47:30.623Z
2016-10-10T14:47:30.623Z
Julien Guertault
<p>Ideal mirrors are just that, ideal. The question if or not it has color never comes to play, its ideal it reflects everything. Like division by zero it is undefined. However, that does not mean you could not multiply your result by one its still the same result.</p>

<p>The problem is that we have succesfully mixed the concepts of intensity and color together. We simply assume in RGB that color is 3 independent intensities. Which is not at all true, its quite an simplification of how reality works. There really is such thing as a highly intense dark orange that RGB can not account for. So as such its hard to tell since we are conflating two independent things as one. But yes probably some energy being removed for reason unknown in that code.</p>

CC BY-SA 3.0
2016-10-10T13:13:55.717Z
2016-10-10T13:13:55.717Z
joojaa
<p>What "ideal" means in this context is that there is no divergence in the direction of light reflection vectors (i.e. no roughness) but that they are all considered to be perfect reflections from an <a href="https://en.wikipedia.org/wiki/Optical_flat" rel="noreferrer">optical flat</a> surface. However, even for optical flat surfaces <a href="https://en.wikipedia.org/wiki/Fresnel_equations" rel="noreferrer">Fresnel equation</a> is still applied in BRDF evaluation that changes specular reflection and is potentially wavelength dependent, which is a common characteristic with metals.</p>

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

<p>However, in smallPt there's no Fresnel approximation (e.g. <a href="https://en.wikipedia.org/wiki/Schlick%27s_approximation" rel="noreferrer">Schlick's approximation</a>) but the surface reflectance is simply multiplied with constant term which is wrong. Also 0.999 specular albedo is very high for any real material. Below is a table of specular reflectange of various metals &amp; dielectrics at normal incidence for reference:</p>

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

CC BY-SA 3.0
2016-10-10T14:20:03.860Z
2016-10-10T14:20:03.860Z
JarkkoL
<p>Ideal specular reflection is like a perfect mirror. I'm looking at the code to <a href="http://www.kevinbeason.com/smallpt/">SmallPt</a> and see that one of the spheres has an ideal specular material:</p>

<pre><code>Sphere spheres[] = {//Scene: radius, position, emission, color, material 
   / ...
   Sphere(16.5,Vec(27,16.5,47),       Vec(),Vec(1,1,1)*.999, SPEC),//Mirr
   / ...
 };
</code></pre>

<p>In the radiance calculation, this happens:</p>

<pre><code>  } else if (obj.refl == SPEC)            // Ideal SPECULAR reflection 
     return obj.e + f.mult(radiance(Ray(x,r.d-n*2*n.dot(r.d)),depth,Xi)); 
</code></pre>

<p>where <code>f</code> is the object colour of <code>Vec(.999,.999,.999)</code>.</p>

<p>I was surprised to see colour multiplication here. Doesn't an ideal mirror have no colour? I guess as <code>f</code> is <code>Vec(.999,.999,.999)</code>, effectively it's passing through the colour almost unchanged? Any thoughts on why .999 was used and not 1? I'm guessing this is something to do modelling a miniscule energy loss?</p>

CC BY-SA 3.0
2016-10-11T08:27:53.623Z
Current answers are avoiding your question why 0.999 is used instead of 1. Besides it making no real visual difference, I suspect that this number is chosen to avoid floating point errors which could result in an energy gain. Could anyone more familiar with IEEE 754 comment on that?
David Kuri
<raytracing><specular>
Should ideal specular multiply light colour with material colour?
PeteUK
# Should ideal specular multiply light colour with material colour?

(Asked by: username_0 on 2016-10-10)

Ideal specular reflection is like a perfect mirror. I'm looking at the code to [SmallPt](http://www.kevinbeason.com/smallpt/) and see that one of the spheres has an ideal specular material:

```
Sphere spheres[] = {//Scene: radius, position, emission, color, material 
   / ...
   Sphere(16.5,Vec(27,16.5,47),       Vec(),Vec(1,1,1)*.999, SPEC),//Mirr
   / ...
 };

```

In the radiance calculation, this happens:

```
  } else if (obj.refl == SPEC)            // Ideal SPECULAR reflection 
     return obj.e + f.mult(radiance(Ray(x,r.d-n*2*n.dot(r.d)),depth,Xi)); 

```

where `f` is the object colour of `Vec(.999,.999,.999)`.

I was surprised to see colour multiplication here. Doesn't an ideal mirror have no colour? I guess as `f` is `Vec(.999,.999,.999)`, effectively it's passing through the colour almost unchanged? Any thoughts on why .999 was used and not 1? I'm guessing this is something to do modelling a miniscule energy loss?

**Tags:** raytracing, specular

> **Comments:**
> **username_1**: Current answers are avoiding your question why 0.999 is used instead of 1. Besides it making no real visual difference, I suspect that this number is chosen to avoid floating point errors which could result in an energy gain. Could anyone more familiar with IEEE 754 comment on that?  

---

## 4 answers

### Answer by username_5 on 2016-10-10. Score: 8 | Accepted answer

What "ideal" means in this context is that there is no divergence in the direction of light reflection vectors (i.e. no roughness) but that they are all considered to be perfect reflections from an [optical flat](https://en.wikipedia.org/wiki/Optical_flat) surface. However, even for optical flat surfaces [Fresnel equation](https://en.wikipedia.org/wiki/Fresnel_equations) is still applied in BRDF evaluation that changes specular reflection and is potentially wavelength dependent, which is a common characteristic with metals.

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

However, in smallPt there's no Fresnel approximation (e.g. [Schlick's approximation](https://en.wikipedia.org/wiki/Schlick%27s_approximation)) but the surface reflectance is simply multiplied with constant term which is wrong. Also 0.999 specular albedo is very high for any real material. Below is a table of specular reflectange of various metals & dielectrics at normal incidence for reference:

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


---

### Answer by username_2 on 2016-10-10. Score: 5

The specular of metals is a product of the light color and the albedo of the material. Only for non-metals is the color of the specular independent of the albedo, but it's also rather dim. A perfect mirror would therefore be a perfectly smooth metallic surface with an albedo of 1. So, you could say such a mirror would be white, rather than having no color.

A more realistic mirror would use something like silver for coating, with an albedo of (0.972, 0.960, 0.915). This color represents the percentage of the light of each frequency that is reflected by silver, so it needs to be multiplied with the color of the reflected light.


---

### Answer by username_3 on 2016-10-10. Score: 5

In this context, "perfect mirror" refers to a perfectly flat surface with a 0% (pure black) diffuse color. It is still possible though to have a specular color: for example a Christmas tree ball behaves like a perfect mirror, but still tints the reflection. If you replace the 99% white color with a red tint, you will get the red Christmas ball look.

In *SmallPT*, spheres have two colors: `e` the emissive color and `c`. The trick is that `c` has two different meanings which depend on the material type `refl`:

1. When `refl` is `DIFF`, `c` is interpreted as the diffuse color.
2. When `refl` is `SPEC`, `c` is interpreted as the specular color.

So in the case #2, the diffuse is left out, which is equivalent to a 0%, pure black, diffuse color.

In case you haven't checked it already, this presentation is an excellent code explanation of *SmallPT*, dense but thorough: [*smallpt: Global Illumination in 99 lines of C++*](https://drive.google.com/file/d/0B8g97JkuSSBwUENiWTJXeGtTOHFmSm51UC01YWtCZw/view).

> **Comments:**
> **username_0**: I'm thinking how the concept of a specular colour makes sense when talking about perfect mirrors? Are you saying it's possible for all incoming light to be reflected at the interface and have it's colour (frequency) changed? Would the angle in incidence = angle of reflection? What physical process would bring about the change of colour? Sorry if I sound like a kid that asks more questions after just been given an answer.  
> **username_3**: It's a bit more complicated. To try and fit the explanation in this comment: when light hits a surface, some will enter it (refraction), some will not and bounce (reflection). Whether it enters or not can depend on the light wavelength (hence the graphs in @username_5's answer) and that's what gives gold its yellow appearance.  
> **username_3**: In case that wasn't clear, I was referring to the copper and aluminum triple graphs: they represent the reflectance for red, green and blue wavelengths.  
> **username_0**: Thanks for your replies. Regarding the light hitting the surface that doesn't bounce and gets refracted: we're not talking about perfect mirror (or ideal specular surface) anymore, right? Is this refraction and re-emission called a specular highlight (i.e. a bright spot)? Back to the contrived ideal specular surface where **all** light gets reflected: is there a possibility for the incident and reflected light to have different colours?  

---

### Answer by username_4 on 2016-10-10. Score: 3

Ideal mirrors are just that, ideal. The question if or not it has color never comes to play, its ideal it reflects everything. Like division by zero it is undefined. However, that does not mean you could not multiply your result by one its still the same result.

The problem is that we have succesfully mixed the concepts of intensity and color together. We simply assume in RGB that color is 3 independent intensities. Which is not at all true, its quite an simplification of how reality works. There really is such thing as a highly intense dark orange that RGB can not account for. So as such its hard to tell since we are conflating two independent things as one. But yes probably some energy being removed for reason unknown in that code.


---

