Spherical Harmonics Lighting

Source: Internet
Author: User

The use of spherical harmonics in graphics is growing. It only needs to calculate a small amount of coefficients and does not need to process a large amount of data during runtime. Spherical harmonical can be used to simulate rtgi. I. Spherical Harmonic Functions

Spherical Harmonics SH is a set of functions defined in the Spherical Coordinate System. It forms a set of standard orthogonal bases on the sphere and acts on the frequency space. Generally, SH is defined in the complex field. It is mainly used in the actual field for illumination calculation.

Spherical Coordinates: (x, y, z) = (rsincos, rsinsin, rcos)

 

Definition of spherical harmonic functions:

Where-L <= m <= l, l> 0, l generally go to 2-3 bands, all general L (L + 1) Items

P is the M-order, L-level, and the computation of the P-order, L-accompanied, lepete polynomials is generally calculated based on three rules.

 

K is a standardized scaling factor:

 

 

Based on the above formulas, we can estimate the projection of the spherical harmonic base coefficient to the Cartesian coordinate system:

 

Indexing: I = L (L + 1) + m available

The choice of the spherical harmonic Basis Function to restore the original function is because the spherical harmonic basis function is orthogonal. With orthogonal, a constant 0 or 1 can be obtained during convolution, if you can obtain the corresponding coefficients represented by the base function of the original function, you can restore the original function.

The sh coefficient of any function F on the sphere S is: (Using Convolution) Sh coefficient formula

Using these sh coefficients, we can restore the original function F:

We need to calculate the integral of the sh coefficient. here we can use Monte Carlo points to convert the integral into multiplication and addition:

Now we use the spherical coordinates to represent the integral for the above calculation of the sh coefficient:

 

When Monte Carlo points are used, the average sampling probability of each point on a sphere surface is:

Therefore, the sh coefficient formula can be written as follows:

 

Now we can calculate the approximate primitive function f degrees of order n. Note that we need to calculate the original function of order n. N * n Spherical Harmonic sh coefficients need to be calculated. Formula for Calculating the original function of myopia

Ii. Features of spherical harmonic functions:

Rotation immutability of the ball Harmonic Function: when the ball harmonic function is used, the intensity of light is not affected when the scene changes, the light is moved or the object is rotated.

The other is to calculate the integral of the product of two spherical harmonic functions, which can be expressed by the sum of the product of its sh coefficient:

The first and second parts are the theoretical parts of the spherical harmonic basis function, which refer to a large amount of information on the Internet. At that time, there were a lot of references, which were not listed in a mess, such as pbrt.

Iii. tr-rendering

Spherical Harmonic illumination replaces the lighting equation with a new illumination equation, and uses the information in the equation with the spherical harmonic Basis Function projectd to the frequency domain space, you can use the sh coefficient to restore the Rendering scenario of the original illumination equation during rendering,

Spherical Harmonic illumination is a process of converting the light distribution in a scenario from the time domain to the frequency domain. It is the same as Fourier Transformation:

Environment light irradiance is a 2D function L (s). This function project is directed to the spherical coordinate, that is, expressed in the frequency space, the parameters include the spherical harmonic Basis Function Yi and the corresponding parameter CI. When an environment ing is given, the offline pre-calculation CI can be performed, then, when rendering, calculate the formula for calculating the original function of myopia (Fance) mentioned above to render the radiant illuminance of points on the surface of an object in a scene, irradiance. We can use the spherical harmonic base of level 2 (, 2) to simulate the reflected radiation illumination, because the reflected radiation illuminance is a low-frequency function, it requires 3*3 = 9 sh coefficients. When calculating the sh coefficient, each sh function is separated into three RGB channels to calculate the output. Finally, there are 27 parameters.

Irradiance:

N indicates the normal direction of each vertex, W indicates the illumination direction, and L (w) indicates the entire envirment map.

Sampling:

Simle randon sampling (simple instant sampling)

Systematic sampling (system sampling) Sampling and offset sampling are performed immediately. First, the overall unit of observation is divided into N parts according to a certain sequence number, and then the unit of observation (k) is extracted from the first part, use equal spacing to extract one observation unit from each part to form a sample.

Cluster sampling (cluster sampling) is divided into several groups at random. All groups are investigated.

Stratified sampling (stratified sampling) is a feature that has a greater impact on the observed indicator sample. It divides the sample into several categories and then extracts a certain number of observed units from each layer, combined to form a sample

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.