36
$\begingroup$

The classical way of shading surfaces in real-time computer graphics is a combination of a (Lambertian) diffuse term and a specular term, most likely Phong or Blinn-Phong.

Image from Wikipedia

Now with the trend going towards physically-based rendering and thus material models in engines such as Frostbite, Unreal Engine or Unity 3D these BRDFs have changed. For example (a pretty universal one at that), the latest Unreal Engine still uses Lambertian diffuse, but in combination with the Cook-Torrance microfacet model for specular reflection (specifically using GGX/Trowbridge-Reitz and a modified Slick approximation for the Fresnel term). Furthermore, a 'Metalness' value is being used to distinguish between conductor and dielectric.

For dielectrics, diffuse is colored using the albedo of the material, while specular is always colorless. For metals, diffuse is not used and the specular term is multiplied with the albedo of the material.

Regarding real-world physical materials, does the strict separation between diffuse and specular exist and if so, where does it come from? Why is one colored while the other is not? Why do conductors behave differently?

$\endgroup$

2 Answers 2

30
$\begingroup$

To start, I highly suggest reading Naty Hoffman's Siggraph presentation covering the physics of rendering. That said, I will try to answer your specific questions, borrowing images from his presentation.

Looking at a single light particle hitting a point on the surface of a material, it can do 2 things: reflect, or refract. Reflected light will bounce away from the surface, similar to a mirror. Refracted light bounces around inside the material, and may exit the material some distance away from where it entered. Finally, every time the light interacts with the molecules of the material, it loses some energy. If it loses enough of its energy, we consider it to be fully absorbed.

To quote Naty, "Light is composed of electromagnetic waves. So the optical properties of a substance are closely linked to its electric properties." This is why we group materials as metals or non-metals.

Non metals will exhibit both reflection and refraction. Non-Metals

Metallic materials only have reflection. All refracted light is absorbed. Metals

It would be prohibitively expensive to try to model the light particle's interaction with the molecules of the material. We instead, make some assumptions and simplifications.

Simplifying refraction

If the pixel size or shading area is large compared to the entry-exit distances, we can make the assumption that the distances are effectively zero. For convenience, we split the light interactions into two different terms. We call the surface reflection term "specular" and the term resulting from refraction, absorption, scattering, and re-refraction we call "diffuse". Splitting into diffuse and specular

However, this is a pretty large assumption. For most opaque materials, this assumption is ok and doesn't differ too much from real-life. However, for materials with any kind of transparency, the assumption fails. For example, milk, skin, soap, etc.

A material's observed color is the light that is not absorbed. This is a combination of both the reflected light, as well as any refracted light that exits the material. For example, a pure green material will absorb all light that is not green, so the only light to reach our eyes is the green light.

Therefore an artist models the color of a material by giving us the attenuation function for the material, ie how the light will be absorbed by the material. In our simplified diffuse/specular model, this can be represented by two colors, the diffuse color, and the specular color. Back before physically-based materials were used, the artist would arbitrarily choose each of these colors. However, it should seem obvious that these two colors should be related. This is where the albedo color comes in. For example, in UE4, they calculate diffuse and specular color as follows:

DiffuseColor = AlbedoColor - AlbedoColor * Metallic;
SpecColor = lerp(0.08 * Specular.xxx, AlbedoColor, Metallic)

where Metallic is 0 for non-metals and 1 for metals. The 'Specular' parameter controls the specularity of an object (but it's usually a constant 0.5 for 99% of materials)

$\endgroup$
8
  • 1
    $\begingroup$ Why does the incident ray is split after reflection/refraction? If the light is a particle does that means that that this particle recursively split? And if the light is a wave does that means that is splits by frequency (but in this case why it splits after second/third/etc hit)? $\endgroup$ Commented Sep 18, 2015 at 6:59
  • 5
    $\begingroup$ The particle does not split. Rather, the images show the potential paths it could take. $\endgroup$
    – RichieSams
    Commented Sep 18, 2015 at 7:03
  • 2
    $\begingroup$ Many particles will hit the (nearly) same spot from the (nearly) same angle. For every particle going out there is (usually) a particle that went in. That means that averaged out the beam of particles from a certain angle on a certain spot gets split up in several (a lot) reflections. $\endgroup$ Commented Sep 18, 2015 at 9:09
  • 1
    $\begingroup$ Great answer shedding light on most of my questions. Why is the specular part of non-metals colorless and not affected by the albedo? How and where does polarization come into play? $\endgroup$
    – David Kuri
    Commented Sep 18, 2015 at 10:58
  • 1
    $\begingroup$ "A material's observed color is the light that is not absorbed." At this point it might be worth referencing the Are there common materials that aren't represented well by RGB? discussion, as fluorescent materials spring to mind. $\endgroup$
    – Simon F
    Commented Sep 18, 2015 at 11:01
23
$\begingroup$

I was actually wondering about exactly this a few days ago. Not finding any resources within the graphics community, I actually walked over to the Physics department at my university and asked.

It turns out that there are a lot of lies we graphics people believe.


First, when light hits a surface, the Fresnel equations apply. The proportions of reflected/refracted light depend on them. You probably knew this.

There's no such thing as a "specular color"

What you might not have known is that the Fresnel equations vary based on wavelength, because the refractive index varies based on wavelength. The variation is relatively small for dielectrics (dispersion, anyone?), but can be enormous for metals (I presume this has to do with these materials' differing electric structures).

Therefore, the Fresnel reflection term varies by wavelength, and therefore different wavelengths are reflected preferentially. Seen under broad-spectrum illumination, this is what leads to specular color. But in particular, there is no absorption that magically happens at the surface (the other colors are just refracted).

There's no such thing as "diffuse reflection"

As Naty Hoffman says in the talk linked in the other answer, this is really an approximation to outscattered subsurface scattering.

Metals DO transmit light

Naty Hoffman is wrong (more precisely, simplifying). Light does not get absorbed immediately by metals. In fact, it will pass quite handily through materials several nanometers thick. (For example, for gold, it takes 11.6633nm to attenuate 587.6nm light (yellow) by half.)

Absorption, as in dielectrics, is due to the Beer-Lambert Law. For metals, the absorption coefficient is just much larger (α=4πκ/λ, where κ is the imaginary component of the refractive index (for metals ~0.5 and up), and λ is given in meters).

This transmission (or more accurately the SSS it produces) is actually responsible for a significant portion of metals' colors (although it is true that metals' appearances are dominated by their specular).

$\endgroup$
6
  • 3
    $\begingroup$ Thank you! I only knew the simplifications. These extra details are awesome $\endgroup$
    – RichieSams
    Commented Sep 21, 2015 at 6:07
  • 1
    $\begingroup$ This is a fascinating answer. Could you clarify/link the acronym SSS please? $\endgroup$ Commented Sep 21, 2015 at 20:28
  • $\begingroup$ Thanks :) If you clarify it in the question, it will survive deletion of the comments (which are not guaranteed to be long lived). I've edited in a link and hover text which hopefully leaves your intended presentation intact. $\endgroup$ Commented Sep 22, 2015 at 9:48
  • 2
    $\begingroup$ While i do appreciate the pedantry of this answer. Sub surface scattering is considered a mm scale effect while its true that at molecular ranges everything passes the surface to some degree. But the base constraint is that we are generally counting mm scale effects and trying to abstract lower levels as statistical models. Hence micrometer is equal to immediately as most pixels see much greater area than this. Same applies to color which does not meaningfully exist in physics the same way as our eyes and brain precieve it $\endgroup$
    – joojaa
    Commented Sep 22, 2015 at 13:38
  • $\begingroup$ Do you have sources to recommend on the fact that metals do transmit light? What is the order of magnitude of the contribution to the perceived color? $\endgroup$ Commented Apr 8, 2016 at 8:03

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