Physically Based Blinn Phong questions

Started by
11 comments, last by Aqua Costa 11 years, 3 months ago
According to RTR3 and this article (n+8)/8Pi is the energy conservation term for Blinn-Phong.

So if we integrate it in microBRDF.png

ignoring both the visibility and the fresnel terms we should use Code_Cogs_Eqn.gif ?

Far Cry 3 seems to be using (n+2)/2Pi (slide 43) which is incorrect? And the same goes for this topic.

Or am I missing something?
Advertisement

You have to distiguish between normalizing a BRDF and normalizing a microfacet distribution. (And between Phong and Blinn-Phong). This is a relatively nice online resource on the topic:
http://www.thetenthplanet.de/archives/255

(n+2)/(2*pi) is for the modified Phong BRDF (i.e. the BRDF without the cosine in the denominator).
It is also correct for the Blinn-Phong MF-distribution.

(n+8)/(8*pi) is an approximation commonly used for the modified Blinn-Phong BRDF. As far as I remember, it is slightly too large, but in most cases where this BRDF is used it doesn't really matter.

Thanks! That link explained it.

Related questions:
Should I remove the Pi in every light source? Or just in point lights?
And the Lambert normalization factor is cdiff/Pi, should the Pi also be removed?
Thanks! That link explained it.

Related questions:
Should I remove the Pi in every light source? Or just in point lights?
And the Lambert normalization factor is cdiff/Pi, should the Pi also be removed?

The factor of 1/pi is independent of the light source. If you integrate the Lambertian cosine term over the hemisphere of incoming directions, you get:

[eqn]\displaystyle \int_\Omega | \omega \cdot \mathbf{n} | ~ \text{d} \omega = \int_0^{2 \pi} \int_0^{\frac{\pi}{2}} \sin{\theta} \cos{\theta} ~ \text{d} \theta ~ \text{d} \phi = \pi[/eqn]

So to make sure your BRDF is normalized, you need to divide by pi. In realtime rendering this division is often precomputed into the light intensity values themselves, as you achieve essentially the same result by doing that (it should be clear by looking at the rendering equation).

“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”

From macnihilist link:
The RDFs and NDFs nec­es­sar­ily con­tain quicklatex.com-8a8665f7cf659993bfd05b5dd, as the result of an inte­gra­tion over parts of a sphere. In the shader code how­ever, quicklatex.com-8a8665f7cf659993bfd05b5dd does usu­ally not appear, because it can­cels out when mul­ti­ply­ing with irra­di­ance, which is itself an inte­gra­tion over parts of a sphere.
Con­sider a point light source mod­eled as a small and very far away sphere, at dis­tance quicklatex.com-2650c16c3c9e38aa51f9867a2. Let this sphere have radius quicklatex.com-41b55da56ff026ecf99579290 and a homo­ge­neous emis­sive sur­face of radi­ance quicklatex.com-6f95e74d0f47b89836795acc8. From the point of view of the receiv­ing sur­face, the solid angle sub­tended by this sphere is a spher­i­cal cap, and so the irra­di­ance inte­grates to quicklatex.com-1a5fd135a91ccf6615e08f641. So there you have quicklatex.com-8a8665f7cf659993bfd05b5dd in the for­mula for the irra­di­ance of a point light, neatly can­cel­ing with the quicklatex.com-8a8665f7cf659993bfd05b5dd from the RDF/?NDF.
So Pi or no Pi?
The way I see it, the derivation in the link is a special case for a small circular area light. Small means small enough (as seen from the surface) that you can assume the fr*cos term is constant over the projected area and take it out of the integral. For this case it's correct, but I'm pretty sure you cannot generalize this to arbitrary lights.

But, as Bacterius said, for _direct_ illumination from delta lights, you can always pull the pi into the light's intensity. Example:

Consider a point light 1 unit above a surface normal to the light. Let's say the light causes an irradiance of E=1 at the surface point closest to the light. For a diffuse BRDF we get for every direction
L_o(wo) = fr*E.

Case 1: With fr = 1 we get L_o = 1 for every direction. The radiant exitance (Lo*cos integrated over hemisphere) is M = pi. So we have M>E which means we reflect more than came in.

Case 2: With fr = 1/pi we get exactly M=E, which is correct.

Of course, in case 1 you can always say "My light source was really causing E=1*pi and my BRDF was really 1/pi". You'll get the exact same image (if only direct illumination from this point light is considered), but you safe a division by pi.


Bottom line:
In my opinion, the pi should always be there. But if you're only doing direct illumination from delta lights and every multiplication counts, you can pull the pi into the light sources. But that's only my personal opinion, so you should take it with a pinch of salt.

EDIT: Of course, if you decide to "pull pi into the light source", you have to multiply _every_ BRDF by pi. (And every BRDF component, e.g. if you only remove pi in the diffuse term, you'll obviously shift the balance between diffuse and glossy.)

For diffuse alone the pi factor isn't really that important. Like others have mentioned you can consider it to be "baked" into the light intensity and so the difference is mostly arbitrary. What's it's actually important for is balancing your diffuse with your specular, which is what machnilist mentioned above. If you don't properly account for the 1/pi you can easily end up with diffuse that's too bright, and your materials won't look right.

Thanks for all answers! So the most important thing is consistency, either both diffuse and specular BRDF have the pi factor or neither.

I did a little more research, and found the calculations that eliminate the Pi factor and an explanation in SIGGRAPH 2012 PBR Course notes (page 21).

Especially if you're doing tone-mapping, a constant intensity difference everywhere will probably make little to no difference to the final render.

“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”

Of course, in case 1 you can always say "My light source was really causing E=1*pi and my BRDF was really 1/pi". You'll get the exact same image (if only direct illumination from this point light is considered), but you safe a division by pi.

I haven't understood which part should be divided by pi if the light is not implicitly causing pi*1 light.

Should it be:


((diffuse / pi) + (f_microfacet)) * light_energy

or


(diffuse + f_microfacet) * (light_energy / pi)

This topic is closed to new replies.

Advertisement