1
$\begingroup$

When I am sampling diffuse BRDF I am using cosine-weighted distribution and when I want to sample specular BRDF I use sampling by GGX distribution. I can decide how much light is reflected and how much is diffused by using Fresnel. That gives me an evaluation formula like this:

Eval = BRDF_specular * F + BRDF_diffuse * (1 - F)

the same principle I can use on PDF. But the problem comes up when I try to use this on sampling. It is obvious that I cannot use this interpolation for the sampled vector. But what I can do is to have some probability that I will sample specular direction and probability for sampling diffuse direction. As sample count goes up it will perform as if it was interpolation between these types of sampling. I can use this for dielectric materials because their Fresnel value is the same for RGB. But because I am using separate values for RGB for Fresnel on metallic material I can have different probabilities (for example, R = 0.8, G = 0.3, B = 0.0). This gives a nice look to metals as you can see in this post. What probability I should choose then? The biggest?? Average? Or is this some different approach to this problem, because I cannot find anywhere how to combine these BRDFs?

$\endgroup$
  • $\begingroup$ float luma(const vec3& color) { return dot(color, vec3(0.2126f, 0.7152f, 0.0722f)); } $\endgroup$ – Max Tarpini May 2 at 14:10
  • 1
    $\begingroup$ For metals, or basically mix of diffuse and specular reflection I suggest you the Ashikhmin BRDF. It properly accounts for the diffuse part , Fresnel effect. Look at google.com/url?sa=t&source=web&rct=j&url=http://… $\endgroup$ – ali May 4 at 4:06
  • 1
    $\begingroup$ Are you asking of the probability of choosing either of the two BRDFs? If yes, then it can be any number(can be 0.5) as later you divide brdf by this probability to account for rays that you didn't trace. $\endgroup$ – ali May 4 at 4:10
  • 1
    $\begingroup$ Thank you. I already came up with solution. I decided to choose them randomly 50:50. Then I average the PDF. I just forgot about this question. I will post a answer so that the question will not be left without one. Thanks you once again. $\endgroup$ – Vít Gardoň May 4 at 9:00
1
$\begingroup$

So I found a solution on a shader toy.

I choose randomly from sampling diffuse or sampling specular with distribution 50:50. But I calculate PDF of both and average then. If you want to use a different proportion between sample function you just have to make sure that PDFs are combined with the same proportion as choose.

| improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ Why would you have both the probabilities at 50 though. It's gonna waste a lot of samples if, let's say we have a material that is 90% specular and 10% diffuse. You'd end up sampling the diffuse and specular 50% of the times when clearly you should have sampled the specular more. $\endgroup$ – gallickgunner May 9 at 23:49
  • 1
    $\begingroup$ Yes, it would be better, but my specular is different for each RGB value so it wouldn't be consistent. I would have to average the reflectivity and then decide what sampling to use. That's definitely an option, but I am not so far yet with optimization. But a good point. Thank you $\endgroup$ – Vít Gardoň May 10 at 8:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.