Precomputed Radiance Transfer and Relighting [CSE 190 Assignment 3] Sean Wenzel Brittany Factura University of California, San Diego University of California, San Diego [email protected] [email protected] ABSTRACT Recently, a body of work known as precomputed radiance transfer, or precomputation-based relighting, has become a popular technique for real-time rendering in varying illumination, and recently also viewpoint for dynamic scenes. Some variant of this technique is now widely used in movies and games. Good references are the seminal papers by Sloan, Kautz and Snyder in SIGGRAPH 02, and Ng, Ramamoorthi, Hanrahan in SIGGRAPH 03. In this assignment, we aim to understand and implement Precomputed Radiance Transfer. Precomputed Radiance Transfer Precomputed Radiance Transfer splits the problem of realtime global illumination into two parts: a precomputed step, and one solved in real time. Functions ρ, V, and G can be grouped into a single function T, known as the transfer function Direct lighting: light reflected/scattered at x in the direction ωo after arriving directly from light sources or other emitting surfaces along all possible directions. Z Le (wi )ρ(x, wi , wo )V (x, x0 )G(x, x0 )dωi Lo (x, wo ) = ω 1. INTRODUCTION The high cost of global illumination algorithms has limited their use in real-time applications. Precomputed radiance transfer is an attempt to surpass the challenge of real-time global illumination by splitting the problem into two parts: one that is solved in a precomputed step and another that is solved in real time. The Rendering Equation All rendering algorithms can be seen as solutions to particular formulations of the rendering equation. L(x, wo ) = Le (x, wo )+ Z L(x0 , wi )ρ(x, wi , wo )V (x, x0 )G(x, x0 )dωi ω where, ω: the domain of all possible directions L(x’,wi ): the amount of light arriving at x from another point x’ along ωi ρ(x,wi ,wo ): the function that tells how much of the incoming light arriving at x along ωo V(x,x’): binary visibility function involving x and x’ G(x,x’): geometric relationship between x and x’ The light leaving any point x in a given direction ωo is computed as the amount of light that x emits in direction ωo , plus the reflected/scattered light from x in the outgoing direction ωo after it has reached x from all incoming directions. Local geometric aspects are implicitly defined by x. Material properties are expressed as p. The incoming light is represented by L. Occlusions are obtained as the result of the visibility function V. and after grouping, Z Le (wi )T (x, wi , wo , x0 )dωi Lo (x, wo ) = (1) ω Where Le is the lighting function that describes the arriving light intensity at point x and T is the transfer function that expresses how x responds to the incoming illumination. To determine the illumination of a point over a surface, it is necessary to integrate, along with its material properties (ρ), the lighting function (Le ), the visibility function (V) and the geometric factor (G). The lighting and transfer functions are estimated during a pre-processing step, and their values are used to approximate the integral in real time. We then use basis functions to project and reconstruct arbitrary functions. Projection and Reconstruction of Functions Given a function space, a basis functions β is an infinite set of functions used to project and reconstruct arbitrary functions. The projection of a function f into any function βi gives a measure ci of how similar these two functions are, and is accomplished by integrated the product f and βi over the entire domain of f: Z ci = f (x)βi (x)dx The process of reconstruction allows for the original function f to be recovered as a linear combination of the basis functions βi , each modulated by its corresponding coefficient ci . Its accuracy increases the more basis functions are used; with an infinite number of basis functions (and an infinite number of coefficients), the original function can be recovered. PRT uses orthonormal basis functions: ( Z 0, if i 6= j βi (x)βj (x)dx = 1, if i = j Orthonormality guarantees that the integral of the product of two basis functions will be either zero if the functions are different, or one if they are the same. Thus, let ck and dk be the coefficients associated with the projections of any two functions f(x) and g(x), respectively, into the basis functions βk , for all k. The integral of the product f(x)g(x) is obtained as the sum of the products ck dk . n X c k dk (2) Spherical Harmonics Spherical harmonics are orthonormal functions defined over the unit sphere, where the 2D domain can be seen as the set of all possible directions. In their general formulation, spherical harmonic functions are defined over complex numbers, but Precomputed Radiance Transfer is mainly concerned in approximating real functions. Legendre polynomials are the core of the spherical harmonic functions. The associated Legendre polynomials return real numbers. They are characterized by two parameters, l, which is usually called band, and m, that varies according to l. They are defined over real numbers in the interval between [-l, l ]. k=1 This provides a powerful mechanism for factoring the evaluation of Equation (1) in two steps: (i) the projection of both Le and T into an orthonormal basis, which can be done during pre-processing, and (ii) the evaluation of the integral as a dot product (Equation 2), which can be efficiently done in real time. Precomputed Radiance Transfer Eq Derivation Let both lighting and transfer functions from Equation (1) be projected into the same set basis functions βk . The original functions can be approximated as: Le (wi ) ≈ n X lk βk (wi ), where R Le (wi )βk (wi )dwi k=1 lk = T (x, wi , wo , x0 ) ≈ n X tk βk (wi ), where k=1 tk = R ω For each term k of the sum, the associated lighting coefficient will be multiplied by the entire integral. But this integral represents a projection operation. So, each term of the sum will produce a new coefficient that is the result of projecting the transfer function into the associated basis function, resulting in the following equation: Lo (x, wo ) = n X lk t k k=1 which is a dot product of the lighting and the transfer coefficients. While this only handles direct lighting, it handles occlusions with respect to the light source. To perform extra bounces, a similar derivation can be done with higher order terms of the Neumann Expansion, which leads to the final PRT equation: L(x, wo ) = 2. IMPLEMENTATION The PRT algorithm consists of two steps: (i) preprocessing - projection of the lighting and transfer functions into some orthonormal basis functions (ii) real time rendering - the evaluation of Equation (3). Lighting functions can be represented as environment maps stored as spherical maps or cube maps (light probes). For transfer functions, two types will be considered: (i) unshadowed transfer functions, which ignore the visibility function (V(x,x’)) and (ii) shadowed transfer functions, which take the occlusion term into account. We can also add indirect lighting, or interreflected transfer function, to the shadowed case. The transfer function will be evaluated for each vertex present in the scene. T (x, wi , wo , x0 )βk (wi )dwi Substituting into Equation (1), Z n X lk βk (wi )T (x, wi , wo , x0 )dwi Lo (x, wo ) = k=1 Spherical harmonic functions are parametrized using θ and φ, with scaling factors Klm for normalizing the functions. A spherical harmonics approximation of a function using l bands requires l2 coefficients. n X k=0 lk (t0k + t1k + t2k + ...) (3) 3. LITERATURE 4. RESULTS AND DISCUSSIONS 5. FUTURE WORKS 6. REFERENCES
© Copyright 2024 Paperzz