December 02, 2015

XLE now support a few area light types: sphere, tube & rectangle (with disc and maybe some other shapes coming soon). Maybe in a future post I'll go into some details about the implementation (actually, it's quite interesting!). But this post is about something different: this post is about why they are important.

I'm finding that it makes a huge difference. So much so that not only do we want to support area lights -- we also want to outlaw non-area lights. Point light sources are now the enemy!

PBR Concept

The biggest buzzword at the moment is Physically Based Renderering (or PBR, or sometimes Physically Based Shading). But what does that mean, really? Partially it means sampling values from the real world. But really it's just a container under which we're placing many related concepts.

One of these "sub-concepts" of PBR is the idea that a single material should work in many different lighting environments.

In the past, artists often tweaked the material settings for objects to suit the lighting environment they are in. This is a problem because it means that if the object moves into another lighting environment, the material settings must be tweaked to match.

This happen in both movies and games. In games, it's particularly a problem for games with a day/night cycle. In games where time is changing, the lighting environment is also always changing. Previously this means that extreme lighting settings (sunsets, etc) had to be more subtle than real-life. What we want is materials that look correct in all possible lighting environments.

Specular highlight size

There's a simple way to think about this. Let's consider the size of a specular highlight.

Here are 5 spheres rendered in Blender with Cook Torrence lighting.

Each sphere is reflecting the same light, but the material settings are changed to change the size of highlight in each sphere.

In older games, this was the only way to change the size of the highlight. If a highlight appeared too small or too big, an artist would change the material settings.

However there should be something else that should effect the size of the highlight: obviously, it's the shape of the light! We need area lights to achieve that.

New model for specular highlights

So, we have two important concepts to control the size of the specular highlights: - material roughness - light size

Notice that these ideas are simpler and clearer than concepts in older engines. Previously we might talk about "gloss" or "specular power" or "specular hardness." But what do those really mean?

Roughness is much clearer. It's just a single value between 0 and 1. And it's linear -- not exponential! It's probably the most important variable of our material model (other than Color, I guess).


Roughness controls the size of the highlight by spreading the light energy over a large area.

Notice the image above. In one extreme the highlight is a dense, concentrated point of light. In the other extreme, the specular light energy is spread out over a very large area, so that it appear almost like diffuse lighting.

This is critical for us because in XLE, all materials are reflective. But when the roughness is very high, the reflections get spread out over a very large area, so that they appear almost diffuse.

Also, both specular highlights and IBL reflections get spread out in the same way. Sometimes it's even difficult to tell what is a specular highlight, and what is a reflection.

Light size

With rectangle and sphere lights, the size of the highlight will change significantly with the size of the light (and also the distance to the light). But it changes in a very different way to roughness. Large lights give an appearance that just wasn't possible previously.

If we want to make a very large specular highlight, we can do that by changing the size of the light. So there is no need to tweak the material any more!

No more point lights

Now, the only problem with this is point lights no longer look correct. If the material is balanced correctly for use with area lights, then highlights from point lights will look unnaturally too small. This is logical, because point light sources don't exist in reality.

Fortunately, sphere lights are only slightly more expensive than point lights. And we can use the same BRDFs with sphere lights. So it's an easy transition.

So the solution is to always use area lights, and never use point lights.

Authoring material settings

Even though we've created a separation between material settings and lighting environment settings, I'm still finding that we will probably need some kind of standard lighting environment for authoring the material settings.

That is, the values that artists will select for roughness may vary with the lighting environment they are testing with.

Probably an Image Based Lighting environment would be best for this. This is a great reason why BRDF for IBL and dynamic lights should match as closely as possible. We should author the material settings in a 100% IBL environment, and then we should expect that dynamic lights should just work.

Simpler... and better

So, I found that area lights are critical to the PBR concept. So much so that an engine that doesn't support area lights shouldn't properly be called PBR.

And I think it meets two important concepts of PBR: - materials should look correct in all lighting environments - it should be simpler and better (at the same time)

3 cheers for area lights!

blog comments powered by Disqus