Ray tracking method and device and electronic equipment

By constructing and optimizing K-dimensional trees, the problem of invalid redundant rays in traditional ray tracing algorithms is solved, achieving savings in computational resources and improved efficiency.

CN121236282APending Publication Date: 2025-12-30CHINA TELECOM CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511295100.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-10
Publication Date
2025-12-30

AI Technical Summary

Technical Problem

Traditional ray tracing algorithms have a large number of invalid and redundant rays, which leads to a waste of computational resources.

Method used

An initial K-tree corresponding to the geometric model of the target scene is constructed. By determining the axis-aligned bounding box and the list of triangular faces for each node, the effective ray probability is optimized, the target K-tree is generated, and the ray intersection is detected by traversing the target K-tree. Low-probability regions are pruned to reduce invalid ray emission.

Benefits of technology

This reduces the invalid ray emission and traversal of inefficiently occluded areas in ray tracing, saving computational resources and improving computational efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121236282A_ABST
    Figure CN121236282A_ABST
Patent Text Reader

Abstract

The invention discloses a ray tracking method and device and electronic equipment. The method comprises the steps that an initial K-dimensional tree corresponding to a geometric model of a target scene is constructed, each node of the initial K-dimensional tree corresponds to an axis alignment bounding box, the axis alignment bounding boxes are associated with included triangular patch lists, and corresponding electromagnetic parameters are bound according to materials of triangular patches in the triangular patch lists; determining an effective ray probability of a space region represented by an axis alignment bounding box corresponding to each node in the initial K-dimensional tree; optimizing the initial K-dimensional tree according to the effective ray probability to obtain a target K-dimensional tree; and traversing all target nodes in the target K-dimensional tree, detecting the intersection between the rays and the axis alignment bounding boxes corresponding to the target nodes, obtaining an intersection result, stopping until leaf nodes are reached, and tracking the rays according to the intersection result. The technical problem that a large number of invalid redundant rays exist in a traditional ray tracing algorithm, and consequently computing resources are wasted is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of wireless communication, and more specifically, to a ray tracing method, apparatus, and electronic device. Background Technology

[0002] Shooting and Bouncing Ray (SBR) algorithms predict channel characteristics by simulating the propagation paths of electromagnetic waves in a scene (such as reflection and diffraction), and are a core method for 5G / 6G high-frequency channel modeling. However, its computational complexity increases quadratically with the scene complexity, requiring frequent geometric intersection detection. Furthermore, traditional SBR uses a uniform sampling strategy for emitted rays, failing to distinguish path validity, resulting in a contradiction of "high redundancy - low coverage." Therefore, traditional ray tracing algorithms contain a large number of redundant rays, leading to a waste of computational resources.

[0003] There is currently no effective solution to the above problems. Summary of the Invention

[0004] This application provides a ray tracing method, apparatus, and electronic device to at least solve the technical problem that traditional ray tracing algorithms have a large number of invalid redundant rays, resulting in a waste of computing resources.

[0005] According to one aspect of the embodiments of this application, a ray tracing method is provided, comprising: constructing an initial K-tree corresponding to a geometric model of a target scene, wherein each node of the initial K-tree corresponds to an axis-aligned bounding box, the axis-aligned bounding box is associated with a list of contained triangular faces, and electromagnetic parameters are bound according to the material of the triangular faces in the list of triangular faces, the list of triangular faces is a set corresponding to geometric elements in the geometric model, the geometric model is used to describe the shape and position of objects in the target scene, and the K-tree is a data structure in multidimensional space used to store point data; determining the effective ray probability of the spatial region represented by the axis-aligned bounding box corresponding to each node in the initial K-tree; optimizing the initial K-tree according to the effective ray probability to obtain a target K-tree; traversing all target nodes in the target K-tree, detecting the intersection of the ray with the axis-aligned bounding box corresponding to the target node, obtaining the intersection result, stopping when a leaf node is reached, and tracing the ray according to the intersection result, wherein the target node is any node in the target K-tree.

[0006] Optionally, constructing an initial K-dimensional tree corresponding to the geometric model of the target scene includes: determining the root node of the initial K-dimensional tree, wherein the root node contains the target axis-aligned bounding box corresponding to the target scene; at the root node, selecting a segmentation axis according to the spatial dimension of the target scene, and dividing the space contained in the root node into two subspaces along the midpoint of the segmentation axis, wherein each subspace corresponds to a node in the initial K-dimensional tree; for each subspace, repeating the steps of selecting the segmentation axis and segmenting the space until the termination condition is met, thereby obtaining the initial K-dimensional tree, wherein the node corresponding to the space obtained after the last execution of segmenting the space is the initial leaf node.

[0007] Optionally, determining the effective ray probability of the spatial region represented by the axis-aligned bounding box corresponding to each node in the initial K-dimensional tree includes: determining the geometric visibility probability and the average reflectance of the region corresponding to each node in the initial K-dimensional tree, wherein the geometric visibility probability is used to represent the probability that light will directly hit the spatial region represented by the axis-aligned bounding box corresponding to the node in the K-dimensional tree, and the average reflectance of the region is used to evaluate the ability of the spatial region to reflect rays; and determining the effective ray probability of the spatial region based on the geometric visibility probability and the average reflectance of the region.

[0008] Optionally, determining the geometric visibility probability corresponding to each node in the initial K-dimensional tree includes: acquiring a detection region, wherein the detection region is the spatial region represented by any node in the initial K-dimensional tree; determining the cosine of the angle between the center point of the detection region and the line of sight of the transceiver; projecting a ray onto the detection region to determine the occlusion status of the detection region; if the occlusion status indicates that the detection region is occluded, determining the geometric visibility probability of the node corresponding to the detection region in the initial K-dimensional tree to be 0; if the occlusion status indicates that the detection region is not occluded, determining the geometric visibility probability of the node corresponding to the detection region in the initial K-dimensional tree to be the cosine of the line of sight.

[0009] Optionally, determining the regional average reflectance corresponding to each node in the initial K-dimensional tree includes: obtaining the axis-aligned bounding box corresponding to each node in the initial K-dimensional tree, and traversing all triangular faces within the axis-aligned bounding box; determining the area and reflectance of each triangular face, and determining a weighted average based on the area and reflectance of all triangular faces to obtain the regional average reflectance.

[0010] Optionally, determining the effective ray probability of a spatial region based on the geometric visibility probability and the regional average reflectivity includes: determining a first weight corresponding to the geometric visibility probability and a second weight corresponding to the regional average reflectivity; and determining the effective ray probability based on the first weight, the geometric visibility probability, the second weight, and the regional average reflectivity.

[0011] Optionally, the initial K-dimensional tree is optimized based on the effective ray probability to obtain the target K-dimensional tree, including: identifying regions with effective ray probabilities greater than a preset threshold as high-probability regions, and generating candidate segmentation points in the high-probability regions along the segmentation axis; determining the cost function based on the first effective ray probability of the left child node of each candidate segmentation point and the second effective ray probability of the right child node of each candidate segmentation point; determining the segmentation axis and candidate segmentation point with the minimum cost function as the target segmentation axis and target segmentation point, and recursively repeating the steps of generating candidate segmentation points, determining the cost function, and determining the target segmentation axis and target segmentation point for the left and right child nodes of the target segmentation point until the preset conditions are met, thereby obtaining the target K-dimensional tree.

[0012] Optionally, the cost function is determined as follows: First surface area of ​​the axis-aligned bounding box corresponding to the left child node of each candidate segmentation point, second surface area of ​​the axis-aligned bounding box corresponding to the right child node of each candidate segmentation point, and third surface area of ​​the axis-aligned bounding box corresponding to each candidate segmentation point; first number of geometric elements contained in the left child node of each candidate segmentation point, and second number of geometric elements contained in the right child node of each candidate segmentation point; and cost function corresponding to each candidate segmentation point determined based on the first surface area, second surface area, third surface area, first number, second number, first effective ray probability, and second effective ray probability.

[0013] Optionally, ray tracking based on intersection results includes: pruning the subtree corresponding to the target node when the effective ray probability corresponding to the target node is less than a probability threshold, or when the intersection result indicates that the ray does not intersect with the axis-aligned bounding box corresponding to the target node; determining the ray's state information when the intersection result indicates that the ray intersects with the axis-aligned bounding box corresponding to the target node, wherein the state information includes at least one of the following: energy, path delay, number of reflections, and ray power; stopping ray tracking when the ray reaches the receiver's receiving range and the ray's state information satisfies that the ray power is less than a power threshold, or the number of reflections is greater than a preset maximum number of reflections; merging the ray paths of all target rays reaching the receiver's receiving range, and generating multipath channel parameters based on the state information of the target rays contained in the ray paths.

[0014] According to another aspect of the embodiments of this application, a ray tracing device is also provided, comprising: a construction module, configured to construct an initial K-tree corresponding to a geometric model of a target scene, wherein each node of the initial K-tree corresponds to an axis-aligned bounding box, the axis-aligned bounding box is associated with a list of contained triangular facets, and electromagnetic parameters are bound according to the material of the triangular facets in the triangular facet list, the triangular facet list is a set corresponding to geometric elements in the geometric model, the geometric model is used to describe the shape and position of objects in the target scene, and the K-tree is a data structure in multidimensional space used to store point data; a determination module, configured to determine the effective ray probability of the spatial region represented by the axis-aligned bounding box corresponding to each node in the initial K-tree; an optimization module, configured to optimize the initial K-tree according to the effective ray probability to obtain a target K-tree; and a tracking module, configured to traverse all target nodes in the target K-tree, detect the intersection of the ray with the axis-aligned bounding box corresponding to the target node, obtain the intersection result, stop when a leaf node is reached, and track the ray according to the intersection result, wherein the target node is any node in the target K-tree.

[0015] According to another aspect of the embodiments of this application, an electronic device is also provided, including: a memory and a processor, wherein the memory is used to store program instructions; the processor is connected to the memory and is used to execute the above-described ray tracing method.

[0016] According to another aspect of the embodiments of this application, a non-volatile storage medium is also provided, the non-volatile storage medium including a stored computer program, wherein the device containing the non-volatile storage medium executes the above-described ray tracing method by running the computer program.

[0017] According to another aspect of the embodiments of this application, a computer program product is also provided, including computer instructions that, when executed by a processor, implement the above-described ray tracing method.

[0018] In this embodiment, an initial K-tree corresponding to the geometric model of the target scene is constructed. Each node of the initial K-tree corresponds to an axis-aligned bounding box, which is associated with a list of contained triangular faces. The electromagnetic parameters are bound according to the material of the triangular faces in the list. The triangular face list is a set of geometric elements in the geometric model, which describes the shape and position of objects in the target scene. The K-tree is a data structure in multidimensional space used to store point data. The effective ray probability of the spatial region represented by the axis-aligned bounding box corresponding to each node in the initial K-tree is determined. The initial K-tree is optimized based on the effective ray probability to obtain the target K-tree. All target nodes in the target K-tree are traversed, and the intersection of the ray with the axis-aligned bounding box corresponding to the target node is detected to obtain the intersection result. The process continues until a leaf node is reached, and the ray is tracked based on the intersection result. The target node can be any node in the target K-tree. This reduces the invalid ray emission and traversal of inefficient and occluded areas in ray tracing, thereby achieving the technical effect of saving computing resources. This solves the technical problem that traditional ray tracing algorithms have a large number of invalid redundant rays, leading to a waste of computing resources. Attached Figure Description

[0019] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0020] Figure 1 This is a hardware structure block diagram of a computer terminal for implementing a ray tracing method according to an embodiment of this application;

[0021] Figure 2 This is a flowchart of a ray tracing method according to an embodiment of this application;

[0022] Figure 3 This is a flowchart of a ray tracing system module according to an embodiment of this application;

[0023] Figure 4 This is a structural diagram of a ray tracking device according to an embodiment of this application. Detailed Implementation

[0024] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0025] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0026] In related technologies, to accelerate ray traversal, the Surface Area Heuristic (SAH) algorithm is introduced. By constructing a KD-tree, it optimizes the efficiency of geometric intersection detection, reduces computational complexity, and significantly improves the efficiency of static scene simulation. However, SAH's static segmentation strategy only assigns weights based on geometric surface area, ignoring physical characteristics such as material reflectivity (e.g., different materials like metal, walls, and glass) and geometric visibility (e.g., occlusion relationships). For example, highly reflective glass and ordinary walls are assigned the same weight, resulting in insufficient segmentation of highly reflective or directly visible areas and redundant computation in inefficient areas. Furthermore, when moving objects or transceiver positions change, SAH needs to globally reconstruct the KD-tree, resulting in a high time cost and failing to meet the dynamic scene requirements of fields such as vehicle networking and autonomous driving.

[0027] To address the problems existing in related technologies, this application provides a ray tracing method that can be run on... Figure 1 The computer terminal shown is explained below.

[0028] The ray tracing method embodiments provided in this application can be executed on mobile terminals, computer terminals, or similar computing devices. Figure 1 A hardware block diagram of a computer terminal for implementing a ray tracing method is shown. Figure 1As shown, the computer terminal 10 may include one or more processors (shown as 102a, 102b, ..., 102n in the figure) (the processor may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 104 for storing data, and a transmission module 106 for communication functions connected via wired and / or wireless networks. In addition, it may also include: a display, a keyboard, a cursor control device, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, and a BUS bus. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0029] It should be noted that the aforementioned one or more processors and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be implemented wholly or partially as software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be wholly or partially integrated into any other element in the computer terminal 10. As involved in the embodiments of this application, the data processing circuits serve as processor control (e.g., selection of a variable resistor termination path connected to an interface).

[0030] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the ray tracing method in this embodiment. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby implementing the ray tracing method described above. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0031] The transmission module 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the computer terminal 10. In one example, the transmission module 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission module 106 may be a Radio Frequency (RF) module, used for wireless communication with the Internet.

[0032] The display may be, for example, a touchscreen liquid crystal display (LCD) that allows the user to interact with the user interface of the computer terminal 10.

[0033] It should be noted here that, in some optional embodiments, the above... Figure 1 The computer terminal shown may include hardware elements (including circuitry), software elements (including computer code stored on a computer-readable medium), or a combination of both hardware and software elements. It should be noted that... Figure 1 This is only one instance of a specific particular instance, and is intended to illustrate the types of components that may exist in the aforementioned computer terminal.

[0034] In the above operating environment, this application provides an embodiment of a ray tracing method. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Also, although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than that shown here.

[0035] Figure 2 This is a flowchart of a ray tracing method according to an embodiment of this application, such as... Figure 2 As shown, the method includes the following steps:

[0036] Step S202: Construct an initial K-tree corresponding to the geometric model of the target scene. Each node of the initial K-tree corresponds to an axis-aligned bounding box. The axis-aligned bounding box is associated with a list of contained triangular faces. The corresponding electromagnetic parameters are bound according to the material of the triangular faces in the list of triangular faces. The list of triangular faces is a set of geometric elements in the geometric model. The geometric model is used to describe the shape and position of objects in the target scene. The K-tree is a data structure used to store point data in multidimensional space.

[0037] In step S202 above, when constructing the initial K-tree (or initial KD tree), the geometric model of the target scene is imported. The geometric model consists of a series of triangular facets, used to accurately describe the shape and position of objects in the target scene. The target scene can be, for example, a vehicle networking scene or an autonomous driving scene. The K-tree structure organizes each triangular facet and its position information in the geometric model to improve the efficiency of subsequent ray traversal. Each node of the initial K-tree is associated with an axis-aligned bounding box (AABB). The bounding box contains the boundary information of the scene region represented by the node and stores a list of all triangular facets in that region, facilitating the rapid detection of ray intersections with potential objects. For each triangular facet within the bounding box, specific electromagnetic parameters, such as reflectivity and refractive index, are bound according to its material (e.g., metal, glass, concrete).

[0038] Step S204: Determine the effective ray probability of the spatial region represented by the axis-aligned bounding box corresponding to each node in the initial K-dimensional tree.

[0039] In step S204 above, the effective ray probability of the spatial region represented by the axis-aligned bounding box corresponding to each node in the initial K-dimensional tree can be determined by the geometric visibility probability of the spatial region and the average reflectivity of the region.

[0040] Step S206: Optimize the initial K-dimensional tree based on the effective ray probability to obtain the target K-dimensional tree.

[0041] In step S206 above, the segmentation strategy of the initial K-dimensional tree is optimized based on the calculated effective ray probability. High-probability regions (e.g., regions where the effective ray probability is greater than a preset threshold) require finer segmentation, thereby adjusting the structure of the initial K-dimensional tree to obtain the target K-dimensional tree.

[0042] Step S208: Traverse all target nodes in the target K-dimensional tree, detect the intersection of the ray with the axis-aligned bounding box corresponding to the target node, obtain the intersection result, stop when the leaf node is reached, and trace the ray according to the intersection result, where the target node is any node in the target K-dimensional tree.

[0043] In step S208 above, the optimized target K-dimensional tree (i.e., the target KD tree) is traversed, and the intersection of rays with the axis-aligned bounding boxes corresponding to each target node is detected. High-probability regions are processed first during traversal, and low-probability regions (e.g., regions where the effective ray probability is less than the probability threshold) are skipped through a dynamic pruning strategy to reduce unnecessary ray detection. When an intersection between a ray and the bounding box corresponding to a target node is detected, the ray is further tracked, and the ray is tracked based on the intersection result, such as updating the ray's direction, energy, and time delay.

[0044] Through steps S202 to S208, the goal of reducing invalid ray emission and traversal of inefficient and occluded regions in ray tracing is achieved, thereby saving computational resources. This solves the technical problem of a large number of invalid redundant rays in traditional ray tracing algorithms, which leads to wasted computational resources. The following is an explanation.

[0045] In step S202 of the above ray tracing method, constructing an initial K-dimensional tree corresponding to the geometric model of the target scene includes: determining the root node of the initial K-dimensional tree, wherein the root node contains the target axis-aligned bounding box corresponding to the target scene; on the root node, selecting a segmentation axis according to the spatial dimension of the target scene, and dividing the space contained in the root node into two subspaces along the midpoint of the segmentation axis, wherein each subspace corresponds to a node in the initial K-dimensional tree; for each subspace, repeating the steps of selecting the segmentation axis and segmenting the space until the termination condition is met, thereby obtaining the initial K-dimensional tree, wherein the node corresponding to the space obtained after the last execution of segmenting the space is the initial leaf node.

[0046] In some embodiments of this application, the initial K-dimensional tree forms a hierarchical tree structure by recursively segmenting the geometric scene space of the target scene. The construction process is as follows:

[0047] 1. Calculate the minimum bounding volume of the entire target scene, i.e., the target axis-aligned bounding box (or simply the target bounding box). The axis alignment of the bounding box means that its boundary is parallel to the coordinate axes. The AABB contained in the root node is the bounding volume of all objects in the target scene, i.e., the maximum boundary of the scene space, represented by the target axis-aligned bounding box.

[0048] 2. At the root node, a dividing axis is selected based on the spatial dimensions of the target scene. In some embodiments of this application, the dividing axis is selected among the three dimensions of x, y, and z. After selecting the dividing axis, the entire space contained in the root node is uniformly divided into two subspaces according to the midpoint of the dividing axis (such as the midpoint of the axis corresponding to the target axis-aligned bounding box). That is, in the direction of this axis, the coordinate values ​​of all objects are compared with the coordinate values ​​of the midpoint to determine which subspace the object belongs to.

[0049] 3. For each segmented subspace, create a new node and associate the segmented subspace information with that node. Repeat the steps of selecting the segmentation axis and segmenting the space for each subspace until a termination condition is met, resulting in an initial K-tree. The termination condition includes two aspects: first, the number of objects contained in the subspace is less than or equal to a preset number; second, the depth of the K-tree is greater than or equal to a depth threshold. When either termination condition is met, the node corresponding to that subspace becomes a leaf node, and no further segmentation is performed. This initial K-tree is a hierarchical structure, where the root node is at the top level, containing the entire target scene space, while the leaf nodes are at the bottom level, each representing a specific, smaller spatial region within the scene.

[0050] In step S204 of the above ray tracing method, determining the effective ray probability of the spatial region represented by the axis-aligned bounding box corresponding to each node in the initial K-dimensional tree includes: determining the geometric visibility probability and the average reflectivity of the region corresponding to each node in the initial K-dimensional tree, wherein the geometric visibility probability is used to represent the probability that light will directly hit the spatial region represented by the axis-aligned bounding box corresponding to the node in the K-dimensional tree, and the average reflectivity of the region is used to evaluate the ability of the spatial region to reflect rays; and determining the effective ray probability of the spatial region based on the geometric visibility probability and the average reflectivity of the region.

[0051] In the above steps, determining the geometric visibility probability corresponding to each node in the initial K-dimensional tree includes: acquiring the detection area, wherein the detection area is the spatial region represented by any node in the initial K-dimensional tree; determining the cosine of the angle between the center point of the detection area and the transceiver's line of sight; projecting a ray into the detection area to determine the occlusion status of the detection area; if the occlusion status indicates that the detection area is occluded, determining the geometric visibility probability of the node corresponding to the detection area in the initial K-dimensional tree to be 0; if the occlusion status indicates that the detection area is not occluded, determining the geometric visibility probability of the node corresponding to the detection area in the initial K-dimensional tree to be the cosine of the line of sight.

[0052] In some embodiments of this application, the geometric visibility probability corresponding to each node in the initial K-dimensional tree can be represented by V(R). For each detection area, the cosine of the angle between its center point and the line of sight of the transceiver is calculated as cosθ. By projecting a small number of rays into the detection area, it is determined whether the detection area is occluded, and the occlusion status is obtained. If the occlusion status indicates that the detection area is occluded, then V(R) = 0. If the occlusion status indicates that the detection area is not occluded, then V(R) = cosθ.

[0053] In the above steps, determining the average reflectance of the region corresponding to each node in the initial K-dimensional tree includes: obtaining the axis-aligned bounding box corresponding to each node in the initial K-dimensional tree, and traversing all the triangular faces within the axis-aligned bounding box; determining the area and reflectance of each triangular face, and determining a weighted average based on the area and reflectance of all triangular faces to obtain the average reflectance of the region.

[0054] In some embodiments of this application, the formula for the average reflectance of the region corresponding to each node in the initial K-dimensional tree is as follows:

[0055]

[0056] Where R(R) represents the average reflectance of the region corresponding to each node in the initial K-dimensional tree, Area i R represents the area of ​​each triangle within the axis-aligned bounding box corresponding to each node, N represents the number of triangles within the axis-aligned bounding box corresponding to each node, and R represents the area of ​​each triangle within the axis-aligned bounding box corresponding to each node. i This represents the reflectivity of each triangular facet within the axis-aligned bounding box corresponding to each node.

[0057] In the above steps, determining the effective ray probability of a spatial region based on the geometric visibility probability and the regional average reflectivity includes: determining the first weight corresponding to the geometric visibility probability and the second weight corresponding to the regional average reflectivity; and determining the effective ray probability based on the first weight, the geometric visibility probability, the second weight, and the regional average reflectivity.

[0058] In some embodiments of this application, the formula for calculating the effective ray probability is as follows:

[0059] P(R)=α·V(R)+β·R(R), (α+β=1)

[0060] Where P(R) represents the effective ray probability of the spatial region corresponding to each node in the initial K-dimensional tree, α represents the first weight, and β represents the second weight. In an optional embodiment, the values ​​of the first weight and the second weight can be: α = 0.7, β = 0.3, and the first weight and the second weight can be dynamically adjusted.

[0061] In step S206 of the above ray tracing method, the initial K-dimensional tree is optimized based on the effective ray probability to obtain the target K-dimensional tree. This includes: identifying regions with effective ray probabilities greater than a preset threshold as high-probability regions, and generating candidate segmentation points in the high-probability regions along the segmentation axis; determining the cost function based on the first effective ray probability of the left child node of each candidate segmentation point and the second effective ray probability of the right child node of each candidate segmentation point; determining the segmentation axis and candidate segmentation point with the minimum cost function as the target segmentation axis and target segmentation point, and recursively repeating the steps of generating candidate segmentation points, determining the cost function, and determining the target segmentation axis and target segmentation point for the left and right child nodes of the target segmentation point until the preset conditions are met, thus obtaining the target K-dimensional tree.

[0062] In some embodiments of this application, the initial K-dimensional tree is adjusted based on the effective ray probability to optimize the granularity of high-probability regions, ensuring denser and more accurate ray tracing in these regions. The specific process is as follows:

[0063] 1. Determine the effective ray probability of the spatial region represented by each node in the initial K-dimensional tree. Regions with an effective ray probability greater than a preset threshold are identified as high-probability regions. High-probability regions indicate that the ray is more likely to generate an effective path (such as reaching the receiver) in that region.

[0064] 2. In high-probability regions, a series of candidate segmentation points are generated along the segmentation axes (x / y / z axes). The number and location of candidate segmentation points can be adjusted according to specific implementation details. More candidate segmentation points result in finer segmentation, but also increase computational cost. In high-probability regions, densely generating candidate segmentation points can better capture the potential effective paths of rays.

[0065] 3. For each candidate split point, calculate the effective ray probabilities of its left and right child nodes (the two new regions after splitting), which are represented as the first effective ray probability and the second effective ray probability, respectively. Based on the first effective ray probability and the second effective ray probability, the cost function can be determined. The cost function is used to quantify the merits of each splitting scheme.

[0066] 4. By comparing the cost functions of all candidate segmentation points, the segmentation axis and segmentation point with the lowest cost are selected as the target segmentation axis and target segmentation point, thereby most effectively preserving and increasing the possibility of effective rays.

[0067] 5. After determining the target segmentation point, segment the point and recursively repeat the steps of generating candidate segmentation points, calculating the cost function, and selecting a segmentation scheme for the left and right child nodes generated by the segmentation until the preset conditions are met, thus obtaining the target K-dimensional tree. The preset conditions may be, for example, that the effective ray probability P(R) corresponding to a certain node is less than ε, or that the number of objects in the spatial region represented by a certain node is less than or equal to a certain preset value, such as the number of objects ≤ 5.

[0068] In some embodiments of this application, when the target scene changes, the affected nodes in the target K-dimensional tree are located, the effective ray probability of the affected nodes is recalculated, and the subtree is locally reconstructed.

[0069] Through the above steps, the target KD tree optimizes the spatial partitioning, with high-probability regions being partitioned more finely, increasing the efficiency and accuracy of ray traversal; while low-probability regions retain the original coarser partitioning, reducing the calculation of invalid rays and saving computational resources.

[0070] In the above steps, the cost function is determined as follows: The first surface area of ​​the axis-aligned bounding box corresponding to the left child node of each candidate segmentation point, the second surface area of ​​the axis-aligned bounding box corresponding to the right child node of each candidate segmentation point, and the third surface area of ​​the axis-aligned bounding box corresponding to each candidate segmentation point are obtained; the first number of geometric elements contained in the left child node of each candidate segmentation point and the second number of geometric elements contained in the right child node of each candidate segmentation point are obtained; based on the first surface area, second surface area, third surface area, first number, second number, first effective ray probability, and second effective ray probability, the cost function corresponding to each candidate segmentation point is determined.

[0071] In some embodiments of this application, the formula corresponding to the cost function is as follows:

[0072]

[0073] Where Cost represents the cost function, A L Let A represent the first surface area. R Let A represent the second surface area. P N represents the third surface area. L N represents the first quantity. R P represents the second quantity. L P represents the probability of the first effective ray. R This represents the probability of the second effective ray.

[0074] Before generating and traversing the target K-dimensional tree, rays need to be generated based on the characteristics of the target scene, and the emission direction and energy distribution of the generated rays need to be determined. The emission direction of the rays can be determined based on the effective ray probability. The ray density is doubled in high-probability regions (such as P(R) > 0.7). Each emitted ray carries the initial power P0, path delay t = 0, number of reflections n = 0, and path history.

[0075] In step S208 of the above ray tracing method, ray tracing based on intersection results includes: pruning the subtree corresponding to the target node when the effective ray probability corresponding to the target node is less than a probability threshold, or when the intersection result indicates that the ray does not intersect with the axis-aligned bounding box corresponding to the target node; determining the ray's state information when the intersection result indicates that the ray intersects with the axis-aligned bounding box corresponding to the target node, wherein the state information includes at least one of the following: energy, path delay, number of reflections, and ray power; stopping ray tracing when the ray reaches the receiver's receiving range and the ray's state information satisfies that the ray power is less than a power threshold, or the number of reflections is greater than a preset maximum number of reflections; merging the ray paths of all target rays reaching the receiver's receiving range, and generating multipath channel parameters based on the state information of the target rays contained in the ray paths.

[0076] In some embodiments of this application, traversing the target K-dimensional tree includes the following steps:

[0077] a) Root node access: Starting from the root node of the target K-dimensional tree, detect the intersection of the ray with the axis-aligned bounding box corresponding to the target node;

[0078] b) Sort by the effective ray probability of child nodes in descending order (e.g., left child node P) L =0.8, right child node P R =0.3, visit the left child node first;

[0079] c) Dynamic pruning condition: If the effective ray probability P(R) of the current target node is less than ε or the ray does not intersect with the axis-aligned bounding box corresponding to the current target node, then the subtree corresponding to the current target node is pruned, or the subtree corresponding to the current target node is skipped.

[0080] d) Recursive traversal: Repeat steps b) to c) above for unpruned child nodes until a leaf node is reached.

[0081] Perform ray-triangle intersection tests on all objects within the leaf nodes, and record the nearest intersection point, intersection normal, and material properties.

[0082] The reflection direction is calculated using the following formula: r = i - 2(i·n)n, where i represents the incident direction, n represents the normal vector, and r represents the reflection direction.

[0083] The transmission direction is calculated using the following formula (Snell's Law): Where η represents the refractive index, η i η represents the incident refractive index. t θ represents the refractive index of the transmission medium. i θ represents the angle of incidence. t Indicates the transmission angle.

[0084] The reflection and transmission directions can be used to determine the reflection path and transmission path, as well as the power of the ray after reflection or transmission attenuation and the path delay.

[0085] Tracing of a ray is achieved by determining its state information, which includes at least one of the following: energy, path delay, number of reflections, and ray power. It should be noted that energy and ray power decrease with each reflection and transmission; path delay is cumulatively updated based on the physical distance the ray travels and the properties of the medium; and the number of reflections increases with the number of times the ray reflects within the target scene.

[0086] When the X-ray reaches the receiver's receiving range, the system checks whether the X-ray's status information meets the conditions for stopping calculation or tracking. This includes whether the X-ray power is less than a preset power threshold (e.g., X-ray power P < P0). min ), or whether the number of reflections of the ray is greater than the preset maximum number of reflections (e.g., reflection number n > n). max If any condition is met, ray tracking will terminate, and no further path calculations will be performed. When the ray reaches the receiver, the received power contribution is calculated using the following formula:

[0087]

[0088] Among them, P R G represents the received power contribution, where P represents the radiation power and G represents the received power contribution. Rx λ represents the gain of the receiver antenna, d represents the straight-line distance of the ray from the source to the receiver, and λ represents the parameter.

[0089] The ray paths of all target rays arriving within the receiver's receiving range are merged, and multipath channel parameters are generated based on the state information of the target rays contained in the ray paths. These multipath channel parameters may include: total received power, delay spread, angular spectrum, etc.

[0090] The following section uses indoor 5G communication multipath channel simulation as an example to illustrate the implementation steps of the above ray tracing method:

[0091] 1. Scene Modeling and Region Division: Import the 3D model of the target scene, analyze the structural parameters of the target scene such as metal doors and windows, glass partitions, and concrete walls, construct the initial KD tree using traditional SAH segmentation, and terminate the tree when the number of objects in the leaf node is ≤5 or the depth is ≥20, and bind the material reflectivity.

[0092] 2. Calculation of effective ray probability in the region:

[0093] 1) Calculate the average reflectance of each region within the area represented by each node in the initial KD tree, weighted by material (reflectance) and area.

[0094] 2) Calculation of geometric visibility probability: Calculate the cosine of the line of sight from the transceiver (such as the base station) to the center of the detection area, cosθ. Use fast ray projection to detect occlusion. If there is occlusion, V(R) = 0. If there is no occlusion, V(R) = cosθ.

[0095] 3) Probability fusion: P(R)=α·V(R)+β·R(R), the default values ​​can be set to α=0.7, β=0.3, and the probability of all regions is calculated and then normalized.

[0096] 3. Improve SAH's KD-tree optimization:

[0097] For nodes with an effective ray probability greater than a preset threshold (e.g., 0.7), the number of candidate segmentation points is increased from 20 to 30. The improved SAH cost (Cost) of each candidate segmentation is calculated. The segmentation axis and position (i.e., candidate segmentation point) that minimizes the cost are selected. The above steps are repeated for the left and right child nodes until the effective ray probability is less than the threshold or the number of objects contained in the child node is ≤5.

[0098] 4. Ray tracking and dynamic pruning:

[0099] 1) Effective ray probability drives ray generation: The emitted ray density is adjusted according to the effective ray probability of the region. For example, the ray density is 100 rays / 3 radian in a high-probability region (effective ray probability > 0.7) and 25 rays / 3 radian in a low-probability region (effective ray probability ≤ 0.3).

[0100] 2) Perform KD-tree traversal on each ray, prioritize visiting child nodes in high-probability regions and add them to the priority queue, dynamically prune child nodes in low-probability regions, detect the precise intersection of the ray with the object in the child node, handle reflection and transmission paths, and calculate the direction and attenuation of the new ray according to the laws of reflection and refraction.

[0101] 3) The calculation of a ray is terminated when the ray reaches the receiver range, the power attenuation reaches the threshold (i.e. the ray power is less than the power threshold), or the maximum number of reflections is reached. If the ray reaches the receiver, the received power contribution is calculated, the ray is added to the effective ray set, all ray paths that reach the receiver range are merged, and the total received power, delay spread, and other multipath channel parameters are calculated.

[0102] Compared with the traditional SAH scheme, the ray tracing method of this application has the following advantages: The traditional SAH scheme relies on geometric distribution (number of objects and bounding box area) for spatial division, resulting in insufficient segmentation of high-reflectivity or direct-view areas, while low-probability areas (such as occlusion blind spots) are redundantly subdivided. This application embodiment uses probability-weighted SAH to embed the effective ray probability of a region (integrating geometric visibility and reflectivity) into the segmentation decision, enabling fine segmentation of high-probability areas and improving computational efficiency. During ray tracing, low-probability subtrees (such as areas with an effective ray probability below a threshold) are dynamically skipped based on the effective ray probability of a node, reducing invalid ray tracing. Compared with machine learning prediction schemes, machine learning requires a large amount of training data to predict ray paths, resulting in high computational costs and poor adaptability to dynamic scenes. This application embodiment generates effective ray probabilities based on a physical model (not data-driven), eliminating training overhead, and uses an incremental update mechanism to locally adjust the KD-tree structure, which can cope with real-time scene changes.

[0103] Figure 3 This is a flowchart of a ray tracing system module according to an embodiment of this application, such as... Figure 3 As shown, the system consists of four parts: a scene modeling and pre-computation module, a probability generation module, a KD-tree optimization module for improved SAH, and a ray tracing module. The steps involved in each module are explained below:

[0104] The scene modeling and pre-computation module includes:

[0105] 1. Import scene geometry model: Input the 3D model of the target scene (such as triangular mesh or voxel representation), transmitter and receiver positions, material library, etc. into the simulation system;

[0106] 2. Generate basic KD tree: By extracting model features from the geometric model, the initial KD tree is constructed using the traditional SAH algorithm as the starting point for ray traversal. Each node represents a spatial region, represented by an AABB (axis-aligned bounding box), and stores a list of geometric elements (such as triangular facets) within that region.

[0107] 3. Bind electromagnetic parameters: Associate the material properties (reflectivity, transmittance, etc.) of the triangular facets with the nodes in the initial KD tree according to the material library.

[0108] The probability generation module includes: analyzing the geometric visibility of each spatial region (direction cosine method), calculating the cosine of the angle between the line of sight and the transceiver's line of sight using a ray projection method, and analyzing whether it is obstructed by other objects, thereby determining the region's visibility probability (i.e., geometric visibility probability). Based on the region's average reflectivity and visibility probability, the effective ray probability of the region is determined.

[0109] The improved SAH KD tree optimization module includes: adaptively generating candidate split points based on the effective ray probability, and recursively constructing the KD tree based on the improved SAH algorithm and cost calculation to obtain the target KD tree.

[0110] The ray tracing module includes: generating rays based on the probability distribution of the scene and initializing the ray's state information, including direction, energy, path delay, and number of reflections. During KD-tree traversal and dynamic pruning, the ray traverses from the root node of the target KD-tree, checks intersections with nodes, prioritizes visiting high-probability child nodes, and performs dynamic pruning based on the node's effective ray probability threshold to reduce invalid traversals. Through intersection testing and path generation, effective path electromagnetic calculations are achieved. For example, when a ray reaches the receiver's range and its state information meets the requirements, the electromagnetic characteristics of the ray, such as received power and delay, are calculated. Finally, all effective path information is merged to generate multipath channel parameters.

[0111] Figure 4 This is a structural diagram of a ray tracking device according to an embodiment of this application, such as... Figure 4 As shown, the device includes:

[0112] Module 40 is used to construct an initial K-tree corresponding to the geometric model of the target scene. Each node of the initial K-tree corresponds to an axis-aligned bounding box. The axis-aligned bounding box is associated with a list of contained triangular faces. The electromagnetic parameters are bound according to the material of the triangular faces in the list. The list of triangular faces is a set of geometric elements in the geometric model. The geometric model is used to describe the shape and position of objects in the target scene. The K-tree is a data structure used to store point data in multidimensional space.

[0113] Module 42 is used to determine the effective ray probability of the spatial region represented by the axis-aligned bounding box corresponding to each node in the initial K-dimensional tree;

[0114] Optimization module 44 is used to optimize the initial K-dimensional tree based on the effective ray probability to obtain the target K-dimensional tree;

[0115] The tracking module 46 is used to traverse all target nodes in the target K-dimensional tree, detect the intersection of the ray with the axis-aligned bounding box corresponding to the target node, obtain the intersection result, and stop when the leaf node is reached. The ray is tracked based on the intersection result, where the target node is any node in the target K-dimensional tree.

[0116] By using the construction module, determination module, optimization module, and tracking module in the above-mentioned ray tracing device, the purpose of reducing the invalid ray emission and traversal of inefficient and occluded areas in ray tracing is achieved, thereby realizing the technical effect of saving computing resources. This solves the technical problem that traditional ray tracing algorithms have a large number of invalid redundant rays, which leads to the waste of computing resources.

[0117] It should be noted that, Figure 4 The ray tracking device shown is used to perform Figure 2 The ray tracing method shown above is also applicable to this ray tracing device, and will not be repeated here.

[0118] This application embodiment also provides an electronic device, which includes a memory and a processor. The memory is used to store program instructions; the processor is connected to the memory and is used to execute program instructions that perform the following functions: constructing an initial K-tree corresponding to the geometric model of a target scene, wherein each node of the initial K-tree corresponds to an axis-aligned bounding box, the axis-aligned bounding box is associated with a list of contained triangular faces, and the corresponding electromagnetic parameters are bound according to the material of the triangular faces in the list of triangular faces. The list of triangular faces is a set corresponding to the geometric elements in the geometric model, the geometric model is used to describe the shape and position of objects in the target scene, and the K-tree is a data structure used to store point data in a multidimensional space; determining the effective ray probability of the spatial region represented by the axis-aligned bounding box corresponding to each node in the initial K-tree; optimizing the initial K-tree according to the effective ray probability to obtain a target K-tree; traversing all target nodes in the target K-tree, detecting the intersection of rays with the axis-aligned bounding boxes corresponding to the target nodes, obtaining the intersection result, stopping when a leaf node is reached, and tracking rays according to the intersection result, wherein the target node is any node in the target K-tree.

[0119] It should be noted that the aforementioned electronic equipment is used to perform Figure 2 The ray tracing method shown above is also applicable to this electronic device, and will not be repeated here.

[0120] This application embodiment also provides a non-volatile storage medium, which includes a stored computer program. The device containing the non-volatile storage medium executes the following ray tracing method by running the computer program: constructing an initial K-tree corresponding to the geometric model of the target scene, wherein each node of the initial K-tree corresponds to an axis-aligned bounding box, the axis-aligned bounding box is associated with a list of contained triangular faces, and electromagnetic parameters are bound according to the material of the triangular faces in the triangular face list. The triangular face list is a set corresponding to geometric elements in the geometric model, the geometric model is used to describe the shape and position of objects in the target scene, and the K-tree is a data structure used to store point data in multidimensional space; determining the effective ray probability of the spatial region represented by the axis-aligned bounding box corresponding to each node in the initial K-tree; optimizing the initial K-tree based on the effective ray probability to obtain a target K-tree; traversing all target nodes in the target K-tree, detecting the intersection of the ray with the axis-aligned bounding box corresponding to the target node, obtaining the intersection result, stopping when a leaf node is reached, and tracing the ray based on the intersection result, wherein the target node is any node in the target K-tree.

[0121] It should be noted that the aforementioned non-volatile storage media is used for execution. Figure 2 The ray tracing method shown above is also applicable to this non-volatile storage medium, and will not be repeated here.

[0122] This application also provides a computer program product, including computer instructions that, when executed by a processor, implement the steps of the ray tracing method in various embodiments of this application.

[0123] This application also provides a computer program that, when executed by a processor, implements the steps of the ray tracing method in various embodiments of this application.

[0124] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0125] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0126] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.

[0127] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0128] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0129] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.

[0130] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A ray tracing method, characterized by, The method comprises the following steps: constructing an initial K-dimensional tree corresponding to a geometric model of a target scene, wherein each node of the initial K-dimensional tree corresponds to an axis-aligned bounding box, the axis-aligned bounding box is associated with a list of triangular patches contained therein, and the axis-aligned bounding box is associated with an electromagnetic parameter corresponding to a material binding of a triangular patch in the list of triangular patches, the list of triangular patches is a set corresponding to a geometric element in the geometric model, the geometric model is used to describe the shape and position of an object in the target scene, and the K-dimensional tree is a data structure used to store point data in a multidimensional space; determining an effective ray probability of a space region represented by an axis-aligned bounding box corresponding to each node in the initial K-dimensional tree; optimizing the initial K-dimensional tree according to the effective ray probability to obtain a target K-dimensional tree; traversing all target nodes in the target K-dimensional tree, detecting intersection of a ray and an axis-aligned bounding box corresponding to the target node to obtain an intersection result, stopping when a leaf node is reached, and tracking the ray according to the intersection result, wherein the target node is any node in the target K-dimensional tree.

2. The method of claim 1, wherein, The method of constructing an initial K-dimensional tree corresponding to a geometric model of a target scene comprises the following steps: determining a root node of the initial K-dimensional tree, wherein the root node contains a target axis-aligned bounding box corresponding to the target scene; on the root node, selecting a split axis according to the spatial dimension of the target scene, and splitting the space contained in the root node into two subspaces along the midpoint of the split axis, wherein each subspace corresponds to a node in the initial K-dimensional tree; for each subspace, repeatedly performing the steps of selecting a split axis and splitting a space until a termination condition is met, and obtaining the initial K-dimensional tree, wherein the node corresponding to the space obtained after the last execution of the splitting space is an initial leaf node.

3. The method of claim 1, wherein, The method of determining an effective ray probability of a space region represented by an axis-aligned bounding box corresponding to each node in the initial K-dimensional tree comprises the following steps: determining a geometric visibility probability and a region average reflectivity corresponding to each node in the initial K-dimensional tree, wherein the geometric visibility probability is used to represent the possibility that a light ray directly shoots at a space region represented by an axis-aligned bounding box corresponding to a node in the K-dimensional tree, and the region average reflectivity is used to evaluate the ability of the space region to reflect a ray; determining the effective ray probability of the space region according to the geometric visibility probability and the region average reflectivity.

4. The method of claim 3, wherein, The method of determining a geometric visibility probability corresponding to each node in the initial K-dimensional tree comprises the following steps: obtaining a detection region, wherein the detection region is a space region represented by any node in the initial K-dimensional tree; determining a line-of-sight direction cosine from a center point of the detection region to a transceiver; projecting a ray to the detection region to determine an occlusion condition of the detection region; in a case where the occlusion condition indicates that the detection region is occluded, determining that the geometric visibility probability of the node corresponding to the detection region in the initial K-dimensional tree is 0; In a case that the occlusion indication indicates that the detection region is not occluded, the geometric visibility probability of a node corresponding to the detection region in the initial K-dimensional tree is determined as the line-of-sight direction angle cosine.

5. The method of claim 3, wherein, The average reflectivity of a region corresponding to each node in the initial K-dimensional tree is determined, including: An axis-aligned bounding box corresponding to each node in the initial K-dimensional tree is obtained, and all triangular facets in the axis-aligned bounding box are traversed; The area and reflectivity of each triangular facet are determined, and a weighted average value is determined according to the area and reflectivity of all triangular facets to obtain the average reflectivity of the region.

6. The method of claim 3, wherein, The effective ray probability of the spatial region is determined according to the geometric visibility probability and the average reflectivity of the region, including: A first weight corresponding to the geometric visibility probability and a second weight corresponding to the average reflectivity of the region are determined; The effective ray probability is determined according to the first weight, the geometric visibility probability, the second weight and the average reflectivity of the region.

7. The method of claim 1, wherein, The initial K-dimensional tree is optimized according to the effective ray probability to obtain a target K-dimensional tree, including: Regions with the effective ray probability greater than a preset threshold are determined as high-probability regions, and candidate split points in the high-probability regions are generated along a split axis; A cost function is determined according to a first effective ray probability of a left child node of each candidate split point and a second effective ray probability of a right child node of each candidate split point; The split axis and the candidate split point with the minimum cost function are determined as a target split axis and a target split point, and the steps of generating candidate split points, determining a cost function and determining a target split axis and a target split point are recursively repeated for the left child node and the right child node of the target split point until a preset condition is met to stop, so as to obtain the target K-dimensional tree.

8. The method of claim 7, wherein, The cost function is determined by: A first surface area of an axis-aligned bounding box corresponding to the left child node of each candidate split point, a second surface area of an axis-aligned bounding box corresponding to the right child node of each candidate split point, and a third surface area of an axis-aligned bounding box corresponding to each candidate split point are obtained; A first number of geometric elements contained in the left child node of each candidate split point and a second number of geometric elements contained in the right child node of each candidate split point are obtained; A cost function corresponding to each candidate split point is determined according to the first surface area, the second surface area, the third surface area, the first number, the second number, the first effective ray probability and the second effective ray probability.

9. The method of claim 1, wherein, The ray is tracked according to the intersection result, including: In a case that the effective ray probability corresponding to the target node is less than a probability threshold or the intersection result indicates that the ray does not intersect with the axis-aligned bounding box corresponding to the target node, a sub-tree corresponding to the target node is pruned; In a case that the intersection result indicates that the ray intersects with the axis-aligned bounding box corresponding to the target node, state information of the ray is determined, wherein the state information includes at least one of the following: energy, path delay, number of reflections, and ray power. When the ray reaches the receiving range of the receiver and the state information of the ray satisfies that the ray power is less than a power threshold or the reflection times is greater than a preset maximum reflection times, the ray is stopped from being tracked; All ray paths of the target rays reaching the receiving range of the receiver are merged, and a multipath channel parameter is generated according to the state information of the target rays contained in the ray paths.

10. A ray tracing device, characterized by The method comprises the steps of: constructing an initial K-dimensional tree corresponding to a geometric model of a target scene, wherein each node of the initial K-dimensional tree corresponds to an axis-aligned bounding box, the axis-aligned bounding box is associated with a list of triangular patches contained therein, and the axis-aligned bounding box is associated with an electromagnetic parameter corresponding to the material binding of the triangular patches in the list of triangular patches, the list of triangular patches is a set corresponding to a geometric element in the geometric model, the geometric model is used to describe the shape and position of an object in the target scene, and the K-dimensional tree is a data structure used to store point data in a multidimensional space; determining the effective ray probability of a space region represented by the axis-aligned bounding box corresponding to each node in the initial K-dimensional tree; optimizing the initial K-dimensional tree according to the effective ray probability to obtain a target K-dimensional tree; traversing all target nodes in the target K-dimensional tree, detecting the intersection of a ray and an axis-aligned bounding box corresponding to the target node to obtain an intersection result, stopping when a leaf node is reached, and tracking the ray according to the intersection result, wherein the target node is any node in the target K-dimensional tree.

11. An electronic device, comprising: The method comprises the steps of: a memory and a processor, wherein the memory is used to store program instructions; the processor is connected with the memory and is used to execute the ray tracking method of any one of claims 1 to 9.

12. A non-volatile storage medium, comprising: The non-volatile storage medium comprises a stored computer program, wherein the device in which the non-volatile storage medium is located executes the ray tracking method of any one of claims 1 to 9 by running the computer program.

13. A computer program product comprising computer instructions, characterized in that, The computer instructions are executed by the processor to implement the ray tracking method of any one of claims 1 to 9.