Presentation is loading. Please wait.

Presentation is loading. Please wait.

Photo-realistic Rendering and Global Illumination in Computer Graphics Spring 2012 Stochastic Path Tracing Algorithms K. H. Ko School of Mechatronics Gwangju.

Similar presentations


Presentation on theme: "Photo-realistic Rendering and Global Illumination in Computer Graphics Spring 2012 Stochastic Path Tracing Algorithms K. H. Ko School of Mechatronics Gwangju."— Presentation transcript:

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

2 2 Indirect Illumination BRDF Sampling  The choice of PDF When the diffuse part of the BRDF is sampled with p 1 (Ψ), the obvious choice is to sample according to the cosine distribution. The glossy part can either be sampled according to the cosine distribution or proportional to the cosine lobe cos n (Ψ,Θ s ), centered around Θ s.  The choice of q 1, q 2 and q 3 also has a significant influence on the variance of the estimator. In principle, any set of values provides an unbiased estimator. But choosing these values carefully has an impact on the final result.

3 3 Indirect Illumination BRDF Sampling  The choice of q 1, q 2 and q 3 also has a significant influence on the variance of the estimator. A good choice is to pick these values proportional to the reflected energy in the different modes.  These values can be computed by integrating the reflected energy for an incident direction along the normal N x on the surface:

4 4 Indirect Illumination Incident Radiance Field Sampling  Sample a direction Ψ according to the incident radiance values L r (x<- Ψ).  Since this incident radiance is generally unknown when we want to compute L indirect (x- >Θ), an adaptive technique needs to be used. An approximation to L r (x<-Ψ) is built during the algorithm and then this approximation is used to sample direction Ψ i.

5 5 Indirect Illumination Area Sampling  Sampling the hemisphere is the most straightforward way to compute the indirect illumination integral. For each sampled direction, a ray has to be cast to determine the closest visible point.  This is a costly operation.  But there will be no noise in the final image due to failed visibility checks.  By writing the indirect illumination as an integral over all surfaces in the scene, an estimator can be constructed by sampling surface points. 

6 6 Indirect Illumination Area Sampling The corresponding estimator when using a PDF p(y) is  By sampling areas, the visibility function V(x,y i ) needs to be evaluated as part of the estimator. When sampling the hemisphere, the visibility is hidden in the ray-casting function for finding the closest visible point in each direction.

7 7 Indirect Illumination Area Sampling  Putting the visibility in the estimator increases the variance for an equal number of samples.

8 8 Indirect Illumination Putting it All Together  All algorithms are in place to build a full global illumination renderer using stochastic path tracing.  The efficiency and accuracy of the complete algorithm will be determined by Number of viewing rays per pixel Direct Illumination Indirect illumination

9 9 Indirect Illumination Putting it All Together  Number of viewing rays per pixel A higher number of viewing rays eliminates aliasing and decreases noise.  Direct Illumination For direct illumination, a number of choices are necessary that will determine the overall efficiency  The total number of shadow rays N d cast from each point x.  How a single light source is selected from among all the available light sources for each shadow ray.  The distribution of the shadow ray over the area of a single light source.

10 10 Indirect Illumination Putting it All Together  Indirect Illumination The indirect illumination component is usually implemented using hemisphere sampling.  Number of indirect illumination rays N i distributed over the hemisphere Ω x.  Exact distribution of these rays over the hemisphere (uniform, cosine, …)  Absorption probabilities for Russian roulette in order to stop the recursion

11 11 Indirect Illumination Putting it All Together

12 12 Indirect Illumination Putting it All Together  It is obvious that the more rays we cast at each of the different choice points, the more accurate the solution will be.  The better we make use of importance sampling, the better the final image and the less objectionable noise there will be.  The interesting question is.. When given a total number of rays one can cast per pixel, how should they best be distributed to each a maximum level of accuracy for the full global illumination solution?

13 13 Indirect Illumination Putting it All Together  The interesting question is.. When given a total number of rays one can cast per pixel, how should they best be distributed to each a maximum level of accuracy for the full global illumination solution? It is still very much an open problem in global illumination algorithms. There are no hard and fast rules. It is generally accepted that branching out too much (recursively generate multiple rays at every surface point) at all levels of the tree is less efficient. Indeed, progressively more rays will be cast at each deeper level, while at the same time, the contribution of each of those individual rays to the final radiance value of the pixel will diminish.

14 14 Indirect Illumination Classic Ray Tracing  Classic ray tracing, or Whitted-style ray tracing, is an often-used technique for computing photorealistic pictures.  However, it does not compute a full solution to the rendering equation.  A classic ray-tracing algorithm usually computes the light transport components when computing an estimator for the radiance L(x->Θ) Shadows Reflections and refractions

15 15 Indirect Illumination Classic Ray Tracing  Shadows Shadows are computed in the same way as direct illumination. However, when using point light sources, care has to be taken that the correct radiometric properties are still being used.  Reflections and refractions This is the only indirect illumination component present. Instead of sampling the entire hemisphere to look for incident illumination at x, only two interesting directions are explicitly sampled:  The perfect specular direction  The perfect refracted ray in case the surface is transparent.

16 16 Indirect Illumination Classic Ray Tracing only computes a small selected subset of the indirect illumination and is not able to deal with diffuse inter-reflections, caustics, etc.

17 17 Light Tracing Stochastic ray tracing is derived from a Monte Carlo evaluation of the rendering equation.  The resulting algorithm traces paths through the scene, starting at the point visible through a pixel and through recursion of shadow rays, these paths reach the light sources, upon which a contribution to the radiance value to be computed is found. This tracing of rays from the eye to the light sources looks unnatural since light travels the other way.

18 18 Light Tracing Light particles originate at the light source and finally hit the film surface or the human eye where they are recorded and added to the measured intensity. Some light tracing algorithms are introduced.

19 19 Light Tracing The basic light-tracing algorithm evaluates the potential or importance equation for a single pixel. The importance equation, the dual of the rendering equation, is given by

20 20 Light Tracing The accompanying measurement equation for a single pixel is The light-tracing algorithm then proceeds as follows:  The measurement equation will be evaluated using Monte Carlo integration. Points x i and direction Θ i on the light sources are generated for which the importance W(x->Θ) will be evaluated. This will finally lead to an estimator for the flux through a pixel.

21 21 Light Tracing The light-tracing algorithm then proceeds as follows:  Evaluating the importance W(x->Θ) requires a Monte Carlo integration of the importance equation. This evaluation is very similar to the evaluation of the rendering equation in stochastic ray-tracing algorithms. The same sampling schemes (hemisphere, area, BRDF…) can be used.

22 22 Light Tracing The light-tracing algorithm then proceeds as follows:  Send a contribution ray from each surface point along a light path to the eye of the camera and check whether it passes through the pixel under consideration. If this is the case, a contribution to the pixel is recorded.

23 23 Light Tracing The light-tracing algorithm then proceeds as follows:

24 24 Light Tracing

25 25 Light Tracing The algorithm outlined above is rather inefficient.  The whole algorithm has to be repeated for each individual pixel. It is clear that all pixels can be processed in parallel:  If a contribution ray passes through any pixel, a contribution to that specific pixel is then recorded. Thus, the image will form gradually, not by sequentially completing pixels as was the case in the stochastic ray-tracing algorithm, but by accumulating the contributions over the whole image plane.

26 26 Light Tracing vs. Ray Tracing Stochastic light tracing and ray tracing are dual algorithms and solve the same transport problem.  The camera acts as a source of importance during light tracing.  The light sources are the source of radiance in stochastic ray tracing. Shadow rays and contribution rays are each other’s dual mechanism for optimizing the computations of final flux through a pixel. It is generally accepted that stochastic ray tracing will perform better.

27 27 Light Tracing vs. Ray Tracing Image size versus scene size  If the image only shows a very small part of the scene, it is to be expected that many particles shot from the light sources during light tracing will end up in parts of the scene that are only of marginal importance to the light transport relevant for the image.  Stochastic ray tracing will perform better. The radiance values to be computed are driven by the position of the camera and individual pixels. We can expect less work to be wasted on computing irrelevant transport paths.

28 28 Light Tracing vs. Ray Tracing Nature of the transport paths  The Shadow rays or contribution rays work best at diffuse surfaces. The direction (towards the light sources or towards the camera) cannot be chosen.  At a specular surface, there is a very high likelihood that those rays will yield a very small contribution to the final estimator. We would like to trace rays as much as possible over specular surfaces before we send out a shadow ray or contribution ray.  For mirrored images (where the light hits a diffuse surface before it hits a specular surface), we prefer ray tracing.  For caustics (where the light hits specular surfaces before diffuse surfaces), we would prefer light tracing.

29 29 Light Tracing vs. Ray Tracing Number of sources  Comparison of two methods In ray tracing, the sources for the transport we are simulating are the light sources. In light tracing, the importance sources are the individual pixels.  This has some effect on the efficiency of both algorithms, especially when sources are to be moved, in conjunction with an algorithm where partial information of the transport simulation is stored in the scene. When a light-tracing algorithm is used, we could store all endpoints of all paths, and only retrace the contribution rays when the camera moves. This is not as easy with ray tracing.


Download ppt "Photo-realistic Rendering and Global Illumination in Computer Graphics Spring 2012 Stochastic Path Tracing Algorithms K. H. Ko School of Mechatronics Gwangju."

Similar presentations


Ads by Google