Jump to content
  • Advertisement
Sign in to follow this  

Lambert and the division by PI

This topic is 2175 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok so I'm still confused about this.
I define my diffuse lighting term as the following:

float4 Diffuse = Ka + (Kd / PI) * Ei;

Ei being the color of the light combined with the materials diffuse color multiplied by N dot L.
Ka = Ambient constant
Kd = Diffuse constant

So do I understand that right when I say my outgoing energy is < incoming energy ?
Because doing so what I get as a result is a darker color than when I don't divide by PI.

Ei = float4(1.0f, 1.0f, 1.0f, 1.0f);
would give me a complete white surface on a plane with a directional light shining directly onto it, while doing the division by PI the result looks more like something around
~ RGBA(0.7, 0.7, 0.7, 1.0f).

Now if what I said before was true would it even be possible to get a perfect white as a result if the output is always going to be darker than that? Edited by lipsryme

Share this post

Link to post
Share on other sites
You divide by pi because a BRDF works on infinitesimally small solid angles (it is a derivative), the total radiance contribution is summed up over the whole diffuse hemisphere which cancels out the 1/pi term to ensure energy conservation (note that you've already failed in that respect by using an ambient term, but anyway). And Ei can (and usually is) more intense than just (1, 1, 1).

This thread might make things clearer (pretty much the same question).

Share this post

Link to post
Share on other sites
The energy conservation thing is a little tricky to understand at first. This is because when you render you usually only deal with the amount of reflected energy that goes towards the viewer, but energy conservation is concerned with the amount of energy reflected in all directions. Formally you definite it as exitant irradiance <= incident irradiance, or


where Eo is defined like this:


where f is our BRDF. Conceptually you can imagine this as moving the camera everywhere around the hemisphere surrounding the normal, applying the BRDF, and summing up the amount that's reflected toward the camera. This is very different from saying "the amount of energy reflected in the view direction should be less than or equal to the incident lighting", which isn't required to be true for energy conservation. In fact with a physically-based specular term the specular reflection can be many times greater than the incident irradiance.

If we use Lambertian diffuse as our BRDF, we can derive the 1/pi factor required for energy conservation. For Lambertian our BRDF = DiffuseAlbedo, so if we assume albedo = 1 then our BRDF drops out completely. If we then assume that our only incident irradiance comes from a directional light with intensity = 1.0 that's exactly perpendicular to the surface, then Ei = 1.0 and that also drops. Which leaves us with this, once we convert from hemispherical integral to spherical double integral form:


If we solve that integral we get a result of pi, which means that if we multiply our diffuse by 1/pi then we'll satisfy the energy conservation inequality.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!