Re: [Algorithms] PRT equations confussion.
Brought to you by:
vexxed72
From: <Pau...@sc...> - 2005-09-27 14:25:05
|
gda...@li... wrote on 27/09/2005 13:21:31: > Hi, > > hmm, this means I got the transfer vector right, which is what i thought > really. Then maybe this means that my L' coefficients vector is wrong. > > From the PRT equations it looks like that is calculated by doing a > projection of the light environment on the spherical function (SH in my > case) > > L(s) = Sum( li Yi(s)) [ where i = 0 to order^2 ] > > Which is a bit confusing because it does not tell me how to actually obtain > the li coefficients. So what I do instead is follow the Ramamoorhi and > Hanrahan paper (An Efficient Representation of Irradiance Environment Maps) > and project my env map using a weighted lookup. So I get > > L = Int (L(s) Y(s) )ds > > where L(s) is the light incomming from direction s and Y(s) is a spherical > harmonics function evaluated in the direction s. (this is a double integral > on theta and phi and there is a sin(theta) in there as well, but I just > presented it like that for simplicity). > > Now in my case L (calculated above) is just a vector Nx3 which is what li > coefficients put together are. > > So my question is: is it correct to use my calculated L coefficients (as of > above) in to the PRT equations? Are they the same as the li coefficients (or > L' in matrix/vector form) in the PRT equations? If not, how else do I > calculate the li coefficients needed for diffuse PRT? > > Thanks in advance, You have to make sure the maths is the same in both cases - i.e. the way you build the SH for your environment map and they way you build your SH for each 'normal' potential incoming radiance: Project both into SH using the same maths... from http://www.research.scea.com/gdc2003/spherical-harmonic-lighting.pdf a = 0.5sqrt(1/PI) b = 0.5sqrt(3/PI) c = 0.5sqrt(15/PI) d = 0.25sqrt(5/PI) Li[0] = a*1 Li[1] = b*y Li[2] = b*z Li[3] = b*x Li[4] = c*y*x Li[5] = c*y*z Li[6] = d*2*z^2-x^2-y^2 Li[7] = c*z*x Li[8] = c*x^2-y^2 So vector components x, y and z (the environment map and your bent 'normals') go though this function to generate the SH coefficients. If you have R, G and B you will have three such sets. Then at runtime, you just dot these two vectors (i.e. environment SH and per vertex SH) together to yield the intensity. You may have to do some other normalisation which i can't recall right now... If you haven't read that paper i linked to, it might shed some more light (um, another pun, horrah) on the subject. Cheers, Paul. ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify pos...@sc... This footnote also confirms that this email message has been checked for all known viruses. ********************************************************************** Sony Computer Entertainment Europe |