3D Surfaces and Light (Part 1)

One thing that I have seen confuse many new 3D artists is how Diffuse, Specular, and Ambient settings in their surfaces affect the outcome of their renders. Since this can be sort of a big topic, I’m planning to split this discussion into 4 parts.

What Are We Trying To Do?

One thing a 3D artist needs to keep in mind is that everything we’re doing in the rendering engine is a simulation of reality. As rendering engines have become more sophisticated, that simulation is getting better, but we’re still talking about an approximation of reality. So, for this reason, I wanted to start by describing the reality that we’re trying to simulate.

Light Bounces

I’m sure you’re aware that the reason that we can see anything is because light strikes the object and bounces (reflects) off of it. In a perfect mathematical / physics world, light interacting with a perfect reflector would look something like this…

A perfect light reflection around the normal of the surface.

A perfect light reflection around the normal of the surface.

Naturally, most of the surfaces in the real world are not perfect mirrors. In the real world, materials can do three things with light. They can absorb it, reflect it, or transmit it. Cloth, plastic, metal, glass, they all interact with light in different ways. For the purposes of this 3 part discussion, we’re talking about reflection only.

Since we’re trying to simulate reality here, the rendering engine designers needed a way to model the various ways that materials interact with light. Since nobody (especially movie directors) likes to wait, they had to figure out very efficient ways to simulate the interaction of light with a surface.

Don’t Cut the Red Wire!

Sorry. Whenever I say “diffuse” out loud, I think of “defuse” and trying to disarm a bomb.

The first type of surface to light interaction to look at is the diffuse reflections. A dictionary definition of the word “diffuse” that fits our usage is: “Widely spread or scattered; not concentrated.” Or from Wikipedia “Diffuse reflection is the reflection of light from a surface such that an incident ray is reflected at many angles rather than at just one angle…”

In a picture, diffuse reflections would look something like this…

Light scattered in all directions simulating diffuse reflection.

Light scattered in all directions simulating diffuse reflection.

Now, you might be thinking “Wait a second! Light doesn’t really reflect all willy nilly like that!” And (silly word choices aside) you’d be correct. Light doesn’t reflect that way. What it does is to reflect within the tiny imperfections of a surface in such a way that it appears to reflect like this. Technically, we could try to model those imperfections, define them mathematically, and wait a few days for even simple images to render. Or we can accept that we’re trying to approximate reality, not create a light wave physics simulator.

What this means for the purposes of rendering is that it doesn’t (almost) matter what angle your camera is to the surface, if there is a diffuse factor to the surface shader, it will affect the resulting image. All three of the cameras in the illustration above would be able to “see” the diffuse reflection of the light source.

The one exception would be if the surface is between the light source and the camera. In that case, the diffuse reflection from that light souce could not be seen by the camera and it won’t have an effect on the final image.

Spectacular Speculator

Diffuse lighting isn’t very interesting all by itself. The other real life factor that surface shaders need to account for is highlights. While most of the light from a real life surface is similar to diffuse lighting, without the highlights of specular lighting, the model is going to look flat and unrealistic.

If we think of diffuse reflection as showing the part of a real world material which doesn’t match the perfect reflections in theoretical physics, then specular reflections are the part of the material which gets closer to the ideal world that the eggheads live in.

In 3D surface terms, a very important factor in specular lighting model is the roughness (sometimes called glossiness) factor of the material. Basically this setting controls how close to the perfect reflection angle the camera has to be in order for the specular highlight to be evident. So in the following illustration, Camera 1 can see the specular reflection, Camera 2 cannot.

Specular reflection showing the viewing angle based on the roughness setting.

Specular reflection showing the viewing angle based on the roughness setting.

How Rough Is It?

You’re probably wondering how roughness affects the angles. Basically, it there are two effects. First, the more rough a material is, the wider the range of angles at which the camera can see the highlight. However, increasing the roughness also causes the specular highlighting to be spread out over the surface. So while the highlight will be more visible, it will also be less pronounced. A lower roughness will keep the viewing angle more narrow, but will result in a more significant highlight effect.

By the way, if your surface shader / rendering engine uses the term “glossiness”, they are probably inverting the meaning. So, a higher setting is going to to result in a smaller, more intense highlight effect, while a lower setting will spread the highlight across the surface.

Note that there is one “special case” to this guideline. At VERY low roughness (0-2%) or high glossiness (98-100%) the visible angle range can actually get so small that the highlight will appear to disappear. This can lead one to think that there is “somthing wrong” with how your rendering engine does specular light. There isn’t, it’s just that extreme cases like that don’t reflect the real world.

It has a certain … ambience

In 3D rendering, both diffuse and specular reflections are based on the lights that are in the scene. However, in the real world light keeps on bouncing until the last of it is absorbed somewhere. If it didn’t when you were outside and the sun was shining, your shadow would be completely black. You wouldn’t be able to see anything that the sun wasn’t directly shining on.

In this modern era, 3D artists may (or may not) have a feature called “Global Illumination” (GI for short) to call on to represent this bouncy behavior of light. But GI can be an expensive computation and not all rendering engines support it. Before we had such nifty features, the rendering engine wizards came up with ambient lighting.

Basically ambient lighting says “not all light in the scene is defined by the lights”. Think of it as a global factor which can be applied to surfaces so that a light doesn’t specifically have to be shining on them. In most surface shaders, ambient lighting will be washed out or over ridden if either diffuse or specular light is detected on that part of the surface. But not always. So be careful in your settings of using high values for the ambient strength channel or you might get some unwanted results.

Wrapping Up

In the second part of this discussion, I’ll talk in more detail about how the values you set for the Diffuse, Specular, and Ambient channels are actually used in the surface shaders. For now, I hope that at least explaining why there are three different channels might help clear up some confusion for you.



  1. […] 3D Surfaces and Light (Part 1), I talked about the physics of what diffuse, specular, and ambient settings in a surface shader are […]

  2. […] continuing to build on the information I’ve shared in Part 1 (diffuse, ambient and specular) and Part 2 (shader basics) of how surfaces in 3D graphics are defined and how they interact with […]

  3. karl3d Said:

    For anyone following this, I corrected a mistake in my description of Glossiness in the Specular lighting section. And I added a discussion of why at the extreme values it appears that specular highlights disappear.

  4. […] Diffuse, Specular, and Ambient […]

  5. […] commonly used with specular reflections ( if that term is unfamiliar to you, see my discussion of Diffuse, Specular, and Ambient surface settings ). Shaders (aka materials) which have an anisotropic specular model allow you to […]

  6. […] Part 1 – What are we trying to do? […]

{ RSS feed for comments on this post} · { TrackBack URI }

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: