29 thoughts on “Sampling microfacet BRDF

  1. Steve November 2, 2015 / 6:54 pm

    You have a small typo in the equation at the end of the “Sampling GGX” section: the division by 1 – \epsilon should be inside the square root.

    Liked by 1 person

    • Rafael June 28, 2020 / 8:12 am

      How the “One Extra Step” formula is derived? How do you calculate dwh / dwi ?

      Like

  2. wallacekcy October 5, 2017 / 3:33 am

    Hi,

    Why does Beckmann’s pdf has a sine term instead of a cosine term like the others?

    Thanks

    Liked by 1 person

    • AGraphicsGuy October 6, 2017 / 8:50 am

      It should have a cosine term, I guess I missed it, :(. Already corrected.
      Thanks for pointing it point.

      Like

  3. Alessandro Nardini November 3, 2017 / 3:12 pm

    Very useful article, learning a lot from this! thank you for sharing!

    Like

  4. Fei Xia December 5, 2017 / 5:20 pm

    it seems there exists small errors in the derivation of the cdf of both ggx and beckmann:
    the second step of ggx and the fourth step of beckmann are missing the minus sign

    Like

    • Fei Xia December 5, 2017 / 5:26 pm

      my bad, only the fourth step of beckmann is missing the minus sign.

      Like

      • AGraphicsGuy December 6, 2017 / 7:01 pm

        I don’t see any issue of the derivation, I think there is no problem with the fourth step.

        Like

    • AGraphicsGuy December 6, 2017 / 7:02 pm

      I’m afraid that I don’t agree. It is normal that I sample in the three cases, there is no difference of bling comparing with others.

      Like

  5. g2-c02031016c3e5bf73dca2b8eb33f399a June 21, 2018 / 10:18 pm

    Hi! Great post but I have a question: could you explain how you do this step in the calculation?

    https://imgur.com/HJLWAFh

    Look like magic…

    Like

    • AGraphicsGuy June 21, 2018 / 10:23 pm

      Thanks.
      I wish I can type latex here, which I don’t think so.
      First of all, squared alpha in the nominator can be isolated because it is a constant. Try replace cos(t)^2 with x, you will get a new formula. And then what is left is very basic mathematics about integral calculus. I hope this helps.

      Liked by 1 person

      • g2-c02031016c3e5bf73dca2b8eb33f399a June 21, 2018 / 11:38 pm

        Thanks. (but it’s very basic for you maybe, I still can’t properly integrate like you did, I’m heavily relying on Mathematica do to that for me 😀 )

        Like

  6. Aditya Sreekar August 18, 2018 / 12:48 pm

    Awesome tutorial

    Like

  7. Hao Zhang March 8, 2019 / 2:59 pm

    Hi! Great post, but I have a problem. In Sampling Part, for example, sampling GGX. ‘The PDF respecting solid angle’ you wrote is p(h,n,α)=D(h,n,α)|h⋅n|, and the solid angle means |h⋅n|, right? why should there be a |h⋅n|?

    Like

    • Hao Zhang March 8, 2019 / 3:03 pm

      I figure out, after I read the link in the blog. Thanks.

      Like

      • AGraphicsGuy March 9, 2019 / 11:35 pm

        To reply to your last question, none of the final conclusion reaches 0 when roughness goes to 0. Do notice that there is a curve from roughness to alpha, it is not a direct match. You can check out the code to get a better explanation of it.

        Like

      • Hao Zhang March 9, 2019 / 11:25 am

        Thank you very much for your reply. I have one more question. When roughness equal to zero, the D(h) is always 0, doesn’t like a dirac-delta function which is 0 expect 1 point. So I can get good result at roughness close to 0, but it becomes totally black when the roughness is one. How did you deal with this 0 divided by 0 problem?

        Like

  8. Casper January 25, 2020 / 5:00 pm

    Great blog, this is excactly the problem i’m encountering right now. I have one question though. For a faster converging image we need to sample in the direction of the reflection. In the end we have calculated a theta, that as far as I understand it, describes the angle between the normal and the outgoing ray. I’m not sure how this can be converted to an outgoing ray. Can we pick any outgoing direction which is at this angle?

    Like

  9. Hulda Erxleben October 15, 2020 / 5:22 pm

    I’d like to thank you for the efforts you have put in penning this website. I am hoping to check out the same high-grade blog posts by you in the future as well. In truth, your creative writing abilities has motivated me to get my very own blog now 😉

    Like

  10. Jewel Heath October 17, 2020 / 4:44 am

    Having read this I believed it was very enlightening. I appreciate you finding the time and energy to put this article together. I once again find myself spending a significant amount of time both reading and commenting. But so what, it was still worth it!

    Like

Leave a reply to Fei Xia Cancel reply