What is diffuse reflection?

Diffuse reflection is a fundamental process in illuminating the 3D objects in a scene. It plays a significant role in these objects' perceived depth and texture. 

Diffuse or Lambertian reflection is a common form of light reflection used in computer graphics. It describes the way light interacts with the surface of objects. When light hits an object, it gets scattered in multiple directions rather than reflecting in a single direction. It provides the basic colors and shadings to the objects.

Lambert's cosine law and diffuse reflection

Diffuse reflection in computer graphics is modeled using Lambert’s cosine law.

The intensity of the diffusely reflected light is proportional to the cosine of the angle between the surface normal and the direction of the light source.

Where,

  • II is the intensity of the light observed.

  • I0I_0 is the maximum intensity of the light.

  • θ\theta is the angle between the direction of the light and the surface normal.

The mathematical perspective

The color cc of the surface is proportional to the cosine of the angle between the surface normal and the direction of the light.

The cosine of the angle between the surface normal (n\mathbf{n}) and the direction of the light source (l\mathbf{l}) can be calculated as given below.

Where,

  • Normal (nn): The normal is a vector that is perpendicular to the surface at the point of interest. 

  • Light vector (ll): The light vector is a directional vector from a point towards the light source. 

  • Angle between ll and nn (θ\theta): It is the angle between the light vector and the normal vector.

Lambert's cosine law
Lambert's cosine law

nn and ll are often normalized (n=l=1|\mathbf{n} | = |\mathbf{l}| = 1) which simplifies the formula as given below.

The above equation shows that as the angle between n\mathbf{n} and l\mathbf{l} decreases (making nl\mathbf{n} \cdot \mathbf{l} larger), the surface color becomes brighter and vice versa.

The equation can be rewritten as given below.

The exact amount of the diffuse reflection (IdiffI_{diff}) can then be determined by multiplying the cosine of the angle (cosθ\cos\theta) by the intensity of the light (IlI_l) and the diffuse reflection coefficient (kdk_d) of the surface.

Where,

  • IlI_l is the light source intensity

  • kd=mdCk_d = m_dC is the surface reflectance coefficient [0  1][0 \; 1] and the color

  • θ\theta is the angle between the normal (n\mathbf{n}) and the light (l\mathbf{l})

Since the value of the cosine of the angle is known to be n.ln.l, the above equation can be rewritten as given below.

Note:

  • The diffuse reflection coefficient (kdk_d) lies between 00 and 11.

  • It represents the property of the material that determines how much it diffuses the incident light.

Handling backface lighting

To avoid calculating negative values when the surface is facing away from the light source (nl<0\mathbf{n} \cdot \mathbf{l} < 0), we use the maxmax function to ensure that the negative diffuse reflections are bounded to zero.

  • The max(0,nl)\max(0, \mathbf{n} \cdot \mathbf{l}) component means that if nl<0\mathbf{n} \cdot \mathbf{l} < 0, it is treated as 00 which indicates that no light is reflected in such cases.

The above equation avoids inaccurate negative reflections and prevents incorrect rendering of the backface lighting.

Diffuse reflection for surfaces away from the light
Diffuse reflection for surfaces away from the light

Examples

  • Same spheres lit differently from different lighting angles (independent of the viewing angle)

Diffuse reflection on the same spheres lit differently
Diffuse reflection on the same spheres lit differently
  • Same spheres but with different diffuse reflection coefficient (kdk_d)

Spheres with different diffuse reflection coefficient
Spheres with different diffuse reflection coefficient

When the value of kdk_d changes, the reflectance property of the surface changes.

  • A higher kdk_d means that the surface will reflect more light, making it appear brighter.

  • A lower kdk_d means that the surface will reflect less light, making it appear darker.

The variations of kdk_d can be used to represent a wide range of materials in computer graphics, from dull and matte surfaces (low kdk_d) to bright and reflective surfaces (high kdk_d).

Read more


Copyright ©2024 Educative, Inc. All rights reserved