polar01 114 Report post Posted February 19, 2010 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 0 Share this post Link to post Share on other sites
phresnel 953 Report post Posted February 19, 2010 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 :) 0 Share this post Link to post Share on other sites
polar01 114 Report post Posted February 19, 2010 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 :-PSo,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 0 Share this post Link to post Share on other sites
phresnel 953 Report post Posted February 19, 2010 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) 0 Share this post Link to post Share on other sites
David Neubelt 866 Report post Posted February 19, 2010 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.lIntegral(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 0 Share this post Link to post Share on other sites