Hierarchical non-sequential ray tracing method
Through the layered non-sequential ray tracing method, the generated light attributes are divided after the light reaches the surface, and the emitted light is classified. Combined with the GPU allocation task method, the problem of insufficient trace speed and analysis capabilities in traditional technology is solved, and efficient stray light analysis of optical system is achieved.
Patent Information
- Application Number
- CN202211214123.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-30
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2042-09-30
AI Technical Summary
Traditional non-sequence ray tracing technology has shortcomings in speed and analysis capabilities, and cannot effectively meet the needs of high-precision and efficient analysis of stray light in optical systems.
A layered non-sequential ray tracing method is proposed. By dividing the light attributes after it reaches the surface, classifying the emitted light, controlling the types of emitted light according to the analysis requirements, achieving easy control of the trace tracing process, and combining with the GPU allocation task method to improve the trace tracing speed.
Through the layered non-sequential ray tracing method, the trace speed and analysis ability are significantly improved, and the path analysis and source analysis of stray light of the optical system can be completed more quickly, which is suitable for high-precision optical system simulation.
Smart Images

Figure CN115598834B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of optical technology, and in particular to a layered non-sequential ray tracing method. Background Art
[0002] With the increasing demand for optical system indicators, simulation and analysis of external stray light in optical systems are also widely used in various optical systems with high image quality and high stray light suppression ratio. The simulation and analysis of external stray light in optical systems mainly use non-sequential ray tracing technology to convert stray light into light with direction and energy, trace all external stray light rays, and perform statistics at the image plane to finally obtain the path and results of the stray light.
[0003] At present, traditional non-sequential ray tracing technology is mostly aimed at ray tracing technology for the purpose of graphics rendering, and the existing non-sequential ray tracing directly traverses all rays to complete the calculation from the light source to the receiver. The technology with rendering equation as the core focuses on visual effects and realism, and is not suitable for high-precision and efficient analysis of stray light in optical systems. The speed and analysis ability of traditional non-sequential ray traversal tracing methods are affected by the traversal method. Each ray must be traced before the next ray can be traced. Therefore, there are problems such as the tracing process cannot be interrupted, the source of the tracing results is not easy to analyze, and the tracing speed is greatly affected by the number of rays and the energy threshold. Summary of the invention
[0004] In view of the above problems, the purpose of the present invention is to propose a hierarchical non-sequential ray tracing method; in the case where the accuracy of the non-sequential ray tracing method based on the rendering equation is difficult to meet the requirements of external stray light analysis of the optical system, by dividing the light properties generated after the light reaches the surface, the different types of outgoing light rays are classified, and the types of outgoing light rays can be controlled according to the analysis requirements. The tracing process is easy to control, and the tracing resources are allocated preferentially to the light rays concerned by the simulation experiment. Combined with the GPU task allocation method, the tracing speed can be greatly improved.
[0005] To achieve the above object, the present invention adopts the following specific technical solutions:
[0006] The present invention provides a layered non-sequential ray tracing method, comprising the following steps:
[0007] S1. Tracing the incident light in the light system to obtain light information;
[0008] S2, layering the surface properties of the optical system and setting weight values and switches for each layer to achieve generation and control of outgoing light;
[0009] S3, distributing the light energy of the incident light in each layer according to the weight information of the layered surface properties of the optical system;
[0010] S4, performing hierarchical non-sequential tracing of the outgoing light rays according to the energy allocation principle in step S3, and allocating GPU calculations according to hierarchical priorities;
[0011] S5. Repeat step S4 until all rays of maximum gradient values are traced. The ray tracing ends, and the non-sequential ray tracing results are obtained and the illumination in each cell in the receiving surface is calculated. By querying the layered source of the light, the light source analysis is finally realized.
[0012] Preferably, each piece of light information includes: the starting coordinates of the light source (x, y, z), the light direction vector (l, m, n), the energy E carried by the light, and the light layer source.
[0013] Preferably, in step S2, the surface properties of the optical system are divided into three layers, namely:
[0014] Reflected light and transmitted light are divided into Snell layers, forward scattered light and back scattered light are divided into scattering layers, and absorbed light is divided into absorption layers;
[0015] And set the Snell layer weight value k respectively snell , scattering layer weight value k scatter , the absorption layer weight value k absorb and layered switches.
[0016] Preferably, in step S3:
[0017] The energy distribution formula of Snell layer light is as follows:
[0018] Φ snell =Φ in *k snell =Φ t +Φ r
[0019] Φ t =Φ snell *T
[0020] Φ r =Φ snell *R
[0021] Among them, k snell is the Snell layer weight value;
[0022] T is transmittance, R is reflectivity;
[0023] Φ snell It is the Snell layer light energy;
[0024] Φ in is the incident light energy;
[0025] Φ r Transmits light energy for the Snell layer;
[0026] Φ t Reflects light energy for the Snell layer.
[0027] Preferably, in step S3:
[0028] The energy distribution formula of the scattering layer light is as follows:
[0029] Φ scatter =Φ in *k scatter =Φ scatterfront +Φ scatterback
[0030] Φ scatterfront =Φ scatter *TIS front
[0031] Φ scatterback =Φ scatter *TIS back
[0032] in,
[0033] k scatter is the scattering layer weight;
[0034] TIS front is the total cumulative scattering of the forward scattered light;
[0035] TIS back is the total accumulated scattering of backscattered light;
[0036] Φ scatter is the energy of light in the scattering layer;
[0037] Φ scatterfront is the total accumulated scattered energy of the forward scattered light in the scattering layer;
[0038] Φ scatterback is the total accumulated scattered energy of the backscattered light in the scattering layer.
[0039] Preferably, in step S3:
[0040] The energy distribution formula of the light in the absorption layer is as follows:
[0041] Φ absorb =Φ in *(1-k scatter -k snell )
[0042] in,
[0043] Φ absorb is the energy of light in the scattering layer.
[0044] Preferably, the energy threshold of the Snell layer, scattering layer and absorption layer is set to 10E-8; that is, relative to the energy of the light source, when the energy of the outgoing light calculated by the Snell layer, scattering layer and absorption layer is lower than 10E-8 times the energy of the light source, no outgoing light is generated.
[0045] Preferably, in step S5:
[0046] First, calculate the cell area on the receiving surface;
[0047] Then calculate the rays in the cell area and add up the number of rays in each cell;
[0048] Add up the light energy of each cell and divide it by the number of rays to get the luminous flux of each cell;
[0049] The luminous flux of each cell is divided by the corresponding cell area to obtain the illumination of each cell;
[0050] By querying the layered sources of light, the light source analysis is finally achieved.
[0051] Compared with the prior art, the present invention has the following advantages:
[0052] (1) Convenient path analysis
[0053] The present invention separates various types of outgoing light rays through the light layering method, thereby improving the problem of mixing various types of light rays in non-sequential ray tracing. First, by indexing the layered sources of light rays reaching the image plane, the stray light generating position or the stray light key surface can be quickly located, and based on the absorbed light, the disappearance path of the stray light can be quickly analyzed for illumination analysis. Secondly, according to the priority of the layered light rays, it can be ensured that important light rays are traced first. Finally, by switching on and off each layer of optical properties, ghost images, cold reflections, and primary scattered light of the optical system can be quickly simulated.
[0054] (2) Fast calculation speed
[0055] The present invention fixes various ray generation algorithms in each hierarchical attribute through attribute stratification, and then converts the tracing process into an instruction set through task decomposition. The GPU processes multi-step rays in parallel to realize GPU-accelerated gradient non-sequential ray tracing, which is faster and saves more computing resources when processing large-scale ray tracing.
[0056] (3) The tracking process is easy to control
[0057] The present invention can control the type of light generated by each surface by setting the layer switch, and can also adapt to the changes in the surface properties of the optical system by changing the layer weight, without the need for additional simulation. Since the layered light can be controlled, a specific position of the optical system can be analyzed separately and in detail. This function is of great help to the stray light suppression method of the optical system. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] Figure 1 It is a flowchart of a layered non-sequential ray tracing method provided according to an embodiment of the present invention.
[0059] Figure 2 It is a flowchart of a layered non-sequential ray tracing method provided according to an embodiment of the present invention.
[0060] Figure 3 Schematic diagram of a layered method in a layered non-sequential ray tracing method provided according to an embodiment of the present invention. DETAILED DESCRIPTION
[0061] Hereinafter, embodiments of the present invention will be described with reference to the accompanying drawings. In the following description, the same modules are represented by the same reference numerals. In the case of the same reference numerals, their names and functions are also the same. Therefore, the detailed description thereof will not be repeated.
[0062] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and do not constitute a limitation of the present invention.
[0063] Figure 1 A schematic flow chart of a layered non-sequential ray tracing method provided according to an embodiment of the present invention is shown.
[0064] Figure 2 A flowchart of a layered non-sequential ray tracing method provided according to an embodiment of the present invention is shown.
[0065] like Figure 1-2As shown, the layered non-sequential ray tracing method provided by the embodiment of the present invention first counts all the surface properties of the optical system, and divides all the light that can be generated after the light enters the surface into transmitted light, reflected light, totally reflected light, forward scattered light, backscattered light and absorbed light. Then, Snell reflection-type light and Snell transmitted light are divided into Snell layers, forward scattered light and backscattered light are divided into scattering layers, and absorbed light is divided into absorption layers. When non-sequential ray tracing is performed, when the light reaches any surface, the generated light is divided into three layers, the Snell layer is calculated first, and then the scattering layer is calculated, and the remaining light is the absorption layer. By switching on and off the three-layer tracing, and the three-layer properties can be superimposed in multiple layers, the simulation accuracy is higher, and simulation experiments such as ghost images and cold reflections can be completed quickly. Finally, due to the layered tracing, the calculation method and data format of each layer are clear, and the three-layer tracing is task-decomposed separately to achieve GPU acceleration, and the entire non-sequential tracing process is completed quickly.
[0066] The specific steps include:
[0067] S1. Tracing the incident light in the light system to obtain the incident light information.
[0068] In ray tracing, the core is ray information. Each ray is composed of line segments consisting of the emission point and direction (each calculation node is also divided in this way during the tracing process). Obtain node information for intersection and calculate emission information, and use this as the tracing record node. Each time the intersection, judgment, and calculation are performed, they are recorded and used as the new starting point for continuous tracing. Therefore, in the ray tracing process, the ray information will be updated for each segment. The ray information includes: the starting coordinates of the segment, the direction vector, the energy carried by the ray, and the layered information.
[0069] The light source emits 10,000 rays of light l1~l 10000 For example, each piece of light information includes: the starting coordinates of the light source (x, y, z), the direction vector (l, m, n), the energy E carried by the light, and the layered source of the light.
[0070] S2. Layer the surface properties of the optical system and set weight values and switches for each layer to achieve generation and control of outgoing light.
[0071] Figure 3 A schematic diagram of a layered method in a layered non-sequential ray tracing method provided according to an embodiment of the present invention is shown.
[0072] like Figure 3As shown in the figure, the optical properties of the surface are attached to each surface when the optical system is introduced into the ray tracing algorithm. The optical properties are set according to the physical properties of the optical system itself, which can be divided into Snell reflection, Snell transmission, total reflection, forward scattering, backscattering and absorption. These six types of optical properties can be superimposed and combined to form the surface properties that conform to the actual optical system.
[0073] The light layering method converts six types of attributes into three layers of attributes attached to the surface of the optical system, among which the reflected and transmitted light are divided into the Snell layer, the forward and backward scattered light are divided into the scattering layer, and the absorbed light is divided into the absorption layer. By controlling the switches of these three layers of attributes, the generation and control of the outgoing light are achieved. The three layers are set with weight values and switches to determine whether they meet the actual surface attributes of the optical system.
[0074] In the embodiments provided by the present invention:
[0075] When the Snell layer is turned on and the other layers are turned off, the reflection, transmission and total reflection light of the ideal optical surface can be processed;
[0076] When the Snell layer and the absorption layer are turned on, the light generated by the optical surface with absorption can be processed;
[0077] When all three layers are turned on, they can process light generated by optical surfaces with scattering and absorption;
[0078] When only scattering and absorbing layers are used, the generated light from various coatings or polished surfaces with or without absorption can be processed.
[0079] The Snell layer, scattering layer and absorption layer are respectively set with the Snell layer weight value k snell , scattering layer weight value k scatter , the absorption layer weight value k absorb and layered switches to determine compliance with actual optical system surface properties.
[0080] S3. Allocate the light energy of the incident light in each layer according to the weight information of the layered surface properties of the light system.
[0081] When the light reaches the surface, it is divided into two parts according to the Snell layer weight value k. snell , scattering layer weight value k scatter , the absorption layer weight value k absorb Distribute light energy.
[0082] The Snell layer is first allocated, and the allocated energy is divided according to the proportion of the layer, and the internal properties of the layer (reflection, transmission, total reflection) can also be set according to the actual properties. If it is set to zero, there will be no such light in the layer;
[0083] The energy distribution formula of Snell layer light is as follows:
[0084] Φ snell =Φ in *k snell =Φ t +Φ r
[0085] Φ t =Φ snell *T
[0086] Φ r =Φ snell *R
[0087] Among them, k snell is the Snell layer weight value;
[0088] T is transmittance, R is reflectivity;
[0089] Φ snell It is the Snell layer light energy;
[0090] Φ in is the incident light energy;
[0091] Φ r Transmits light energy for the Snell layer;
[0092] Φ t Reflects light energy for the Snell layer.
[0093] The scattering layer includes forward scattering and backward scattering. The energy distribution formula of the scattering layer light is as follows:
[0094] Φ scatter =Φ in *k scatter =Φ scatterfront +Φ scatterback
[0095] Φ scatterfront =Φ scatter *TIS front
[0096] Φ scatterback =Φ scatter *TIS back
[0097] in,
[0098] k scatter is the scattering layer weight;
[0099] TIS front is the total cumulative scatter of the forward scatter;
[0100] TIS back is the total accumulated backscatter.
[0101] Φ scatter is the energy of light in the scattering layer;
[0102] Φ scatterfront is the total cumulative scattered energy of forward scattering in the scattering layer;
[0103] Φ scatterback is the total accumulated scattered energy backscattered in the scattering layer.
[0104] The absorption layer is the remaining weight of the first two layers, and the energy distribution formula of the absorption layer light is as follows:
[0105] Φ absorb =Φ in *(1-k scatter -k snell )
[0106] in,
[0107] Φ absorb is the energy of light in the scattering layer;
[0108] In the three-layer attributes:
[0109] The Snell layer calculates the emission direction using Snell's law and distributes energy to the light using the above distribution method;
[0110] The scattering layer machine generates the direction of scattered light, calculates the corresponding BRDF value according to the angle, and obtains the corresponding BRDF value to calculate the flux ratio of each light;
[0111] The absorption layer is used for the remaining energy to generate absorption light, which is used for stray light analysis.
[0112] In this case, the energy threshold of each layer is set to 10E-8, that is, relative to the energy of the light source, when the energy of the outgoing light calculated by each layer is lower than the energy of the light source by 10E-8 times, no outgoing light is generated.
[0113] S4. Perform hierarchical non-sequential tracing of the outgoing light rays according to the energy allocation principle in step S3, and allocate GPU calculations according to hierarchical priorities.
[0114] When the light source emits light and begins to trace the light, the light reaches the intersection surface and reads the surface property settings. When each light reaches any surface, the light energy is automatically distributed to each layer by the layer weight, and then the energy and direction of the generated light are calculated and distributed within the layer. The layer energy and direction are shown in step S3.
[0115] During the tracing process, three layers of tracing priorities can be assigned, and the layers with higher priorities can be traced first. Since the algorithms of each layer are fixed, the tracing task can be decomposed into intensive computing tasks, which can realize multi-threaded CPU computing and GPU parallel computing.
[0116] Since the rays are independent of each other, they can be calculated in parallel. This type of calculation is instruction-intensive, so the GPU acceleration method is used to optimize the algorithm, and the CUDA parallel computing architecture is used to enable the GPU to achieve parallel general computing.
[0117] Prioritize the calculation of rays with high hierarchical priority, decompose the tasks of intersection, emission calculation, and threshold judgment, import the structure of the optical system to be traced into the CUDA operating environment, convert the intersection, emission calculation, and threshold judgment into functions as interfaces, and use the data of each layer of incident rays as input to complete the task decomposition and construct an instruction set suitable for GPU parallel processing. When the GPU calculates rays with high hierarchical priority, the CPU and GPU are combined for processing, and multiple layers of rays are processed in parallel to ensure that the GPU is at an appropriate and efficient operating efficiency. Repeat in sequence until all ray tracing is completed and this tracing ends.
[0118] S5. Repeat step S4 until all ray tracing is completed. The ray tracing ends, and the non-sequential ray tracing results are obtained and the illumination in each cell in the receiving surface is calculated. By querying the layered source of the light, the light source analysis is finally realized.
[0119] The non-sequential ray tracing of stray light in the optical system is completed, and the stray light simulation can be realized by analyzing the receiver surface.
[0120] First, calculate the cell area, then calculate the light in the cell area, and add up the number of light in each cell. Add up the light energy of each cell and divide it by the initial number of light to get the luminous flux of each cell. Divide the luminous flux of each cell by the corresponding cell area to get the illumination of each grid. By querying the layered source of light, light source analysis can be achieved.
[0121] In the embodiment provided by the present invention: the receiving surface unit cell network is divided into 101×101, and the illumination distribution of the stray light on the entire receiving surface can be completed by calculating the illumination within each unit cell respectively.
[0122] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present invention.
[0123] The above specific implementations of the present invention do not constitute a limitation on the protection scope of the present invention. Any other corresponding changes and modifications made based on the technical concept of the present invention should be included in the protection scope of the claims of the present invention.
Claims
1. A layered non-sequential ray tracing method, characterized in that: The following steps are involved: S1. Tracing the incident light in the light system to obtain light information, where the light information of each light includes: the starting coordinates of the light source , light direction vector , light carries energy , light layering sources; S2. Layering the surface properties of the optical system and setting weight values and switches for each layer to achieve generation and control of outgoing light. The surface properties of the optical system are divided into three layers, namely: The reflected light and the transmitted light are divided into the Snell layer, the forward scattered light and the back scattered light are divided into the scattering layer, and the absorbed light is divided into the absorption layer; And set the Snell layer weight values separately , scattering layer weight value , absorption layer weight value and layered switches; S3, distributing the light energy of the incident light in each layer according to the weight information of the layered surface properties of the optical system; S4, performing hierarchical non-sequential tracing of the outgoing light rays according to the energy allocation principle in step S3, and allocating GPU calculations according to hierarchical priorities; S5. Repeat step S4 until all rays of maximum gradient values are traced, and the ray tracing ends to obtain the non-sequential ray tracing results and calculate the illumination in each cell in the receiving surface. By querying the layered source of the light, the light source analysis is finally realized.
2. A layered non-sequential ray tracing method according to claim 1, characterized in that: In step S3: The Snell layer light energy distribution formula is as follows: in, is the Snell layer weight value; T is transmittance, R is reflectivity; Φ snell is the Snell layer light energy; Φ in is the incident light energy; Φ r transmitting light energy to the Snell layer; Φ t The Snell layer reflects light energy.
3. A layered non-sequential ray tracing method according to claim 2, characterized in that: In step S3: The energy distribution formula of the scattering layer light is as follows: in, is the scattering layer weight; is the total accumulated scattering of the forward scattered light; is the total accumulated scattering of the backscattered light; Φ scatter is the light energy of the scattering layer; Φ scatterfront is the total accumulated scattering energy of the forward scattered light in the scattering layer; Φ scatterback is the total accumulated scattered energy of the backscattered light in the scattering layer.
4. A layered non-sequential ray tracing method according to claim 3, characterized in that: In step S3: The energy distribution formula of the absorption layer is as follows: in, Φ absorb is the energy of light in the scattering layer.
5. A layered non-sequential ray tracing method according to claim 4, characterized in that: The energy thresholds of the Snell layer, the scattering layer and the absorption layer are set to 10E-8; that is, relative to the energy of the light source, when the energy of the emitted light calculated by the Snell layer, the scattering layer and the absorption layer is lower than 10E-8 times the energy of the light source, no more emitted light is generated.
6. A layered non-sequential ray tracing method according to claim 5, characterized in that: In step S5: Firstly, the cell area on the receiving surface is calculated; Then, the light rays in the cell area are calculated, and the number of light rays in each cell is accumulated; Add up the light energy of each cell and divide it by the number of rays to get the luminous flux of each cell; The luminous flux of each cell is divided by the corresponding cell area to obtain the illumination of each cell; By querying the layered sources of light, the light source analysis is finally achieved.
Citation Information
Patent Citations
Applications of interval arithmetic for reduction of number of computations in ray tracing problems
US20060139349A1
Ray tracing device based on a pixel processing element and method thereof
US20090153556A1