Dynamic scene real-time rendering method under dynamic global environment illumination

By using hemispherical harmonic function to perform rotation, triple product and multiple product calculations of ambient light in complex dynamic scenarios, the shortcomings of the existing technology in rotation operation and occlusion penetration are solved, and rapid light traversal and material reflection characteristics are realized. Improves the real-time rendering efficiency and freedom of dynamic scenes.

CN119107397APending Publication Date: 2024-12-10NANJING INST OF ASTRONOMICAL OPTICS & TECH NAT ASTRONOMICAL OBSE
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411106342.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-13
Publication Date
2024-12-10

Smart Images

  • Figure CN119107397A_ABST
    Figure CN119107397A_ABST
Patent Text Reader

Abstract

The invention discloses a dynamic scene real-time rendering method under dynamic global environment illumination. The method comprises the following steps: modeling illumination by adopting a spherical harmonic function SH; coordinate system conversion is carried out by adopting a rapid rotation method of a spherical harmonic function SH; performing conversion from spherical harmonic illumination based on a spherical harmonic function SH to hemispherical harmonic illumination based on a hemispherical harmonic function HSH; obtaining expression of hemispherical harmonic shielding; the operation that hemispherical harmonic light passes through hemispherical harmonic shielding is carried out; estimating reflected light based on a material reflection angle spectrum; and acquiring the reflected light intensity of the attention direction. The method has the advantages of supporting rapid illumination rotation, supporting rapid conversion from spherical harmonic illumination to hemispherical harmonic illumination, being high in penetrating and shielding operation speed, being high in material reflection obtaining speed, being suitable for dynamic scene light and shadow operation and the like.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of three-dimensional computer image processing, and in particular relates to a dynamic scene real-time rendering method based on hemispherical harmonics under dynamic global environment illumination. Background Art

[0002] With the increasing application of realistic games, virtual reality, and augmented reality, real-time rendering in complex dynamic scenes faces huge challenges. The main challenge in this field is how to obtain complex lighting on the drawn fragments and efficiently obtain the required drawing points. To solve this problem, Sloan et al. proposed a precomputed radiance transfer (PRT) framework for scene rendering under ambient lighting (references [Peter-Pike Sloan, Jan Kautz, and John Snyder. 2002. Precomputed radiance transfer for real-time rendering in dynamic, low-frequency lighting environments. ACM Trans. Graph. 21, 3 (July 2002), 527–536] and [Jan Kautz, Peter-Pike Sloan, and John Snyder. 2002. Fast, arbitrary BRDF shading for low-frequency lighting using spherical harmonics. In Proceedings of the 13th Eurographics workshop on Rendering (EGRW'02). Eurographics Association, Goslar, DEU, 291–296.]). The core concept of this framework is to control the scale of preprocessed data by using specific basis functions to express the ambient light function and light transfer function, and to approximate the drawing integral of each fragment as the dot product of the basis function coefficients. However, the complexity of PRT is reflected in several aspects: first, the expression of ambient light and the conversion between coordinate systems; second, the transmission of light in multiple occlusions; third, the calculation of the interaction between light and materials; fourth, whether it can support full-band drawing; and fifth, whether the above four aspects can provide efficient algorithms.

[0003] Spherical harmonics (SH) are first used in PRT because of their orthogonality and completeness on the entire sphere. They support triple products and multiple products required for fast rotation operations and occlusion operations. However, SH is less efficient in expressing high-frequency signals, and can only achieve good results when drawing low-frequency light and shadow images and diffuse reflection materials, which limits its application in complex scenes. For this reason, Ng et al. proposed the spherical wavelet (SW) function (reference [Ren Ng, Ravi Ramamoorthi, and Pat Hanrahan. 2003. All-frequency shadows using non-linear wavelet lighting approximation. ACM Trans. Graph. 22, 3 (July 2003), 376–381.]). Compared with SH, spherical wavelets not only support fast multiple multiplications, but also can effectively represent full-frequency signals, but they are insufficient in fast rotation operations, which limits their application scenarios to a certain extent. Later, Tsai and other scholars used spherical radial basis functions (SRBF) to solve the above problems in PRT (reference [Yu-Ting Tsai and Zen-Chung Shih. 2006. All-frequency precomputed radiance transfer using spherical radial basis functions and clustered tensor approximation. ACM Trans. Graph. 25, 3 (July 2006), 967-976.]). Although progress was made in full-frequency signal expression and fast coordinate system rotation, it was impossible to quickly obtain the triple product and multi-product required for the operation of light passing through occlusion, and could only process static scenes.

[0004] Spherical harmonics SH, spherical wavelets SW, and radial basis functions SRBF face a common problem when expressing the reflective properties of materials, that is, the material's bidirectional reflectance distribution function (BRDF) needs to be projected onto the basis function in order to apply orthogonality to calculate the dot product in the hemisphere space. This additional BRDF projection will also bring additional computational complexity. In addition, if the optical transfer function is obtained in advance through PRT, the occlusion relationship and the material reflective properties are solidified. Although high dynamic rendering characteristics can be obtained, it can only be used for static scenes.

[0005] Therefore, the application of complex dynamic scenes requires further exploration of new rendering methods, matched with fast acquisition methods such as coordinate rotation, triple and multiple products, and material reflection characteristic expressions, in order to obtain better drawing effects. Summary of the invention

[0006] In order to solve the problem of real-time rendering of complex dynamic scenes, the present invention proposes a real-time rendering method for dynamic scenes under dynamic global environment illumination, which is based on the rotation, triple product and multiple product of hemispherical harmonics (HSH), material reflection characteristics, and full frequency for rendering.

[0007] To achieve the above object, the present invention provides the following technical solutions:

[0008] A method for real-time rendering of a dynamic scene under dynamic global ambient lighting comprises the following steps:

[0009] Step 1: Use spherical harmonics SH to model the lighting;

[0010] Step 2: Use the fast rotation method of spherical harmonics SH to transform the coordinate system;

[0011] Step 3: Convert the spherical harmonic illumination based on the spherical harmonic function SH to the hemispherical harmonic illumination based on the hemispherical harmonic function HSH;

[0012] Step 4: Obtain the expression of hemispherical harmonic occlusion;

[0013] Step 5: Perform the operation of hemispherical harmonic illumination passing through hemispherical harmonic occlusion;

[0014] Step 6: Estimate the reflected light based on the material reflection angle spectrum;

[0015] Step 7: Get the reflected light intensity in the direction of interest.

[0016] Furthermore, in step 1, a global coordinate system of the rendering scene is established, and the ambient lighting is expressed as a linear superposition of real spherical harmonics in the global coordinate system.

[0017] Furthermore, in step 2, objects in computer graphics rendering are discretized into many fragments, the fragment to be drawn is selected, a local coordinate system centered on it is established, the Euler angles for converting from the global coordinate system to the local coordinate system are obtained, and then the rotation matrix of the spherical harmonic function is constructed, and the global spherical harmonic illumination coefficient is converted into local spherical harmonic illumination through the rotation matrix.

[0018] Furthermore, in step 3, the local spherical harmonic illumination coefficient is converted into the hemispherical harmonic illumination coefficient using the pre-calculated conversion matrix from the spherical harmonic function SH to the hemispherical harmonic function HSH.

[0019] Furthermore, in step 4, the occlusion is divided into multiple layers from far to near, the innermost layer of occlusion is the self-occlusion of the object itself, and each layer of occlusion distribution is decomposed by a hemispherical harmonic function to obtain the hemispherical harmonic function coefficient of the occlusion.

[0020] Furthermore, the occlusion includes static occlusion and dynamic occlusion, the static occlusion is determined by pre-calculation, and the dynamic occlusion is determined by sampling calculation.

[0021] Furthermore, in step 5, the Kleibsch-Gordon coefficients of the hemispherical harmonic function are pre-calculated to construct a hemispherical harmonic transmission tensor; based on the hemispherical harmonic illumination coefficient, the outermost hemispherical harmonic occlusion coefficient and the hemispherical harmonic transmission tensor, the hemispherical harmonic illumination after penetrating the outermost layer is obtained; and in this way, the hemispherical harmonic illumination coefficient that finally illuminates the material is obtained by penetrating the occlusion layer by layer.

[0022] Furthermore, in step 6, a reflection angle spectrum of the material is obtained, and a reflection hemispherical harmonic coefficient is obtained based on the final illumination hemispherical harmonic illumination coefficient and the reflection angle spectrum.

[0023] Furthermore, in step 7, the pre-calculated hemispherical harmonic function values ​​of the hemispherical distribution are stored in a table form, the reflection direction to be estimated is determined, the value of the hemispherical harmonic function in that direction is obtained by looking up the table, and the reflection intensity in that direction is obtained by combining the corresponding reflection hemispherical harmonic coefficient.

[0024] Compared with the prior art, the present invention has the following beneficial effects:

[0025] 1. The present invention uses spherical harmonics SH to describe ambient light and supports rapid illumination rotation;

[0026] 2. Supports fast conversion from spherical harmonic illumination to hemispherical harmonic illumination, and occlusion is also expressed using hemispherical harmonic functions;

[0027] 3. The "transmission tensor" used in the operation method of HSH Illumination Vector passing through HSHocclusion is sparse and symmetric, which can greatly reduce the number of non-zero elements that need to be stored and the number of associated multiplications and additions, so the penetration of occlusion is fast;

[0028] 4. The reflection characteristics of the material adopt the reflection angle spectrum RAS based on hemispherical harmonics. The reflection angle spectrum can be pre-calculated, and it is sparse and occupies little memory. The reflection of the light passing through the hemispherical occlusion by the material can be calculated by multiplying the reflection angle spectrum with the hemispherical harmonic coefficient of the incident light, so the material reflection acquisition speed is fast;

[0029] 5. The method of the present invention greatly reduces the amount of online real-time calculations and is suitable for the drawing and light and shadow operations of dynamic and complex scenes. Compared with traditional pre-calculated rendering, the present invention also provides greater freedom. For example, changing the spherical harmonic lighting can achieve environmental changes, updating the hemispherical harmonic occlusion coefficient can achieve occlusion relationship changes, and updating the material reflection angle spectrum can achieve material changes. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 is a flow chart of the method of the present invention;

[0031] Figure 2 It is the form of the first 6-order spherical harmonics. The ordinate is the altitude angle order l of the hemispherical harmonics, and the abscissa is the azimuth angle order m of the spherical harmonics.

[0032] Figure 3 is the form of the first 15 hemispherical harmonics. The ordinate is the order l of the hemispherical harmonics, the abscissa is the azimuthal ordinal number m of the hemispherical harmonics, and the number k next to the dotted arrow is the number of serialized terms of the hemispherical harmonics;

[0033] Figure 4 It is a principle block diagram of the graphics rendering based on hemispherical harmonics of the present invention;

[0034] Figure 5 It is the decomposition principle of the real spherical harmonic function S30 after rotation within the same order function;

[0035] Figure 6 Schematic diagram of the conversion matrix used to convert spherical harmonic coefficients into hemispherical harmonic coefficients;

[0036] Figure 7 It is a schematic diagram of hemispherical harmonic illumination after multi-layer occlusion and hemispherical harmonic occlusion;

[0037] Figure 8 To transmit the distribution of effective elements of the tensor, balls with larger diameters represent larger absolute values;

[0038] Fig. 9 is the reflection angle spectrum of a material. The ordinate is the code of the incident hemispherical harmonic illumination, the abscissa is the code of the reflected hemispherical harmonic illumination, and the intensity of the reflection mode is represented by grayscale. DETAILED DESCRIPTION

[0039] The present invention will be further described in detail below in conjunction with the accompanying drawings.

[0040] The present invention is a real-time rendering method for dynamic scenes based on hemispherical harmonics. Figure 1As shown, the method mainly includes the following steps: using spherical harmonics SH to model lighting; using the fast rotation method of SH to transform the coordinate system; transforming SH spherical harmonic lighting to hemispherical harmonic HSH lighting; expressing hemispherical harmonic occlusion; using the algorithm of hemispherical harmonic illumination passing through hemispherical harmonic occlusion; estimating reflected light based on material reflection angle spectrum; and calculating light and shadow.

[0041] In computer graphics rendering, objects are discretized into many fragments. The core of rendering is to calculate the reflected radiance in a specific direction based on the incident light radiance, the occlusion of the fragments, and the reflection characteristics of the material.

[0042] The ambient lighting is represented by spherical harmonics in the global coordinate system, and the coefficients from low frequency to high frequency are obtained;

[0043] Select the fragment to be drawn, establish a local coordinate system centered on it, obtain the Euler angles for transforming from the global coordinate system to the local coordinate system, and then calculate the rotation matrix of the spherical harmonic function, and transform the global spherical harmonic illumination coefficient into the local spherical harmonic illumination through the rotation matrix;

[0044] The pre-calculated matrix of spherical harmonic function SH to hemispherical harmonic function is used to convert the local spherical harmonic illumination coefficient into the hemispherical harmonic illumination coefficient;

[0045] The occlusion is divided into multiple parts from far to near, namely V1, V2, ..., to V-self (self-occlusion of the object itself). Each occlusion distribution is decomposed by hemispherical harmonics to obtain the hemispherical harmonic coefficients of the occlusion. Static occlusion (such as self-occlusion) can be pre-calculated, and dynamic occlusion requires sampling calculation;

[0046] Pre-calculate the Clebsch-Gordan Coefficients of the hemispherical harmonic function and store them in order as a third-order tensor, called the hemispherical harmonic transfer tensor (HSH Transfer Tensor). Multiply the hemispherical harmonic illumination coefficient and the outermost hemispherical harmonic occlusion coefficient with the tensor to obtain the hemispherical harmonic illumination after penetrating the outermost layer;

[0047] As above, traverse the occlusion layer by layer to obtain the hemispherical harmonic illumination coefficient of the final illumination to the material;

[0048] Pre-calculate the reflectance angular spectrum (RAS) of the material, refer to [Yi Zheng, Lin Lin, Changpeng Ding, Yonghui Hou, and Xiaofei Li, "Hemisphericalharmonic illumination and reflectance angular spectrum," Optics Express, 32 (5), 6823-6837, 2024] and [Material reflectance characteristic characterization and rendering method based on modal light illumination, Chinese invention patent, patent number ZL 202110467306.8], multiply the final illumination hemispherical harmonic illumination coefficient by RAS to obtain the reflection hemispherical harmonic coefficient;

[0049] The hemispherical harmonic function values ​​of the hemispherical distribution are calculated in advance and stored in a table form. The reflection direction to be estimated is determined, and the value of the hemispherical harmonic function in the direction is obtained by looking up the table, and the value is multiplied and accumulated with the corresponding reflection hemispherical harmonic coefficient to obtain the reflection intensity in the direction. The several functions involved in the present invention are described as follows:

[0050] (1) Real Spherical Harmonics

[0051] The expression formula of real spherical harmonics is as follows:

[0052]

[0053] in:

[0054] θ is the zenith angle in the global spherical coordinate system, ranging from 0 to π;

[0055] is the zenith angle in the global spherical coordinate system, ranging from 0 to 2π;

[0056] are Legendre polynomials;

[0057] It is associated with the Legendre polynomials, expressed as follows:

[0058]

[0059] Reference for the first 6 orders of real spherical harmonics Figure 2 shown.

[0060] is a set of orthogonal complete functions on the sphere, so the distribution on the sphere It can be approximated by its expansion, the formula is as follows:

[0061]

[0062] Real spherical harmonics The orthogonality of is reflected in the following formula:

[0063]

[0064] Where L is the approximate cutoff order, there are a total of (L+1) 2 Real spherical harmonics Participate in the approximation, corresponding to (L+1) 2 coefficient By order Arrange the ordinal numbers m from small to large in order from low to high to obtain the approximation coefficient vector For simplicity, a single subscript is used to record the coefficient vector, denoted as in

[0065] (2) Hemi-Spherical Harmonics

[0066] The function expression is

[0067]

[0068] The first 15 terms of hemispherical harmonics Figure 3 shown.

[0069] is a set of orthogonal complete functions on the hemisphere, so the distribution on the hemisphere It can be approximated by its expansion, the formula is as follows:

[0070]

[0071] Hemispherical harmonics The orthogonality of is reflected in the following formula:

[0072]

[0073] Where L is the approximate cutoff order, there are a total of 0.5(L+1)(L+2) hemispherical harmonics Participate in the approximation, corresponding to the coefficient of 0.5(L+1)(L+2) By order Arrange the ordinal numbers m from small to large in order from low to high to obtain the approximation coefficient vector For simplicity, a single subscript is used to record the coefficient vector, denoted as [μ1μ2…μ s …μ 0.5(L+1)(L+2) ],in

[0074]

[0075] The specific steps of a dynamic scene real-time rendering method under dynamic global ambient lighting of the present invention include: Step 1: establishing a global coordinate system and characterizing the ambient light with spherical harmonics.

[0076] Step 1.1 Establish the global coordinate system of the rendering scene;

[0077] like Figure 4 As shown, the origin of the coordinate system is determined to be O, and the three orthogonal axes are Global-X, Global-Y and Global-Z. This coordinate system is recorded as the global coordinate system. Among them: 1 is the spherical harmonic illumination distribution; 2 is the hemispherical harmonic illumination; 3 is the hemispherical occlusion; 4 is the rendered fragment P.

[0078] Step 1.2 Get the global incident light irradiance distribution and express it as a linear superposition of real spherical harmonics;

[0079] Distribution on the sphere far away from the scene Project it onto the spherical harmonics to obtain the global spherical harmonic lighting vector This vector is the spherical harmonic illumination distribution ( Figure 4 Spherical harmonic illumination distribution in 1).

[0080]

[0081] Where G is the number of truncated terms of the spherical harmonics, g = 1, 2, ..., G. If the real spherical harmonics of the first L orders are used for approximation, then G = (L + 1) 2 ;

[0082] Step 2: Establish a local coordinate system for the rendered fragment, calculate the Euler angles for transforming the local coordinate system to the global coordinate system, and then construct the rotation matrix of the spherical harmonic function to transform the global spherical harmonic illumination coefficient vector into the local spherical harmonic illumination coefficient vector.

[0083] Step 2.1 Establish a local coordinate system for rendering fragments;

[0084] like Figure 4 As shown, the spatial coordinates of the center point P of the fragment are (x p ,y p ,z p ), normal direction With point P as the origin and the normal direction as the Z axis ( Figure 4 The two perpendicular directions on the tangent plane through point P are the X-axis (Local X) and the Y-axis (Local Y) to establish a local coordinate system. If the material is isotropic, the direction of the X-axis can be chosen arbitrarily; if the material is anisotropic, The preferred choice of axis is consistent with the horizontal axis direction determined when measuring the material's reflective properties, reducing the amount of calculation required for later calculations of the interaction between light and material reflections.

[0085] Step 2.2 Get the Euler angles α, β, and γ from the global coordinate system to the local coordinate system;

[0086] The definition of Euler angles is related to the rotation order. Based on the rotation of spherical harmonics around the Z axis, the amount of computation required to construct the rotation matrix is ​​small. The rotation order of ZYZ is used but not limited to, corresponding to the Euler angles α, β, and γ respectively. The rotation matrix can be determined using the following formula:

[0087]

[0088] After multiplication, we can obtain the following expression:

[0089]

[0090] According to the three-axis orientation of the global coordinate system and the local coordinate system, the rotation matrix can be constructed as follows:

[0091]

[0092] From this, the Euler angles can be calculated:

[0093]

[0094] Step 2.3 Construct the rotation matrix R of the spherical harmonics SH (α, β, γ), the illumination coefficient vector is transferred from global to local.

[0095] The illumination calculation of the fragment is performed in the local coordinate system, and the spherical harmonic illumination coefficient in the global coordinate system needs to be converted to the local coordinate system. There are two ways to do this conversion: one is to convert the global spherical illumination coefficient to the local coordinate system. Convert the illumination distribution into local coordinate system according to Euler angle (θ′, is the zenith angle and azimuth in the local coordinate system), and then use the real spherical harmonic function to decompose and obtain the spherical harmonic illumination coefficient vector in the local coordinate system; second, the rotation matrix R of the spherical harmonic function coefficient is constructed according to the Euler angle SH (α, β, γ), and then use the global spherical harmonic illumination coefficient vector to directly calculate the spherical harmonic illumination coefficient vector in the local coordinate system. The second method adopted by the present invention has the significant advantage that the amount of calculation is much smaller than the first method. Especially for real spherical harmonic functions, the coefficient rotation of a specific order will not affect the coefficient rotation of other orders, so R SH(α, β, γ) is a block sparse diagonal matrix, where the size of each block corresponds to the ordinal number within each order, that is, the coefficients of each real spherical harmonic function after rotation only come from the linear combination of the coefficients of the original spherical harmonic function within the corresponding order, see Figure 3 Figure 5 .

[0096]

[0097] in is the global spherical harmonics Projection to local spherical harmonics after rotation The specific value of coefficient depends on the Euler angle. In the form of block matrix, the above coefficient rotation matrix can also be expressed as:

[0098]

[0099] Step 2.2 has calculated the Euler angles α, β, γ, and the coefficient rotation matrix R SH It is decomposed into the product of three rotations, namely, rotation of angle α around the Z axis, rotation of angle β around the Y axis, and rotation of angle γ around the Z axis. The coefficient rotation matrix of the two rotations around the Z axis is easily obtained from the formula of spherical harmonics. The rotation around the Y axis needs to be further decomposed into a positive rotation of 90° around the X axis, a rotation of angle β around the Z axis, and finally a reverse rotation of 90° around the X axis.

[0100] R SH (α,β,γ)=Z γ Y β Z α =Z γ X -90 Z β X +90 Z α (15)

[0101] Where X +90 and X -90 The rotation matrices of the spherical harmonic coefficients corresponding to the positive rotation of 90 degrees and the reverse rotation of 90 degrees around the X-axis are fixed block diagonal matrices, which are independent of the Euler angles and can be completed by pre-calculation.

[0102] The following is an example of the rotation matrix of the first three-order spherical harmonics (9 items in total).

[0103]

[0104] Z β and Z γ The expression of Z α Basically the same, just replace α with β and γ in the corresponding positions.

[0105]

[0106]

[0107] Higher-level X -90 and X -90 The calculation of can be obtained using analytical or numerical methods.

[0108] Step 2.4 : Calculate the spherical harmonic illumination coefficient vector in the local coordinate system

[0109] The rotation matrix R using the spherical harmonics coefficients SH (α, β, γ), the coefficient vector for calculating local spherical harmonic lighting.

[0110]

[0111] The coefficient vector of local spherical harmonic illumination can be obtained Step 3: Convert the local spherical harmonic illumination to equivalent hemispherical harmonic illumination.

[0112] For the rendered fragment, without considering other occlusions, only the light from the upper hemisphere will shine on it, so the spherical harmonic illumination in the local coordinate system needs to be converted into equivalent hemispherical harmonic illumination. For the convenience of calculation, the spherical harmonic coefficients are directly converted to hemispherical harmonic coefficients, instead of sampling them in the airspace and then projecting them to calculate the coefficients.

[0113] Step 3.1 The first J hemispherical harmonics are used to expand the first G spherical harmonics on the hemisphere to obtain a transformation matrix, which is denoted as Ψ.

[0114]

[0115] in Use the following formula to calculate. There is a truncation error in the above formula, so an approximate equal sign is used.

[0116]

[0117] The transformation matrix is ​​fixed and can be pre-calculated and stored without real-time calculation. Figure 6 .

[0118] Step 3.2 The coefficient vector of local spherical harmonic lighting Convert to coefficient vector of hemispherical harmonic illumination The superscript 0 represents the light that is farthest away from the fragment and is not affected by occlusion.

[0119]

[0120] Step 4: Sample the occlusion distribution (also called visibility distribution) of the fragment P and project it onto the hemispherical harmonics, the occlusion coefficient vector.

[0121] The occlusion of fragments is complex. There are both occlusions of the rendered object itself and occlusions caused by other objects. Especially in the dynamic rendering process, the occlusion distribution is constantly changing. Here, the occlusion is divided into K layers from far to near. The innermost layer is self-occlusion. Then the K-layer occlusion distribution is projected onto the hemispherical harmonic function to obtain the K-layer occlusion coefficient vector. Figure 7 .

[0122]

[0123] The kth hemispherical harmonic occlusion coefficient vector is denoted as

[0124] Step 5: Obtain the light irradiance distribution after hemispherical harmonic occlusion of the transmission K layer.

[0125] Step 5.1 Compute the Clebsch-Gordan coefficients of the hemispherical harmonics and construct the transport tensor.

[0126]

[0127] After expanding and arranging it, we can get:

[0128]

[0129]

[0130] The matrix Ω (J rows and Q columns) is called the hemispherical harmonic function transfer matrix. It connects the incident hemispherical harmonic illumination coefficient vector and the hemispherical harmonic occlusion coefficient vector and is used to calculate the hemispherical illumination distribution after occlusion. The graphic reference of Ω is Figure 8 . The element H in Ω j ·H q , (j=1,2,…,J;q=1,2,…,Q) are all hemispherical distribution functions, which can be expanded by hemispherical harmonic functions:

[0131]

[0132] λ j,q,t is the triple integral of the hemispherical harmonics, referring to the triple integral of the real spherical harmonics, called λ j,q,t is the Clebsch-Gordan coefficient of the hemispherical harmonics, and Ω is expressed as the product of a third-order tensor and a hemispherical harmonics vector.

[0133]

[0134] The tensor of the above formula is recorded as It is called the transfer tensor, and rewrites Ω into a matrix stack:

[0135] The symbol → in the formula represents the next layer; The tensor has a fixed expression, is independent of the incident illumination and occlusion distribution, and can be pre-calculated and stored. Due to the use of hemispherical harmonics, the elements are only one-sixth of the transmission tensor generated by spherical harmonics of the same order, and have a strong sparse characteristic. Coupled with symmetry, the amount of calculation is significantly reduced, the speed is faster, and it can meet the needs of real-time rendering. The shape reference Figure 8 . Step 5.2 Calculate the hemispherical harmonic illumination coefficient vector Transmitted through the k-th hemisphere harmonic occlusion coefficient vector The obtained illumination coefficient vector

[0136] Substituting formula (27) into formula (24) and rearranging it, we can obtain the following expression:

[0137]

[0138] Among them, W j ,j=1,2,…,J is a matrix with Q rows and T columns,

[0139]

[0140] Thus, the hemispherical harmonic illumination coefficient vector after transmission through the kth hemispherical occlusion can be obtained: is a T-dimensional vector,

[0141]

[0142] Step 5.3 Repeat step 5.2 until the light passes through the innermost occlusion (self-occlusion) to obtain the hemispherical harmonic illumination coefficient vector of the real lighting on the material. Step 6: Get the reflection angular spectrum RAS (Reflectance Angular Spectrum) of the material, and then multiply it with the hemispherical harmonic illumination coefficient vector irradiated on the material to obtain the reflected hemispherical harmonic coefficient vector.

[0143] Step 6.1Obtain the reflection angle spectrum of the material, which is a set of two-dimensional matrices encoded with hemispherical harmonic functions. The acquisition process refers to [Yi Zheng, Lin Lin, Changpeng Ding, Yonghui Hou, and Xiaofei Li, "Hemispherical harmonic illumination and reflectance angular spectrum," Optics Express, 32 (5), 6823-6837, 2024] and [Material reflection characteristic characterization and rendering method based on modal light illumination, Chinese invention patent, patent number ZL 202110467306.8], the incident light There are T coefficients, and the outgoing light is defined as fitting with U hemispherical harmonic functions. Then the reflection angle spectrum is a matrix with T rows and U columns, which can be expressed as:

[0144]

[0145] Graphical reference for RAS Fig. 9 , the hemispherical harmonic coefficient vector of the reflected light is recorded as Calculate using the following formula,

[0146]

[0147] Step 7: Calculate the reflected light intensity in the direction of interest.

[0148] Get the hemispherical harmonic coefficients of the reflected light After that, the reflection intensity in any direction can be calculated using the formula:

[0149]

[0150] So to calculate The values ​​of the first T hemispherical harmonics at the position can be obtained by real-time calculation. This method is direct but requires a little more calculation. Another method is to calculate the values ​​of the T hemispherical harmonics at multiple positions on the hemisphere in advance, store them in a table, and then interpolate the specific hemispherical harmonics in the table. This method uses storage capacity in exchange for calculation speed and has better real-time performance.

[0151] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modification, equivalent replacement and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for real-time rendering of dynamic scenes under dynamic global environment illumination, characterized in that: The steps include: Step 1: Use spherical harmonics SH to model the lighting; Step 2: Use the fast rotation method of spherical harmonics SH to transform the coordinate system; Step 3: Convert the spherical harmonic illumination based on the spherical harmonic function SH to the hemispherical harmonic illumination based on the hemispherical harmonic function HSH; Step 4: Obtain the expression of hemispherical harmonic occlusion; Step 5: Perform the operation of hemispherical harmonic illumination passing through hemispherical harmonic occlusion; Step 6: Estimate the reflected light based on the material reflection angle spectrum; Step 7: Get the reflected light intensity in the direction of interest.

2. The method for real-time rendering of dynamic scenes under dynamic global environment illumination according to claim 1, characterized in that: In step 1, a global coordinate system for the rendering scene is established, and the ambient lighting is expressed as a linear superposition of real spherical harmonics in the global coordinate system.

3. The method for real-time rendering of dynamic scenes under dynamic global environment illumination according to claim 1, characterized in that: In step 2, objects in computer graphics rendering are discretized into many fragments. The fragment to be drawn is selected, and a local coordinate system centered on it is established to obtain the Euler angles for converting from the global coordinate system to the local coordinate system. Then, the rotation matrix of the spherical harmonic function is constructed, and the global spherical harmonic illumination coefficient is converted into local spherical harmonic illumination through the rotation matrix.

4. The method for real-time rendering of dynamic scenes under dynamic global environment illumination according to claim 1, characterized in that: In step 3, the local spherical harmonic illumination coefficient is converted into the hemispherical harmonic illumination coefficient using the pre-calculated conversion matrix from spherical harmonic function SH to hemispherical harmonic function HSH.

5. The method for real-time rendering of dynamic scenes under dynamic global environment illumination according to claim 1, characterized in that: In step 4, the occlusion is divided into multiple layers from far to near. The innermost layer of occlusion is the self-occlusion of the object itself. The occlusion distribution of each layer is decomposed by a hemispherical harmonic function to obtain the hemispherical harmonic function coefficient of the occlusion.

6. The method for real-time rendering of dynamic scenes under dynamic global environment illumination according to claim 5, characterized in that: The occlusion includes static occlusion and dynamic occlusion. The static occlusion is determined by pre-calculation, and the dynamic occlusion is determined by sampling calculation.

7. The method for real-time rendering of dynamic scenes under dynamic global environment illumination according to claim 1, characterized in that: In step 5, the Kleibusch-Gordon coefficients of the hemispherical harmonics are pre-calculated to construct a hemispherical harmonic transmission tensor; based on the hemispherical harmonic illumination coefficient, the outermost hemispherical harmonic occlusion coefficient and the hemispherical harmonic transmission tensor, the hemispherical harmonic illumination after penetrating the outermost layer is obtained; In this way, the hemispherical harmonic illumination coefficient of the final illumination to the material is obtained by passing through the occlusion layer by layer.

8. The method for real-time rendering of dynamic scenes under dynamic global environment illumination according to claim 1, characterized in that: In step 6, the reflection angle spectrum of the material is obtained, and the reflection hemispherical harmonic coefficient is obtained based on the final illumination hemispherical harmonic illumination coefficient and the reflection angle spectrum.

9. The method for real-time rendering of dynamic scenes under dynamic global environment illumination according to claim 1, characterized in that: In step 7, the pre-calculated hemispherical harmonic function values ​​of the hemispherical distribution are stored in a table form, the reflection direction to be estimated is determined, the value of the hemispherical harmonic function in that direction is obtained by looking up the table, and the reflection intensity in that direction is obtained by combining the corresponding reflection hemispherical harmonic coefficient.