Method and device for drawing light source of light file based on tree structure
Through the tree-based light source drawing method, the problems of poor results accuracy and large memory usage in the reverse simulation of complex high-frequency light file light sources are solved, and fast and accurate light source representation and simulation calculation are achieved, reducing the use of memory space .
Patent Information
- Application Number
- CN202411415830.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-11
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2044-10-11
AI Technical Summary
Complex and high-frequency light file light sources have poor results in reverse simulation and consume a large amount of memory space. The existing technology has a large gap with the correct results after processing, and requires a large amount of memory space for storage.
The light source drawing method of light file based on tree structure is used to divide the luminous light in the light file into three-dimensional space and luminous direction, and build a tree structure, and treat each leaf node of the tree structure as an implicit light source, according to the implicit light source Update the surrounding volume data from bottom to top, and perform importance sampling and luminous radiation calculations in ray tracing drawing or optical simulation.
It improves the accuracy of the results of the inverse simulation of complex high-frequency light files, reduces the use of memory space, and realizes the characteristics of fast preprocessing and simulation calculation speed and less memory space.
Smart Images

Figure CN119206085A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of computer graphics light source sampling, and in particular relates to a tree-structured ray file light source drawing method and device. Background Art
[0002] In the optical simulation application of lamp design, ray file is a common format that can represent any luminous body. A ray file contains multiple luminous rays. Each luminous ray generally contains data such as the coordinates of the ray starting point, the ray direction, and the luminous flux. The number of luminous rays is usually in the order of one hundred thousand to ten million. LED manufacturers usually provide the corresponding ray files of LED lamps for simulation calculations. They can also perform simulation calculations through optical simulation applications to obtain the ray files of the designed lamps and use them for further simulation calculations or lighting rendering. Optical simulation is usually performed using Monte Carlo ray tracing. Depending on the direction of tracing, it includes forward simulation starting from the light source, which is also called light tracing or particle tracing in the field of computer graphics, and reverse simulation starting from the photoreceptor, which is also called path tracing in the field of computer graphics. Since the ray file uses luminous rays to describe the light source, the data is discrete in both spatial position and direction. This makes the ray file light source unusable in reverse simulation, because the light emitted from the receiver cannot hit the corresponding luminous point in the corresponding direction, making the ray file light source unable to contribute to the result.
[0003] Since some tracing light paths are difficult or impossible to trace in forward simulation, and the ray file data occupies a large amount of memory space, some studies have processed the ray file light source in a continuous manner so that the ray file light source can be used for reverse simulation and reduce the use of memory space. For example, the literature Mas, Albert, et al. "Compression and Importance Sampling of Near-Field" Computer Graphics Forum , 27 (2008): 2013-2027. This paper divides the rays in the ray file and then triangulates them to obtain a triangular mesh. On each vertex of the triangular mesh, a spherical uniform map is used to represent and record the direction distribution of the rays near the starting point of the luminous ray, and a two-dimensional texture is used to store the distribution. Velázquez-Armendáriz, Edgar et al. "Complex Luminaires:Illumination and Appearance Rendering". ACM Transactions on Graphics34.3(2015): 1-15 Perform agglomerative clustering on the luminous light, use multiple discrete anisotropic point lights to represent each cluster, and also use a 2D texture to represent the luminous direction distribution of each anisotropic point light. Although the luminous points are discrete, the representation of the directional distribution is continuous, so it can also be used for inverse simulation.
[0004] Although the method proposed in the above literature allows the light file light source to be used for reverse simulation, for complex and high-frequency light file light sources, such as the light file of a car headlight obtained by simulating an optical simulation application, there is a large gap between the processed simulation results and the correct results, and a large memory space is required to store the processed data. Summary of the invention
[0005] In view of the above, an object of the present invention is to provide a tree-structured ray file light source rendering method and device to improve the result accuracy of complex and high-frequency ray file light sources while reducing the required memory space.
[0006] To achieve the above-mentioned object of the invention, an embodiment provides a tree-structured ray file light source drawing method, comprising the following steps: Divide the luminous rays in the ray file into three-dimensional space and luminous direction and build a tree structure; The bounding volume of each leaf node of the tree structure is regarded as an implicit light source, and the bounding volume data is updated in the tree structure from bottom to top according to the implicit light source; The updated tree structure is used for importance sampling and radiance calculation in ray tracing rendering or optical simulation.
[0007] Preferably, dividing the luminous rays in the luminous rays file into three-dimensional space and luminous direction and constructing a tree structure includes: Divide the luminous rays from top to bottom. When dividing, each layer from top to bottom divides the spatial bounding volume and / or the directional bounding volume in turn to realize the division of three-dimensional space and luminous direction. The left and right parts obtained by the division are used as the left child node and the right child node of the current node to form a tree structure. When the number of luminous rays in the interval to be divided is less than or equal to a set value, stop dividing and form a leaf node; Optionally, several consecutive layers are extracted and merged to form a tree structure with more forks per layer and a lower maximum height.
[0008] Preferably, dividing the spatial bounding volume and / or the directional bounding volume includes: Enumerate each dimension of the bounding volume, evaluate the optimal partitioning and corresponding partitioning cost under each dimension, and select the optimal dimension for partitioning; When evaluating the current dimension, the range of the bounding volume in the current dimension is equally divided into a specified number of buckets; for each emitting light in the divided interval, the sequence number of the bucket of its emitting starting point or emitting direction in the current evaluation dimension is calculated and assigned to the corresponding bucket; for any two adjacent buckets, consider dividing between the two buckets, evaluate the division cost according to the light allocated to the buckets on both sides, and update the optimal division point and optimal division dimension based on the division cost; The partition cost is evaluated as follows: for the left and right sides after the partition, the partition cost is evaluated based on the calculated sum of the luminous flux, the volume of the spatial bounding box, the average direction of the luminous direction, and the maximum angle between all luminous directions on each side and the average luminous direction. , the formula is: ; in, and Represent the total luminous flux on the left and right sides respectively, and Respectively represent the volume of the spatial bounding box on the left and right sides, and Respectively represent the maximum angle between the left and right luminous directions and the average luminous direction, is the solid angle of the spherical circular area with the average luminous direction on the left as the center and the maximum angle as the range, It is the solid angle of the spherical circular area with the average luminous direction on the right as the center and the maximum angle as the range.
[0009] Preferably, the bounding box of each leaf node of the tree structure is regarded as an implicit light source, including: Use a disk-shaped light source to model the implicit light source. Specifically, calculate the starting point bounding box of the luminous light included in the current leaf node, and use the center of the starting point bounding box as the center of the disk-shaped light source; calculate the average luminous direction of the luminous light included in the current leaf node, and use the average luminous direction as the orientation of the disk-shaped light source; calculate the maximum angle between the luminous light included in the current leaf node and the average luminous direction, and expand it outward by a certain angle as the luminous angle range of the disk-shaped light source; calculate the projection point of the starting point of the luminous light included in the current leaf node in the xy plane in the local coordinate system with the center of the disk as the coordinate origin and the average luminous direction as the z-axis, and use the maximum distance from the projection point to the origin as the radius of the disk-shaped light source.
[0010] The expansion of the luminous angle of the disk-shaped light source uses the following formula: ;
[0011] in is the original maximum angle, is the maximum angle after expansion, is a set value.
[0012] Preferably, updating the bounding volume data in a tree structure from bottom to top according to the implicit light source includes: Use the geometric information of the disk-shaped light source to update the spatial bounding volume information of the node. In the subtree with the current node as the root, expand the angle range of the current node according to the maximum expansion angle difference, where the expansion angle difference is the angle between the luminous light and the average luminous direction. Angle with expansion The difference is .
[0013] Preferably, the updated tree structure is used in ray tracing rendering or optical simulation to perform importance sampling and luminous radiance calculation, including: When light hits any shading point in the scene, starting from the root node of the tree structure, we continuously sample a child node at each level of the tree structure until we reach a leaf node, take out the implicit light source corresponding to the leaf node, and sample a point as the luminous point, calculate the illumination of the luminous point on the shading point, and implement the importance sampling of the next event estimation; When the light sampled by the importance of the bidirectional scattering distribution function leaves the shading point, it starts from the root node of the tree structure and continuously traverses the child nodes. It uses the bounding volume data of the node to quickly eliminate the subtree that needs to be traversed, and calculates the luminous radiance of the corresponding implicit light source in the opposite direction of the current light at each traversed leaf node. When light is emitted from a light source, starting from the root node of the tree structure, a child node is continuously sampled at each layer of the tree structure using the luminous flux of the child node as the weighted importance until a leaf node is reached. The implicit light source corresponding to the node is taken out, and a point is sampled in the implicit light source as the luminous point. A luminous direction is sampled, and the luminous radiance at the luminous point and the sampling direction is calculated to obtain the sampled luminous light.
[0014] Preferably, a child node is sampled at each level of the tree structure, including: For each child node of the current node, use its luminous direction, angle range, center coordinates of the bounding volume, and radius of the bounding volume to determine whether the current shading point is within the illumination range it represents; if it is within the range, evaluate the illumination contribution of the current child node to the shading point, and use the illumination contribution as the weight to importance sample a child node; if all child nodes determine that the current shading point is not within the illumination range, directly terminate the traversal of the tree structure and return the sampled luminous radiance as 0; Preferably, when sampling a point in the implicit light source, a point on the disk is selected with equal probability using disk uniform sampling.
[0015] Preferably, the illumination of the sampled light-emitting point on the shading point in the implicit light source is calculated using the following formula: ;
[0016] in, For a point on a disk-shaped light source that models an implicit light source, is the current shading point, for arrive The unit vector of is the direction of the disk-shaped light source, represents the vector dot product, is the luminous angle range of the disk-shaped light source, is the basic luminous radiance of the disk-shaped light source, which is calculated by the following formula: ; in, is the total luminous flux recorded by the leaf node corresponding to the current implicit light source, is the radius of the disk-shaped light source.
[0017] Preferably, the node's bounding volume data is used to quickly eliminate the subtree that needs to be traversed, including: If the angle between the reverse direction of the current light direction and the luminous direction recorded by the node exceeds the node angle range, the current subtree is eliminated; if the distance from the center point of the current node bounding volume to the straight line where the luminous direction is located exceeds the radius of the node bounding volume, the current subtree is eliminated.
[0018] To achieve the above-mentioned purpose of the invention, an embodiment of the present invention further provides a tree-structure-based ray file light source drawing device, comprising a tree structure building module, a tree structure updating module, and a drawing module; The tree structure building module is used to divide the luminous light in the ray file into three-dimensional space and luminous direction and build a tree structure; The tree structure updating module is used to regard the bounding volume of each leaf node of the tree structure as an implicit light source, and update the bounding volume data in the tree structure from bottom to top according to the implicit light source; The rendering module is used to use the updated tree structure to perform importance sampling and luminous radiance calculation in ray tracing rendering or optical simulation.
[0019] To achieve the above-mentioned purpose of the invention, an embodiment further provides a computing device, including a memory and one or more processors, wherein the memory stores executable code, and when the one or more processors execute the executable code, they are used to implement the above-mentioned tree-structured based ray file light source drawing method.
[0020] To achieve the above-mentioned purpose of the invention, an embodiment further provides a computer-readable storage medium on which a program is stored. When the program is executed by a processor, the above-mentioned tree-structure-based ray file light source drawing method is implemented.
[0021] Compared with the prior art, the present invention has the following beneficial effects: The tree-structured ray file light source drawing method and device provided by the present invention can calculate the luminous radiance and importance sampling of the light source at the specified luminous position and direction in reverse simulation by using the tree structure to organize and represent the luminous light in the ray file, and can also perform continuous importance sampling of the luminous light in forward simulation. This ray file light source representation method has the characteristics of fast preprocessing and simulation calculation speed, small memory space occupation, and can represent high-frequency ray file data. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0023] Figure 1 is a flowchart of a tree-structured ray file light source drawing method provided in an embodiment; Figure 2 It is a flow chart of sampling a luminous ray using a tree-structured ray file light source importance in a forward simulation provided by an embodiment; Figure 3 It is a flowchart of sampling a light source sample using a tree-structured ray file light source importance for a given shading point in a reverse simulation provided by an embodiment; Figure 4 It is a flow chart of calculating the luminous radiance in the reverse direction of a given light ray using a light source with a tree structure-based light file in a reverse simulation provided by an embodiment; Figure 5 It is a structural schematic diagram of a tree-structured ray file light source drawing device provided in an embodiment. DETAILED DESCRIPTION
[0024] 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 embodiments. It should be understood that the specific implementation methods described herein are only used to explain the present invention and do not limit the scope of protection of the present invention.
[0025] The inventive concept of the present invention is as follows: In view of the deficiencies in the background technology, the embodiment provides a tree-structured ray file light source drawing method and device, which can realize the rapid and accurate use of ray file light sources in reverse simulation, and can also sample continuous luminous rays in the forward direction, while reducing the memory usage required to store ray file light source data. The tree-structured ray file light source drawing method and device provided in the embodiment also use a tree structure to organize and represent the luminous rays in the ray file. This representation method of ray file light sources has the characteristics of fast preprocessing and simulation calculation speed, small memory space occupation, and the ability to represent high-frequency ray file data.
[0026] like Figure 1 As shown, the embodiment provides a tree-structured ray file light source drawing method, comprising the following steps: S1, divide the luminous light in the ray file into three-dimensional space and luminous direction and build a tree structure.
[0027] In the embodiment, when dividing the luminous rays in the ray file, the luminous rays are divided from top to bottom, and the left and right parts obtained by the division are used as the left child node and the right child node of the current node to form a binary tree. The top layer is divided according to the spatial bounding volume of the starting point of the luminous ray, and the next layer is divided according to the bounding volume of the luminous direction in the two-dimensional space after the octahedron mapping. After that, each layer divides the space and direction in turn, which is similar to the division of a kd tree.
[0028] When partitioning a node in each layer, enumerate each dimension of the bounding volume, evaluate the optimal partitioning and the corresponding partitioning cost in each dimension, and select the optimal dimension for partitioning. There are three dimensions to be enumerated for space and two for direction.
[0029] When enumerating each dimension, the bounding volume in the dimension is equally divided into a specified number of buckets. For each luminous ray in the divided interval, the sequence number of the bucket of its luminous starting point or luminous direction in the current evaluation dimension is calculated and assigned to the corresponding bucket. After the allocation is completed, the luminous starting point bounding volume, average luminous direction, maximum luminous direction angle, and total luminous flux of the luminous ray assigned to each bucket are calculated.
[0030] Then enumerate the partition points, and for any two adjacent buckets, consider partitioning between the two buckets. According to the above-mentioned luminous starting point bounding volume, average luminous direction, maximum luminous direction angle, and total luminous flux data calculated for each bucket, merge the spatial bounding box, average luminous direction, maximum luminous direction angle, and total luminous flux on the left and right sides of the partition point, and use the following formula to evaluate the partition cost : ; in, and Represent the total luminous flux on the left and right sides respectively, and Respectively represent the volume of the spatial bounding box on the left and right sides, and Respectively represent the maximum angle between the left and right luminous directions and the average luminous direction, is the solid angle of the spherical circular area with the average luminous direction on the left as the center and the maximum angle as the range, It is the solid angle of the spherical circular area with the average luminous direction on the right as the center and the maximum angle as the range.
[0031] During the division process, if the number of luminous rays that need to be divided is less than or equal to a specified number, the division is stopped and the node is treated as a leaf node.
[0032] After completing the above division operation, a binary tree is obtained. In order to further improve efficiency and reduce the storage space occupied by the tree structure, several consecutive layers are optionally extracted and merged to form a tree structure with more forks per layer and a lower maximum height.
[0033] In the embodiment, a layer of intermediate nodes is extracted every other layer, and the four nodes corresponding to a node in the previous layer after extraction in the next layer are used as its four child nodes to obtain a quadtree. If the extracted layer contains leaf nodes, it is divided once to ensure that each node is either a leaf node or has four complete child nodes to reduce complexity. This division method is the same as the division in the above binary tree construction process.
[0034] In the embodiment, when storing the tree structure, all child nodes of a node are stored continuously, so that for each intermediate node, only the sequence number of its first child node needs to be stored, further reducing the storage space occupied.
[0035] S2: The bounding volume of each leaf node of the tree structure is regarded as an implicit light source, and the bounding volume data is updated in the tree structure from bottom to top according to the implicit light source.
[0036] In the embodiment, when the bounding box of each leaf node of the tree structure is regarded as an implicit light source, a special disk-shaped light source is used to model this implicit light source. For each leaf node of the tree structure: calculate the starting point bounding box of the luminous light included in the leaf node, and use the center of the bounding box as the center of the disk-shaped light source; calculate the average luminous direction of the luminous light included in the leaf node, and use this direction as the orientation of the disk-shaped light source, that is, the normal direction of the disk and the main luminous direction of the light source; calculate the maximum angle between the luminous light included in the leaf node and the average luminous direction, and expand a certain angle as the luminous angle range of the disk-shaped light source; calculate the projection point of the starting point of the luminous light included in the leaf node in the xy plane in the local coordinate system with the center of the disk as the coordinate origin and the average luminous direction as the z-axis, and use the maximum distance from the projection point to the origin as the radius of the disk-shaped light source.
[0037] In the embodiment, since the attenuation formula of the disk-shaped light source used in the direction attenuates quickly, the result is made more continuous between different directions and different disk-shaped light sources by expanding an angle. The following formula is used to calculate the expansion angle: ; in is the original maximum angle, It is the maximum angle after expansion. is a set value, which means the value of the disc-shaped light source directional attenuation item in the original angle range after expansion. For common LED lights or light files of designed lamps, this Values are usually set between 0.4 and 0.8.
[0038] In the embodiment, the bounding volume data is updated in the tree structure from bottom to top according to the implicit light source, specifically by a depth-first search method, including: using the geometric information of the disk-shaped light source to update the spatial bounding volume information of the node, so that the spatial bounding volume is closer to the modeled light source; in the subtree with the current node as the root, according to the maximum outward expansion angle difference Expand the angle range of the current node to ensure that the possible luminous range is included in the parent node.
[0039] S3, using the updated tree structure to perform importance sampling and luminous radiance calculation in ray tracing rendering or optical simulation.
[0040] The embodiment mainly includes three aspects: In the forward simulation, a luminous direction is sampled from the light source of the ray file represented by the tree structure, and its luminous radiance is calculated. Figure 2 A flow chart of this operation is given; In reverse simulation, when a ray hits any shading point in the scene, the importance sampling of the next event evaluation is performed. According to the ray file light source represented by the tree structure, a direction is sampled at the current shading point. Figure 3 A flow chart of this operation is given; In the reverse simulation, when the BSDF (bidirectional scattering distribution function) importance sampled light leaves the shading point, the light source of the light file represented by the calculation tree structure contributes to the luminescence of the light. Figure 4 A flow chart of this operation is given.
[0041] The above three aspects all include a common part, which is to calculate the luminous radiance of a point on the implicit light source in a certain luminous direction. In the embodiment, the following formula is used for calculation: ; in, A point on a disk-shaped light source that models an implicit light source; is the direction of light emission. If a shading point on the surface of an object is currently being considered ,but for arrive The unit vector of is the orientation of the disk-shaped light source, that is, the normal direction of the disk and the main emission direction of the light source; Represents vector dot product; is the luminous angle range of the disk-shaped light source; is the basic luminous radiance of the disk-shaped light source, which is calculated by the following formula: ; in, is the total luminous flux recorded by the leaf node corresponding to the current disk-shaped light source, is the radius of the disk-shaped light source. This formula comes from the definition of luminous flux and luminous radiance, that is, ; The integral domain represents the entire disk surface, the integration domain Indicates the luminous angle range The solid angle inside.
[0042] In the embodiment, in order to sample a luminous direction on the light source of the ray file represented by the tree structure in the forward simulation, starting from the root node of the tree structure, at each layer of the tree structure, the luminous flux of the four child nodes is used as the weight, and a child node is sampled according to importance, and this operation is repeated down the tree structure until a leaf node is reached, and the corresponding disk-shaped light source is taken out, and a point on the disk is uniformly sampled as the starting point of the ray, and according to Importance sampling is performed on a luminous direction, and the luminous radiance at the sampling point and the sampling direction is calculated to obtain the sampled luminous light.
[0043] In the embodiment, in order to perform importance sampling for the next event evaluation when light hits any shading point in the scene in reverse simulation, starting from the root node of the tree structure, at each layer of the tree structure, the contribution of the four child nodes to the current shading point is evaluated, and a child node is sampled based on the weighted importance, and this operation is repeated down the tree structure until a leaf node is reached, the corresponding disk-shaped light source is taken out, and a point is uniformly sampled on the disk, with the direction from the shading point to the point as the sampling direction, and the opposite direction is the light emission direction of the disk-shaped light source, and the illumination of the point on the shading point is calculated.
[0044] In the embodiment, in order to evaluate the contribution of a node to the current shading point, it is first determined whether the shading point is within the area covered by the node's bounding volume, luminous direction, and luminous angle range. If it is not within the area, the evaluated contribution is 0. If it is within the area, the following formula is used to evaluate the illumination contribution of the current node to the shading point: ; in ; ; ; in, , , , , Same meaning as above, represents the center of the disk, represents the normal direction of the shading point, represents the vector modulus, represents the angle between two vectors, A unit vector that represents a point from another point.
[0045] In an embodiment, in order to calculate the luminous contribution of the light source in the ray file represented by the tree structure to the ray after the ray sampled by the BSDF importance leaves the shading point in the reverse simulation, starting from the root node of the tree structure, each possible child node is continuously traversed, and the subtree that needs to be traversed is quickly eliminated using the node's bounding volume information, and the luminous radiance of the corresponding disk-shaped light source in the opposite direction of the current ray is calculated at each traversed leaf node.
[0046] In an embodiment, the node's bounding volume information is used to eliminate the subtree that needs to be traversed, and the judgment is made according to the following method: if the angle between the reverse direction of the current light direction and the luminous direction recorded by the node exceeds the node angle range, the current subtree is eliminated; if the distance from the center point of the current node's bounding volume to the straight line where the luminous direction is located exceeds the node's bounding volume radius, the current subtree is eliminated.
[0047] like Figure 5 As shown, the embodiment also provides a tree-structured ray file light source drawing device 50, comprising: a tree structure construction module 51, a tree structure update module 52, and a drawing module 53; wherein the tree structure construction module 51 is used to divide the luminous light in the ray file into three-dimensional space and luminous direction and construct a tree structure; the tree structure update module 52 is used to regard the bounding volume of each leaf node of the tree structure as an implicit light source, and update the bounding volume data in the tree structure from bottom to top according to the implicit light source; the drawing module 53 is used to use the above-mentioned updated tree structure to perform importance sampling and luminous radiance calculation in ray tracing drawing or optical simulation.
[0048] It should be noted that the tree-structured ray file light source drawing device provided in the above embodiment should be illustrated by the division of the above functional modules when performing tree-structured ray file light source drawing. The above functional allocation can be completed by different functional modules as needed, that is, the internal structure of the terminal or server is divided into different functional modules to complete all or part of the functions described above. In addition, the tree-structured ray file light source drawing device provided in the above embodiment and the tree-structured ray file light source drawing method embodiment belong to the same concept. The specific implementation process is detailed in the tree-structured ray file light source drawing method embodiment, which will not be repeated here.
[0049] Based on the same inventive concept, an embodiment further provides a computing device, including a memory and one or more processors, wherein executable code is stored in the memory, and when the one or more processors execute the executable code, the method for drawing a light source based on a tree structure using a ray file is implemented, specifically including the following steps: S1, divide the luminous light in the luminous light file into three-dimensional space and luminous direction and construct a tree structure; S2, treating the bounding volume of each leaf node of the tree structure as an implicit light source, and updating the bounding volume data in the tree structure from bottom to top according to the implicit light source; S3, using the updated tree structure to perform importance sampling and luminous radiance calculation in ray tracing rendering or optical simulation.
[0050] The computing device provided in the embodiment, in addition to the processor and memory, also includes hardware required for other services such as internal bus, network interface, memory, etc. at the hardware level. The memory is a non-volatile memory, and the processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to implement the tree-structured ray file light source drawing method described in S1-S3 above. Of course, in addition to the software implementation, the present invention does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0051] Based on the same inventive concept, an embodiment further provides a computer-readable storage medium on which a program is stored. When the program is executed by a processor, the above-mentioned tree-structured ray file light source drawing method is implemented, which specifically includes the following steps: S1, divide the luminous light in the luminous light file into three-dimensional space and luminous direction and construct a tree structure; S2, treating the bounding volume of each leaf node of the tree structure as an implicit light source, and updating the bounding volume data in the tree structure from bottom to top according to the implicit light source; S3, using the updated tree structure to perform importance sampling and luminous radiance calculation in ray tracing rendering or optical simulation.
[0052] In the embodiments, computer-readable media include permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data. The specific implementation methods described above provide a detailed description of the technical solutions and beneficial effects of the present invention. It should be understood that the above is only the most preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, supplements and equivalent substitutions made within the scope of the principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A light source drawing method based on a tree structured ray file, characterized in that: The following steps are involved: Divide the luminous rays in the ray file into three-dimensional space and luminous direction and build a tree structure; The bounding volume of each leaf node of the tree structure is regarded as an implicit light source, and the bounding volume data is updated in the tree structure from bottom to top according to the implicit light source; The updated tree structure is used for importance sampling and radiance calculation in ray tracing rendering or optical simulation.
2. The method for drawing a light source using a ray file based on a tree structure according to claim 1, characterized in that: Divide the luminous rays in the ray file into three-dimensional space and luminous direction and build a tree structure, including: Divide the luminous rays from top to bottom. When dividing, each layer from top to bottom divides the spatial bounding volume and the directional bounding volume in turn to realize the division of three-dimensional space and luminous direction. The left and right parts obtained by the division are used as the left child node and the right child node of the current node to form a tree structure. When the number of luminous rays in the interval to be divided is less than or equal to a set value, stop dividing and form a leaf node; Optionally, several consecutive layers are extracted and merged to form a tree structure with more forks per layer and a lower maximum height.
3. The tree-structured ray file light source drawing method according to claim 2, characterized in that: The spatial bounding volume and the directional bounding volume are divided, including: Enumerate each dimension of the bounding volume, evaluate the optimal partitioning and corresponding partitioning cost under each dimension, and select the optimal dimension for partitioning; When evaluating the current dimension, the range of the bounding volume in the current dimension is equally divided into a specified number of buckets; for each emitting light in the divided interval, the sequence number of the bucket of its emitting starting point or emitting direction in the current evaluation dimension is calculated and assigned to the corresponding bucket; for any two adjacent buckets, consider dividing between the two buckets, evaluate the division cost according to the light allocated to the buckets on both sides, and update the optimal division point and optimal division dimension based on the division cost; The partitioning cost is evaluated as follows: for the two sides after the partition, the partitioning cost is evaluated based on the calculated sum of the luminous flux, the spatial bounding box, the average direction of the luminous direction, and the maximum angle between all luminous directions on each side and the average luminous direction.
4. The method for drawing a light source using a ray file based on a tree structure according to claim 1, characterized in that: The bounding box of each leaf node of the tree structure is regarded as an implicit light source, including: Use a disk-shaped light source to model the implicit light source. Specifically, calculate the starting point bounding box of the luminous light included in the current leaf node, and use the center of the starting point bounding box as the center of the disk-shaped light source; calculate the average luminous direction of the luminous light included in the current leaf node, and use the average luminous direction as the orientation of the disk-shaped light source; calculate the maximum angle between the luminous light included in the current leaf node and the average luminous direction, and expand it outward by a certain angle as the luminous angle range of the disk-shaped light source; calculate the projection point of the starting point of the luminous light included in the current leaf node in the xy plane in the local coordinate system with the center of the disk as the coordinate origin and the average luminous direction as the z-axis, and use the maximum distance from the projection point to the origin as the radius of the disk-shaped light source.
5. The method for drawing a light source using a ray file based on a tree structure according to claim 4, characterized in that: Update bounding volume data in the tree structure from bottom to top based on implicit light sources, including: Use the geometric information of the disk-shaped light source to update the spatial bounding volume information of the node. In the subtree with the current node as the root, expand the angle range of the current node according to the maximum expansion angle difference, where the expansion angle difference is the difference between the angle from the luminous light to the average luminous direction and the expansion angle.
6. The tree-structured ray file light source drawing method according to claim 1, characterized in that: Use the updated tree structure for importance sampling and radiance calculations in ray tracing rendering or optical simulation, including: In reverse simulation, when light hits any shading point in the scene, starting from the root node of the tree structure, a child node is continuously sampled at each level of the tree structure until a leaf node is reached. The implicit light source corresponding to the leaf node is taken out, and a point is sampled as the luminous point. The illumination of the luminous point on the shading point is calculated to achieve the importance sampling of the next event evaluation. In the reverse simulation, when the light sampled by the importance sampling of the bidirectional scattering distribution function leaves the shading point, it starts from the root node of the tree structure, continuously traverses the child nodes, and uses the bounding volume data of the node to quickly eliminate the subtree that needs to be traversed. At each traversed leaf node, the luminous radiance of the corresponding implicit light source in the opposite direction of the current light is calculated; In forward simulation, when light is emitted from a light source, starting from the root node of the tree structure, a child node is continuously sampled at each layer of the tree structure using the luminous flux of the child node as the weighted importance until a leaf node is reached. The implicit light source corresponding to the node is taken out, and a point is sampled in the implicit light source as the luminous point. A luminous direction is sampled, and the luminous radiance at the luminous point and the sampling direction is calculated to obtain the sampled luminous light.
7. The tree-structured ray file light source rendering method according to claim 6, characterized in that: At each level of the tree structure, importance samples a child node, including: For each child node of the current node, use its luminous direction, angle range, center coordinates of the bounding volume, and radius of the bounding volume to determine whether the current shading point is within the illumination range it represents; if it is within the range, evaluate the illumination contribution of the current child node to the shading point, and use the illumination contribution as the weight to importance sample a child node; if all child nodes determine that the current shading point is not within the illumination range, directly terminate the traversal of the tree structure and return the sampled luminous radiance as 0; Use the bounding volume data of the node to quickly eliminate the subtrees that need to be traversed, including: If the angle between the reverse direction of the current light direction and the luminous direction recorded by the node exceeds the node angle range, the current subtree is eliminated; if the distance from the center point of the current node bounding volume to the straight line where the luminous direction is located exceeds the radius of the node bounding volume, the current subtree is eliminated.
8. A light source drawing device based on a tree structure, characterized in that: include: Tree structure building module, tree structure updating module, drawing module; The tree structure building module is used to divide the luminous light in the ray file into three-dimensional space and luminous direction and build a tree structure; The tree structure updating module is used to regard the bounding volume of each leaf node of the tree structure as an implicit light source, and update the bounding volume data in the tree structure from bottom to top according to the implicit light source; The rendering module is used to use the updated tree structure to perform importance sampling and luminous radiance calculation in ray tracing rendering or optical simulation.
9. A computing device comprising a memory and one or more processors, wherein the memory stores executable code, characterized in that: When the one or more processors execute the executable code, they are used to implement the tree-structured ray file light source drawing method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: A program is stored thereon, and when the program is executed by a processor, the tree-structured ray file light source drawing method described in any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Illumination rendering method and device, equipment and medium
CN115082611A
System and method of constructing bounding volume hierarchy tree
US20170161944A1
System architecture for high speed ray tracing
US7012604B1
