6
$\begingroup$

Wikipedia's path tracing algorithm has the following line for the diffuse BRDF:

Color BRDF = 2 * m.reflectance * cos_theta;

I'm a little confused as I've been reading that Lambertian surface BRDF is $\frac{\rho}{\pi}$ where $\rho$ is the reflectivity (albedo?) of the surface. Where does the $2$ come from?

$\endgroup$
  • $\begingroup$ I can't give you a deeper answer unfortunately (someone else surely will!) but the 2 comes from integrating the BRDF over the hemisphere. You didn't ask, but you may also be wondering where the $\pi$ went. It's assumed that your color values already include the adjustment for $\pi$. You can read more about that here: seblagarde.wordpress.com/2012/01/08/… $\endgroup$ – Alan Wolfe Nov 15 '16 at 22:38
  • 1
    $\begingroup$ Thanks but why is the BRDF being integrated over the hemisphere at this stage of the algorithm when we're dealing with a single incident direction? $\endgroup$ – PeteUK Nov 15 '16 at 22:43
6
$\begingroup$

When you perform regular Monte Carlo integration over a hemisphere using $N$ samples, each sample represents $\frac{2\pi}{N}$ steradians. So the Monte Carlo integration for Lambertian BRDF is:

$$\frac{2\pi}{N}\sum_{i=1}^N\frac{\rho}{\pi}L_i*Cos\theta_i$$

For path tracing, you only take one sample per path segment, so because $N$=1, the above sum becomes:

$$2\pi\frac{\rho}{\pi}L*Cos\theta = 2\rho L*Cos\theta$$

$\endgroup$
  • $\begingroup$ Nice one, thanks. Trying to connect this to what my book has for MC estimator for the light going to the viewer: $\left \langle L_r(x\rightarrow\Theta) \right \rangle = \frac{1}{N}\sum_{1}^N\frac{L(x\leftarrow\Psi_i)f_r(x,\Theta\leftrightarrow \Psi_i)\cos(\Psi_i,N_x)}{p(\Psi_i)}$. The division is by the pdf which for non-cosine-weighted hemisphere sampling is $p(\Psi_i) = \frac{1}{2\pi}$. Dividing by a fraction is multiplication by reciprocal, and constant coefficient $2\pi$ gets pulled out from the sum. Does that make sense? $\endgroup$ – PeteUK Nov 16 '16 at 14:53
  • $\begingroup$ Although I've now confused myself again because that Wikipedia article says "in the naive case above, there is no particular sampling scheme, so the PDF turns out to be 1". But isn't the pdf $\frac{1}{2\pi}$? $\endgroup$ – PeteUK Nov 16 '16 at 15:24
  • 1
    $\begingroup$ Yes, pdf is $\frac{1}{2\pi}$ for uniform sampling over the hemisphere. $\endgroup$ – JarkkoL Nov 16 '16 at 18:05

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.