Re: [Algorithms] Pick dominant light from sh coeffs
Brought to you by:
vexxed72
From: Peter-Pike S. <pet...@ho...> - 2012-02-03 00:21:59
|
This is actually quite straightforward. The optimal linear direction is -L[3],-L[1],L[3] - assuming the usual sign conventions, storage, etc. where in your case L could be the luminance of the RGB SH vectors. If you are using the coefficients from appendix 10, it turns out to be even simpler - it is just the .xyz coefficients after doing a luminance weighting of cAr/cAg/cAb. That give you the direction. To generate the color of the light, you can simply evaluate the outgoing radiance using the above direction (as in the shader code in the appendix), and that's the color for the light (if illuminating a white material that is the light in the given direction that would give you the same diffuse response as the SH probe.) See the section of the paper titled: "Extracting Conventional Lights from SH" on a technique to solve for both a colored directional light and an ambient light given SH coefficients, but if you are using the storage in appendix 10 it's a bit trickier since the DC term has been "polluted" by part of the quadratic ZH function to make evaluation faster. You would have to reconstruct the original vector to do the math... Peter-Pike Sloan Date: Fri, 3 Feb 2012 09:22:21 +1000 From: dan...@gm... To: gda...@li... Subject: [Algorithms] Pick dominant light from sh coeffs I have 9 red, 9 green and 9 blue sh coefficients (packed using the method in appendix 10 of http://www.ppsloan.org/publications/StupidSH36.pdf). I want to pick a single dominant light to use for specular. How would I go about efficiently extracting the direction and color of that light from the coefficients? Looks like I need to calculate the "optimal linear direction" which is supposedly in this paper http://research.microsoft.com/en-us/um/people/johnsny/papers/ldprt.pdf, however I can't see it. Worse still, if it is in there, it is probably an integral that I will struggle to turn into code! Thanks Dan ------------------------------------------------------------------------------ Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d _______________________________________________ GDAlgorithms-list mailing list GDA...@li... https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list Archives: http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list |