Fast 3D Analytical Affine Transformation for Polygon ‐ Based Computer ‐ Generated Holograms

: We present a fast 3D analytical affine transformation (F3DAAT) method to obtain poly ‐ gon ‐ based computer ‐ generated holograms (CGHs). CGHs consisting of tens of thousands of trian ‐ gles from 3D objects are obtained by this method. We have attempted a revised method based on previous 3D affine transformation methods. In order to improve computational efficiency, we have derived and analyzed our proposed affine transformation matrix. We show that we have further increased the computational efficiency compared with previous affine methods. We also have added flat shading to improve the reconstructed image quality. A 3D object from a 3D camera is reconstructed holographically by numerical and optical experiments.


Introduction
With the rapid development of display and computer technology, 3D display technology has made great progress [1,2]. The current 3D display technologies generally include binocular parallax display [3], volume 3D display [4], light field display [5] and holographic 3D display. Holographic 3D display is a technology to reconstruct 3D wavefront by using light wave diffraction information based on the principle of wave optics. Because the wave-front information of the 3D scene is reconstructed, it can provide all the depth cues required by the human eye [6][7][8]. The wave-front recording process of holography can be completed and simulated by a computer to generate the so-called computergenerated holograms (CGHs). The use of CGHs avoids the setup of complicated optical paths in optical holography [9,10], as long as the mathematical description of the 3D scene is obtained and transformed into the wave-front distribution in the hologram plane by algorithms. Therefore, the algorithm of calculating CGHs is key, because it directly determines the computational efficiency of the hologram and the quality of the reconstructed image [11,12].
Indeed, the mathematical description of a 3D scene can also be expressed in many forms. According to the geometric information of its surface, it can be discretely expressed as a collection of point sources, giving the so-called point-based method [13]. The wavefront information of the whole 3D object is obtained by calculating and then adding the light field distribution of the spherical wave emitted by each point light source in the hologram plane. However, the required number of point sources is usually as high as millions, leading to computational bottlenecks. By using a look-up tables (LUTs) [14][15][16] and graphic processing units (GPUs) [17,18], we can accelerate the calculations greatly. Another popular CGH calculation method is the use of polygons (usually represented by triangle meshes) to approximate the surface of a 3D scene, giving to the polygon-based method [19][20][21][22][23][24][25][26][27][28][29][30][31][32]. Compared with the point-based method, the number of polygons can be greatly reduced, and the mature theory of computer graphics can be used to make the reconstructed scene more realistic. There are other methods to decompose 3D objects, such as the layer-based [33,34] or line-segment based method [35].
In polygon-based methods, the propagation of light field can be calculated for each polygon by using the angular spectrum theory if the polygon is parallel to the hologram plane [6]. The essence of polygon-based methods is the diffraction calculation between non-parallel planes. Polygon-based methods can be divided into two categories; one is the traditional method based on sampling [8]. This method needs to sample each tilted polygon that is not parallel to the hologram in the spatial and frequency domains. Due to the polygon rotation, sampling in the spatial and frequency domains creates uneven sampling intervals between the two domains. Time-consuming interpolation is needed to alleviate sampling distortion. The other method is the analytical method [8]. Unlike the traditional method, sampling in the spatial domain to obtain the spectrum of a tilted polygon is not needed. Instead, the spectrum of a tilted polygon can be expressed in terms of the spectrum of a unit triangle (also called primitive triangle), which is known analytically, through the 2D affine transform [23]. Therefore, only sampling is needed in the frequency domain for each polygon, bypassing the need for interpolation in the traditional method. Compared with the traditional method, the analytical method effectively reduces the amount of calculations. However, shaping and texture mapping are not easily included in the analytical methods as compared with the traditional methods [8].
Pan et al., [25,26] have developed an analytical method utilizing 3D affine transformation. They have defined a pseudo inverse matrix to map the spatial triangle with a three-dimensional right primitive triangle (which has an analytical spectrum expression). The major issue of the technique is the inaccuracy caused by the inversion of the pseudo matrix. Zhang et al., [28,29] have derived a correct analytical expression in the context of 2D affine transformation [23] and proposed a method to achieve 3D transformation from an arbitrary triangle to a primitive triangle through a 3D rotation of the arbitrary triangle and the use of a 2D affine matrix [29]. Although this method avoids the time-consuming calculation of the pseudo inverse matrix, the process is rather complex. Zhang et al., [8] also have proposed a method called the fast 3D affine transformation (F3DAT) method by translating the primitive triangle to avoid the use of the pseudo inverse matrix to improve the computational efficiency.
In the wave-optics based approach, it can provide accurate depth cues. However, view-dependent properties' rendering requires additional calculations. Rendering technology of computer graphics makes the reconstructed 3D scene more realistic [36][37][38]. Matsushima et al., have discussed the methods of shading and texturing [20][21][22] and created a large-scale full-color CGH successfully [39]. Subsequently, many methods have been proposed to improve the quality of reconstructed images through texturing [36,37], shading [22,38], and resolution improvement [40]. Additionally, the use of the silhouette method for hidden surface removal has been described [41].
In this study, based on the three-dimensional affine theory [25,29], we present a fast 3D analytical affine transformation (F3DAAT) method to obtain a full-analytical spectrum of a spatial triangle. We obtain the analytical expression of a 3D affine matrix algebraically, and the spectrum of tilted triangles can be obtained directly. Compared with previous methods, we show improved computational efficiency. In addition, in order to improve the image quality, we add flat shading to make the reconstructed image more realistic. We also demonstrate reconstructed 3D objects composed of tens of thousands of polygons numerically as well as the use of a spatial light modulator (SLM) for optical reconstruction.
In Section 2, we briefly introduce the basic principle of the polygon-based method. In Section 3, we present the theory of F3DAAT. In Section 4, we demonstrate the reconstruction of 3D objects numerically and optically. The computational efficiency is also compared with previous methods. The results of adding flat shading are also illustrated. Figure 1 shows the basic principle of the polygon-based method. The surface of a 3D object is discretized into many polygons (usually triangles). The hologram is assumed to be on the plane 0. The total complex field distribution on the hologram plane , , 0 can be expressed as the superposition of the polygon fields from each polygon, , , :

Conventional Polygon-Based Method
where is the number of polygons and , , is the complex field on the hologram plane from the polygon. Since the complex field distribution of each triangle on the hologram can be expressed by the inverse Fourier transform of its spectrum: where ℱ • represent the inverse Fourier transform and , , represents the spectrum of the polygon on the hologram. Therefore, the key to the polygon-based method is how to obtain the spectrum of each triangle on the hologram plane. As shown in Figure 2, a polygon on the source coordinate system , , is not necessarily parallel to the hologram plane , ; one needs to rotate the polygon to parallel local coordinate system , , to be parallel to the hologram plane in order to calculate the diffracted field toward the hologram through standard diffraction theory [6]. The spatial frequencies , can be expressed as: where are the elements of the rotation matrix. , (corresponding to , in Equation (10a,b) in Ref. [8]) are the spatial frequencies corresponding to source coordinates , , . , , (corresponding to , , in Equation (10a,b) in Ref. [8]) are spatial frequencies corresponding to parallel local coordinates , , . Upon a differential operation in Equation (3a), we have: where with being the wavelength of the light source. Since the spatial frequencies , are uniformly distributed, we have , . For simplicity, let us assume Δ 1, Δ 1, and Equation (4) then can be rewritten as follows: Coordinate systems of the traditional polygon-based method: source coordinate system , , , parallel local coordinate system , , and hologram plane , . Adapted from Zhang et al. [8].
Since Δ (the derivative of ) is not constant, Equation (5) indicates that for an arbitrary set of spatial frequencies , corresponding to the parallel local coordinates, spatial frequency , after rotation has highly nonlinear properties. Because uniform sampling is necessary for the FFT to work correctly in the traditional method, interpolation process is required for spatial frequencies , after rotation. This procedure would add substantially to the computational time [30]. Comparing with the traditional method, the analytical method avoids the use of the FFT in obtaining the spectrum of the polygon in the source coordinates and the interpolation process is therefore not required. The analytical method can obtain the analytical expression of the tilted triangle spectrum directly by using affine transformation and a given spectrum expression of a primitive triangle. In this paper, we analytically solve the affine matrix, which avoids the most timeconsuming steps in previous methods [8,25,29] and further improves the computational efficiency over the previous methods.

Theory
The aim of the polygon-based method is the calculation of the polygon field in the plane of the hologram. However, we cannot obtain the polygon field or its spectrum directly by using standard diffraction theory, which is valid only between parallel planes. One of the conventional approaches to solve this problem is to map the desired light field or its spectrum using affine relations. The traditional affine transformation method is based on procedures such as rotation and translation to establish the relationship between the input and output coordinates, with the output represented by a set of known inputs and affine relations. Hence, the essence of affine transformation method is a mapping method, and the core problem of affine transformation is to find the affine matrix. In our proposed theory, we will find the affine matrix algebraically in a universal way.
In the traditional 3D affine transformation algorithm, there is a global coordinate system , , as the output coordinate system, as shown in Figure 3. The hologram plane , is located in 0, and the tilted triangle Π with vertexes , , , , , and , , is located in the global coordinate system. We now define the affine coordinates , , ) as our input coordinates, as shown in Figure 4. A primitive triangle Δ with vertexes , , , , , and , , is in the affine coordinate system, and the analytical expression of the primitive triangle spectrum is obtained by using two-dimensional Fourier transform for 0. The spectrum of the tilted triangle is finally obtained from the affine relationship between the primitive triangle Δ and the tilted triangle Π with the analytical expression of the primitive triangle spectrum derived from the Fourier transform. , , is the coordinate vector of primitive triangle Δ in the affine coordinates and the superscript denotes the transpose operation.
is a 3 × 3 matrix and ⃗ is a 3 × 1 vector. We let , , = 0,0,0 , , , = 1,0,0 and , , = 0, 1, 0 . Therefore, we can write in terms of matrix multiplication as shown in Equation (6), where is the affine transformation matrix and and represent matrices consisting of vertexes of tilted triangle Π and primitive triangle Δ, respectively. By calculating the twelve parameters of affine matrix , we can uniquely determine the 3D affine transformation: The key to the affine transformation algorithm is to find the elements of affine matrix . There is no inverse for 4 × 3 matrix , because inverse only exists for square matrices. The affine matrix has been found by using the pseudo inverse matrix of [25]. The accurate method is to avoid the use of pseudo matrices and to find the affine transformation matrix through direct calculation of . There are twelve unknown elements in affine matrix , and so we have to solve twelve equations to get these twelve elements. However, each matrix and only contain three vertexes in Equation (6). From this, we can only get nine equations to solve for the nine elements; the remaining elements in the affine matrix cannot be determined. In light of this, we introduce a new set of vertexes , , in matrix and a 4×1 vector , , , in matrix to determine all the unknown twelve elements of the affine matrix . Therefore, we extend and to a 4 4 matrix and , respectively. In light of this, Equation (6) becomes: In order to simplify calculations and improve the calculation efficiency, the best choice is let 0 and , , = 0,0,1 . Then, becomes Through simple calculations, we can obtain det 1, indicating the existence of the inverse matrix of . Then, we can find the affine transformation matrix by . Note that the vertex , , only represents a point located in the primitive coordinate system independent of the primitive triangle, and the value of , , and must be chosen such that det 0 to make sure the inverse of exists. ~ can take any value; different values of ~ make a different affine transformation matrix and the Jacobian determinant also changes at the same time. Again, we have chosen Equation (8) for ease of calculations and there is no effect on the final results that we end up solving. According to the above discussion, the affine transformation matrix can be obtained by Equation (7): For primitive triangle Δ, assuming that its surface function has strength of one within the triangle and zero outside, its spectrum analytical expression , can be obtained (see Appendix A): where , are the spatial frequencies corresponding to affine coordinates and . The singular points 0 , 0 or 0 have been discussed in Appendix A.
Through affine transformation, the spectrum distribution of tilted triangle Π on the hologram plane is (see the derivation of this equation in Appendix B): , ⃗ ⃗ e , where , , again are spatial frequencies of the global coordinate system, ⃗ , , is the surface function of the tilted triangle ⃗= , , , ⃗= , , and the Jacobian determinant . Then, the spectrum distribution on the hologram is: , , , which has been derived in Appendix C. Note that for an arbitrary tilted polygon, we can set an arbitrary point instead of point , , of the polygon. For a different choice, it will change the affine transform matrix, but the Jacobian determinant in Equation (12) also changes at the same time, giving the same result in Equation (12) As shown in Figure 5a, the zero frequency in the global coordinate system is , , 0, 0, . According to the spatial frequency relationship given by Equation (28) in Appendix C, as shown in Figure 5b, the zero frequency in the affine coordinate system , , is , , , , : From the above equation, we can see that the zero frequency in the affine coordinate system has a frequency offset, and this offset will be represented in the reconstruction image with a phase factor. To eliminate this offset, as shown in Figure 5c, we can subtract this frequency offset Δ , Δ , Δ according to where , , 33 . Therefore, the spatial frequencies in the "offset" affine coordinate system can be rewritten as The spectrum of a tilted triangle on the hologram plane now has been completely analyzed, and we can directly obtain the spectrum distribution through the initial parameters. For a single tilted triangle, we have , , , as in Equation (2), and for a 3D object we use Equation (1). The complex field distribution of a 3D object reconstructed by the hologram can be expressed as the superposition of a tilted triangle complex field on reconstructed image plane : where is the distance between the reconstructed image plane and the hologram plane 0. Through the above steps, we can obtain the reconstructed complex field distribution of the 3D object through only one Fourier transform. In the next section, we will verify our proposed method through numerical simulations and optical experiments.

Numerical Reconstruction
Based on the 3D mesh in Figure 1, the Stanford bunny consists of 59,996 polygons, and we have reconstructed the bunny using our proposed method. The actual size of the bunny was 3.11 × 3.08 × 2.41 mm 3 . We have increased its size to 6.56 × 6.49 × 5.08 mm 3 before the generation of the hologram. In order to improve the computational efficiency and image quality, we have implemented back-face culling by judging normal. The normal vector of a hologram is ⃗, and ⃗ is the normal vector of a tilted triangle. If ⃗ ⃗ 0, the tilted triangle will be calculated, and tilted triangles that do not meet the condition will be discarded.
After back-face culling, the bunny only contains 31,724 polygons. However, in Section 3 the result of Equation (12) is based on the assumption that the amplitude distribution of a triangle is a unit constant and the reconstructed results will lack realism. As shown in Figure 6, in order to reproduce the details of the 3D object, we assign the surface function of the tilted triangle , as follows: where ⃗, ⃗, ⃗ are the components of unit normal vector ⃗ of the xyz-axis in the global coordinate system, and represents ambient reflected light. , and are the direction cosine values of illumination directions. In our case, 0.2, 60°, 60°, 5°. The surface function usually refers to the strength information, and the amplitude is expressed as , . The surface function of the titled triangle , is a constant for each tilted triangle according to Equation (17), so that we can let , (I is a constant here) and by using the property of Fourier transform: √ , ℱ √ , , the spectrum in the hologram of a tilted triangle with added flat shading and the elimination of the "offset" is based on Equation (12), together with Equation (15), we have: Figure 7 shows the numerical reconstructions of the bunny based on our proposed F3DAAT method. Figure 7a is the result of calculating Equation (12), and we can see that because the amplitude of each mesh is the same constant the reconstruction result is a lack of realism. Additionally, the bunny has self-occlusion, so that back-face culling by judging normal will have some errors for some polygons. Due to the wrong judgment, visible polygons and invisible polygons are superimposed together and the reconstructed part of the image is shown in the red box on Figure 7a. Figure 7b,c are the reconstruction results based on Equation (18), and from these two reconstructed images we can clearly see the details of various parts of the bunny. Figure 7b focuses on the bunny's leg, shown in the yellow box, and Figure 7c focuses on the bunny's ear, shown in the yellow box. We have also scanned a human face called "Alex" with a 3D camera, and the 3D mesh of "Alex" is shown in Figure 8a, which consists of 49,272 meshes. In this case, there is no need to use back-face culling, because the data is the result from actual image scanning. We have calculated the CGH of "Alex", and its holographic reconstructed image is shown in Figure 8b.

Comparison with Previous Methods
The Pseudo Inverse Matrix Method by Pan et al. [25,26] sets up an affine transformation matrix that contains all the information on the transformation. However, they have defined the primitive triangle located at 0, i.e., the plane of the source local coordinate system, leading to the concept of a pseudo inverse matrix to perform matrix inversion.
The introduction of the pseudo inverse matrix has produced calculation errors and slowed down the calculation speed. Zhang et al. [29] have introduced a Full Analytical 3D Affine Method to avoid the use of the pseudo inverse matrix. The method includes three core steps: rotation transformation for the tilted triangle until it is parallel to the hologram plane, 2D affine transform of the rotated triangle and finally the computation of the field distribution on the hologram by using the angular spectrum (AS) method for diffraction. Zhang et al. [8] also have proposed a Fast 3-D Affine Transformation (F3DAT) method based on the 3D affine transformation by Pan et al., to improve the computation efficiency. In the method, they have defined the primitive triangle located at 0, allowing the affine matrix to be fully inverted. The result of the F3DAT method provides a faster calculation time compared with that of the pseudo inverse matrix method and full analytical 3D affine method.
In the present proposed fast 3D analytical affine transformation (F3DAAT) method, we have obtained the affine matrix directly and derived an analytical expression of the spectrum of the primitive triangle. The more meshes that are calculated the more time F3DAAT will save. We have generated the holograms with a resolution of 1024×1024, and the hardware includes Intel Core i7-11700 @ 4.8GHz, 16G-byte RAM under the environment of MATLAB 2018b.
The Stanford bunny consisting of 31,724 meshes (after back-face culling) takes 893 s for the calculation, and the calculation of "Alex" of 49,272 meshes takes about 1288 s (See Figure 9). Additionally, shown in Figure 9 where we have used "Alex", we can see that the computational efficiency of F3DAAT has increased by almost two times compared with the previous methods. The calculation of the four methods is based on the same hardware condition and only CPU is used for the calculation. In one of the most recent studies, Wang et al., [43] proposed a polygon-based method using LUTs (look-up tables) with principal component analysis to speed up the calculation of CGHs. However, the method in the process of pre-computing the affine matrix still needs to solve a pseudo inverse matrix, and our proposed method is more general and efficient for solving the mapping relationship between the two coordinate systems, the global and the affine coordinate systems.

Optical Experiment
The optical experiment is shown in Figure 10. We have reconstructed 3D objects by loading the phase of the CGHs from the computer onto the spatial light modulator (SLM). The SLM in our experiment is a HOLOEYE PLUTO2 (NIR-011) phase-only SLM with a resolution of 1920 × 1080 (Full HD 1080p) and a pixel pitch of 8 μm and the active area is 15.36 mm × 8.64 mm. The laser is a green light with a wavelength of 532 nm. The spatial filter is used to generate a collimated light for the illumination of the hologram. The polarizer is for adjusting the polarization state of the light to work with the phase-only SLM. A camera (MMRY UC900C Charge-coupled Device) is used to receive the reconstructed image in the image plane of the imaging lens (focal length is 150 mm). Optical reconstructions of the bunny and the face of "Alex" are shown in Figure 11a,b, respectively.

Conclusions
In conclusion, we have proposed an improved algorithm to obtain a full-analytical spectrum of a tilted triangle based on 3D affine transformation. Our method avoids the time-consuming steps such as the need to solve for the pseudo inverse matrix or the complex process of 3D rotation and transformation. We have verified our method by calculating complex 3D objects composed of tens of thousands of meshes. In addition, we have added flat shading for realistic image presentation. We have successfully obtained the reconstructed images by numerical and optical reconstructions. Through comparison, it is found that our method improves the computational efficiency by about two times compared with the previous affine methods.

Appendix C. Derivation of the Analytical Spectrum Expression of Tilted Triangle on the Hologram
According to affine transformation, ⃗ ⃗ ⃗ . Therefore, the coordinate relationships between the global coordinate system , , and affine coordinate system , , are: , , .

(A9)
Additionally, the relationships between the spatial frequencies of the global coordinate system , , and the affine coordinate system , , are , , , , . We can write as follows: , , .