Multiple Importance Sampling
Fixed lots of bugs in my Ashikhmin & Shirley and Schlick BRDF’s. Schlick anisotropic is still not 100% correct. Added explicit BRDF calculation for both BRDF’s, allowing for light sampling in addition to BRDF importance sampling. This helped a great deal with small light sources like the sun. To incorporate the benefits of both sampling strategies (light and BRDF), I also added Multiple Importance Sampling (MIS) using the one-sample model and balance heuristic as described in section 9.2.4 of Eric Veach’s dissertation. This solves the glossy highlights problem (section 9.3.1).
The MIS is actually incredibly simple to do, once you can compute the BRDF for an arbitrary direction. Choose weights for two sampling strategies (light sampling or brdf sampling). I do .5 and .5. Then select one of the sampling techniques according to its weight. Trace the ray and compute the BRDF. Then divide by the PDF as done for regular importance sampling, but now the PDF is weight1*pdf1+weight2*pdf2 (regardless of technique chosen). Done. Well… actually, it took some refactoring and debugging in lots of places to add MIS everywhere.
I was hung up for a long time because I tried to be cheap and only compute the simplified BRDF/PDF ratio when importance sampling the BRDF. Pointless. Just compute both the BRDF and PDF, since you’ll need both for MIS.
Also added direct lighting computation for emissive spheres.
Times are about 42 minutes with 1024 samples per pixel (spp), on a Q6600 quad core cpu.
5 comments5 Comments so far
Leave a reply
Great results. Keep it coming! And also keep it come with blogging. Personally, it seems I fail with the latter D:
phresnel: not at all, why do you say that?
well, I’m a little puzzled. When you mentioned “Fixed lots of bugs”, Do you mean bugs of Ashikhmin & Shirley’s BRDF model, or bugs of your implementation of that?
Bugs in my implementation. I updated my post to clarify that. Thanks!
While we are on the subject… I think there is a “bug” in the Schlick BRDF. Rather, the importance sampling formulas do not match any given PDF perfectly, since I see different results between BRDF importance sampling and light sampling for the anisotropic cases. I was only able to make the isotropic cases match by scaling by ratio (…). I’m not sure though, and I suppose a little integration could determine what the problem is.
“phresnel: not at all, why do you say that?”
That was addressed to my lazy butt, which fails to compose a blog-entry on a regular basis 😀