6
$\begingroup$

The GGX NDF, as it appears on the paper where it is presented is:

$$D(m)=\frac{\alpha_g^2\space\chi^+(m\cdot n)}{\pi\cos^4(\theta_m)(\alpha_g^2+\tan^2(\theta_m))^2}$$

It is equivalent, in the range $[0,\frac{\pi}{2}]$, to the following formulation (notation simplified by me):

$$D(m)=\frac{\alpha^2}{\pi(\cos^2(\theta)(\alpha^2-1)+1)^2}$$

by finding the derivative of the inverse of the expresions used for importance sampling ($\theta_m=\arctan(\frac{\alpha\sqrt{\xi_1}}{\sqrt{1-\xi_1}})$ and $\phi_m=2\pi\xi_2$) presented in the same paper we can derive the following PDF:

$$p(m)=\frac{\alpha^2\cos(\theta)\sin(\theta)}{\pi(\cos^2(\theta)(\alpha^2-1)+1)^2}$$

When finding the corresponding PDF for, for instance, the Blinn NDF the only difference is a $\sin(\theta)$ in the numerator that comes from the fact that the NDF is a distribution over a hemisphere. So where does the $\cos(\theta)$ factor in the GGX PDF come from?

I think it is explained after formula (37) in the paper but i don't understand the reasoning behind it.

PD:here are the Blinn NDF and PDF as i understand them for reference

NDF: $\frac{n+1}{2\pi}\cos^n(\theta)$ --- PDF: $\frac{n+1}{2\pi}\cos^n(\theta)\sin(\theta)$

EDIT: here is a link to the paper in case it makes the question easier to answer

$\endgroup$
2
  • $\begingroup$ BTW, the Blinn–Phong NDF should have $n + 2$, not $n + 1$, in the numerator (see equation 30 in the paper). $\endgroup$ Dec 5, 2017 at 21:49
  • $\begingroup$ Yup, thank you. now I also understand that the exponent in the PDF should be n+1 $\endgroup$ Dec 6, 2017 at 6:37

1 Answer 1

6
$\begingroup$

Normal distribution functions are defined a bit differently than you might expect. They're not strictly a probability distribution over solid angle; they have to do with the density of microfacets with respect to macro-surface area. The upshot is that they're normalized with an extra cosine factor: $$ \int_\Omega D(m) \cos(\theta_m)\, d\omega_m = 1 $$ This cosine factor accounts for the projected area of microfacets onto the macrosurface. When importance-sampling the NDF this cosine factor must be accounted for as well.

This is actually hinted at in the text of the paper, as it says

The equations for sampling $D(m) | m \cdot n |$ are:

(just above equations 35–36). The $|m \cdot n|$ factor there is equal to $|cos(\theta_m)|$. So the quantity being sampled is not just the NDF itself, but includes this extra factor. Then, as you note, the sine shows up as part of the area element for spherical coordinates.

I wrote a blog post a few years ago that goes into more detail about this.

$\endgroup$
1
  • $\begingroup$ Ahh i see. that makes sense. thank you very much. EDIT: Awesome blog post as well! $\endgroup$ Dec 6, 2017 at 6:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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