Hey everyone,
I'm attempting to implement the AshikhminShirley 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
Cheers
Asger
Sampling AshikhminShirley BRDF

 Posts: 85
 Joined: Thu Apr 11, 2013 5:15 pm
Re: Sampling AshikhminShirley BRDF
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.,
Note that you potentially run into precision issues if diffuseProbability is too close to (but not equal to) 0 or 1.
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.
Re: Sampling AshikhminShirley BRDF
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.
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.
Re: Sampling AshikhminShirley BRDF
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.
Click here. You'll thank me later.

 Posts: 160
 Joined: Mon Nov 28, 2011 7:28 pm
Re: Sampling AshikhminShirley BRDF
You probably want "diffuseProbability" to be nottofar 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.
Return to “General Development”
Who is online
Users browsing this forum: No registered users and 7 guests