Home Creators Posts Import Register Favorites Logout

Content

In the domain of Physically Based Rendering (PBR), one of the most complex topics is specularity, also known as glossiness, reflectivity and, of course… shininess! There are many resources exploring the physics and math governing the reflectivity of materials, but they're often highly technical. This article will present a practical crash course, explaining the general scientific context and how it applies to our work as CG artists.

All renderers use basically the same math to calculate reflections, but each one has different parameters and naming conventions. I’ll focus on RenderMan, mainly because it offers the most granular control. However, everything discussed here will apply generally to Cycles, Arnold, V-Ray and more.

What Is a Reflection?

A funny question, perhaps, since we all intuitively know what reflections are in real life. A bathroom mirror reflects our face, a lake reflects the sky, a billiard ball reflects a lamp on the wall. But what exactly is happening in each of these cases?

Simply put, a reflection is a light ray, emitted from a light source, that bounces off an object and into our eye (or a camera). The modifications to the bounced light by the material it encounters are what gives objects their distinctive look.

Broadly speaking, there are two categories of material: dielectrics and conductors. Conductors conduct electricity and dielectrics do not. (There is another category, semi-conductors, but that’s not too important when talking about PBR.) For our purposes, conductors are metals and dielectrics are everything else: water, glass, plastic, fabric, etc.

The math describing the reflectivity of dielectrics and conductors was solved hundreds of years ago with the Fresnel equations. All 3D renderers use standard approximations of these formulas. Approximations are necessary because the computations would otherwise slow rendering down to an unacceptable degree.

With respect to reflectivity, the Fresnel equations describe how the intensity of light is affected relative to the angle at which light hits a surface. In the case of dielectrics, light that hits a surface head on, that is, at a zero degree angle relative to the surface normal (the facing angle), has greatly reduced energy. As a light ray approaches a 90 degree of incidence angle (the glancing angle), the strength of the reflection approaches 1 (or 100%).

In this diagram we see that a light ray coming from a sharp angle relative to the normal (N) will be reflected outwards at the same sharp angle. Ai always equals Ar, or, as the old saying goes, angle of incidence equals angle of reflection.

Following this rule, a ray coming from straight ahead will be reflected straight back.

Let’s look at what this means in practice and see how RenderMan in particular implements these concepts.

Specularity in Practice

RenderMan has a Primary Specular parameter group that sets the reflective behavior of a material. All other renderers have a similar parameters, but often with somewhat different implementation and terminology.

Right away we have many choices. We can choose Artistic or Physical mode, then set Edge Color, Face Color, IOR, Extinction Coefficient, Roughness, and more.

Let’s look at Artistic mode. If we read the tooltips we learn that RenderMan assigns Face Color to the 0 degree angle of incidence and Edge Color to 90 degrees.

While RenderMan exposes the Edge Color parameter to the artist, it should be noted that no real materials would ever have an edge color that is not “white” or, more precisely, 100% of the color and intensity of the incoming light ray. In RenderMan this means that the Edge Color should always be 1 (or very close), meaning it’s a 1x multiplier of the incoming light ray.

What about Face Color? When rendering any dielectric material, the Fresnel equations dictate that light reflected at 0 degrees relative to the normal will have drastically reduced energy, usually in the range of 4%. In RenderMan this means our Face Color should be 0.04 or so.

(Note that no dielectric materials naturally tint their reflections. “Artistic” mode lets us do just that, be artistic. We could have an object with blue edge tint and 10% strength red face tint. That wouldn’t be physically correct, but it works if that’s the look you want.)

For a physically correct dielectric, an Edge Color of 1 and a Face Color of 0.04 will get you most of the way there, the rest is just dialing in roughness. Briefly, roughness describes to what degree light rays are diffused by microscopic imperfections on a surface. A surface with many imperfections will create blurry reflections, while a surface polished to a shine with few imperfections will reflect back a mirror image.

As you can see from the below sample, RenderMan is running the math as we’d expect. This sphere has a light in front of it with an intensity of 1 and a light behind, also with an intensity of 1. The sphere material has a diffuse weight of 0 just so we know we’re only seeing the specular component. In the reflections we can clearly see the Fresnel equations in action. The central, 0 degree, reflection has a color value of 0.04, a 4% multiplier of the incoming light. The edges of the sphere approach 1 (white) as the angle of incidence of the reflected rays approaches 90 degrees.

Now let’s check out Physical mode. I prefer this mode for all types of materials, but it’s especially important when rendering metals (conductors). The main difference between conductors and dielectrics is that conductors tint the reflected light at facing angles, gradually falling off to white at the edges.

This behavior is why the Extinction Coefficient parameter becomes necessary. This is a color value that has been scientifically deduced from real world materials. When using Physical mode we’ll also need the Index of Refraction of the material (IOR).

IOR describes how light is refracted (bent) within translucent materials. Refraction is the process by which light is redirected and slowed down when transitioning from (usually) air to a material such as glass or water. Reflections can also be derived from IOR using the Fresnel equations. If you know IOR, you know how the object reflects light.

There are many great resources online that provide IOR and extinction values for common materials, such as: https://balyberdin.com/tools/ior-list/

How does this apply to RenderMan’s Physical mode? When setting the values for conductors, we’ll need an IOR and Extinction Coefficient. IOR is often denoted by n and extinction by k. Refer to a material in the link above, set n and k as desired, edge color to 1, add a little roughness and, voila, we’ve got some very realistic metal!

What about dielectrics in Physical mode? Most dielectric materials have an IOR around 1.5. You can look up more specific numbers if needed: some might be 1.49, like acrylic, or even 1.33 for water. Interestingly, 1.5 happens to translate to a 96% reduction in facing angle reflection intensity. A material using Physical mode and an IOR of 1.5 will exactly match our Artistic mode test with a Face Color of 0.04. (Note that RenderMan says to set extinction to 0 for dielectrics.)

Final Thoughts

This article gave you a strong foundation for understanding how PBR renderers calculate reflections. RenderMan is a great case study since it exposes a lot of advanced parameters, but these principles apply to all modern renderers. (Incidentally, I don’t think any other renderers have an Edge Color parameter, showcasing how that one is intended to essentially be hard-coded to 1.)

Check out your favorite renderer and now you’ll be able to quickly deduce the scientific purpose of each parameter. Knowing how real world objects behave not only helps you create more realistic materials, but will also help you artistically deviate in a convincing way since you know how the science works.

Files

Comments

No comments found for this post.