Energy conservation of diffuse term

Started by
17 comments, last by SergeyAS 10 years, 8 months ago

I've seen quite often that the diffuse term is being modulated by a diffuse fresnel term using NdotL as an approximation like so:


Ldiff = cdiff * (cosTheta_i * E_L * (1.0f - DiffuseFresnel));

What I don't quite understand is since cdiff is already the directional hemispherical reflectance constant of lambert's BRDF should that not already be energy conserving ? Since we only define the diffuse color in between [0-1]. Do We need to do this because we combine it with a specular brdf ? But shouldn't it be enough then to only make sure that the specular term is energy conserving ?

Am I missing something ?

Advertisement

It's because the energy conservation considers the integration across the hemisphere, while you're talking about a single ray.

To explain in simple terms, imagine a rectangle of 5x1 in size where the height is the amount of energy going out of from a single ray, each sub-millimeter of the width is a single ray (infinite rays means infinitely small increments across the width), and the area of the rectangle is the total energy going out (the sum of all rays)

Now with this analogy, the area of the rectangle is the one that must be equal to one, and your question would be like asking why do you need to change your formula if the height at any given point is 1. The thing is, we need the area to be 1, not the height.

If height = 1 and width = 5; then the rectangle area is not energy conserving because it's equal to 5x1 = 5.

Thus, you need to divide your output by 5 (or multiply by 0.2) from each ray so that the area is now 1 --> 5 * 1 * 0.2 = 1

This is a simple analogy in 2D terms using a basic rectangle. BRDF is exactly the same thing but over a hemisphere in 3D space. To mathematically obtain the right factor you need to be familiar with limits of integration.

An example of analytically obtaining the right factor can be seen here; and you can look at an even harder example from Fabian Giesen.

Note that integration is an advanced topic, usually taught in University-level courses. Some integrals are so hard to solve that we scratch our head multiple times, or just turn to Monte Carlo solutions (a fancy word for saying try multiple times until you start approaching the result)

...constant of lambert's BRDF should that not already be energy conserving ? Since we only define the diffuse color in between [0-1]. Do We need to do this because we combine it with a specular brdf ?

IIRC, for lambert to be energy conserving the constant/colour must be from 0 to 1/pi.
Anyway, say you've got an energy conserving diffuse brdf, and an energy conserving specular brdf -- individually they each reflect <=100% of the input energy, so when combined together they reflect <=200%...
The fresnel term you mention is used to blend the two brdf's together so that when they're combined, the total reflectance is <=100% again.

I see, maybe it was just confusing to me since in real-time rendering 3rd edition they wrote:

"The requirement for a BRDF to be energy conserving is simply that R(l) be no greater than one for all possible values of l"

and not specifically the sum of all possible values. So I thought it is enough for every single ray to be between 0 and 1 for the BRDF to be energy conserving.

That's an interesting phrase from RTR, I might have to re-read their explanation, maybe they suggest the correct meaning through the context around that sentence? Do you have a page number? wink.png

Yeah, AFAIK, it should read something like: "that R(I) integrated over the hemisphere will be no greater than I".

Yeah it's at the bottom of page 227.

They do show that R(l) is equal to the BRDF times the cosine of the angle between n and l, integrated over all possible outgoing directions in the hemisphere. Still that sentence confused me.

Just throwing this out there, I think the problem is more that most of the classical BRDFs used in rendering are designed to be 'one-shot' in the sense they don't offer a breakdown for diffuse and specular terms. When a theoretical graphics programmer is using said BRDFs as intended, there's no energy competition between the two terms, and our 'diffuse Fresnel' problem goes away. In fact, the reason we have these models more has to do with the rather crappy indirect lighting situation most games find themselves in-- we have to get a little more bang for our buck from existing point lights, etc. so we have a sort of multilayered BRDF approach that's designed to show detail not immediately in the specular area of influence.

EDIT: Yeah, I wrote this on reduced sleep and in a rush to get to work; I'm not sure where I was going with the whole GI/multilayer BRDF thing. See MJP's post below for a nice explanation of what I think I was originally going for wink.png

clb: At the end of 2012, the positions of jupiter, saturn, mercury, and deimos are aligned so as to cause a denormalized flush-to-zero bug when computing earth's gravitational force, slinging it to the sun.

Huh? The lack of GI is not the reason we break the BRDFs into Diffuse & Specular terms.

Specular formulas simulate lighting coming with a particular polarity pattern while Diffuse lighting simulate lighting coming with polarization patterns on a different axis.

This is a real life phenomenon unrelated to Indirect/Global Ilumination.

In general the combination of a diffuse and specular is just to simulate materials that are actually composed of multiple layers consisting of different reflective properties. The classic example would be a coated plastic, where you have a very smooth specular reflection on the surface layer while underneath you have a layer that's much rougher with subsurface scattering that causes the reflected light to take on the albedo color. You can generalize this to having a material being composed of a sum of BRDF's, instead of a more rigid diffuse/specular relationship. For instance on cars you typically have a clear coat on top, and a more metallic surface underneath that is still very much view-dependent which necessitates another specular lobe. In all cases you just need to be careful in how you set up the interactions between the two BRDF terms if you want to maintain energy conservation.


Huh? The lack of GI is not the reason we break the BRDFs into Diffuse & Specular terms.

Specular formulas simulate lighting coming with a particular polarity pattern while Diffuse lighting simulate lighting coming with polarization patterns on a different axis.

This is a real life phenomenon unrelated to Indirect/Global Ilumination.

I always thought that the traditional difference between specular and diffuse terms was simply that the specular term is only the light that is perfectly reflected from the light source, rather than being reflected over some distribution of angles (although I've also colloquially heard specular be considered any light reaching the camera dependent on the angle between the camera and the reflector as well; in this case diffuse would be limited to "ideal" diffuse, and certain kinds of materials like Minnaert shading, which give off light in certain directions but not dependent on the angle of entry, would still be considered "specular"). My recollection of how polarity works seems to suggest that it isn't sufficient to make that distinction, at least in all cases.


In all cases you just need to be careful in how you set up the interactions between the two BRDF terms if you want to maintain energy conservation.

I'm a bit curious about this. Since real-life materials are perfectly capable of absorbing light and then re-emitting it as energy other than visible light, what does it really mean to have a material that doesn't conserve energy? I guess materials that absorb light in especially strange, angle-sensitive ways are probably rare, but it seems plausible that some arrangement of microfacets could potentially be described by materials which are obviously "wrong."

-~-The Cow of Darkness-~-

This topic is closed to new replies.

Advertisement