The way things look
© 2023-08-24 Luther Tychonievich
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License
other posts
How light interacts with things and lets us see them

When I was a student I learned about how light works and how it bounces off of objects to create visual appearance. In those days the model I was taught11 I outlined that model in post 385 ten years ago. didn’t quite match up to the real world. That is, if you combined everything I’d been taught in a computer simulation of appearance you’d get something that looked recognizably solid, but never quite like anything real.

It turns out that a few relatively simple advances fixed that: now you can have a computer simulate something that looks like its photographic reference. In this post I want to describe the few key pieces of shading that enable this.

Spread over a surface

Consider holding a piece of cardboard in the sunlight. If we hold the cardboard facing the sun, it sees as much light as it can. As we turn it away from the sun, fewer total photons hit it until when it is edge-on to the sun virtually no photons hit its face, even though neither light intensity nor cardboard size changed. When fewer photons hit the same area it appears dimmer. This angle-dependent amount of entering light is called Lambert’s Law22 Johann Heinrich Lambert published a formula for this angle dependence in 1760. and is a principle contributor to varying surface shading.

In and out

Most materials we interact with are a little bit transparent. Light enters them, but once inside gets bounced about by opaque bits and very soon exits again. Not all of the light makes it out: generally more than half gets absorbed33 A common absorption mechanism is an electron takes the photon’s energy and uses it to move a little further from its nucleus. Sometimes it can’t quite stay there, though, and falls back down to its old orbit re-emitting a new photon along the way. Perceptually we can usually treat that is if it bounces off of the atom instead of being absorbed and re-emitted, unless it either (a) takes a long time to be re-emitted (creating phosphorescence or the glow in the dark effect) or (b) absorbs one energetic photon but emits two or three lower-energy photos (creating florescence or the glow under black light effect)., and the rest gets so scrambled that it comes out going any which-way. The light that comes back out is called diffuse44 Diffuse means spread out; in this case, the light direction is spread out in all directions. and looks equally bright from all directions and is thus proportional to how much light is hitting the material.

Many organic materials (flesh, leaves, wood, bone, wax, milk, etc) and some inorganic (marble, jade) are so transparent that the light can come out a noticeable distance from where it entered. This is called subsurface scattering and reduces the visual crispness of light and dark, which makes things look softer, warmer, and more alive.

Off the surface

Sometimes photons bounce off the surface of material they encounter like a rubber ball off a wall. This happens because light moves more slowly in denser material than in less-dense material but it travels as a wave, and if your try to slow down a wave it both changes direction and loses volume55 The fast-moving and slow-moving sides of the wave have to line up. Thus it can’t change amplitude, and if it takes 2 femtoseconds for the wave to pass on the fast side it has to take the same time on the slow slide meaning it has less width on the slow side. Same amplitude with less width means less volume.; the excess volume has to go somewhere and the only way it can go that preserves the wave’s energy is in a second smaller wave that reflects ff the interface in the ball-off-a-wall direction. This bouncing is called the Fresnel effect66 Augustin-Jean Fresnel published an equation for how much bounces and how much enters in 1823. and is a principle contributor to shininess.

One of the interesting nuances of the Fresnel effect is that the amount of light that bounces instead of entering is higher the steeper the angle of incidence is. Light hitting the material head-on is likely to enter, while light hitting it at a steep angle is likely to bounce off. You’ve observed this with ponds and puddles: look down and they seem transparent, look from the side and they seem reflective.

All transparent materials have this same property, even if the photons that enter almost immediately get scattered about and exit again, and thus all are shiny. It is likely that every non-metal77 Metal is special. Because it is very electrically conductive and light is eletromagnetic radiation, light can’t enter metal: it either bounces off the surface or it is absorbed. Common metals reflect 30–60% of light and absorb the rest. material you can see is transparent and has a Fresnel effect, bouncing 3–5% of light that hits it head-on and 100% of light that hits it at a glancing angle.

Everything is shiny, but only some things look shiny because some things are bumpy at the visual scale of light and others are smooth.

Little bumps, big effects

Your eye can see photons with wavelengths between roughly 400 and 700 nanometers. That’s a thousand times smaller than the width of a line drawn by a ball-point pen but several thousand times larger than the distanced between molecules in a solid. At that scale, matter seems pretty-well uniform: individual molecules aren’t as important as their aggregate shape. But matter we see as flat may well be bumpy at that scale, or vice versa. Visual-scale bumps are typically called microfacets.88 Micro because they are small. Facet because early models of them assumed little flat faces instead of smooth bumps.

When matter is visually-bumpy, the direction light bounces off of it depends on the slope of the microscopic part of a bump it hit. On a perfectly smooth object, bouncing light creates crisp reflections. As bumpiness increases those reflections spread out. Small bumps and a little spread in reflections makes the classic shine spot: the reflection is really of everything around, but because it is spread out a bit and pretty dim only the brightest lights are clearly visible. More spread makes things not seem shiny at all: even the bright lights’ reflections are spread out too far to be easily seen as such. When you get to a super-bumpy material like cardboard which (at the scale light operates) is a chaotic jumble of matted fibers, the shine spots are spread over basically the entire object and so not seen as such by us.

Bumps also have a self-shadowing effect. Just as low areas of hilly terrain are shadowed by the tops of the hills when the sun is low, so too low areas in bumpy surfaces are shadowed by high areas when the light is at a steep angle, creating an over-all darker visual result. The amount of darkening is dependent on the angle of the incoming light and the height of the bumps.

But that’s not all bumps do. The diffuse light created by light entering, bouncing around, and exiting again behaves differently in bumpy material, and differently at different scales of bumps.

If the bumps are smaller than the path light tends to travel before exiting the bumps have little visual impact: Lambert’s Law tells us how much light enters somewhere in the vicinity and the light moves around to hide the visual effect of the bumps.

But if the bumps are larger than the path light tends to travel before exiting then they change the appearance significantly. Light that hits the material head-on might hit the steep slope of a bump, being spread out over more local area and looking dimmer. Light that hits at a glancing angle might hit the side of a bump head-on, appearing brighter. In general, the gradual fall-off effect of shading described by Lambert’s law is reduced, resulting in a flatter appearance. A classic example of this is the moon: its mountains and craters and boulders and pebbles give it a much more uniform brightness on its lit side than the same shape would have it it were shrunk down small enough to fit in your hand.

And the rest

Most materials you look at are described above. But some aren’t.

Mirages and heat waves are caused by light bending in air. The color in oil slicks and some sunglasses are created by quantum wave interference. The sunset is red and the sky blue because air is only almost transparent, but every few miles a blue photon is scattered in a new direction. Raven feathers and compact discs have rainbows because the form diffraction gratings. Mirrors are extremely reflective because of the combined impact of the reflectivity of metal, the smoothness of glass, and total internal reflection. Rainbows appear because water droplets change the direction of light when it enters and exits the droplet by an amount dependent on the light’s color. Some rainbows have violet because they are actually two rainbows overlapping. Shine spots on straight glossy hair streak perpendicular to the hair strands because of the distribution of surface directions in clusters of aligned cylinders. And so on.

But most of the things you see are not these special cases. Instead, their appearance can be fully simulated by the combination of just four components:

  1. Lambert’s Law: Less light is spread over more space at steeper angles.
  2. Diffuse light: Light enters, bounces around, some is absorbed and the rest comes back out. If it goes a visible distance we call it subsurface scattering instead of diffuse lighting.
  3. The Fresnel Effect: Light reflects off of surfaces it enters, with more reflection at steep angles.
  4. Microfacets: Bumpiness at the scale light acts spreads out reflections and, if large enough, makes glancing-angle lighting brighter and head-on lighting dimmer.