The Theory of Lighting

Next, you will see many words that look very similar: Radiance, Irradiance...

I used to have a hard time understanding the relationship between these concepts until I read this article. I highly recommend that you read it too. This article is almost a retelling of the content of that article, and I have great respect for the original author. His explanation may be far easier to understand than mine.

Radiant Flux, Irradiance, Radiant Intensity

If you walk into a store to buy a light bulb, you usually care more about its wattage, that is, how many watts it has. This means that you are more concerned with how much energy this light bulb can emit per second, rather than how bright it can light up a certain area - which is related to the structure of your house.

image

We will refer to this concept as Radiant Flux.

Next, we will use Φ\Phi to represent this concept.

However, during rendering, we want to refine this value to facilitate further calculations. There are two ways to refine this value:

  • We want to know the energy under a specific solid angle
  • We want to know the energy received by a certain region
image

The former is the differential of Radiant Flux with respect to solid angle ω\omega. Called Radiant Intensity

I(ω)=dΦ(ω)ωI(\omega) = \frac{d\Phi(\omega)}{\omega}

The latter is the differential of Radiant Flux with respect to unit area A.Called Irradiance

E(p)=dΦ(p)dAE(p) = \frac{d\Phi(p)}{dA}
ℹ️
Here, pp represents a specific location.
  • Radiant Intensity:Imagine a point light source. If the solid angle is fixed, then the emitted energy is also fixed.
  • Irradiance: Imagine a piece of paper illuminated by a light source. If the paper is small enough, the energy reflected by the paper into the surrounding space depends solely on the position of the paper after being illuminated by the light source.

Clearly, there is some correlation between the two. Imagine a piece of paper under a point light source.

image

Based on the definition of solid angle, we can determine that the solid line in the diagram corresponds to the surface area of a sphere.

Asphere=wr2A_{sphere} = wr^2

If the angle between the surface normal and the direction of the light source is θ, then the relationship between the illuminated area and the surface area of the sphere is:

A=Aspherecosθ=ωr2cosθA = \frac{A_{sphere}}{\cos\theta} = \frac{\omega r^2}{\cos\theta}

If we substitute this equation into the expressions for Radiant Intensity and Irradiance, we can obtain:

E(p)=dΦ(p)dA=dΦ(p)dωr2cosθ=dΦ(p)cosθr2dω=dΦ(p)dωcosθr2=I(ω)cosθr2E(p) = \frac{d\Phi(p)}{dA} = \frac{d\Phi(p)}{d\frac{\omega r^2}{\cos \theta}} = \frac{d\Phi(p) \cos\theta}{r^2d\omega} = \frac{d\Phi(p)}{d\omega} \frac{\cos\theta}{r^2} = I(\omega)\frac{\cos\theta}{r^2}

This is the famous The Inverse Square Law. We will see this law when calculating direct lighting from a light source.

Radiance

The paper illuminated by a light source will emit energy to the entire surrounding area, like a thick and diffuse cloud.

image

However, during rendering, we are more concerned with the energy intensity at specific emission angles. We need to further subdivide this cloud of mist according to solid angles.

image

For this, we further define the concept of Radiance as "the solid angle density of irradiance."

L(p,ωo)=dE(p)dωocosθL(p,\omega_o) = \frac{dE(p)}{d\omega_o \cos\theta}

In order to differentiate from the angle of incidence, we have added a subscript "o" here.

Of course, we can further incorporate the definition of irradiance:

L(p,ωo)=d(dΦdA)dωocosθL(p,\omega_o)=\frac{d(\frac{d\Phi}{dA})}{d\omega_o \cos\theta}

This expression looks strange, let's rewrite it using partial differential symbols:

L(p,ωo)=2ΦωoAcosθL(p,\omega_o) = \frac{\partial^2\Phi}{ \partial \omega_o \partial A\cos\theta}

Surface Irradiance

Next, we need to further model the behavior of light bouncing.

In the previous analysis, we actually assumed that the lighting only came from a point source and there was no introduction of diffuse lighting.

This is clearly incorrect, as any surface can reflect light, and any surface can act as a light source. We must model this behavior.

image

To do this, we can introduce Irradiance for surfaces, just like we did for light sources.

image

In the previous analysis, we differentiated from left to right. Now let's integrate from right to left.

dE(p)dωo=L(p,wo)cosθ\frac{dE(p)}{d\omega_o} = L(p,w_o)\cos\thetaE(p)=ΩL(p,ωo)cosθdωoE(p) = \int_\Omega L(p,\omega_o)\cos\theta d\omega_o
ℹ️
Ω\int_\Omega indicate that we are integrating over a hemisphere.
image

If the surface does not absorb any energy and is not a self-luminous material, then according to the law of energy conservation, the integral of input Radiance should be equal to Irradiance, and also equal to the hemisphere integral of output Radiance.

Ah ha, Radiance acts as a needle and thread!

E(p)=ΩL(p,ωi)cosθdωiE(p) = \int_\Omega L(p,\omega_i)\cos\theta d\omega_i

BRDF and The Rendering Equation

To facilitate the distinction between input and output, we add an output subscript o to this item. This is our ultimate goal:

Lo(p,ωo)L_o(p,\omega_o)

Let's think about what our goal is? What we ultimately want to achieve is the value of this equation. How can we do that?

image

Let's go step by step in our deduction:

image

Radiance emitted from a certain surface has reached the current surface. Its Radiance intensity is:

Li(p,ωi)L_i(p,\omega_i)

Obviously we need to project the solid angle onto the current region, so we add a cosine term.

image
Li(p,ωi)cosθiL_i(p,\omega_i) \cos\theta_i

Unless it is a perfect mirror, the incident light will scatter at the current point.

image

The function that describes this scattering condition is the famous BRDF.

f(p,ωo,ωi)f(p,\omega_o,\omega_i)
image

Although there are a lot of arrows, we are currently only concerned with the one facing the camera.

image
f(p,ωo,ωi)Li(p,ωi)cosθf(p,\omega_o,\omega_i)L_i(p,\omega_i)\cos\theta

We have only considered one ray. Now let's consider all incident rays, so we need a hemispherical integral.

image
Ωf(p,ωo,ωi)Li(p,ωi)cosθdωi\int_\Omega f(p,\omega_o,\omega_i)L_i(p,\omega_i)\cos\theta d\omega_i

This is the definition of Lo(p,ωo)L_o(p,\omega_o)

Lo(p,ωo)=Ωf(p,ωo,ωi)Li(p,ωi)cosθdωiL_o(p,\omega_o) =\int_\Omega f(p,\omega_o,\omega_i)L_i(p,\omega_i)\cos\theta d\omega_i

Here is a small extension, let's try to solve the BRDF.

dLo(p,ωo)dωi=f(p,ωo,ωi)Li(p,ωi)cosθ\frac{dL_o(p,\omega_o)}{d\omega_i} = f(p,\omega_o, \omega_i) L_i(p, \omega_i) \cos\thetaf(p,ωo,ωi)=dLo(p,ωo)dωiLi(p,ωi)cosθ=1Li(p,ωi)cosθdLo(p,ωo)dωif(p,\omega_o,\omega_i) = \frac{dL_o(p,\omega_o)}{d\omega_i L_i(p,\omega_i) \cos\theta} = \frac{1}{L_i(p,\omega_i) \cos\theta}\frac{dL_o(p,\omega_o)}{d\omega_i}

According to the previous formula:We can start again from here and go back to Irradiance.

f(p,ωo,ωi)=dωidEi(p)dLo(p,ωo)dωi=dLo(p,ωo)dEi(p)f(p,\omega_o,\omega_i) = \frac{d\omega_i}{dE_i(p)}\frac{dL_o(p,\omega_o)}{d\omega_i} = \frac{dL_o(p,\omega_o)}{dE_i(p)}

Summary

There is an excellent summary of this discussion on Wikipedia with a fantastic image that encapsulates everything we've discussed.