# Why does the reflected component in Lambertian path tracing get multiplied by a factor of 2?

I would like to intuitively understand the Path Tracing equation/formula/pseudocode, but I'm not fully getting the last return statement. As per Wikipedia page:

// Probability of the newRay
const float p = 1/(2*M_PI);
// Compute the BRDF for this ray (assuming Lambertian reflection)
float cos_theta = DotProduct(newRay.direction, ray.normalWhereObjWasHit);
Color BRDF = material.reflectance / M_PI ;
...
// Apply the Rendering Equation here.
return emittance + (BRDF * incoming * cos_theta / p);


I would understand:

• p is the probability of new ray (not quite sure what this means), though it's 1 / (2 * PI)
• cos_theta is the angle between the normal of a given surface and the incoming ray
• BRDF is the material colour divided by PI
• After computing the incoming colour, we add the emittance component with the Lambertian

I would interpret the second part of the return statement as:

1. Reflect current colour based on how much is incoming BRDF * incoming
2. "Weight" it by the angle (rays that are next to the normal would reflect more colour, energy) * cos_theta
3. But then we / p, which if we consider the BRDF, removed the PI component and leave a factor of 2 (BRDF / p = material.reflectance / M_PI * (2 * M_PI) = material.reflectance * 2)

Why is there such factor of 2? What is the most logical explanation to this?

• The division by $\pi$ in the brdf's constant is for energy preservation (then material.reflectance can be anything in [0,1]). This is unrelated to the division by $\frac{1}{2\pi}$ which is due to the pdf. The pdf is $\frac{1}{2\pi}$, since the probability of uniformly generating any point on the upper hemisphere is $\frac{\sin\theta}{2\pi}$. The $\sin\theta$ gets canceled with a term from the rendering equation, and $2\pi$ is the surface area of the unit hemisphere (the whole sphere has area $4\pi r^2$, and $r=1$ for the unit sphere). – lightxbulb Oct 22 '19 at 0:14
• Thanks for this, so it's a chance that 2 factor gets left there. Do you have a link to the full equation you mentioned there? – Emanuele Oct 22 '19 at 6:07
• The rendering equation? Search for rendering equation in google/wikipedia. – lightxbulb Oct 22 '19 at 9:44