The Diffuse Layer

The diffuse layer represents the bottom-most layer of my uber-shader where light is reflected almost uniformly across all directions, usually because the surface is extremely rough and light does not penetrate the surface to any noticeable effect. Reflected light can consist of light from punctual light sources, image sources, and/or reflections of other objects. In general, “the vast majority of visible objects are seen primarily by diffuse reflection.”

Lambertian Diffuse
Lambertian Diffuse
Raw diffuse light
Raw diffuse light

The most common diffuse shader model by far is the Lambert model. In this model, the micro-surface is assumed to be mirror-like and reflects light view-independently. The math is relatively simple: the amount of light reflected is “directly proportional to the cosine of the angle θ between the observer’s line of sight and the surface normal.” So, the light is strongest where the surface is pointing towards the light source, and it gradually fades out as the surface becomes more parallel with the direction of the light. However, many surfaces aren’t perfect mirrors at their micro-surface, so this model fails to accurately represent light reflected by rougher surfaces such as clay.

The Oren-Nayar model reasonably predicts the reflected light response of rough materials, so that is what I’m using as my diffuse layer. In addition to the parameters of the Lambert model, the Oren-Nayar model includes a single ‘roughness’ parameter that describes how rough the surface is. At a roughness of 0, the math simplifies down to the Lambert model. Increasing roughness scatters more light around the edges, so that light reflected from glancing angles is brighter than light reflected head-on. The following is a set of images with varying roughness values:

The Oren-Nayar model is easy to implement for punctual light sources, but I’ve also incorporated it for light bounced off of other objects and from image sources. So, adjusting the roughness parameter of the diffuse layer will accurately adjust all light received by the diffuse layer.