Name: George Bernard Laskowsky Ziguilinsky
E-mail address: georgelaskowsky@gmail.com
Nick: glaskows
Irradiance Caching (IC from now on) is a technique for computing global illumination on diffuse surfaces reasonably fast. Its concern is the indirect illumination bouncing from one diffuse surface to another.
The main idea is to implement IC inside Yafaray's two-pass photon mapping algorithm, specifically for improving the speed and quality of indirect illumination on diffuse (Lambertian) surfaces, which is the most costly component to compute in a Monte Carlo ray tracer (this is the case even if we only compute the first bounce of diffuse illumination, like in Final Gather).
The problem with techniques for indirect illumination is that for every intersection/reflection we need to calculate a Monte Carlo integrator for the incoming radiance. In Yafaray it is used a simplification which consist in using the integrator only at the accurate computation and the global photo map in the approximate evaluation.
IC can exploit the main characteristic of indirect illumination (without caustics, which use another photon map): its slow rate of change (spatial coherence). Instead of integrating in every bounce, we can use past results saved on a cache for estimating the irradiance in p by interpolation.
It is utterly crucial to have a good way to tell when we can use cached result and when we need to make a new Monte Carlo ray trace. Special cases must be dealt if we want to have noiseless pictures.
The main steps of the IC should be, for every reflection:
In the photon integrator of yafaray (photonintegr.h, .c) there an option to include IC. In photonIntegrator_t::integrate(), where all the integration occurs, the call to irradianceCache_t::gatherSamples() start the IC process. The current implementation is incomplete and presents bad results, so there is a great need for fixing this.
There should be at least four classes (two of them are pure virtual):
Different algorithms should be implemented in different classes using the correct interface (following the strategy software pattern). This kind of modularity (decoupling) allows me to check and perform automated tests with different configurations, combining different algorithms for best speed or quality.
The drawback is the overhead in the virtual methods table. In the final release I should promote the best implementing classes and discard the virtual ones.
Finally, I should incorporate two techniques: importance sampling, it uses the radiance in the photon map so the sampling in the Monte Carlo method is directed to the regions with more flux, and, two-pass image rendering, which try to eliminate the "miss contribution" problem by populating the IC first and then making a second pass for the actual render.
The final user should be able to set at least three main parameters. One for turning IC on and off, a constant K and the number of radiance samples per irradiance record. K control the area of validity for each record (quality v/s speed).
I am a last year CS student at Federico Santa Maria University, in Valparaiso, Chile, South America, Planet Earth (http://tinyurl.com/ycd9je7).
Currently I work as a researcher in a high energy physics lab (www.silab.fis.utfsm.cl), developing a cosmic ray detector (software and hardware). I have always been interested in computer generated graphics, but I haven't done anything big, mainly old style opengl and some hlsl in XNA (also, I did implement a couple of simple programs that calculated the flux of photons on a optic fiber using the simplest optic equations). I am proficient in C, C++, Python, Java, Javascript and some other languages. I have been a basic user of Blender for some time.
In this section I want to present most of the equation I'll be using in the IC implementation. This is just a summary, not an in depth explanation.
Irradiance at a point p with normal n can be obtained from the incoming radiance over the hemisphere,
,
wich can be approximated through an stratified Monte Carlo estimator, which, for this particular case, yields the final irradiance estimaror
,
where Lj,k is the incoming radiance sample computed by tracing a ray in the direction
,
where
are two uniformly distributed random numbers in the range [0, 1), N denotes the number of divisions along Φ (azimuth) and M the number of divisions along Θ (elevation) in the hemisphere.
The calculus of the irradiance on a given point through interpolation can be greatly improve if we know how the irradiance in the cached samples changes when we move it over a surface or change it's orientation. The irradiance in a scene is a five dimensional scalar field and the gradient on each point can be represented through a five dimensional vector. In the program we will use 2 vectors, one for translation and one for rotation, and both will "live" in the tangent plane of the surface, so each one only represents two dof. For the calculations we use the same rays from the irradiance integral.
,
,
The irradiance at p is equal to the weighted average of the "near" cached records ![]()
Ei(p) equals to the irradiance contribution of sample i extrapolated to the point p ![]()
Only If the weight wi is bigger than 0, we add the cached record to the set S(p).
where ![]()
The term Ri is the approximated distance to the surfaces visible from the record pi location. It is common to use the harmonic mean of the ray lengths (assuming a split sphere model)
or just the minimum
.
Problem arise near corners where Ri is small even at close distances, so too many samples are cached. The opposite occurs in open spaces, where too many rays are lost in the distance. We need to clamp Ri for preventing this.
There is also another test that check if record pi is "in front" of p, where step like features, just besides p, which can contribute to indirect lighting, are ignored because pi is near enough, if di is less than a small negative value then pi is excluded from interpolation set. ![]()
Comments
Detailed description
Hi
The detailed description of your proposal is explaining very well the irradiance caching algorithm, and that's a good thing, but this section is mostly there for you to write details on how you will execute your proposal.
As a suggestion, you can point where each step you described is going to get implemented and so on.
Cheers
Boiko