7
$\begingroup$

Ideal specular reflection is like a perfect mirror. I'm looking at the code to 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?

$\endgroup$
  • $\begingroup$ 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? $\endgroup$ – David Kuri Oct 11 '16 at 8:27
8
$\begingroup$

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 surface. However, even for optical flat surfaces Fresnel equation 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

However, in smallPt there's no Fresnel approximation (e.g. Schlick's 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

$\endgroup$
5
$\begingroup$

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.

$\endgroup$
5
$\begingroup$

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

$\endgroup$
  • $\begingroup$ 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. $\endgroup$ – PeteUK Oct 11 '16 at 15:14
  • $\begingroup$ 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. $\endgroup$ – Julien Guertault Oct 11 '16 at 15:27
  • $\begingroup$ 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. $\endgroup$ – Julien Guertault Oct 11 '16 at 15:34
  • $\begingroup$ 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? $\endgroup$ – PeteUK Oct 11 '16 at 18:52
3
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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