Sampling directions

A special case of 2D sampling is sampling 3D directions, which can be thought of as generating points on the surface of a sphere. In many cases, you will probably only sample in a hemisphere instead of the whole sphere, as light is either reflected or transmitted at a surface. Other cases, such as sampling in a volumetric medium exist too, of course, but we will cover some surface cases here. The following sections cover different related methods to sample (weighted) hemisphere regions.