• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
ZachBethel

Trying to understand the BRDF Equation

9 posts in this topic

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
0

Share this post


Link to post
Share on other sites
[quote name='MJP' timestamp='1338191296' post='4943925']
Does that make sense?
[/quote]
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. [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]
Best regards
0

Share this post


Link to post
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.
[/quote]

Yeah I screwed it up the first time I generated the image and attached it. [img]http://public.gamedev.net//public/style_emoticons/default/sad.png[/img] The one in the actual post should be correct.
0

Share this post


Link to post
Share on other sites
[quote name='MJP' timestamp='1338335257' post='4944483']
[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.
[/quote]

Yeah I screwed it up the first time I generated the image and attached it. [img]http://1.1.1.5/bmi/public.gamedev.net//public/style_emoticons/default/sad.png[/img] The one in the actual post should be correct.
[/quote]

Never mind, this was just me being pedantic. [img]http://public.gamedev.net//public/style_emoticons/default/wink.png[/img]
The post is very good and a nice refresher. [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]
0

Share this post


Link to post
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. [img]http://public.gamedev.net//public/style_emoticons/default/tongue.png[/img]

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
0

Share this post


Link to post
Share on other sites
Hi Zach,

[quote name='ZBethel' timestamp='1338610382' post='4945484']
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?
[/quote]
Yes, that’s right. Each differential incoming irradiance contributes a little to the total outgoing radiance. We simply sum up all (differential) contributions.

[quote name='ZBethel' timestamp='1338610382' post='4945484']
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?
[/quote]
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.

[quote name='ZBethel' timestamp='1338610382' post='4945484']
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?
[/quote]
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. [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]
2

Share this post


Link to post
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: [url="http://www.farbrausch.de/~fg/stuff/phong.pdf"]http://www.farbrausc...stuff/phong.pdf[/url] [img]http://public.gamedev.net//public/style_emoticons/default/wink.png[/img] Edited by Bummel
0

Share this post


Link to post
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:
[code]
// 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;
[/code]
1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0