# Diffuse Reflection in Computer Graphics

Pre-requisites: Basic Illumination Models

Diffuse reflection is a fundamental concept in computer graphics that has a wide range of applications. In this blog post, we will explore the basics of diffuse reflection and its implications for computer graphics. We will also provide some practical examples of how diffuse reflection can be used to create realistic images.

## Diffuse Reflection:

When light strikes a surface, some of the light will reflect off of the surface. The angle at which the light reflects off the surface is determined by the surface’s normal, which is a vector perpendicular to the surface. The amount of reflected light also depends on the angle at which the light strikes the surface, as well as the roughness of the surface. Diffuse reflection is when light reflects off of a surface in all directions. This is opposed to specular reflection, which is when light reflects off of a surface in a single direction. Diffuse reflection is what gives surfaces their matte appearance.

Rough surfaces tend to cause more diffuse reflection than smooth surfaces. This is because rough surfaces have many different angles that they can reflect light off of, whereas smooth surfaces have fewer angles. The color of a diffusely reflecting object depends on the wavelength of the incoming light and the wavelength-dependent absorption coefficient of the material. For example, a red object will appear red because it absorbs all wavelengths of light except for red (which it then reflects).

## Types of Diffuse Reflection:

There are three types of diffuse reflection: Lambertian, Oren-Nayar, and Phong.

• Lambertian reflection is the simplest type of diffuse reflection. It assumes that the surface is perfectly diffuse, meaning that the angle at which light hits the surface has no effect on how much light is reflected. This results in a smooth, even reflection without any highlights or shadows.
• Oren-Nayar reflection is a more realistic type of diffuse reflection that takes into account the fact that light doesn’t always hit a surface evenly. It accounts for both the angle at which light hits the surface and the roughness of the surface. This results in a more natural-looking reflection with highlights and shadows.
• Phong reflection is the most realistic type of diffuse reflection. It takes into account not only the angle at which light hits the surface and the roughness of the surface but also the shininess of the surface. This results in a very natural-looking reflection with highlights, shadows, and specular reflections (the bright highlights you see on polished surfaces).

## Diffuse reflection equation

The diffuse reflection equation is given by:

```Rd = kd * I * max(0, n * l)
where,
Rd = diffuse reflectance
kd = diffuse reflectance coefficient
I = light intensity
n = surface normal
l = light vector```

Assuming we have a light source with an intensity of 500 lumens, a diffuse reflectance coefficient of 0.5, and a surface that is perpendicular to the light source, the diffuse reflection would be:

```Rd = kd * I * max(0, n * l)
Rd = 0.5 * 500 * max(0, 1 * 1)
Rd = 0.5 * 500 * 1
Rd = 250 lumens```

Let’s say a surface has a diffuse reflectivity coefficient of 0.5 and is illuminated by light with an intensity of 100 units. The surface normal is pointing directly towards the light source, so n * l will be equal to 1. The diffuse reflectance of the surface will be:

```Rd = 0.5 * 100 * max(0, 1)
Rd = 50 lumens```

One of the advantages of diffuse reflection is that it can help to create the illusion of a more three-dimensional object. This is because when light is reflected off of a surface, it creates shadows. By using diffuse reflection, these shadows can be softened, giving the object a rounder appearance.

Another advantage of diffuse reflection is that it can help to create an even coloration on an object. This is because all of the light that is reflected off of the surface is scattered in different directions. As a result, there are no areas that appear significantly lighter or darker than others.

There are several disadvantages of diffuse reflection that can impact the quality of computer graphics. One significant disadvantage is that it can cause “graininess” or “noise” in the image. This occurs because the light is scattered in many different directions when it hits a diffuse surface, which can result in a loss of detail and overall degradation of the image. In addition, diffuse reflection can also cause “washed-out” colors and decreased contrast. This is because the scattered light tends to wash out the colors and reduce the contrast between light and dark areas.

## Diffuse Reflection in Computer Graphics:

In computer graphics, diffuse reflection is the most basic form of reflection. It occurs when light strikes a surface and is scattered in many directions, giving the impression that the surface is rough. This type of reflection is what gives an object its matte finish.

There are two main ways to implement diffuse reflection in computer graphics: through a shader or through environment mapping.

• A shader is a small program that runs on the GPU and is responsible for calculating the color of each pixel on the screen. In order to create a diffuse reflection, the shader must take into account the angle at which the light hits the surface, as well as the roughness of the surface. The roughest the surface, the more scattered the light will be.
• Environment mapping is a technique where a texture map is used to simulate diffuse reflections. This texture map contains images of surrounding objects, which are then projected onto the object that needs to be rendered. This technique is often used for real-time rendering because it can be computationally expensive to calculate diffuse reflections using shaders.

Previous
Next