I’ve recently been learning more about BRDFs and their properties and I stumbled across the concept of energy conservation. Energy conservation simply states that your BRDF should not emit more energy than it receives. To determine if a BRDF is energy conserving, you accumulate all the light emitted by a surface across a hemisphere centered at the normal of that surface and assure that the accumulated light is less than or equal to the amount of received light.
The mathematical equation for this is:
Where is the incoming light, is the angle from our normal to our current accumulation direction.
Since is a constant, we can remove it and we’re left with:
Faced with this equation, I was struck. Where did that cosine come from?
Where did you come from? Where did you go? Where did you come from Cosine I Joe.
My first instinct was to brush it off. “It’s just the Lambert cosine factor”. False! The Lambert cosine factor was applied in which we removed.
I then began my slow decline into madness.
I was very confused. With a lot of stumbling I came up with various answers, each not as satisfying as I would like them to be.
Radiant exitance I yelped! Is it related to this “physics” and this “poynting vector” that you find when researching radiant flux? It might be, but I’m not proficient in the dark magic of physics. And so I moved on.
Can we instead think of it using the Helmholtz reciprocity principle that says that we can reverse our view and light vectors? This would allow us to flip the meaning of from our viewing direction to our light direction and then simply say it’s the Lambertian cosine factor. But this didn’t feel right. We’re not talking about Lambertian materials, we’re talking about accumulating light from a generalized material. I decided to move on from this theory.
Finally, it struck me. The circle had done it! It’s always the circle.
Let’s forget everything we talked about. Forget about incoming radiance. Forget about 3D. Forget about Helmholtz. Forget about physics.
It’s just geometry
Let’s take a look at what we’re doing when we’re calculating how much light is being emitted by a surface in 2D.
If we start with the integration of the BRDF across a 2D circle without the cosine factor, we get:
Where is our integration segment.
What this means is that We’re splitting the circle into equal lines and multiplying our emitted light by the width of each viewing segment.
Let’s take a look at each integration part in succession. Our integration method implies that we want to multiply our current light value by the width of our integration, as a result, we’ll draw 2 parallel lines for each line segment to represent the shape that would be the result of our multiplication.
When viewed top down, everything is great!
What about at an angle?
Oops! That doesn’t line up with our observed area, our perceived area is containing more than our desired . What do we do about it?
Let’s look at it from the perspective of projecting onto a line at different angles
Notice how our area is getting smaller as our angle gets steeper? That’s what our integration segment should be doing to remove the extra area that we observed.
Let’s figure out the proportion of that shrinking area.
Notice that we can calculate the length of our projection using a right angle triangle (It always comes back to triangles).
Our hypotenuse is , our angle is and our projected area is .
Remembering our identities, SOH CAH TOA, Sine of our angle is equal to our opposite over our hypotenuse. This gives us which we can reformulate as .
here is the area of our integration segment, it is the value by which we want to multiply our accumulated light. Now that we know how to get , we want to formulate in terms of our integration segment .
Since we know that from the top down (when is ) matches we can say that which simplifies to , as a result, we can replace our in the above to get .
We can therefore modify our integral to be and substituting we get . Close! But why is it a sine and not a cosine? This is because our angle is the angle from the plane of our normal to our normal but the information that we have is the angle from our normal to our plane (using N dot V). Let’s call the angle from the normal to the viewing direction . We know that . If we solve for we get and substituting to get which finally becomes !
We’ve reached the end. This is where our cosine comes from!
I spent quite some time trying to unravel this mystery, but it’s always exciting to get just that little bit of extra intuition. Hopefully this helps you understand it just a little bit more!
Q: Why don’t we always do this cosine when integrating over a hemisphere?
A: Because we’re not always integrating a differential area (). It would be wrong to always apply that rule if we’re instead integrating a smaller hemisphere, or some other geometrical concept
Q: Why don’t we multiply our light by this cosine factor when we’re rendering?
A: Because it’s implicit in our perspective projection. When we’re viewing the surface it already covers less of our viewing surface when viewed at an angle. If we applied the cosine when rendering we would be applying it twice. We apply it here because we don’t have any perspective projection applied when doing our integration.