Re: [Algorithms] Lighting (HDR)
Brought to you by:
vexxed72
|
From: Nathaniel H. <na...@io...> - 2009-07-27 05:16:05
|
There are two ways to get a normalized BRDF with a cosine power term. One is to construct the BRDF empirically (e.g. as a modified Blinn-Phong), and then normalize the BRDF by computing an upper bound for the directional-hemispherical reflectance and dividing by it. The other is to derive the BRDF from physical principles (e.g. microfacet theory), treating the cosine power term as a normal distribution function (NDF) and normalizing it as such. The derivation on page 446 of "physically-based rendering" (PBR) relates to the second way. "Real-time rendering, 3rd edition" (RTR3) does both kinds of derivations, and compares them to each other. The empirical approach results in the (m+8)/8pi term (page 257 of RTR3). Unfortunately, we did not include the derivation in the book; we did the exact same derivation as Fabian Giesen (see page 2 of http://www.farbrausch.de/~fg/articles/phong.pdf), but approximated the integral with a simple function rather than using it directly. Since we were concerned with real-time rendering and not global illumination, we did not try to make the BRDF strictly energy-conserving (integral always less than 1) but just approximately so (integral close to 1, doesn't matter if slightly above or slightly below). We chose an approximation which was relatively accurate for low specular powers, which in our opinion is perceptually important. The physically based derivation starts with the derivation of microfacet BRDFs included in Ashikhmin, Shirley and Premoze's 2000 SIGGRAPH paper and "plugs in" a cosine power NDF (page 259 of RTR3). the result, like PBR, includes a (m+2) term, which is not surprising since the same normalization by projected solid angle is included in the derivation (the 8pi instead of 2pi term in the denominator is the result of converting between incident and half-vector angles). I wouldn't necessarily say (m+2) is "more correct" since it results from a physical derivation. Both are equally "correct", just based on different assumptions. In my own work, using relatively simple BRDFs, I have had good results with the (m+8)/8pi term (in most game engines the pi cancels out, so this is just (m+8)/8). If you are trying to include shadowing / masking and foreshortening terms and otherwise closely emulate a microfacet BRDF, you might want to go with (m+2)/8 instead. Thanks, Naty Hoffman > From: Matt Pharr <ma...@ph...> > Date: Sat, Jul 25, 2009 at 4:29 PM > Subject: Re: [Algorithms] Lighting (HDR) > To: Game Development Algorithms <gda...@li...> > > > (below) > > On Jul 25, 2009, at 12:00 PM, Fabian Giesen wrote: >> Joe Meenaghan wrote: >>> >>> 1. I have differing information about the normalization term for the >>> Blinn-Phong BRDF and I'd like to know which is correct. In Real-Time >>> Rendering the authors suggest (m + 8) / (8 * pi) based on a >>> derivation from Sloan and Hoffman. However, in Pharr and Humphrey >>> (Physically Based Rendering, p.446) they calculate (m + 2) / (2 * >>> pi). >>> The definite integral solution demonstrated in the >>> latter appears reasonable to me, so I'm uncertain. Normally I've >>> associated the m+2 version as the normalization term for plain Phong, >>> yet, Pharr and Humphrey are very explicitly referring to the Blinn >>> BRDF >>> and are using the half vector rather than the reflection vector in >>> their >>> discussion, and they are convincing. Is there something I'm missing? > > Unfortunately RTR doesn't seem to have a derivation, so it's hard to > see precisely where the difference comes from. One general note is > that the PBR book is normalizing a microfacet distribution, but RTR is > (from a quick skim) normalizing a BRDF. So I think that the 2pi vs > 8pi difference in the denominator comes from the fact that 2pi works > out to be the right denominator for a normalized microfacet > distribution, but if you fold in the 1/4 term that comes in the > Torrance-Sparrow BRDF (discussed on p442 of the PBR book), then that > covers that difference. > > The (m+2) vs (m+8) stuff in the numerator I don't have any insight > on. As far as I know the PBR derivation is correct and I just wrote a > short program to verify the result numerically and it all came out as > expected. Hopefully Naty can chime in? > >> >> I went through the same thing a few months ago. See the discussion in >> the comments here: >> >> http://www.rorydriscoll.com/2009/01/25/energy-conservation-in-games/ >> >> (Including a comment from Naty Hoffman who did the derivation >> mentioned >> in RTR). The exact normalization factor obviously depends on what >> variant of the BRDF you use. I did the computation for typical >> variants >> of Phong and Blinn-Phong here: >> >> http://www.farbrausch.de/~fg/articles/phong.pdf > > I think there is a bug in the Blinn-Phong normalization there. In > particular, I don't think that the first step of going from an > integral over cos theta h to an integral of cos theta/2 is right (or > needed--the microfacet distribution can be normalized fine in theta_h > land.) > > A related note is that the extra cos theta factor doesn't come from it > being a BRDF, but comes from the geometry of microfacets--i.e. the > projection of a microfacet with angle theta_h from the actual surface > normal projects to a differential area scaled by cos theta_h on the > actual surface. > >> >> (also referenced in the discussion above). Hope that helps! >> >> Cheers, >> -Fabian "ryg" Giesen |