36
Photo-realistic Rendering and Global Illumination in Computer Graphics Spring 2012 Stochastic Radiosity K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

Embed Size (px)

DESCRIPTION

Photo-realistic Rendering and Global Illumination in Computer Graphics Spring 2012 Stochastic Radiosity. K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology. The Form Factors. Form Factor Sampling Using Global Lines - PowerPoint PPT Presentation

Citation preview

Page 1: K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

Photo-realistic Rendering and Global Illumination in Computer Graphics

Spring 2012

Stochastic Radiosity

K. H. Ko

School of MechatronicsGwangju Institute of Science and Technology

Page 2: K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

2

The Form Factors Form Factor Sampling Using Global Lines

The previous algorithm requires us to shoot local lines, lines with an origin and direction selected with regard to a particular patch i in the scene.

There are, however, a number of algorithms for form factor sampling based on uniformly distributed global lines.

The origin and direction of global lines is chosen irrespective of any particular surface in the scene by connecting uniformly distributed sample points on a bounding sphere for the scene.

The probability of finding an intersection of such lines at any given surface location is uniform regardless of actual scene geometry.

Page 3: K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

3

The Form Factors

Form Factor Sampling Using Global LinesLines constructed like that will cross

several surfaces in the scene.The intersection points with the

intersected surfaces define spans of mutually visible patches along the line.

Page 4: K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

4

The Form Factors

Page 5: K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

5

The Form Factors Form Factor Sampling Using Global Lines

Each such line span corresponds to two local cosine-distributed lines-one in both directions along the line.

The global uniformly distributed lines are uniformly distributed with regard to every patch in the scene.

This is unlike local lines, which are uniformly distributed only with regard to the patch on which the origin was sampled.

The probability that a global uniform line, generated with the algorithms, intersects a given patch i is proportional to the surface Area Ai.

Page 6: K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

6

The Form Factors Form Factor Sampling Using Global Lines

If N global lines are generated, the number Ni of lines crossing a patch i will be

Ni ≈N Ai/AT. It can be shown that if Nij is the number of

lines that have successive intersections with the surfaces in the scene on patch i and j, then

Nij/Ni ≈Fij. The main advantage of global lines over local

lines is that geometric scene coherence can be exploited in order to generate global lines more efficiently.

For the same computation cost, more global line spans can be generated than local lines.

Page 7: K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

7

The Form Factors Form Factor Sampling Using Global

LinesThe main limitation of global lines with

regard to local lines is that their construction cannot easily be adapted in order to increase or decrease the line density on a given patch.

In particular, when used for form factor calculation, it can be shown that the form factor variance is approximately inversely proportional to the area Ai of the source patch i.

Page 8: K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

8

Stochastic Relaxation Radiosity The algorithms using form factor sampling solve

the radiosity system of equations. By doing so, the form factor will appear in the

numerator and denominator of the mathematical expressions to be evaluated.

So their numerical value will never be needed. The difficult problems of accurately computing form

factors and their storage are simply avoided. They do not only require less storage, but for all but the

simplest models, they also finish in less computation time.

These algorithms allow much larger models to be rendered with a fraction of the storage cost of other radiosity algorithms.

In addition, Monte Carlo radiosity algorithms have a much better time complexity.

Page 9: K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

9

Stochastic Relaxation Radiosity

There are basically two approaches to solve the radiosity system of linear equations by means of Monte Carlo methods.Stochastic relaxation methods.

The radiosity system is solved using an iterative solution method such as Jacobi, Gauss-Seidel, or South well iterations.

Discrete random walk methods.

Page 10: K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

10

Stochastic Relaxation Radiosity

The Jacobi Iterative Method for Radiosity Jacobi Iterative method

Explanation!!!

Page 11: K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

11

Stochastic Relaxation Radiosity The Jacobi Iterative Method for Radiosity

The vectors x and e correspond to a distribution of light power over the surfaces of a scene.

x = e + Ax A: contraction x: fixed point

The radiosity or power system matrix models a single bounce of light interreflection in the scene.

Multiplication with the self-emitted radiosity or power vector results in direct illumination.

When applied to direct illumination, one-bounce indirect illumination is obtained.

Each Jacobi iteration consists of computing a single bounce of light interreflection, followed by re-adding self-emitted power.

The equilibrium illumination distribution in a scene is the fixed point of this process.

Page 12: K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

12

Stochastic Relaxation Radiosity

The Jacobi Iterative Method for RadiositySimulating a single bounce of light

interreflection is an easier problem than simulating any number of bounces at once.

Page 13: K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

13

Stochastic Relaxation Radiosity

Regular Gathering of Radiosity Given the radiosity equation

As the starting radiosity distribution B(0)i=Bei,

self-emitted radiosity can be taken. A next approximation B(k+1)

i is then obtained by filling in the previous approximation B(k) in the right-hand side of the equation.

Page 14: K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

14

Stochastic Relaxation Radiosity

Regular Gathering of RadiosityA hemicube algorithm allows us to

compute all form factors Fij for fixed patch i simultaneously.

Iteration steps according to the above scheme can be interpreted as gathering steps.

In each step, the previous radiosity approximations B(k)

j for all patches j are “gathered” in order to obtain a new approximation for the radiosity B(k+1) at i.

Page 15: K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

15

Stochastic Relaxation Radiosity Regular shooting of Power

When applied to the power system, a shooting variant of the above iteration algorithm follows:

Using a hemicube-like algorithm one can compute all form factors Fji for fixed j and variable i at a time.

In each step of the resulting algorithm, the power estimate P(k+1)

i of all patches i, visible from j, will be updated based on P(k)

j: j “shoots” its power towards all other patches i.

Page 16: K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

16

Stochastic Relaxation Radiosity Incremental Shooting of

Power Each regular power-shooting

iteration replaces the previous approximation of power P(k) by a new approximation P(k+1).

It is possible to construct iterations in which unshot power is propagated rather than total power.

An approximation for the total power is then obtained as the sum of increments ΔP(k) computed in each iteration step:

Page 17: K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

17

Stochastic Relaxation Radiosity

With deterministic summation, there is no difference between the results after complete iterations with the three iteration schemes.

The computation cost of each iteration is quadratic in the number of patches.

Page 18: K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

18

Stochastic Relaxation Radiosity Stochastic Jacobi Radiosity

What happens if the sums in the iteration formulae are estimated using a Monte Carlo method?

Sums can be estimated stochastically by randomly picking terms from the sum according to some probability.

The average ratio of the value of the picked terms, over the probability by which they have been picked, yields an unbiased estimate for the sum.

When applied to the iteration formulae for radiosity, this procedure corresponds to a straightforward simulation of single bounce light interreflection by tracing one-bounce photon paths.

Page 19: K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

19

Stochastic Relaxation Radiosity

Stochastic Incremental Shooting of PowerConsider the incremental power

shooting iterations.We write the sum ΣjΔP(k)

jFjiρi. As a double sum, by introducing Kronecker’s delta function δli = 1 if l = i and 0 if l≠i.

Page 20: K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

20

Stochastic Relaxation Radiosity

Stochastic Incremental Shooting of PowerThe double sum can be estimated

stochastically using any of the form factor sampling algorithms.

Page 21: K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

21

Stochastic Relaxation Radiosity

Stochastic Incremental Shooting of Power

Page 22: K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

22

Stochastic Relaxation Radiosity

Stochastic Incremental Shooting of Power

Page 23: K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

23

An explanation on this figure is required.

Page 24: K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

24

Stochastic Relaxation Radiosity

Stochastic Incremental Shooting of PowerThe procedure can be used to estimate

ΔP(k+1)i for all patches i simultaneously.

Page 25: K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

25

Stochastic Relaxation Radiosity Stochastic Regular Shooting of Power

The sums in regular power-shooting iterations can be estimated using a very similar Monte Carlo method for incremental power shooting.

The first stochastic Jacobi radiosity algorithms consisted entirely of such iterations.

Unlike its deterministic counterpart, the resulting radiosity solutions of each iteration are averaged, rather than having the result of a new iteration replace the previous solution.

The main disadvantage of using only regular iterations is that higher-order interreflections appeared in the result only at a slow pace, especially in bright environments.

The warming-up or burn-in problem

Page 26: K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

26

Stochastic Relaxation Radiosity Stochastic Regular Shooting of Power

The warming-up problem can be avoided by first performing a sequence of incremental power-shooting iterations until convergence is obtained.

This results in a first complete radiosity solution, including higher-order interrflections.

Especially when the number of samples N is rather low, this first complete solution will exhibit noisy artifacts.

Stochastic regular power-shooting iterations can then be used in order to reduce these artifacts.

A regular power-shooting iteration can be viewed as a transformation, transforming a first complete radiosity solution into a new complete one.

The average of the two radiosity distributions obtained subsequently is to good approximation the same as the result of one iteration with twice the number of samples.

Page 27: K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

27

Stochastic Relaxation Radiosity Stochastic Rgular Gathering of Radiosity

Regular radiosity gathering iterations can be converted into a stochastic variant using the procedure.

The main difference with power-shooting iterations is that a new radiosity estimate is obtained as the average score associated with rays that are shot from each patch i, rather than from rays that land on i.

Gathering iterations are mainly useful to clean up noisy artifacts from small patches, which have a small chance of being hit by rays in a shooting iteration and therefore exhibit a high variance.

Page 28: K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

28

Stochastic Relaxation Radiosity

Several questions remain to be answered.How shall the number of samples N be

chosen?When will the presented algorithms

perform well?When will they be suboptimal?How do they compare?

Page 29: K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

29

Stochastic Relaxation Radiosity

The most expensive operation in the algorithms is ray shooting.The number of rays that needs to be

shot in order to compute the radiosities in the scene to given accuracy with given confidence is determined by the variance of the involved estimators.

Page 30: K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

30

Stochastic Relaxation Radiosity

Incremental ShootingThe variance on the resulting radiosity

estimates Bi for each patch i is, to good approximation, given by

In particular, it is inversely proportional to the surface area Ai, meaning that incremental shooting will not be the optimal solution for small patches.

Page 31: K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

31

Stochastic Relaxation Radiosity

Incremental ShootingThe number of samples N shall be

chosen proportional to the amount of power ΔP(k)

T to be propagated in each iteration, so that rays always carry the same amount of power.

A heuristic for the total number of rays in a sequence of iterations until convergence is

Page 32: K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

32

Stochastic Relaxation Radiosity

Incremental Shooting In practice, it makes a lot of sense to skip

the 10% of patches in a scene with the largest ratio ρi/Ai.

Note that a rough heuristic for N suffices: A higher accuracy can always be obtained by

averaging the result of several independent runs of the algorithm.

Page 33: K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

33

Stochastic Relaxation Radiosity

Incremental ShootingThe ime complexity of the stochastic

Jacobi iterative algorithms for radiosity is roughly log-linear.

This is much lower than the quadratic time complexity of deterministic Jacobi iterations.

Page 34: K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

34Explanation is required.

Page 35: K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

35

Stochastic Relaxation Radiosity Regular Shooting

The variance of a regular shooting iteration, when used with a “complete” radiosity solution as its input, is the same as for a whole sequence of incremental iterations to convergence when the total number of rays being shot is the same.

The complete radiosity results obtained by a sequence of incremental iterations to convergence, and of subsequent regular iterations, are optimally combined by simple averaging.

Page 36: K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology

36

Stochastic Relaxation Radiosity

Regular GatheringThe variance of regular gathering is in

practice most often higher than that of shooting.

But it does not depend on the patch area.Gathering can therefore be useful in

order to clean noisy artifacts from small patches which have a small chance of being hit by shooting rays from elsewhere and can suffer from a large variance with shooting.