(论文)[1997] Metropolis Light Transport
- VEACH E., GUIBAS L. J.: Metropolis light transport. In Annual Conference Series (Proceedings of SIGGRAPH) (Aug. 1997), vol. 31, ACM Press, pp. 65–76. doi:10/bkjqj4.
TODO 找时间得继续看看
Metropolis Light Transport
Abstract
- We present a new Monte Carlo method for solving the light transport problem, inspired by the Metropolis sampling method in computational physics.
- MLT 是无偏的
- Our algorithm is unbiased, handles general geometric and scattering models, uses little storage, and can be orders of magnitude more efficient than previous unbiased approaches.
- 优点
- 在复杂场景中表现很好
- bright indirect light
- small geometric holes
- glossy surfaces.
- 简单场景中和之前的方法相比也不错
- 在复杂场景中表现很好
- The key advantage of the Metropolis approach is that the
path space is explored locally, by favoring
mutations that make small changes to the current path
- First, the average cost per sample is small (typically only one or two rays).
- Second, once an important path is found, the nearby paths are explored as well, thus amortizing the expense of finding such paths over many samples.
- Third, the mutation set is easily extended. By constructing mutations that preserve certain properties of the path (e.g. which light source is used) while changing others, we can exploit various kinds of coherence in the scene. It is often possible to handle difficult lighting problems efficiently by designing a specialized mutation in this way.
1 Introduction
- current methods are optimized for a fairly narrow class of input scenes.
- Monte Carlo methods
- generality and simplicity.
- unbiased
- For these algorithms, any error in the solution is guaranteed to show up as random variations among the samples (e.g., as image noise).
- 有偏算法带来的问题
- Biased algorithms may produce results that are not noisy, but are nevertheless incorrect.
- This error is often noticeable visually, in the form of discontinuities, excessive blurring, or objectionable surface shading.
- Monte Carlo 算法的问题
- The problem is that for some environments, most paths do not contribute significantly to the image, e.g. because they strike surfaces with low reflectivity, or go through solid objects.
- 出问题的场景
- For example, imagine a brightly lit room next to a dark room
containing the camera, with a door slightly ajar between them.
- 两个房间,光源在一个房间中,相机在另一个房间中,两个房间之间有一扇半开的门
- For example, imagine a brightly lit room next to a dark room
containing the camera, with a door slightly ajar between them.
- 对如下现象都不太支持
- glossy surfaces, caustics, strong indirect lighting
- Several techniques have been proposed to sample these difficult
paths more efficiently.
- bidirectional path tracing (BDPT)
- Another idea is to build an approximate representation of
the radiance in a scene, which is then used to modify
the directional sampling of the basic path tracing algorithm.
- 一些问题
- inadequate directional resolution to handle concentrated indirect lighting
- substantial(大量) space requirements.
- MLT
- The algorithm samples paths according to the contribution they make to the ideal image, by means of a random walk through path space.
2 Overview of the MLT algorithm
- sample the paths from the light sources to the lens
- path
是光源- 长度
- power (flux) that flows from the light sources to
the image plane along a set of paths
.
:image contribution function- Our overall strategy is to sample paths with probability
proportional to
, and record the distribution of paths over the image plane - We generate a sequence of paths
, where each is obtained by a random mutation to the path - The mutations can have almost any desired form
- adding, deleting, or replacing a small number of vertices on the current path
- each mutation has a chance of being rejected, depending on the relative contributions of the old and new paths.
- As each path is sampled, we update the current image
- 算法如下
3 The Metropolis sampling algorithm
In 1953, Metropolis, Rosenbluth, Rosenbluth, Teller, and Teller introduced an algorithm for handling difficult sampling problems in computational physics
前提
- We are given a state space
, and a non-negative function . - We are also given some initial state
- We are given a state space
目标
- generate a random walk
such that is eventually distributed proportionally to , no matter which state we start with.
- generate a random walk
the Metropolis algorithm does not require that
integrate to one.Each sample
is obtained by making a random change to- in our case, these are the path mutations
马尔科夫链
- This type of random walk, where
depends only on , is called a Markov chain.
- This type of random walk, where
We let
denote the probability density of going to state , given that we are currently in state .- transition function
- satisfies the condition
The stationary distribution
- 平稳分布(状态不变)
- Each
is a random variable with some distribution , which is determined from by the equation (1) With mild conditions on
- the
will converge to a unique distribution , called the stationary distribution - Note that p does not depend on the initial state
Detailed balance
- 细致平衡
- 在实际的物理系统中,
是由物理约束决定的,给定初始状态便会变化到平稳分布 - The Metropolis algorithm works in the opposite
direction.
- The idea is to invent or construct a transition function
whose resulting stationary distribution will be proportional to the given , and which will converge to as quickly as possible. - 找到转移函数
,希望他能够快速收敛到
- The idea is to invent or construct a transition function
- The technique is simple, and has an intuitive physical interpretation called detailed balance.
- Given
, we obtain as follows. - First, we choose a tentative(试探性的) sample
- This is represented by the tentative transition
function
- where
gives the probability density that given that - The tentative sample is then either accepted or rejected, according
to an acceptance probability
which will be defined below
- To see how to set
, suppose that we have already reached equilibrium, i.e. is proportional to . - From
to , the transition density is proportional to , and a similar statement holds for the transition density from to . - 细致平衡条件
- 细致平衡条件是平稳分布的充分条件
The acceptance probability
接受概率
Recall that
is given, and was chosen arbitrarily. Thus, equation (3) is a condition on the ratio .In order to reach equilibrium as quickly as possible, the best strategy is to make
and as large as possible
- According to this rule, transitions in one direction are always accepted, while in the other direction they are sometimes rejected, such that the expected number of moves each way is the same.
Comparison with genetic algorithms
- different purposes
- genetic algorithms solve optimization problems
- while the Metropolis method solves sampling problems
- Genetic algorithms work with a population of individuals, while Metropolis stores only a single current state.
- Finally, genetic algorithms have much more freedom in choosing the allowable mutations, since they do not need to compute the conditional probability of their actions
4 The path integral formulation of light transport
- Often the light transport problem is written as an integral equation, where we must solve for the equilibrium radiance function L.
- However, it can also be written as a pure integration
problem, over the domain of all transport
paths.
- The MLT algorithm is based on this formulation.
The light transport equation
- We assume a geometric optics model where light is emitted, scattered, and absorbed only at surfaces, travels in straight lines between surfaces, and is perfectly incoherent.
- light transport equation
is the union of all scene surfaces is the area measure on- The function
represents the throughput of a differential beam between and
如下- where
and represent the angles between the segment and the surface normals at and respectively 为可见性
- where
The measurement equation
- We consider only algorithms that compute an image directly, so that
the measurements consist of many pixel values
, where M is the number of pixels in the image. - Each measurement has the form
- where
is a weight that indicates how much the light arriving at from the direction of contributes to the value of the measurement- For real sensors,
is called the flux responsivity (with units of ), but in graphics it is more often called an importance function
- For real sensors,
The path integral formulation
- By recursively expanding the transport equation (6), we can write measurements in the form
- The goal is to write this expression in the form, so that we can handle it as a pure integration problem.
- let
be the set of all paths of the form , where and for each .
- we let
be the union of all the and define a measure on by- 感觉可以把
理解为路径全空间
- 感觉可以把
- We call
the measurement contribution function - 例子
- 上面转化的目的
- The most significant aspect is that we have removed the sum over different path lengths, and replaced it with a single integral over an abstract measure space of paths.
5 Metropolis light transport
- 一些准备工作
- First, we must formulate the light transport problem so that it fits the Metropolis framework.
- Second, we must show how to avoid start-up bias, a problem which affects many Metropolis applications.
- Most importantly, we must design a suitable set of mutations on paths, such that the Metropolis method will work efficiently.
5.1 Reduction to the Metropolis framework
- Observe that each integrand
has the form represents the filter function for pixel represents all the other factors of (which are the same for all pixels).
- In physical terms,
represents the radiant power received by the image area of the image plane along a set of paths. - Note that
depends only on the last edge of the path, which we call the lens edge. - An image can now be computed by sampling
paths according to some distribution , and using the identity
- If we could let
(where is the normalization constant , the estimate for each pixel would be
- This equation can be evaluated efficiently for all pixels at once, since each path contributes to only a few pixel values.
- 问题:This idea requires the evaluation of
, and the ability to sample from a distribution proportional to .- Both of these are hard problems.
- For the second part, the Metropolis algorithm will
help
- however, the samples
will have the desired distribution only in the limit as - Metropolis 应用中丢弃前 k 个 sample,直到结果大概收敛到 equilibrium
distribution
- k 的预测也是个问题
- start-up bias:如果选取的 k
太小,结果将很大程度上受到
的影响
- however, the samples
Eliminating start-up bias
- The idea is to start the walk in a random initial state
, which is sampled from some convenient path distribution- we use bidirectional path tracing for this purpose
- 初始路径通过其他采样方式采出
- To compensate for the fact that
is not the desired distribution , the sample is assigned a weight: - Thus after one sample, the estimate for pixel
is- N=1 代入即可
已知的条件下,这些都是可以计算的
- 接下来可以根据 Metropolis algorithm 进行采样得到
- mutating
- using
as the target density
- mutating
- Each of the
has a different distribution , which only approaches as - To avoid bias, however, it is sufficient to assign
these samples the same weight
as the original sample, where the following estimate is used for pixel
- unbiased
- 如果
,那么结果一定是 equilibrium. - 对于一般的
leads to exactly the same distribution of weighta mong the starting paths, and so we should expect that these initial conditions are unbiased as well.
- 如果
- unbiased 证明如下
- 首先证明如下等式在每一步中都成立
- where
is the joint probability distribution of the i-th weighted sample 是成立的 denotes the Dirac delta distribution
- 由上面的等式 (4)
- Next, observe that (4) is still true with
replaced by (since the mutations set ).
- Next, observe that (4) is still true with
- 期望计算:
Initialization
- In practice, initializing the MLT algorithm with a single sample does not work well
- If we generate only one path
(e.g. using bidirectional path tracing), it is quite likely that (e.g. the path goes through a wall).- 结果为全黑
- The strategy we have implemented is to sample a moderately
large number of paths
, with corresponding weights - We then resample the
to obtain a much smaller number of equally-weighted paths- chosen with equal spacing in the cumulative weight distribution of
the
- These are used as independent seeds for the Metropolis phase of the algorithm
- chosen with equal spacing in the cumulative weight distribution of
the
- The value of n is determined indirectly, by generating a fixed
number of eye and light subpaths (e.g. 10000 pairs), and considering all
the ways to link the vertices of each pair.
- Note that it is not necessary to save all of these paths for the resampling step
- they can be regenerated by restarting the random number generator with the same seed.
- It is often reasonable to choose
(a single Metropolis seed). - 实际测试中,初始化这一步的开销很小
- two phase
- The initialization phase estimates the overall image brightness
- while the Metropolis phase determines the relative pixel intensities across the image
Convergence tests
- Another reason to run several copies of the algorithm in parallel is
that it facilitates(促进) convergence testing.
- We cannot apply the usual variance tests to samples generated by a single run of the Metropolis algorithm, since consecutive samples are highly correlated.
- To test for convergence, the Metropolis phase runs with
independent seed paths, whose contributions to the image are recorded separately (in the form of separate images).
Spectral sampling
- Effectively, each color component
is sampled with an estimator of the form , where is proportional to the luminance.
5.2 Designing a mutation strategy
- MLT 的问题
- consecutive samples are correlated, which leads to
higher variance than we would get with independent
samples.
- 连续被拒绝导致存在未收敛的相同样本,影响 variance
- This can happen either because the proposed mutations to the path are very small, or because too many mutations are rejected.
- consecutive samples are correlated, which leads to
higher variance than we would get with independent
samples.
- This problem can be minimized by choosing a suitable set of path mutations.
- 一些 mutation 需要具备的特征
- High acceptance probability
- acceptance probability is small
long path sequences many samples at the same point on the image plane appears as noise
- acceptance probability is small
- Large changes to the path
- small mutations 还是可能会导致 highly correlated
- Ergodicity
- If the allowable mutations are too restricted, it is possible for
the random walk to get " in some subregion of the path space.
- 比如下面的 figure 2
- To minimize correlation between the sample locations on the image
plane, it is desirable for mutations to change the lens edge
- If the allowable mutations are too restricted, it is possible for
the random walk to get " in some subregion of the path space.
- Stratification
- This is commonly known as the "balls in bins" effect:
- if we randomly throw n balls into n bins, we cannot expect one ball per bin.
- Many bins may be empty, while the fullest bin is likely to contain
balls - In an image, this unevenness in the distribution produces noise.
- For some kinds of mutations, this effect is difficult to avoid.
- However, it is worthwhile to consider mutations for which some form of stratification is possible.
- This is commonly known as the "balls in bins" effect:
- Low cost
- Generally, this is measured by the number of rays cast, since the other costs are relatively small