PBRT_V2 总结记录 The Inversion Method (2)

作用:

The inversion method uses one or more uniform random variables and maps them to
random variables from the desired distribution.

(利用均匀随机变量来匹配 任意概率分布的随即变量)

说明 :

To explain how this process works in general, we will start with a simple discrete example. Suppose we have a process with
four possible outcomes. The probabilities of each of the four outcomes are given by p1,
p2, p3, and p4, respectively, with the requirement that 

The corresponding PDF is shown in Figure 13.1.

Figure 13.1: A Discrete PDF for Four Events Each with a Probability pi .

In order to draw a sample from this distribution, we first find the CDF P(x). In the
continuous case, P is the indefinite integral of p. In the discrete case, we can directly
construct the CDF by stacking the bars on top of each other, starting at the left. This idea

is shown in Figure 13.2. Notice that the height of the rightmost bar must be one because
of the requirement that all probabilities sum to one.

Figure 13.2: A Discrete CDF, Corresponding to the PDF in Figure 13.1. Each column’s height is
given by the PDF for the event that it represents plus the sum of the PDFs for the previous events,

To draw a sample from the distribution, we then take a uniform random number ξ and
use it to select one of the possible outcomes using the CDF, doing so in a way that chooses
a particular outcome with probability equal to its own probability. This idea is illustrated
in Figure 13.3, where the events’ probabilities are projected onto the vertical axis and
a random variable ξ selects among them. It should be clear that this draws from the
correct distribution—the probability of the uniform sample hitting any particular bar is
exactly equal to the height of that bar.
In order to generalize this technique to continuous
distributions, consider what happens as the number of discrete possibilities approaches
infinity. The PDF from Figure 13.1 becomes a smooth curve, and the CDF from Figure
13.2 becomes its integral. The projection process is still the same, although if the
function is continuous, the projection has a convenient mathematical interpretation—it
represents inverting the CDF and evaluating the inverse at ξ. This technique is thus called
the inversion method.

Figure 13.3: To use the inversion method to draw a sample from the distribution described by the
PDF in Figure 13.1, a canonical uniform random variable is plotted on the vertical axis. By construction,
the horizontal extension of ξ will intersect the box representing the ith outcome with probability pi .
If the corresponding event is chosen for a set of random variables ξ, then the resulting distribution
of events will be distributed according to the PDF.

More precisely, we can draw a sample Xi from an arbitrary PDF p(x) with the following
steps:

(以上是 Inversion Method 的一般)

Example: Power Distribution:

As an example of how this procedure works, consider the task of drawing samples from a
power distribution, Sampling from this distribution will be performed when
we are trying to sample the Blinn microfacet model. The PDF of the power distribution is

for some constant c. The first task to tackle(处理) is to find the PDF for the function. In most
cases, this simply involves computing the value of the proportionality constant c, which
can be found using the constraint that 

Therefore,  We can integrate this to get the CDF:

and inversion is simple:

Therefore, given a uniform random variable ξ, samples can be drawn from the power distribution as

Example: Exponential Distribution

猜你喜欢

转载自blog.csdn.net/aa20274270/article/details/84522989
今日推荐