This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks
The process (called normalized decomposition) basically consists of the following separation:
|BRDF(qi, fi,qo, fo)|
This code assumes each value is sampled 16 times. Then, h represents qo, i represents fo, j represents qi, and k represents fi. We need to map this matrix to 2D. To do so, we unroll the 4D matrix into all combinations of parameter pairs. Each row and each column has two parameters fixed, and the other two varying in all possible combinations. The result is a larger matrix; each direction (rows and columns) being NxN in size. An example of such a matrix is shown here, where each parameter (theta and phi) has only two values, 0 and 1:
val = f( theta_i, phi_i, theta_o, phi_o );
/* Store it in a N2 x N2 matrix. */
BRDFMatrix[h*N+i][j*N+k] = val;
It looks like this is getting more and more complex, so let's recapitulate for a second and regain perspective. We started with a 4D BRDF, which I assume we have at hand and can evaluate at any given moment. BRDF data is available from a number of sources. It can be a mathematical expression, tabulated data acquired through a goniometer, and so on. Then, all we do is map this 4D data set to a 2D matrix by using linear combinations of parameters. Why? Because this makes it easier to separate it afterward.
(|x1|2 + |x2|2 + ... + |xn|2)1/2
The norm we will be using here is defined as:
The average vector must be computed per color component. Now, let's identify G and H. If you take a look at the row vector or norm vector, you will see that, due to the unrolling process, each value represents a sampled outgoing direction (qo,fo), which were the two parameters we fixed per row. So, this norm vector (identifying theta and phi as two parameters, and thus returning it to 2D form) is the function H(qo, fo). The average vector or column vector has a similar property: Each column is correlated to an incoming direction, so for each sampled incoming direction (qi,fi) there is a corresponding average value in the average vector. As a result, this average vector can serve as the function G(qi, fi).