The test scene is a plane with no diffuse but a specular component. Above the plane is a dome emitting light <0.5,0.5,0.5>, with no reflection at all. The camera is inside the dome. The dome appears gray and, since every ray bouncing off the plane intersects the dome, the plane should appear the same.
I have not been able to get energy-conserving results (the plane appears too dark or too bright).
Q1: Generating rays with equal probability on a hemisphere, what is the BRDF?
Q2: How should I generate rays for importance sampling, and what is the BRDF in that case? I can generate rays according to a cos^n lobe along a vector (say the reflection vector). Should I generate cos^n weighted rays around R (the reflection vector) and then regenerate the rays that fall below the ecliptic plane?
For what it's worth, I tried e.g. this code (edited to pseudocode for clarity), which I implemented from the Global Illumination Compendium 66.a:
Code: Select all
function radiance(...) {
//Intersection and stuff
result += emission;
//GET BRDF
Float w_i = get_hemisphere(reflected); //uniform sample on hemisphere
Float pdf_w_i = 1 / (2*PI);
Vec3 ks = refl_spec * (refl_exp+2)/(2*PI);
Vec3 brdf = ks * pow(dot(reflected,w_i),refl_exp);
//USE BRDF & RECURSE
result += radiance(...) * brdf * dot(N,w_i) / pdf_w_i;
//stuff
}