410 likes | 436 Vues
Computer. Graphics. Group. Fast Approximation to Spherical Harmonics Rotation. Jaroslav Křivánek Czech Technical University. Ja akko Konttinen University of Central Florida. Jiří Žára Czech Technical University. Sumanta Pattanaik University of Central Florida. Kadi Bouatouch
E N D
Computer Graphics Group Fast Approximation to Spherical Harmonics Rotation Jaroslav Křivánek Czech Technical University Jaakko Konttinen University of Central Florida Jiří Žára Czech Technical University Sumanta Pattanaik University of Central Florida Kadi Bouatouch IRISA / INRIA Rennes
Presentation Topic • What? • Rotate a spherical function represented byspherical harmonics • How? • Approximation by a truncated Taylor expansion • Why? • Applications in real-time rendering and global illumination Jaroslav Křivánek – Spherical Harmonics Rotation
Unfortunate Finding • Our technique is only MARGINALLYFASTER than a previous technique. Jaroslav Křivánek – Spherical Harmonics Rotation
Questions You Might Want to Ask • Q1: So why taking up a SIGGRAPH sketch slot? • Found out only very recently. • Q2: And before? • Implementation of previous work was NOT OPTIMIZED. • Q3: Does optimization change that much? • In this case, it does (4-6 times speedup). • Q4: How did you find out? • I’ll explain later. Jaroslav Křivánek – Spherical Harmonics Rotation
Talk Overview • Spherical Harmonics • Spherical Harmonics Rotation • Previous Techniques • Our Rotation Approximation • Applications & Results • Conclusions Jaroslav Křivánek – Spherical Harmonics Rotation
Talk Overview • Spherical Harmonics • Spherical Harmonics Rotation • Previous Techniques • Our Rotation Approximation • Applications & Results • Conclusions Jaroslav Křivánek – Spherical Harmonics Rotation
Spherical Harmonics • Basis functions on the sphere Jaroslav Křivánek – Spherical Harmonics Rotation
+ + + + + + + Spherical Harmonics + Jaroslav Křivánek – Spherical Harmonics Rotation
Spherical Harmonics Function represented by a vector of coefficients: n … order Jaroslav Křivánek – Spherical Harmonics Rotation
Talk Overview • Spherical Harmonics • Spherical Harmonics Rotation • Previous Techniques • Our Rotation Approximation • Applications & Results • Conclusions Jaroslav Křivánek – Spherical Harmonics Rotation
SH Rotation – Problem Definition • Given coefficients , representing a sphericalfunction • find coefficients for directly from coefficients . Jaroslav Křivánek – Spherical Harmonics Rotation
SH Rotation Matrix • Rotation = linear transformation by R: • R … spherical harmonics rotation matrix • Given the desired 3D rotation, find the matrix R Jaroslav Křivánek – Spherical Harmonics Rotation
Talk Overview • Spherical Harmonics • Spherical Harmonics Rotation • Previous Techniques • Our Rotation Approximation • Applications & Results • Conclusions Jaroslav Křivánek – Spherical Harmonics Rotation
Previous Work – Molecular Chemistry • [Ivanic and Ruedenberg 1996] • [Choi et al. 1999] • Slow • Bottleneck in rendering applications Jaroslav Křivánek – Spherical Harmonics Rotation
Previous Work – Computer Graphics • [Kautz et al. 2002] • zxzxz-decomposition • THE fastest previous method • THE method we compare against • THE method nearly as fast as ours • if properly optimized Jaroslav Křivánek – Spherical Harmonics Rotation
zxzxz-decomposition [Kautz et al. 02] • Decompose the 3D rotation into ZYZ Euler angles: R = RZ(a) RY(b) RZ(g) Jaroslav Křivánek – Spherical Harmonics Rotation
zxzxz-decomposition [Kautz et al. 02] • R = RZ(a) RY(b) RZ(g) • Rotation around Z is simple and fast • Rotation around Y still a problem Jaroslav Křivánek – Spherical Harmonics Rotation
zxzxz-decomposition [Kautz et al. 02] • Rotation around Y • Decomposition of RY(b) into • RX(+90˚) • RZ(b) • RX(-90˚) • R = RZ(a) RX(+90˚) RZ(b) RX(-90˚) RZ(g) • Rotation around X is fixed-angle • pre-computed matrix Jaroslav Křivánek – Spherical Harmonics Rotation
zxzxz-decomposition [Kautz et al. 02] • Optimized implementation – unrolled code • 4-6 x faster Jaroslav Křivánek – Spherical Harmonics Rotation
Talk Overview • Spherical Harmonics • Spherical Harmonics Rotation • Previous Techniques • Our Rotation Approximation • Applications & Results • Conclusions Jaroslav Křivánek – Spherical Harmonics Rotation
Our Rotation • zyz decomposition: R = RZ(a) RY(b) RZ(g) • RY(b) approximated by a truncated Taylor expansion Jaroslav Křivánek – Spherical Harmonics Rotation
Taylor Expansion of RY(b) Jaroslav Křivánek – Spherical Harmonics Rotation
Taylor Expansion of RY(b) • “1.5-th order Taylor exp.” • Fixed, sparse matrices Jaroslav Křivánek – Spherical Harmonics Rotation
SH Rotation – Results • L2 error for a unit length input vector Jaroslav Křivánek – Spherical Harmonics Rotation
Talk Overview • Spherical Harmonics • Spherical Harmonics Rotation • Previous Techniques • Our Rotation Approximation • Applications & Results • Conclusions Jaroslav Křivánek – Spherical Harmonics Rotation
Application 1 – Radiance Caching • Global illumination: smooth indirect term • Sparse computation • Interpolation Jaroslav Křivánek – Spherical Harmonics Rotation
p1 p2 p Incoming Radiance Interpolation • Interpolate coefficient vectors 1 and 2 Jaroslav Křivánek – Spherical Harmonics Rotation
Interpolation on Curved Surfaces Jaroslav Křivánek – Spherical Harmonics Rotation
p p1 Interpolation on Curved Surfaces • Align coordinate frames in interpolation R Jaroslav Křivánek – Spherical Harmonics Rotation
Radiance Caching Results Jaroslav Křivánek – Spherical Harmonics Rotation
Radiance Caching Results Direct illumination Direct + indirect Jaroslav Křivánek – Spherical Harmonics Rotation
More radiance caching: Temporal radiance caching, 3:45, room 210 Jaroslav Křivánek – Spherical Harmonics Rotation
Application 2 – Normal Mapping • Original method by [Kautz et al. 2002] • Environment map • Arbitrary BRDF • Extended with normal mapping • Needs per-pixel rotation to align withthe modulated normal • Rotation implemented in fragment shader Jaroslav Křivánek – Spherical Harmonics Rotation
Normal Mapping Results Rotation Ignored Our Rotation Jaroslav Křivánek – Spherical Harmonics Rotation
Normal Mapping Results Rotation Ignored Our Rotation Jaroslav Křivánek – Spherical Harmonics Rotation
Comparison – Time per rotation (CPU) • DirectX October 2004: 1.8 x slower than Ivanic Order 6 Order 10 T [ms] T [ms] Jaroslav Křivánek – Spherical Harmonics Rotation
Talk Overview • Spherical Harmonics • Spherical Harmonics Rotation • Previous Techniques • Our Rotation Approximation • Applications & Results • Conclusions Jaroslav Křivánek – Spherical Harmonics Rotation
Conclusion • Proposed approximate SH rotation • Slightly faster than previous technique • SH Rotation Speed • Our approximation • DX 9.0c (up to order 6) • zxzxz-decomposition with unrolled code • Lesson learned • Micro-optimization important for fair comparisons Jaroslav Křivánek – Spherical Harmonics Rotation
Future Work • Fast approximate rotation for wavelets Jaroslav Křivánek – Spherical Harmonics Rotation
Questions • Code on-line (SH rotation, radiance caching) • http://moon.felk.cvut.cz/~xkrivanj/projects/rcaching ? ? ? ? ? ? ? ? Jaroslav Křivánek – Spherical Harmonics Rotation
Appendix – Bibliography • [Křivánek et al. 2005] Jaroslav Křivánek, Pascal Gautron, Sumanta Pattanaik, and Kadi Bouatouch. Radiance caching for efficient global illumination computation. IEEE Transactions on Visualization and Computer Graphics, 11(5), September/October 2005. • [Ivanic and Ruedenberg 1996]Joseph Ivanic and Klaus Ruedenberg. Rotation matrices for real spherical harmonics.direct determination by recursion. J. Phys. Chem., 100(15):6342–6347, 1996.Joseph Ivanic and Klaus Ruedenberg. Additions and corrections : Rotation matricesfor real spherical harmonics. J. Phys. Chem. A, 102(45):9099–9100, 1998. • [Choi et al. 1999]Cheol Ho Choi, Joseph Ivanic, Mark S. Gordon, and Klaus Ruedenberg. Rapid andstable determination of rotation matrices between spherical harmonics by directrecursion. J. Chem. Phys., 111(19):8825–8831, 1999. • [Kautz et al. 2002] Jan Kautz, Peter-Pike Sloan, and John Snyder. Fast, arbitrary BRDF shading for low-frequency lighting using spherical harmonics. In Proceedings of the 13th Eurographics workshop on Rendering, pages 291–296. Eurographics Association, 2002. Jaroslav Křivánek – Spherical Harmonics Rotation