Phong model BRDF

Started by
7 comments, last by MJP 7 years, 10 months ago

Can someone explain the next quote from Real-Time Rendering, section 7.6?

2VyeQ.png

Why is the outgoing radiance equal to 0 when the angle between n and l is <= 0?

The author then explains a few things, getting to the next BRDF which I understand:

Image.png (equation 7.46)

But right after that, he says: "The directional-hemispherical reflectance of the specular term can now be calculated. It turns out that when Theta = 0, it reaches a maximum value of 2*Cspec / (m+2)."

How did he get that? First, theta isn't present in equation 7.46, and second, I can't see any possible way to get to the term he wrote.

Here's the whole quote from the book

Image.png

Advertisement

Why is the outgoing radiance equal to 0 when the angle between n and l is <= 0?

Because the surface is back-facing from the light's point of view. The rendering equation itself -- which the BRDF plugs into -- multiplies the entire BRDF by N?L, so having this condition within the BRDF is actually superfluous. I guess it's just mentioned because most realtime renderers actually don't implement the rendering equation properly, so that condition is required to avoid getting specular highlights on the wrong side of an object.

As for the rest, this cosm term seems weird. Phong is based around (L?reflect(V,N))m, which is equivalent to cos(?r)m, where ?r is the angle between the reflection direction and the light direction...

I don't get it. When does theta ever become negative? When it's 0, n and l point to the same direction, so how can the surface be backfacing?

One more question: in the shader code itself, gl_FragColor will eventually be Lo (outgoing radiance), or the BRDF itself?

I don't get it. When does theta ever become negative? When it's 0, n and l point to the same direction, so how can the surface be backfacing?

One more question: in the shader code itself, gl_FragColor will eventually be Lo (outgoing radiance), or the BRDF itself?

Oh, hahah I typed all that and didn't notice the problem...

It should actually be testing whether cos(?) is above or below zero -- i.e. whether ? is below or above 90º!

Yeah in a traditional Phong shader, Lo is the result.

Damn with this book. It's supposed to be a standard yet it fails sometimes. I spent too much time figuring out why the hell he notes ? <= 0.

Why is the outgoing radiance equal to 0 when the angle between n and l is <= 0?

Because the surface is back-facing from the light's point of view. The rendering equation itself -- which the BRDF plugs into -- multiplies the entire BRDF by N?L, so having this condition within the BRDF is actually superfluous. I guess it's just mentioned because most realtime renderers actually don't implement the rendering equation properly, so that condition is required to avoid getting specular highlights on the wrong side of an object.

As for the rest, this cosm term seems weird. Phong is based around (L?reflect(V,N))m, which is equivalent to cos(?r)m, where ?r is the angle between the reflection direction and the light direction...


It's not cosm, it's cosm?r, where ?r is the angle between the light direction and the reflected view direction.

That makes a hell of a lot more sense... :wub:

Hi again, although I don't like this chapter of the book it does explain mandatory stuff.

A few questions:

1. What's a "reflectance value"? As mentioned twice in:

Image.png

2. If the "specular term" is the whole right term in the BRDF, then what's Rspec? (mentioned as "Rspec of the specular term")

3. Why does the BRDF in equation 7.45 becomes too bright at glancing angles? ?i is the angle between the normal and the light, not the normal and the view direction. Shouldn't it be glancing angles if viewed from the light source then?

4. How did the author get to equation 7.47 in here?

Image.png

1. Reflectance is the ratio of outgoing light to incoming light. In other words, for any beam of light striking the surface it tells you how much of that light will reflect off of it instead of getting absorbed. Since it's a ratio, only [0,1] values make sense if you're going to enforce energy conservation. You can compute it for a BRDF and a light direction by integrating the result of the BRDF over the entire hemisphere of viewing directions. So you can essentially think of that process as summing up all of the light that's reflected in all directions from a single ray of light.

2. Rspec is the reflectance of the specular BRDF.

3. By "glancing angle" they mean that the vector light source is close to parallel with the surface plane. This is consistent with the common usage of the term glancing angle in the field of optics, where it refers to an incoming ray striking a surface.

4. So as that paragraph says, they compute the directional-hemispherical reflectance of the specular BRDF with the light direction held constant at ThetaI = 0. Since the reflectance is highest when ?i = 0, you know that the reflectance value represents the maximum possible reflectance value for the BRDF. So by computing the maximum reflectance and then dividing the BRDF by that value, you can be sure that the reflectance of the BRDF never exceeds 1 (as long as Cspec is <= 1).

If you want to derive this result yourself, first start with the specular BRDF. This is the right side of 7.46:

[attachment=32173:BRDF.png]

As we established earlier, we can compute directional hemispherical reflectance by integrating our BRDF about the hemisphere of possible viewing directions. We'll call this set of directions ?v, and in spherical coordinates we'll refer to the two coordinates as ?v and ?v (not to be confused with ?i, which refers to our incident lighting direction). The integral we want to evaluate looks like this:

[attachment=32174:Reflectance.png]

The "sin?v" term is part of the differential element of a spherical surface, which is defined as dS = r2sin?d?d?. In our case we're working on a unit hemisphere, so r = 1.

Now we're going to evaluate this with ?i held constant as zero. In this case ? is equal to ?v, and so we can make that substitution. We can also pull out Cspec / ?, since that part is constant:

[attachment=32176:Result.png]

You can verify the result of this integral using Wolfram Alpha.

EDIT: I accidentally left out the "d?" and "d?d?" from the integrals in the middle image. Please pretend that I put them in there. :)

This topic is closed to new replies.

Advertisement