• 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
Aqua Costa

Physically Based Blinn Phong questions

12 posts in this topic

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? Edited by TiagoCosta
0

Share this post


Link to post
Share on other sites

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.
 

2

Share this post


Link to post
Share on other sites
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? Edited by TiagoCosta
0

Share this post


Link to post
Share on other sites
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).

Edited by Bacterius
0

Share this post


Link to post
Share on other sites
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? Edited by TiagoCosta
0

Share this post


Link to post
Share on other sites
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
1

Share this post


Link to post
Share on other sites

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.

1

Share this post


Link to post
Share on other sites

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

0

Share this post


Link to post
Share on other sites
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)
0

Share this post


Link to post
Share on other sites
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:

 

24y7i1j.jpg 25jgh3p.jpg

0

Share this post


Link to post
Share on other sites
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
0

Share this post


Link to post
Share on other sites
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.

0

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