Brief Introduction to spherical harmonics

Source: Internet
Author: User

Please click it! Orz

SH is a special function. High-Order sh can restore very complex functions, while low-level SH is more suitable for restoring low-frequency functions. Modern GPU hardware usually supports texture of four channels, or large vertex format, which is SH of level 4 or lower (4 ^ 2 = 16 coefficients required) the implementation on the GPU lays the foundation.

Many functions can be approximately decomposed into multiple sine waves of different phases and frequencies, which is also a problem solved by Fourier transformation. SH is similar. It is combined by multiple base functions and has different coefficients for different base functions, so that sh can simulate many functions, of course, its features in the scope of graphics are more suitable for simulating the characteristics of the same direction in diffuse illumination.

Sh has several awesome features. One is rotation invariant. for rotation, there is a rotation function that can rotate Sh. There is also the dot product. Due to the orthogonal nature, you can combine the points of the sh function into several DOT products! In my opinion, this is the main purpose of using Sh.

In PRT and its variants, SH compresses and restores the original functions directly as the core idea. The PRT is also limited by the sh, that is, the ball harmonic feature leads to the same sex, working well in diffuse cases, and cannot be used in Specular cases at all. Therefore, other models are needed to implement specular.

To implement PRT, we will do this:

1) pre-calculation: Obtain the radiation degree transfer information on the vertex or grain through raytracer. If you are too lazy to implement an raytracer, you may only get shadow-free, the effect of N dot l without mutual reflection. Of course, this radiation information part should also be feasible if GPU is used for acceleration. Project the radiation degree information to the sh space to store the sh coefficient of the radiation degree.

2) during running, the illumination vector on the sphere is projected into the sh space and stored as the sh coefficient of illumination. In the shader, Madd is a series of point multiplication operations to multiply the sh coefficient of the radiation degree and the sh coefficient of the illumination to obtain the final radiation degree, add the image as a parameter to the illumination model to obtain a diffuse image with a low frequency, soft shadow, or even interreflection.

Of course, the actual situation is far from that simple, especially the rotation of the sh coefficient. Currently, d3dxshrotate in d3dx only supports up to 6 levels of sh.

References:

Evaluation of the rotation matrices in the basis of real Spherical Harmonics
Http://www1.elsevier.com/homepage/saa/eccc3/paper48/eccc3.html

Spherical Harmonic lighting: the gritty details
Http://www.research.scea.com/gdc2003/spherical-harmonic-lighting.pdf

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.