I'm following this tutorial where at somepoint the derived PDF for spherical coordinates for a Lambertian surface is

\begin{array}{l} p(\theta, \phi) = \dfrac{\sin \theta}{2 \pi}. \end{array}

But as soon as they compute a sample, the result is instead divided by $ \dfrac{1}{2\pi} $, which as they say is the "pdf of the integral"

Why isn't it divided by $ \frac{\sin \theta}{2 \pi} $ instead?

If we were using differential steradians over the unit hemisphere, the only possible probability density function integrating to 1 is infact $ \frac{1}{2\pi} $

But if we separate the integral over the hemisphere traced by spherical coordinates

$$ \int_{\phi = 0}^{2\pi} \int_{\theta = 0}^{\frac{\pi}{2}} \, \frac{\sin{\theta}}{2\pi}d\theta d\phi= 1. $$

The PDF now becomes $ \frac{\sin \theta}{2 \pi} $ yet they still divide by $ \frac{1}{2\pi} $

EDIT: after carefully reviewing the concept of PDFs and integration over the hemisphere I'm starting to think the article I've linked is making a substantial error, mixing the idea of importance sampling with the pdf of choosing a direction of reflectance from a lambertian surface

Radiance is defined as $$ L_{(x,\omega)} = \frac{\mathrm{d}^2\Phi}{\mathrm{d}\omega\ cos\theta\ \mathrm{d}x} $$ Since it's defined over differential solid angles, we can interpret the result of one sample as if it was the flux density "over a unit steradian"

If we use monte carlo estimation and find "the average flux density over a single steradian" and multiply the result by $2\pi$, we get irradiance:

$$ (2\pi) \frac{1}{n}\sum^n L_{(x,\omega)} $$. But in this particular case, $2\pi$ has nothing to do with pdfs! since it's the integral domain used for the monte carlo estimation!

Instead, the real pdf is computed for $\theta$ and $\phi$ because that is the probability density function of choosing one direction over the other, according to the particular properties of a lambertian surface. A mirror-like surface has a different probability of choosing one direction over the other, but this has nothing to do us with dividing the sample with $\frac{1}{2\pi}$. It would be different if we were using importance sampling, but in this case it seems like we're not

Is my reasoning correct? If not, what am I missing?

  • 1
    $\begingroup$ the cdf's are (as far as i know) always computed from the pdf's of of each of the sperical coordinates, not from a probability function of solid angle. besides, a "bigger" solid angle is not well defined since you could choose any two shapes over the hemisphere with equal solid angle but vastly diferent probability $\endgroup$ Dec 9, 2017 at 3:04
  • $\begingroup$ Because the differential variable in your integral is dw and so the pdf would be a function of w. Hence the pdf = 1/2pi. If you instead write the differential variable dw as Sin(tetha)d(tetha)d(phi) as in fact dw equals this, then your pdf I think will be sin(tetha)/2pi. But it doesn't make difference as in this case the sin is cancelled out with the sin in the numinator and you will be left with 1/2pi. $\endgroup$
    – ali
    Dec 9, 2017 at 20:39
  • $\begingroup$ which sin(theta) in the numerator cancels out with the sin in the pdf? $\endgroup$
    – Row Rebel
    Dec 10, 2017 at 12:42
  • $\begingroup$ Sin(tetha) in the numerator comes from the solid angle definition which equals dw = sin(tetha) x d(phi) x d(tetha). And dw is what you have as differential variable in the main integral. $\endgroup$
    – ali
    Dec 12, 2017 at 21:30
  • $\begingroup$ This is exactly the reason why the final PDF should be sin(theta) / 2pi the sin term doesn't cancel out $\endgroup$
    – Row Rebel
    Dec 12, 2017 at 22:51

1 Answer 1


Normally $sin(\theta)$ isn't written as part of the pdf, because it's an artifact from using double integral for spherical integration. The double integral does the integration over a rectangular domain (in you case of size $2\pi$ x $\pi/2$), while you want integration over a sphere/hemisphere, so $sin(\theta)$ is added there as a weight function to transform rectangular to spherical integration.

A common notation is to use integration over solid angle with single integral and differential solid angle $d\omega$ denoting 2D integration over sphere, and you won't see the $sin(\theta)$ term in there.

To clarify, the notation with single integral has constant infinitesimally small solid angle $d\omega$ over the sphere. However, for the double integral over $\theta$ and $\phi$ the solid angle isn't constant (think of sphere tessellation) but a function of $sin(\theta)$. In case of Monte Carlo integration and even distribution of samples over the hemisphere, each sample represents solid angle of $2\pi/N$ steradians and there's no $sin(\theta)$ solid angle weighting required.

  • $\begingroup$ Yet they are choosing samples from a join pdf of theta and azimuth (as you said, double integral over a rectangle) but the resulting radiance is instead multiplied by 1 / 2pi instead of sin(theta) / 2pi, why is that? $\endgroup$
    – Row Rebel
    Dec 22, 2017 at 2:44
  • $\begingroup$ If you are referring to Monte Carlo integration, there's no weighting required because the samples are evenly distributed over the hemisphere by uniformSampleHemisphere() function, so each sample has the same the same solid angle. In the case of double integral the samples close to sphere poles have smaller solid angle which is compensated with the sin-term $\endgroup$
    – JarkkoL
    Dec 22, 2017 at 4:06
  • $\begingroup$ Btw, if you would implement the integration with two nested sums over theta & phi, you would need to add the sin-term because the samples near poles would represent smaller solid angle than the samples at the equator. $\endgroup$
    – JarkkoL
    Dec 22, 2017 at 4:17
  • $\begingroup$ So essentially since the integration is a single recursive sum, each received differential radiance from a pixel represents the radiance along a single steradian and we multiply that by 2pi to estimate the irradiance arriving at point x, to finally multiply that value with the BRDF to see how much of that irradiance arrives to the camera? $\endgroup$
    – Row Rebel
    Dec 22, 2017 at 14:30
  • $\begingroup$ For hemispherical integration with even sample distribution (no biasing towards any region), each sample covers 2pi/n sr (hemisphere=2pi sr). So for the rendering equation you just add up all the samples multiplied by the solid angle for each sample (sample=incident radiance * brdf * cos(theta)) to calculate the total radiance from a pixel towards the eye. $\endgroup$
    – JarkkoL
    Dec 22, 2017 at 16:55

Your Answer

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

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