# What does the Roughness setting on a diffuse shader do?

What does the Roughness setting value in a Diffuse shader actually do?

The wiki says:

Surface roughness; 0.0 gives standard Lambertian reflection, higher values activate the Oren-Nayar BSDF.

But what does this mean in terms of how rays are affected?

Roughness of 1:

Roughness of 0:

The results are different, but what are the technical differences of how these shaders are calculated?

• I'm not enough of a mathematician to know if the answer to the question is included here, or not. – brasshat Jan 2 '16 at 6:47

Lambert discovered in 1760 "Lambert's cosine law", which says that the intensity of the diffusely reflecting light is proportional to the cosine of the angle between the direction of the incident light and the surface normal.

This, however, is inaccurate for several real-world objects with rough surfaces (for complicated reasons: masking, shadowing and interreflections). For example if the moon reflected the light in a Lambertian way, the moon's surface would be darker around the edges. Oren and Nayar created in 1993 the "Oren–Nayar reflectance model", which takes roughness into acount. The math is pretty complicated (you can check out the details at wikipedia...), but the important part is that there is a "roughness" parameter in the 0 - 1 range (which can be adjusted in the Blender node), and when the roughness is zero, then the Oren–Nayar reflectance becomes mathematically equivalent to the Lambertian reflectance.

It is completely normal that a diffuse sphere with roughness = 1 appears "shadeless" if it is illuminated with a light that is behind the camera - this is exactly what the moon looks like.

EDIT: The roughness of the "Diffuse BSDF" node is not the same as the roughness of the "Glossy BSDF" node, they should not have the same same value. (Physically bigger surface bumps/irregularities are needed for the diffuse roughness phenomenon than for the glossy roughness - while these bigger bumps are still smaller than the pixel size). Ideally you should have two different values/maps, but in practice most people either ignore the diffuse roughness, or use a multiplication factor. As this blog says:

Diffuse roughness is now calculated as glossy roughness * 0.33 instead of using the glossy roughness directly. After actually reading some docs on Oren-Nayer shaders (how useful) I found that most real-world surfaces will not exhibit sigma values beyond 0.5, with most topping out around 0.3. This is something I probably should’ve remembered from my LuxBlend days… Anyway, I thought for awhile on the best way to handle diffuse roughness in Simple PBR. Using glossy roughness directly led to weird velvety-looks with roughness=1. I thought about disconnecting it, or locking it at a value, or exposing it as its own parameter. After awhile, I decided on using the glossy roughness * 0.33. It’s kind of arbitrary, but it gives a decent result in most cases without having to manually set it.

For an in-depth explanation see this video (especially minutes 35-37): SIGGRAPH University - Introduction to "Physically Based Shading in Theory and Practice"

The diffuse shader scatters the light in all directions. But most of the light is scattered along the surface normal. A high roughness value spreads the light more evenly in all directions.

What the right value is depends on the material you want to simulate.

Better: If you have a roughness of 0, the amount of light a surface reflects depends mostly on how much the surface is facing the light source.

In your example of the sphere there is not a notable difference, however if you use a mesh with more edges, you notice the difference. The image below has been taken from http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Nodes/Shaders

As you can see, the mesh with more roughness shows more shadow around the edges. This is because rough surfaces reflect less light and show more shading than smooth surfaces.

• Thanks for your answer :) If I understand what you are saying correctly (that the rougher surface reflects less light), then the images seem to be the opposite. The rougher diffuse shader looks almost shadeless. (it seems brighter and the image with a roughness of 0 seems to have more shading). – gandalf3 Nov 29 '13 at 18:32
• You are right, it looks like the values should be the opposite. – Bas van Dijk Nov 30 '13 at 12:43
• This answer is wrong, the values should not be opposite, see my answer for details. – lbalazscs Jan 5 '16 at 6:01