• Create Account

Physically Based Blinn Phong questions

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

12 replies to this topic

#1TiagoCosta  Crossbones+   -  Reputation: 3105

Like
0Likes
Like

Posted 11 January 2013 - 09:46 AM

According to RTR3 and this article (n+8)/8Pi is the energy conservation term for Blinn-Phong.

So if we integrate it in

ignoring both the visibility and the fresnel terms we should use ?

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?

Edited by TiagoCosta, 11 January 2013 - 09:50 AM.

#2macnihilist  Members   -  Reputation: 377

Like
2Likes
Like

Posted 11 January 2013 - 11:07 AM

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.

#3TiagoCosta  Crossbones+   -  Reputation: 3105

Like
0Likes
Like

Posted 11 January 2013 - 04:18 PM

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?

Edited by TiagoCosta, 11 January 2013 - 04:18 PM.

#4Bacterius  Crossbones+   -  Reputation: 11928

Like
0Likes
Like

Posted 11 January 2013 - 05:05 PM

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:

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).

Edited by Bacterius, 11 January 2013 - 05:07 PM.

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

#5TiagoCosta  Crossbones+   -  Reputation: 3105

Like
0Likes
Like

Posted 11 January 2013 - 05:40 PM

The RDFs and NDFs nec­es­sar­ily con­tain , as the result of an inte­gra­tion over parts of a sphere. In the shader code how­ever, 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 . Let this sphere have radius and a homo­ge­neous emis­sive sur­face of radi­ance . 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 . So there you have in the for­mula for the irra­di­ance of a point light, neatly can­cel­ing with the from the RDF/​NDF.
So Pi or no Pi?

Edited by TiagoCosta, 11 January 2013 - 05:41 PM.

#6macnihilist  Members   -  Reputation: 377

Like
1Likes
Like

Posted 12 January 2013 - 04:04 AM

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.)

Edited by macnihilist, 12 January 2013 - 04:20 AM.

#7MJP  Moderators   -  Reputation: 14989

Like
1Likes
Like

Posted 12 January 2013 - 04:51 AM

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.

#8TiagoCosta  Crossbones+   -  Reputation: 3105

Like
0Likes
Like

Posted 13 January 2013 - 03:52 PM

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).

#9Bacterius  Crossbones+   -  Reputation: 11928

Like
0Likes
Like

Posted 14 January 2013 - 04:13 AM

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.”

#10B_old  Members   -  Reputation: 673

Like
0Likes
Like

Posted 14 January 2013 - 08:16 AM

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)

#11TiagoCosta  Crossbones+   -  Reputation: 3105

Like
0Likes
Like

Posted 14 January 2013 - 08:47 AM

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

When normalized both lambert diffuse and blinn-phong NDF terms have Pi in the denominator so:

#12B_old  Members   -  Reputation: 673

Like
0Likes
Like

Posted 14 January 2013 - 09:24 AM

Ok, in that case I see how it makes sense to "pretend" that a light really emits pi times as much energy.
But then I don't understand MJP's comment, that the pi is important for balancing diffuse and specular. How so if they both are affected equally?

Edited by B_old, 14 January 2013 - 12:21 PM.

#13TiagoCosta  Crossbones+   -  Reputation: 3105

Like
0Likes
Like

Posted 14 January 2013 - 10:32 AM

But that I don't understand MJP's comment, that the pi is important for balancing diffuse and specular. How so if they both are affected equally?

He's saying that if you remove the pi from the diffuse and leave it in the specular the lighting wont be balanced because the diffuse will too bright, and the same will happen the other way around, if you remove the pi from the specular and leave it in the diffuse the specular will be too bright.

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

PARTNERS