Sign in to follow this  

Lightning:What is PDF (probability density function) ?

This topic is 2853 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I'm currently looking at some code to raytrace... but I've see that for the phong illumination equation : For diffuse, they divide the result by PI For specular they multiply the result by (power + 2) / (2 x PI)) I suppose it is related with the 'PDF' (probability density function) but I don't understand what it is and how to use it ? Is it related to 'Differential solid angle' ? If you have some literature about this ? Thanks

Share this post


Link to post
Share on other sites
In lighting math, it basically describes the probability at which a given "in-ray" will be scattered so that it becomes a given "out-ray".

But I think this explains it better than I would.

"Differential solid angle" is a measure that is of course related to lighting calculations, but not directly to PDFs per se (as PDFs are a general mathematic construct). I fail to find a good free reference, except maybe Eric Veach's thesis Robust Monte Carlo Methods for Light Transport Simulation , where he explains those basic terms, and if you have money, PBRT seems to be the de-facto reference for physically based rendering (I can only recommend it).

It looks like your being overwhelmed by terminology at the moment, so I'd say first things first, you should work through Jacco Bikkers tutorials on devmaster.net for a basic, yet fast ray tracer. And later, again, get a copy of PBRT if you can afford it, or if you don't fear the math, read Veach's thesis.

Oh, and we've got also ompf.org/forum, a forum dedicated to ray tracing of all kinds. It is low traffic, so it can sometimes be that very basic questions take some days to be answered, but you'll find competent people there, and through the search function a lot of good references and references to good references; I am pretty sure there are some good pointers to realistic image synthesis :)

Share this post


Link to post
Share on other sites
Thanks fresnell,

Just for information :
- I have PBRT
- I have see the wiki page before too :-P
- I have post the question at ompf too :-P

So,

I have not read the Veach thesis... I should.

But at this time, my rendering system is working fine except that I don't understand why :
for diffuse : I divide by Pi (And not 2Pi because Area of hemisphere = 2Pi)
for specular : I multiply the result by (power + 2) / (2 x PI))

I have see this code in other rendering system (During debuging I was getting false results... so I have read other peoples code).

Thanks

Share this post


Link to post
Share on other sites
Hmm, I am not into the Phong model that much. Maybe try finding the original paper?


edit: Where do you have those formulas from? (sidenote: I am off to ompf, where you can use \LaTeX)

Share this post


Link to post
Share on other sites
Hey,

It's pretty simple. I guess simple is relative...if you understand how to solve double integrals on the hemisphere then it is.

Basically, the idea is that BRDF's have to maintain the property that the incoming light integrated over the hemisphere must be less then or equal to 1. If it's greater then 1 then after light comes into your BRDF it will be gaining energy.

So, you set up your integral and solve for 1.

E.g, for lambert your brdf is n.l

Integral(cos(theta)dw = 1.

Solve for that over the hemisphere and you'll get pi. Which means you need to divide by pi to get it back to 1.

If you do the more complicated BRDF of phong and solve for 1 you'll get those normalization factor.

I'm lazy to write out the derivation on gamedev.net for the lack of latex. If you can't solve it yourself then ask and I'll post the derivation.


-= Dave

Share this post


Link to post
Share on other sites

This topic is 2853 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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