<p>The pdf with respect to solid angle (area on the sphere) is <span class="math-container">$D(h) \cos \theta \, \mathrm{d}\omega$</span>, but then when you go to sample it in terms of spherical coordinates, you must include the <span class="math-container">$\sin \theta$</span> factor.
<span class="math-container">$$
\mathrm{d}\omega = \sin \theta \, \mathrm{d}\theta \, \mathrm{d}\phi
$$</span>
If you imagine choosing sample points uniformly in <span class="math-container">$(\theta, \phi)$</span> space, then they would concentrate at the pole, and so you would need to weight down by <span class="math-container">$\sin \theta$</span> to compensate for that and get points that are uniform in area on the sphere.</p>
<p>For importance-sampling the NDF, with an isotropic NDF like this the <span class="math-container">$\phi$</span> parameter is just chosen uniformly from <span class="math-container">$[0, 2\pi]$</span>, and then the remaining <span class="math-container">$P(\theta)$</span> does need to include the <span class="math-container">$\sin \theta$</span> factor, otherwise you would have too many points close to the pole. It is true that <span class="math-container">$P(0) = 0$</span>; that is correct because a <span class="math-container">$\mathrm{d}\phi$</span>-wide sliver comes to have zero width at the pole, and so the density in <span class="math-container">$(\theta, \phi)$</span> space has to come to zero there.</p>

CC BY-SA 4.0
2021-08-30T18:56:18.407Z
2021-08-30T18:56:18.407Z
Nathan Reed
<p>I'm reading the article <a href="https://agraphicsguy.wordpress.com/2015/11/01/sampling-microfacet-brdf/" rel="nofollow noreferrer">Sampling microfacet BRDF</a>.</p>
<p>The GGX function is <span class="math-container">$D(h)$</span>, the articles says the PDF respecting the spherical coordinates is <span class="math-container">$P_1(\theta)=D(h)Cos(\theta)Sin(\theta)$</span>. But I think the PDF(in spherical coordinates) is <span class="math-container">$P_2(\theta)=D(h)Cos(\theta)$</span>, where the term <span class="math-container">$Sin(\theta)$</span> is the Jacobian of integrator. Note that <span class="math-container">$\theta$</span> is the angle between normal vector and half vector.</p>
<p>Another intuitive feeling is that <span class="math-container">$P_1(0)=0$</span>, <span class="math-container">$P_2(0)=D(h)$</span>. I think <span class="math-container">$P_2$</span> seems more reasonable.</p>
<p>Is my understanding correct? Thanks.</p>

CC BY-SA 4.0
2021-08-30T20:34:07.690Z
Yes the $\sin\theta$ is from the Jacobian when going from Cartesian to spherical coordinates. But that also means that it is indeed correct to have the sine in $P_1$. On the other hand $P_2$ seems to be wrt the solid angle measure, where $d\omega = \sin\theta \,d\theta\,d\phi$. Note that this is consistent with the definition of probability density wrt some measure: https://en.m.wikipedia.org/wiki/Probability_density_function#Formal_definition
lightxbulb
<rendering><brdf>
PDF of BRDF respecting the spherical coordinates
Chris Guo
# PDF of BRDF respecting the spherical coordinates

(Asked by: username_0 on 2021-08-30)

I'm reading the article [Sampling microfacet BRDF](https://agraphicsguy.wordpress.com/2015/11/01/sampling-microfacet-brdf/).

The GGX function is $D(h)$, the articles says the PDF respecting the spherical coordinates is $P\_1(\theta)=D(h)Cos(\theta)Sin(\theta)$. But I think the PDF(in spherical coordinates) is $P\_2(\theta)=D(h)Cos(\theta)$, where the term $Sin(\theta)$ is the Jacobian of integrator. Note that $\theta$ is the angle between normal vector and half vector.

Another intuitive feeling is that $P\_1(0)=0$, $P\_2(0)=D(h)$. I think $P\_2$ seems more reasonable.

Is my understanding correct? Thanks.

**Tags:** rendering, brdf

> **Comments:**
> **username_1**: Yes the $\sin\theta$ is from the Jacobian when going from Cartesian to spherical coordinates. But that also means that it is indeed correct to have the sine in $P_1$. On the other hand $P_2$ seems to be wrt the solid angle measure, where $d\omega = \sin\theta \,d\theta\,d\phi$. Note that this is consistent with the definition of probability density wrt some measure: https://en.m.wikipedia.org/wiki/Probability_density_function#Formal_definition  

---

## 1 answers

### Answer by username_2 on 2021-08-30. Score: 3 | Accepted answer

The pdf with respect to solid angle (area on the sphere) is $D(h) \cos \theta \, \mathrm{d}\omega$, but then when you go to sample it in terms of spherical coordinates, you must include the $\sin \theta$ factor.
$$
\mathrm{d}\omega = \sin \theta \, \mathrm{d}\theta \, \mathrm{d}\phi
$$
If you imagine choosing sample points uniformly in $(\theta, \phi)$ space, then they would concentrate at the pole, and so you would need to weight down by $\sin \theta$ to compensate for that and get points that are uniform in area on the sphere.

For importance-sampling the NDF, with an isotropic NDF like this the $\phi$ parameter is just chosen uniformly from $[0, 2\pi]$, and then the remaining $P(\theta)$ does need to include the $\sin \theta$ factor, otherwise you would have too many points close to the pole. It is true that $P(0) = 0$; that is correct because a $\mathrm{d}\phi$-wide sliver comes to have zero width at the pole, and so the density in $(\theta, \phi)$ space has to come to zero there.


---

