## 5.5 Working with Radiometric Integrals

One of the most frequent tasks in rendering is the evaluation of integrals of radiometric quantities. In this section, we will present some tricks that can make this task easier. To illustrate the use of these techniques, we will use the computation of irradiance at a point as an example. Irradiance at a point with surface normal due to radiance over a set of directions is

where is the incident radiance function (Figure 5.12) and the term in this integral is due to the term in the definition of radiance. is measured as the angle between and the surface normal . Irradiance is usually computed over the hemisphere of directions about a given surface normal .

### 5.5.1 Integrals over Projected Solid Angle

The various cosine terms in the integrals for radiometric quantities can
often distract from what is being expressed in the integral. This problem
can be avoided using *projected solid angle* rather than solid angle
to measure areas subtended by objects being integrated over. The projected
solid angle subtended by an object is determined by projecting the object
onto the unit sphere, as was done for the solid angle, but then projecting
the resulting shape down onto the unit disk that is perpendicular to the
surface normal
(Figure 5.13). Integrals over hemispheres of
directions with respect to cosine-weighted solid angle can be rewritten as
integrals over projected solid angle.

The projected solid angle measure is related to the solid angle measure by

so the irradiance-from-radiance integral over the hemisphere can be written more simply as

For the rest of this book, we will write integrals over directions in terms of solid angle, rather than projected solid angle. In other sources, however, projected solid angle may be used, and so it is always important to be aware of the integrand’s actual measure.

Just as we found irradiance in terms of incident radiance, we can also compute the total flux emitted from some object over the hemisphere surrounding the normal by integrating over the object’s surface area :

### 5.5.2 Integrals over Spherical Coordinates

It is often convenient to transform integrals over solid angle into integrals over spherical coordinates . Recall that an direction vector can also be written in terms of spherical angles (Figure 5.14):

In order to convert an integral over a solid angle to an integral over , we need to be able to express the relationship between the differential area of a set of directions and the differential area of a pair (Figure 5.15). The differential area is the product of the differential lengths of its sides, and . Therefore,

We can thus see that the irradiance integral over the hemisphere, Equation (5.4) with , can equivalently be written as

If the radiance is the same from all directions, the equation simplifies to .

For convenience, we’ll define two functions that convert and values into direction vectors. The first function applies the earlier equations directly. Notice that these functions are passed the sine and cosine of , rather than itself. This is because the sine and cosine of are often already available to the caller. This is not normally the case for , however, so is passed in as is.

The second function takes three basis vectors representing the , , and axes and returns the appropriate direction vector with respect to the coordinate frame defined by them:

The conversion of a direction to spherical angles can be found by

The corresponding functions follow. Note that `SphericalTheta()`
assumes that the vector `v` has been normalized before being passed
in; the clamp is purely to avoid errors from `std::acos()` if
is slightly greater than 1 due to floating-point round-off error.

### 5.5.3 Integrals over Area

One last transformation of integrals that can simplify computation is to turn integrals over directions into integrals over area. Consider the irradiance integral in Equation (5.4) again, and imagine there is a quadrilateral with constant outgoing radiance and we’d like to compute the resulting irradiance at a point . Computing this value as an integral over directions is not straightforward, since given a particular direction it is nontrivial to determine if the quadrilateral is visible in that direction. It’s much easier to compute the irradiance as an integral over the area of the quadrilateral.

Differential area is related to differential solid angle (as viewed from a point ) by

where is the angle between the surface normal of and the vector to , and is the distance from to (Figure 5.16). We will not derive this result here, but it can be understood intuitively: if is at distance 1 from and is aligned exactly so that it is perpendicular to , then , , and Equation (5.6) holds. As moves farther away from , or as it rotates so that it’s not aligned with the direction of , the and terms compensate accordingly to reduce .

Therefore, we can write the irradiance integral for the quadrilateral source as

where is the emitted radiance from the surface of the quadrilateral, is the angle between the surface normal at and the direction from to the point on the light, and is the angle between the surface normal at on the light and the direction from to (Figure 5.17).