Sampling Ashikhmin-Shirley BRDF

Practical and theoretical implementation discussion.
Post Reply
Posts: 42
Joined: Fri Jun 21, 2013 10:02 am

Sampling Ashikhmin-Shirley BRDF

Post by papaboo » Thu Jul 11, 2013 10:14 am

Hey everyone,

I'm attempting to implement the Ashikhmin-Shirley BRDF described in An Anisotropic Phong BRDF Model, but I'm having a hard time with the sampling.

In the Monte Carlo sampling section of the paper they describe how the specular part of the BRDF should be sampled by sampling each quadrant of the hemisphere. Then the diffuse part should be sampled using a cosine distribution and "To generate samples for the entire BRDF, simply use a weighted average of 1 and p(k2)"

My question is then how do I combine those two sampling strategies? Or specifically how do I generate a single sample direction and the corresponding density value? I could do it by treating the BRDF as a composition of two BRDFS (specular and diffuse) and then randomly select either the quadrant or the cosine distribution, but if there is a way to generate a sample without using another random number, then that would be great


Posts: 89
Joined: Thu Apr 11, 2013 5:15 pm

Re: Sampling Ashikhmin-Shirley BRDF

Post by friedlinguini » Thu Jul 11, 2013 3:27 pm

If you're feeling stingy about generating random numbers, you can reuse a random number that was used to generate a discrete choice. E.g.,

Code: Select all

float r1 = random();
float r2 = random();
if (r1 < diffuseProbability) {
    r1 = r1 / diffuseProbability;
    // Do diffuse sampling using r1,r2
} else {
    r1 = (r1 - diffuseProbability) / (1.0 - diffuseProbability)
    // Do specular sampling using r1,r2
Note that you potentially run into precision issues if diffuseProbability is too close to (but not equal to) 0 or 1.

Posts: 42
Joined: Fri Jun 21, 2013 10:02 am

Re: Sampling Ashikhmin-Shirley BRDF

Post by papaboo » Fri Jul 12, 2013 9:42 am

Arh yes I could do that, but it would probably introduce too much noise in edge cases.

I was hoping there would be some combined sampling technique, but if not I'll simply split it into two BRDFs and let my BSDF sample them along with any other BRDFs. Then I can combine them again once I introduce compounded BSDFs.

Thanks for the answer.

Posts: 281
Joined: Mon Nov 28, 2011 11:11 pm
Location: London, UK

Re: Sampling Ashikhmin-Shirley BRDF

Post by ingenious » Fri Jul 12, 2013 11:58 am

Another option is to construct two random numbers from the one number by splitting its bits, either 50/50 or however you prefer. One disadvantage of this approach is that you will likely loose any stratification in the random number, which possibly depends on how exactly you split the bits.
Image Click here. You'll thank me later.

Posts: 160
Joined: Mon Nov 28, 2011 7:28 pm

Re: Sampling Ashikhmin-Shirley BRDF

Post by graphicsMan » Fri Jul 12, 2013 1:16 pm

You probably want "diffuseProbability" to be not-to-far from 0.5 anyway (within a couple binary orders of magnitude), and you almost certainly want to be combining these via the MIS single sample model.

Post Reply