## Homework 4

### Assigned Thursday, May 9.   Due Thursday, May 16, 2001

(written portion due at class time)

### Description

The goal of this assignment is to understand direct lighting from area light sources. This involves integrating the reflection equation given the area light source by Monte Carlo sampling. When you finish the assignment, you will be able to perform Monte Carlo integration for direct lighting in one of two ways:

• Randomly sample a triangular light source.
• Randomly sample a Gaussian microfacet distribution function.

You should review Chapters 9-12 in the book for this assignment. These chapters cover the basics of materials and shading, reflection functions, textures, light sources and light transport.

#### 1

Area light sources are typically defined by attaching an emission function to a shape. For now, we will assume the emission function is constant; that is, the outgoing radiance from the light source is independent of both position on the source and outgoing direction. Sampling an area light source involves choosing random points on the surface. The number of random points on any subset of the surface should be proportional to the surface area of that subset. This is called uniform area sampling.

A.   Describe an algorithm for generating a uniform distribution of points on a unit cone (radius 1 on the plane z=0, and height 1; the tip of the cone is at z=1). As before, ignore the base of the cone.

B.   Describe an algorithm for generating a uniform distribution of points on a triangle.

#### 2

It is also important to develop methods for sampling reflection functions. For this problem, we will assume that the reflection function is based on a microfacet model. That is, each point on the surface contains a distribution of tiny facets. The microfacet distribution is written D(α), where α is the angle between H, the normal to the microfacet, and N, the geometric normal to the surface. For this problem, assume:

D(α) = e-cos2α/cos2β

where β is an adjustable parameter controlling the width of the highlight. Note that cos α is simply equal to (N • H)

Microfacet distribution functions return the number of facets of a given size oriented in a given direction H, or more simply, the total area of all the facets oriented in a given direction. Mathematically, this is written as dA(ω) dω = D(ω) dA dω; here the direction is the same as H and is the differential solid angle in the direction ω. Microfacet distributions may be interpreted as probability distributions if they are normalized. The normalization condition may be interpreted geometrically as the condition that total projected area of all the micofacets with different orientations is equal to dA. Therefore,

∫ D(α) cos α dωh = 1.

Note that the microfacet distribution function may be interpreted as a probability distribution function over projected areas.

For this problem, your job is to describe an algorithm to sample microfacet distributions functions. The algorithm should randomly return microfacet directions H according to the normalized form of the distribution given. You can refer to the lecture on microfacet distributions for examples of how this is done for the Blinn microfacet distribution.

#### 3

We generally want to compute the amount of light reflected in a given direction by integrating over the upper hemisphere. The integrand is given by The Reflection Equation: ∫ D(H) L(ω) cos θ dω

A.   Suppose you perform the integral by randomly sampling over the area of the light source. What estimator should be used to compute an unbiased estimate of the integral?

B.   Suppose you perform the integral by randomly sampling microfacets according to the microfacet distribution. What estimator should you use in this case to compute an unbiased estimate of the integral?

#### Programming assignment

There will be a follow-up programming portion of this assignment, consisting of adding two new features to lrt: area sampling of triangles and sampling of a Gaussian microfacet surface. We will release more information on this part of the assignment as soon as it is available.