Fast Approximation to Spherical Harmonics Rotation Jaroslav Kivnek

  • Slides: 47
Download presentation
Fast Approximation to Spherical Harmonics Rotation Jaroslav Křivánek Jaakko Konttinen Czech Technical University of

Fast Approximation to Spherical Harmonics Rotation Jaroslav Křivánek Jaakko Konttinen Czech Technical University of Central Florida Sumanta Pattanaik Kadi Bouatouch Jiří Žára University of Central Florida IRISA / INRIA Rennes Czech Technical University Computer Graphics Group Improved Radiance Gradient Computation

Presentation Topic 2 n Goal Rotate a spherical function represented by Spherical Harmonics n

Presentation Topic 2 n Goal Rotate a spherical function represented by Spherical Harmonics n Proposed method Approximation through a truncated Taylor expansion Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Spherical Harmonics n 3 Basis functions on the sphere Jaroslav Křivánek – Fast Spherical

Spherical Harmonics n 3 Basis functions on the sphere Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Spherical Harmonics + + + + 4 Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Spherical Harmonics + + + + 4 Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Spherical Harmonics Image Robin Green, Sony computer Entertainment 5 Jaroslav Křivánek – Fast Spherical

Spherical Harmonics Image Robin Green, Sony computer Entertainment 5 Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Spherical Harmonics represented by a vector of coefficients: 6 Jaroslav Křivánek – Fast Spherical

Spherical Harmonics represented by a vector of coefficients: 6 Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Spherical Harmonics n Basis functions on the sphere l=0 l=1 l=2 7 Jaroslav Křivánek

Spherical Harmonics n Basis functions on the sphere l=0 l=1 l=2 7 Jaroslav Křivánek – Fast Spherical Harmonics Rotation

SH Rotation – Problem Definition n Given coefficients , representing a spherical function n

SH Rotation – Problem Definition n Given coefficients , representing a spherical function n 8 find coefficients for coefficients . directly from Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Our Contribution n n 9 Novel, fast, approximate rotation Based on a truncated Taylor

Our Contribution n n 9 Novel, fast, approximate rotation Based on a truncated Taylor Expansion of the SH rotation matrix 4 -6 times faster than [Kautz et al. 2002] O(n 2) complexity instead of O(n 3) Two applications n Global illumination (radiance interpolation) n Real-time shading (normal mapping) Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Talk Overview n n n 10 SH rotation Previous Work Our Rotation Application in

Talk Overview n n n 10 SH rotation Previous Work Our Rotation Application in global illumination Application in real-time shading Conclusions Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Talk Overview n n n 11 SH rotation Previous Work Our Rotation Application in

Talk Overview n n n 11 SH rotation Previous Work Our Rotation Application in global illumination Application in real-time shading Conclusions Jaroslav Křivánek – Fast Spherical Harmonics Rotation

SH Rotation – Problem Definition n Given coefficients , representing a spherical function n

SH Rotation – Problem Definition n Given coefficients , representing a spherical function n 12 find coefficients for coefficients . directly from Jaroslav Křivánek – Fast Spherical Harmonics Rotation

SH Rotation Matrix n 13 Rotation = linear transformation: Jaroslav Křivánek – Fast Spherical

SH Rotation Matrix n 13 Rotation = linear transformation: Jaroslav Křivánek – Fast Spherical Harmonics Rotation

SH Rotation n 14 Given the desired 3 D rotation, find the matrix R

SH Rotation n 14 Given the desired 3 D rotation, find the matrix R Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Talk Overview n n n 15 SH rotation Previous Work Our Rotation Application in

Talk Overview n n n 15 SH rotation Previous Work Our Rotation Application in global illumination Application in real-time shading Conclusions Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Previous Work – Molecular Chemistry n [Ivanic and Ruedenberg 1996] n Recurrent relations: Rl

Previous Work – Molecular Chemistry n [Ivanic and Ruedenberg 1996] n Recurrent relations: Rl = f(R 1, Rl-1) n [Choi et al. 1999] n Through complex spherical harmonics n Fast for complex harmonics n Slow conversion to the real form 16 Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Previous Work – Computer Graphics n 17 [Kautz et al. 2002] n zxzxz-decomposition n

Previous Work – Computer Graphics n 17 [Kautz et al. 2002] n zxzxz-decomposition n By far the fastest previous method Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Previous Work – Summary n n n 18 O(n 3) complexity Slow Bottleneck in

Previous Work – Summary n n n 18 O(n 3) complexity Slow Bottleneck in rendering applications Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Talk Overview n n n 19 SH rotation Previous Work Our Rotation Application in

Talk Overview n n n 19 SH rotation Previous Work Our Rotation Application in global illumination Application in real-time shading Conclusions Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Our Rotation n Fast, approximate rotation n Based on replacing the SH rotation matrix

Our Rotation n Fast, approximate rotation n Based on replacing the SH rotation matrix by its Taylor expansion n 4 -6 times faster than [Kautz et al. 2002] 20 Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Rotation Decomposition n 21 Decompose the 3 D rotation into ZYZ Euler angles: R

Rotation Decomposition n 21 Decompose the 3 D rotation into ZYZ Euler angles: R = RZ(a) RY(b) RZ(g) Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Rotation Decomposition n R = RZ(a) RY(b) RZ(g) n Rotation around Z is simple

Rotation Decomposition n R = RZ(a) RY(b) RZ(g) n Rotation around Z is simple and fast n Rotation around Y still a problem 22 Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Rotation Around Y n [Kautz et al. 2002] n Decomposition of Y into X(+90˚),

Rotation Around Y n [Kautz et al. 2002] n Decomposition of Y into X(+90˚), Z, and X(90˚) n R = RZ(a) RX(+90˚) RZ(b) RX(-90˚) RZ(g) n n Rotation around Z is simple and fast Rotation around X is fixed-angle n n 23 can be tabulated The RXRZRX-part can still be improved… Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Rotation Around Y – Our Approach n 24 Second order truncated Taylor expansion of

Rotation Around Y – Our Approach n 24 Second order truncated Taylor expansion of RY(b) Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Taylor Expansion of RY(b) 25 Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Taylor Expansion of RY(b) 25 Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Rotation Procedure – Taylor Expansion 26 Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Rotation Procedure – Taylor Expansion 26 Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Rotation Procedure – Taylor Expansion n n 27 “ 1. 5 -th order Taylor

Rotation Procedure – Taylor Expansion n n 27 “ 1. 5 -th order Taylor expansion” Very sparse matrix Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Full Rotation Procedure 1. Decompose the 3 D rotation into ZYZ Euler angles: R

Full Rotation Procedure 1. Decompose the 3 D rotation into ZYZ Euler angles: R = RZ(a) RY(b) RZ(g) 2. Rotate around Z by a 3. Use the “ 1. 5 -th order” Taylor expansion to rotate around Y by b 4. Rotate around Z by g 28 Jaroslav Křivánek – Fast Spherical Harmonics Rotation

SH Rotation – Results n 29 L 2 error for a unit length input

SH Rotation – Results n 29 L 2 error for a unit length input vector Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Talk Overview n n n 30 SH rotation Previous Work Our Rotation Application in

Talk Overview n n n 30 SH rotation Previous Work Our Rotation Application in global illumination Application in real-time shading Conclusion Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Application in GI - Radiance Caching n n n 31 Sparse computation of indirect

Application in GI - Radiance Caching n n n 31 Sparse computation of indirect illumination Interpolation Enhanced with gradients Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Incoming Radiance Interpolation p p 2 p 1 n 32 Interpolate coefficient vectors 1

Incoming Radiance Interpolation p p 2 p 1 n 32 Interpolate coefficient vectors 1 and 2 Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Interpolation on Curved Surfaces 33 Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Interpolation on Curved Surfaces 33 Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Interpolation on Curved Surfaces n Align coordinate frames in interpolation R p 1 p

Interpolation on Curved Surfaces n Align coordinate frames in interpolation R p 1 p 34 Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Results in Radiance Caching 35 Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Results in Radiance Caching 35 Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Results in Radiance Caching 36 Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Results in Radiance Caching 36 Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Talk Overview n n n 37 SH rotation Previous Work Our Rotation Application in

Talk Overview n n n 37 SH rotation Previous Work Our Rotation Application in global illumination Application in real-time shading Conclusion Jaroslav Křivánek – Fast Spherical Harmonics Rotation

GPU-based Real-time Shading n Original method by [Kautz et al. 2002] n Arbitrary BRDFs

GPU-based Real-time Shading n Original method by [Kautz et al. 2002] n Arbitrary BRDFs n n represented by SH in the local coordinate frame Environment Lighting n represented by SH in the global coordinate frame Lout = 38 ( Incident Radiance BRDF ) = coeff. dot product Jaroslav Křivánek – Fast Spherical Harmonics Rotation

GPU-based Real-time Shading (contd. ) n n 39 must be rotated from global to

GPU-based Real-time Shading (contd. ) n n 39 must be rotated from global to local frame zxzxz - rotation too complicated on CPU Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Our Extension – Normal Mapping n n 40 Normal modulated by a texture Our

Our Extension – Normal Mapping n n 40 Normal modulated by a texture Our rotation approximation n Rotation from the un-modulated to the modulated coordinate frame n Small rotation angle good accuracy Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Normal Mapping Results Rotation Ignored 41 Our Rotation Jaroslav Křivánek – Fast Spherical Harmonics

Normal Mapping Results Rotation Ignored 41 Our Rotation Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Normal Mapping Results Rotation Ignored 42 Our Rotation Jaroslav Křivánek – Fast Spherical Harmonics

Normal Mapping Results Rotation Ignored 42 Our Rotation Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Normal Mapping Results Rotation Ignored 43 Our Rotation Jaroslav Křivánek – Fast Spherical Harmonics

Normal Mapping Results Rotation Ignored 43 Our Rotation Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Talk Overview n n n 44 SH rotation Previous Work Our Rotation Application in

Talk Overview n n n 44 SH rotation Previous Work Our Rotation Application in global illumination Application in real-time shading Conclusion Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Conclusion and Future Work n n 45 Summary n Fast, approximate rotation n Truncated

Conclusion and Future Work n n 45 Summary n Fast, approximate rotation n Truncated Taylor Expansion of the SH rotation matrix n 4 -6 times faster than [Kautz et al. 2002] n O(n 2) complexity instead of O(n 3) n Applications in global illumination and real-time shading Future Work n Rotation for Wavelets n Normal mapping for pre-computed radiance transfer Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Thank You for your Attention ? 46 ? Jaroslav Křivánek – Fast Spherical Harmonics

Thank You for your Attention ? 46 ? Jaroslav Křivánek – Fast Spherical Harmonics Rotation

Appendix – Bibliography n n 47 [Křivánek et al. 2005] Jaroslav Křivánek, Pascal Gautron,

Appendix – Bibliography n n 47 [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 matrices for 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 and stable determination of rotation matrices between spherical harmonics by direct recursion. 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 13 th Eurographics workshop on Rendering, pages 291 – 296. Eurographics Association, 2002. Jaroslav Křivánek – Fast Spherical Harmonics Rotation