# Trying to understand the BRDF Equation

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

## Recommended Posts

I'm trying to wrap my head around the mathematics behind the BRDF. I think I understand Radiance and Irradiance: irradiance is the flux through a projected area. In the case of the BRDF, irradiance means the flow of energy through the projected area that represents the point on the surface where we are evaluating the lighting equation. Radiance is the flow of energy through the projected area with respect to a solid angle.

The BRDF is defined as fr(wi, wo) = dL(wi) / dE(wo), where wi and wo are the incident and exitant solid angles.

According to wikipedia, this equation expands to fr(wi, wo) = dL(wi) / L(wi) * cos(theta) * dw. From what I can tell, this is the differential outgoing radiance divided by the incoming radiance along the incident solid angle, multiplied by the cosine of the azimuth angle (to account for the projected area term), multiplied by the differential solid angle.

My question is, if L is the energy evaluated along the incident differential solid angle, what does the differential of Radiance mean? To clarify, why do we need dL when L is effectively giving us the light energy along a single ray of light? Also, in the denominator, we have the radiance term, L, multiplied by the cosine of the angle (which I understand to be projecting the incident radiance onto the surface). Why is that L instead of dL?

Thanks. Edited by ZBethel

##### Share on other sites
Hey Zach,

You actually have those equations wrong. It should be like this:

[attachment=9077:CodeCogsEqn(2).gif]

This is basically saying that your BRDF function describes a ratio between differential output radiance towards the viewer, and differential incident irradiance. It's defined this way because overall what you do with your BRDF is determine the total radiance towards the viewer given the total incident irradiance on the surface. To compute irradiance you integrate incident radiance times cosine theta, which gives you this familiar equation:

[attachment=9076:CodeCogsEqn(1).gif]

In the case of this integral, the differential radiance is just an infinitesimally small portion of the total output radiance in the direction of the viewer. So you can imagine that by integrating you're just making a trip over the hemisphere, and calculating some fraction of the total outgoing radiance by computing the incident radiance from the set of directions given by the differential solid angle.

As for why you use Li and not dLi, you compute incident irradiance by integrating incident radiance * cos(theta) over the hemisphere. From this we can reason that differential irradiance for some infinitesimally small solid angle is equivalent to the incident radiance from that solid angle. You actually have this in the denominator of the first equation I posted:

[attachment=9079:CodeCogsEqn(4).gif]

Does that make sense?

##### Share on other sites

Does that make sense?

Perfectly!

Though, for consistency I’d say that in the attached thumbnail it should say [formula]dE_i[/formula] instead of [formula]dE_o[/formula], too. Anyway, it’s clear what you mean.

Personally, I like to think of the BRDF as the function “converting” the differential incoming irradiance [formula]dE_i[/formula] into the differential outgoing radiance toward the viewer [formula]dL_o[/formula]. This is just your first equation rearranged to:
[formula]dL_o = f_r \thinspace dE_i[/formula]

Integrating over the hemisphere gives the rendering equation nice and short:
[formula]L_o = \int_\Omega f_r \thinspace dE_i[/formula]

I like this angle more than the “ratio” explanation, though they of course mean the same thing.
Best regards

##### Share on other sites

Though, for consistency I’d say that in the attached thumbnail it should say [formula]dE_i[/formula] instead of [formula]dE_o[/formula], too. Anyway, it’s clear what you mean.

Yeah I screwed it up the first time I generated the image and attached it. The one in the actual post should be correct.

##### Share on other sites

[quote name='Tsus' timestamp='1338326758' post='4944445']
Though, for consistency I’d say that in the attached thumbnail it should say [formula]dE_i[/formula] instead of [formula]dE_o[/formula], too. Anyway, it’s clear what you mean.

Yeah I screwed it up the first time I generated the image and attached it. The one in the actual post should be correct.
[/quote]

Never mind, this was just me being pedantic.
The post is very good and a nice refresher.

##### Share on other sites
Hey Matt,

Yes, thank you very much, your explanation helped a ton. I was trying to write up the post while watching a movie, which is probably why I got the equations backwards.

I think the main part that confused me was the fact that we are summing (or integrating) over all of the differential outgoing radiance values (each of which have their infinitesimal incoming radiance that altogether compose the incoming irradiance). Do I have that right?

I noticed that in the integral we are solving for the total outgoing radiance along a given direction. It is a function that requires the BRDF to solve. It seems like somewhat of a circular definition that the BRDF includes the (diffferential) outgoing radiance as a variable, which is what we really want! I'm assuming that in practical implementations, the BRDF is a known equation of some kind that specifies the reflection ratios? I'm having a bit of a hard time mapping the theoretical into the practical implementation. I know Blinn Phong shading is a horrible example (because it lacks conservation of energy, and it's not physically accurate in any way), but is the specular component where we take the dot product between the half vector and normal technically the "BRDF" portion of the lighting equation? I hope that makes sense.

Thanks!
Zach. Edited by ZBethel

##### Share on other sites
Hi Zach,

I think the main part that confused me was the fact that we are summing (or integrating) over all of the differential outgoing radiance values (each of which have their infinitesimal incoming radiance that altogether compose the incoming irradiance). Do I have that right?

Yes, that’s right. Each differential incoming irradiance contributes a little to the total outgoing radiance. We simply sum up all (differential) contributions.

I noticed that in the integral we are solving for the total outgoing radiance along a given direction. It is a function that requires the BRDF to solve. It seems like somewhat of a circular definition that the BRDF includes the (diffferential) outgoing radiance as a variable, which is what we really want! I'm assuming that in practical implementations, the BRDF is a known equation of some kind that specifies the reflection ratios?

This is exactly why I don’t like much the ratio explanation of what the BRDF is. Formally, the BRDF is defined as the ratio between differential outgoing radiance and differential incoming irradiance (see Matt's post before):
[formula] f_r = \frac{dL_o}{dE_i}[/formula]
In practice we want to know the outgoing radiance, thus we rearrange to
[formula] dL_o = f_r \cdot dE_i[/formula].
Now, it’s obvious that the BRDF must be something given to us. The BRDF now "converts" the differential incoming irradiance to the differential outgoing radiance.

I know Blinn Phong shading is a horrible example (because it lacks conservation of energy, and it's not physically accurate in any way), but is the specular component where we take the dot product between the half vector and normal technically the "BRDF" portion of the lighting equation?

You can normalize the Blinn-Phong model to make it energy conserving. Then, it's not sooo bad anymore. ;)
And yes, you're right. Let me wrap things up:
First of, the dot product between normal and light is not contained in the BRDF. It is already contained in the incoming irradiance. The differential incoming irradiance is the product of the dot product between light vector and normal and the differential incoming(!) radiance. (See Matt's post.)

The simple Phong BRDF without any normalization is:
[formula]f_r(\omega_i,\omega_o) = \rho_d + \rho_s \cdot cos^n \psi[/formula]
Whereas [formula]\rho_d[/formula] and [formula]\rho_s[/formula] are the material’s diffuse and specular color (in other words the amount of flux reflected per color channel) and [formula]\psi[/formula] is the angle between eye vector and reflection vector (or in blinn-phong the half vector and the normal).

With the normalization the Blinn-Phong BRDF is:
[formula]f_r(\omega_i,\omega_o) = \frac{\rho_d}{\pi} + \rho_s \frac{n+8}{8\pi} cos^n \psi[/formula]
(The factors are individually obtained by integrating the BRDF weighted by the dot product of normal and light over the hemisphere.)

Well, and for the classic Phong BRDF it is:
[formula]f_r(\omega_i,\omega_o) = \frac{\rho_d}{\pi} + \rho_s \frac{n+2}{2\pi} cos^n \psi[/formula]

Hope this helped a little.

##### Share on other sites
The actual normalization factor for Blinn-Phong seems to be a bit more complicated according to this paper I found some time ago: http://www.farbrausc...stuff/phong.pdf Edited by Bummel

##### Share on other sites
It's not really a circular definition...it's just rearranging an equation. If you say that y = z * x then you can also say that z = y / x. In practical terms for graphics you're never going to "solve" for the BRDF, you're going to start with one based on some material model you're using for the surface and use that to solve for outgoing radiance.

Here's a really simple Blinn-Phong example for a directional light:
 // Compute incident irradiance float3 Ei = LightColor * saturate(dot(Normal, LightDirection)); // Compute the BRDF for the given normal + light direction + view direction float3 HalfVector = normalize(LightDirection + ViewDirection); float3 BRDF = pow(saturate(dot(Normal, HalfVector), SpecularExponent); // Calculate outgoing radiance by applying the BRDF to incident irradiance float3 Lo = BRDF * Ei; 

##### Share on other sites
Sweet, thanks guys. I'm understanding this a lot better now.