Presentation is loading. Please wait.

Presentation is loading. Please wait.

© Machiraju/Möller Rendering Equation Unbiased MC Methods CMPT 461/770 Advanced Computer Graphics Torsten Möller.

Similar presentations


Presentation on theme: "© Machiraju/Möller Rendering Equation Unbiased MC Methods CMPT 461/770 Advanced Computer Graphics Torsten Möller."— Presentation transcript:

1 © Machiraju/Möller Rendering Equation Unbiased MC Methods CMPT 461/770 Advanced Computer Graphics Torsten Möller

2 © Machiraju/Möller Reading Chapter 16 of “Physically Based Rendering” by Pharr&Humphreys Chapter 19, 20 in “Principles of Digital Image Synthesis,” by A. Glassner

3 © Machiraju/Möller Direct Light General equation of existant radiance: Account only for direct light sources, i.e. Replace L i (p,  i ) with L i (p,  i ): –Most simple form of equation –Somewhat easy to solve! (but a gross simplification) –Kinda what we do in Whitted Ray-tracing –Not too bad - most energy comes from direct lights

4 © Machiraju/Möller Direct Light MC sampling to solve integral (A) –pick one light as representative for all lights –Distribute N samples for this light –Use multiple importance sampling for f r and L d –Scale the result by the total number of lights N L

5 © Machiraju/Möller Multiple Importance Sampling Weight according to f light Weight according to L d light

6 © Machiraju/Möller Direct Light (B) uniformly sample all lights –Do (A) for each light source –Sum the result –Smarter approach - non-uniform sampling of light sources: prefer lights with has higher power

7 © Machiraju/Möller Light Transport Equation Incident radiance effected by all geometry and scattering within a scene (colour bleeding) Global illumination Principle –Ignore wave optics –Energy balance (radiance is in equilibrium) Power leaving Power entering Power emitted Power absorbed

8 © Machiraju/Möller Light Transport Equation If no participating media - express incoming in terms of outgoing radiance: Need to solve for L (only one unknown)

9 © Machiraju/Möller Example - lambertian light One spherical light source on the outside No scene geometry Lambertian BSDF, f r =c Emitted radiance L e in constant is the same, no matter which point on the light. Hence:

10 © Machiraju/Möller Example cont. Let’s solve the last equation a little weirdly: These are basically the number of bounces  hh is the reflectance von Neumann series - principle solution method

11 © Machiraju/Möller Example - direct lighting Using recursion for direct lighting: The last term is being ignored; represents secondary (bounced) light

12 © Machiraju/Möller Expressing LTE in terms of geometry within the scene Replacing the integrand (d  i )with an area integrator over the whole scene geometry and remembering: - visibility term (either one or zero) LTE - Geometric Formulation

13 © Machiraju/Möller Geometry coupling term New (geometric) formulation of the Light Transport Equation (LTE) Randomly pick points in the scene and create a path vs. (previously) randomly pick directions over a sphere LTE - Geometric Formulation

14 © Machiraju/Möller LTE - Geometric Formulation Recursive evaluation

15 © Machiraju/Möller compact formulation: For a path Where p 0 is the camera and p i is a light source LTE - Geometric Formulation

16 © Machiraju/Möller with: Where Is called the throughput Special case: LTE - Geometric Formulation

17 © Machiraju/Möller Again - handle with care (e.g. point light): E.g. Whitted ray tracing only uses specular BSDF’s Specular distributions

18 © Machiraju/Möller Solving the LTE Many different algorithms proposed to deal with Most energy in the first few bounces: emitted radiance at p 1 one bounce to light (direct lighting)

19 © Machiraju/Möller Solving the LTE Simplify according to small and large light sources: Can be handled separatly (different number of samples)

20 © Machiraju/Möller Solving the LTE Similarly, we can split BxDF into delta and non-delta distributions: This creates many factors that cannot be ignores

21 © Machiraju/Möller Measuring over a pixel Integrating over pixel j: Where We is the filter function around a pixel:

22 © Machiraju/Möller Integrating over a pixel And hence the integral: A - light bounces around until it hits the camera B - a quantity from the sensor bounces around and only makes a contribution if it hits a light

23 © Machiraju/Möller Path Tracing Kajiya 1986; solution to A.How to deal with infinite sum? B.For a particular i - how to generate one or more paths to estimate

24 © Machiraju/Möller A) Infinite Sum In general => the longer the path the less the impact Use Russian Roulette after a finite number of bounces –always compute first few terms –Stop after that with probability q

25 © Machiraju/Möller A) Infinite Sum Use probability q i after each

26 © Machiraju/Möller B) Path Generation Pick a surface in the scene at random (I.e. uniform probability distribution): Pick a point on this surface at random (uniform) with probability 1/A i Overall probability of picking a random surface point in the scene:

27 © Machiraju/Möller B) Path Generation This is repeated for each point on the path Last point should be sampled on a light source If we know things about the scene (which objects are contributing most indirect lighting to the scene) we can sample more smartly Problems: –High variance - only few points are mutually visible –Incorrect integral - for delta distributions

28 © Machiraju/Möller For path –At each p j find p j+1 according to BSDF –At p i-1 find p i by multiple importance sampling of BSDF and L d This algorithm distributes samples according to solid angle (  ) instead of area Hence prob. Distribution p A needs to be adjusted: B) Incremental Path Generation

29 © Machiraju/Möller MC estimator: Implementation: –Re-use path for new path Introduces correlation, but speed makes up for it B) Incremental Path Generation

30 © Machiraju/Möller Path Tracing

31 © Machiraju/Möller Path Tracing Direct lighting only 1024 samples per pixel 8 samples per pixel

32 © Machiraju/Möller Pure Path Tracing Best for big luminaires. If lights small, few hits and large variance.

33 © Machiraju/Möller Results Objects are gray, except for spheres and base. –Color bleeding –Caustics

34 © Machiraju/Möller Results 401 minutes 533 minutes 256 x 256 image Ray Traced (no ambient) Path Traced Light scattered by sphere

35 © Machiraju/Möller Bi-directional path tracing Compose one path from two paths – started at the camera p 0 and – started at the light source q 0 Modifications for efficiency: a)Use all i+j paths: b)For all paths replace q 1 with direct lighting computation like normal path tracing

36 © Machiraju/Möller Bi-directional path tracing When useful? –Light sources difficult to reach –Specific BSDF evaluations (caustics)

37 © Machiraju/Möller Bi-direct RT : Pseudo-Code

38 © Machiraju/Möller Pure Bi-Directional: Analysis Advantages: –Each ray cast contributes to many paths –Building from both ends can catch difficult cases All specular paths Caustics –Extends to participating media (anisotropic, heterogeneous) Disadvantages: –Still using lots of effort to catch slow varying diffuse components –May not sample difficult to find paths –Does allow for much noise to be present

39 © Machiraju/Möller Still Tough Cases Caustics –How do you know which direction to cast eye rays to reach the interesting light? Bleeding –How do you know which rays to reflect to reach the interesting parts of diffuse reflections?

40 © Machiraju/Möller MC Algorithms Revisited Provide ability to sample light transport paths. MC algorithms studied so far sample a function to compute the value of an integral. Problems: –Many of the paths are unimportant. –Pure Bi-Directional Path algorithm does not reject. –It may weigh down some paths.

41 © Machiraju/Möller Metropolis’s Idea Circa 1953 Generate a distribution of samples proportional to the unknown function For rendering – –sample image with ray density proportional to radiance –random walk through path space Eric Veach’s PhD thesis and Veach&Guibas paper in Siggraph introduced work of Metropolis to Graphics

42 © Machiraju/Möller Why Does It Make Sense ? In the final image: –More detail in brighter areas –Value of a pixel will be proportional to the number of times it was sampled in a path

43 © Machiraju/Möller  Metropolis sampling Metropolis Light Transport Generate a random walk through path space For each path deposit a constant amount of energy at the corresponding pixel Obtain desired image by distributing paths according to image contribution

44 © Machiraju/Möller Importance function Problem: F(X) is not scalar for colored scenes. Scalar Importance function: I(X)=Lum(F(X)) –Importance sampling: p(X) = I(X) /b P =  F(X)dX=  F/I ·I dX= b ·  F/I · p dX = b ·E[F/I] = b ·1/M ·  F(Xi)/I(Xi) Meaning of b: Luminance of the total power

45 © Machiraju/Möller MLT Essentials Generate samples with probability p(X) Evaluate I(X) : luminance of the power of a path Evaluate b: Tone mapping or estimation by normal rendering Good initial samples: estimation by normal rendering

46 © Machiraju/Möller Overview In order to sample paths, MLT uses a random walk through the space of possible paths. MLT will choose a new path Xi by performing a random mutation on Xi-1. New path can be rejected (if it goes through a wall) Lastly, upon choosing each new path, MLT will update the appropriate image pixel(s).

47 © Machiraju/Möller Propose a mutation of current path Compute acceptance probability Choose as new sample if  Samples are correlated  we can exploit coherence Metropolis Sampling

48 © Machiraju/Möller Where is the image contribution function (contribution made to the image by light flowing through ) tentative transition function - probability of given Metropolis Sampling

49 © Machiraju/Möller Metropolis light transport LeLe Mutations pixel

50 © Machiraju/Möller MLT: Pseudo-Code

51 © Machiraju/Möller Scattering Perturbations Propagation Perturbations Sensor Perturbations Caustic Perturbations Mutation Strategies Bidirectional Mutations –large changes to the current path –ensures ergodicity Perturbations –high acceptance probability –changes to image location –low cost

52 © Machiraju/Möller Bidirectional Mutations Given a path 1.Choose a random subpath to delete. 2.Add random numbers of new vertices to the new interior endpoints of X. 3.Try to connect up the two innermost vertices. 4.Test for acceptance of the new path.

53 © Machiraju/Möller  x1x1 x2x2 x0x0 Mutations – Step 1

54 © Machiraju/Möller Mutations – Step 1 Random subpath to delete. Weigh probability so that smaller subpaths are chosen more frequently.  x1x1 x2x2 x0x0

55 © Machiraju/Möller Mutations – Step 2 Add random numbers of new vertices. Choose number to add from a distribution centered around old number. Choose where to put the break (i.e. how many to add at end of first segment vs. beginning of last segment). Add each vertex by sampling a direction according to a BRDF, and then casting a ray.

56 © Machiraju/Möller x2x2 Mutations – Step 2 Chose to add 2 vertices, with the break between them.  x0x0

57 © Machiraju/Möller x2x2 x1x1 Mutations – Step 3 Connect two innermost vertices Test if two new endpoints are visible If the path is obstructed, reject the mutation  x0x0 x3x3

58 © Machiraju/Möller Test for acceptance of the new path Y over old path X. Use Note that much of this can be pre- computed. Mutations – Step 4

59 © Machiraju/Möller  Good Mutations Don’t make changes that are too small Don’t get stuck

60 © Machiraju/Möller Perturbations Are needed when bidirectional mutations will nearly always be rejected. When there are small regions of the path space in which paths contribute much more than average. –Lenses –Caustics Smaller mutations keep them within high contribution region

61 © Machiraju/Möller –Propagation Perturbation image plane medium light source eye

62 © Machiraju/Möller Propagation Perturbations image plane medium light source eye

63 © Machiraju/Möller Perturbations Move the pixel location (i.e. the path’s endpoint) by a random distance in a random direction. Recast rays through all the specular bounces so that it retains the same length. Mutation strategy depends on what is encountered For example in the caustic LS+DE case make small change in ray connecting the diffuse and specular surface

64 © Machiraju/Möller Caveat Run several copies of the algorithm in parallel. –Helps to remove startup bias. –Helps to test for convergence. Ignore the first several path samples. –Helps to remove startup bias. Don’t bother with MLT for the direct lighting in an image. –Standard techniques for direct lighting usually provide better quality at lower cost. –This way MLT can devote more effort to the indirect lighting.

65 © Machiraju/Möller

66 Results Light for this example comes only through crack in doorway

67 © Machiraju/Möller Results There are specific mutations to capture caustics.

68 © Machiraju/Möller Good For Portions of space where light comes through hole in the wall kinds –mutations will explore new paths once it finds a path through the hole – Bi-directional and Plain Path Tracing use random directions

69 © Machiraju/Möller Not Good For Cornell Box scenes will not benefit Caustics will certainly help. Too many holes does not help Also caustics from mirror reflections

70 © Machiraju/Möller Results

71 © Machiraju/Möller Results

72 © Machiraju/Möller Results

73 © Machiraju/Möller Transport Approximations Classical ray tracing –Direct Lambertian –Global specular Radiosity –Diffuse to diffuse global illumination –View independent. Monte Carlo Methods –More comprehensive –Can be Expensive

74 © Machiraju/Möller Transport Light == particles of energy or photons moving in straight lines in a vacuum No interaction among particles. There are infinite number of particles moving at same speed Particles interact with surfaces in a closed environment Energy is conserved. A steady state of energy transfer between all surfaces

75 © Machiraju/Möller Steady State Audit for flux Accumulation = flow through boundaries - flow out of boundaries + generation within system - absorption within system.


Download ppt "© Machiraju/Möller Rendering Equation Unbiased MC Methods CMPT 461/770 Advanced Computer Graphics Torsten Möller."

Similar presentations


Ads by Google