Illumination probe laying method, device and equipment and storage medium
By determining and eliminating invalid illumination probes using bounding volume hierarchies and GPU acceleration, the method addresses the issue of probes inside target objects, improving rendering efficiency and effectiveness.
Patent Information
- Application Number
- CN202310792751.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-30
- Publication Date
- 2024-12-31
AI Technical Summary
The placement of illumination probes by gridding the three-dimensional space often results in probes appearing inside target objects, leading to invalid lighting information and increased computational load.
A method to determine the positional relationship between the bounding boxes of target objects and lighting probes, eliminating invalid probes within or intersecting with the target objects by using bounding volume hierarchies (BVH) structures and GPU hardware acceleration.
Improves the effectiveness and efficiency of probe deployment by reducing the number of invalid probes, thereby enhancing rendering performance and reducing computational overhead.
Smart Images

Figure CN119228976A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image rendering technology, and in particular to a method, device, equipment and storage medium for placing illumination probes. Background Art
[0002] In order to improve the realism of the rendered image, it is necessary to perform global illumination calculation on the target objects in the virtual scene. Light probes are one of the methods to achieve global illumination calculation. The reasonable placement of light probes will affect the rendering effect and rendering performance.
[0003] In the related art, probes are placed by gridding the three-dimensional space. This method of placing probes may cause some probes to appear inside the target object. The lighting information calculated based on such probes is invalid and the amount of probe placement tasks increases, thereby reducing the effectiveness of the placed probes. Summary of the invention
[0004] In view of this, the embodiments of the present application provide a method, device, equipment and storage medium for deploying illumination probes, aiming to solve the technical problem of low effectiveness of deployed probes in the related art.
[0005] The present application provides a method for deploying illumination probes, the method comprising:
[0006] Determine the structure of the target object in the virtual scene, and determine the structure of the lighting probe currently deployed in the virtual scene;
[0007] The positional relationship between the bounding box in the leaf node of the target object's structure and the bounding box in the corresponding leaf node of the lighting probe's structure is detected, and based on the detection results, invalid lighting probes in the virtual scene are eliminated to retain valid probes, wherein the invalid probes include probes within the target object and / or probes intersecting with the target object.
[0008] In a possible implementation of the present application, if the structure is a BVH (Bounding Volume Hierarchies) structure;
[0009] The step of detecting the positional relationship between the bounding box in the leaf node of the structure of the target object and the bounding box in the corresponding leaf node of the structure of the illumination probe, and removing invalid illumination probes in the virtual scene according to the detection result to retain valid probes, includes:
[0010] The bounding box in the leaf node of the BVH structure of the target object and the bounding box in the corresponding leaf node of the BVH structure of the lighting probe are checked for intersection, and the bounding box of the lighting probe in the virtual scene that does not intersect with the bounding box corresponding to the target object is determined, and the lighting probe corresponding to the non-intersecting bounding box is retained as a valid probe.
[0011] In a possible implementation of the present application, the manner in which the bounding box of the target object intersects with the bounding box of the corresponding light probe includes:
[0012] Determine the distance between the center position of the bounding box of the target object and the bounding box of the corresponding light probe, and determine the half-side length of the bounding box of the target object and the half-side length of the bounding box of the light probe. If the distance is less than the sum of the two half-side lengths, then determine that the bounding box of the target object intersects the bounding box of the corresponding light probe, where the half-side length is half of the distance between the two points corresponding to the maximum and minimum of the bounding box; or:
[0013] If the coordinate value of the minimum point in the corresponding bounding box of the target object is less than or equal to the coordinate value of the maximum point in the corresponding bounding box of the illumination probe and is greater than or equal to the coordinate value of its corresponding minimum point, or if the coordinate value of the maximum point in the corresponding bounding box of the target object is greater than or equal to the coordinate value of the minimum point in the corresponding bounding box of the illumination probe and is less than or equal to the coordinate value of its corresponding maximum point, then it is determined that the bounding box of the target object and the bounding box of the corresponding illumination probe intersect, wherein the coordinate value includes abscissa value, ordinate value or ordinate value.
[0014] In a possible implementation of the present application, after the step of determining the bounding box of the lighting probe in the virtual scene that does not intersect with the bounding box corresponding to the target object, the method further includes:
[0015] From the bounding boxes of the lighting probes that intersect with the bounding box corresponding to the target object, a bounding box that does not intersect with the target object is determined, and the corresponding lighting probe is retained as a valid probe.
[0016] In a possible implementation of the present application, the step of determining, from the bounding boxes of the illumination probes that intersect with the bounding box corresponding to the target object, the bounding boxes that do not intersect with the target object, and retaining the corresponding illumination probes as valid probes, includes:
[0017] Determine the vertex closest to the corresponding probe from the corresponding vertices of the bounding box of the target object;
[0018] Determine m points from the vertex closest to the corresponding probe and the triangular face determined by the target object, wherein the m points are points inside the triangular face or on the triangular edge corresponding to the triangular face, and the m points are the points with the shortest distance from the center point of the corresponding probe among the points of the triangular face, and the normal of the triangular face is N;
[0019] If the center point of the light probe is point p, a directed line PM is determined based on points p and m, and the direction is from p to m;
[0020] If the angle between the directed line PM and the normal line N is an obtuse angle, and the distance between point p and point m is greater than the radius of the corresponding probe, it is determined that the corresponding probe does not intersect the target object and is retained as a valid probe.
[0021] In a possible implementation of the present application, if the angle between the directed line PM and the normal line N is an obtuse angle, and the distance between point p and point m is greater than a preset distance, it is determined that the corresponding probe does not intersect with the target object, wherein the preset distance is greater than the radius of the corresponding probe.
[0022] In a possible implementation of the present application, invalid lighting probes in a virtual scene are determined through GPU hardware parallel computing acceleration, and the invalid lighting probes are eliminated.
[0023] The present application also provides a lighting probe deployment device, the device comprising:
[0024] A determination module, used to determine the structure of the target object in the virtual scene and the structure of the lighting probe currently deployed in the virtual scene;
[0025] A culling module is used to detect the positional relationship between the bounding box in the leaf node of the target object's structure and the bounding box in the corresponding leaf node of the lighting probe's structure, and based on the detection results, to cull invalid lighting probes in the virtual scene to retain valid probes, wherein the invalid probes include probes within the target object and / or probes intersecting with the target object.
[0026] The present application also provides a lighting probe deployment device, which is a physical node device. The lighting probe deployment device includes: a memory, a processor, and a program of the lighting probe deployment method stored in the memory and executable on the processor. When the program of the lighting probe deployment method is executed by the processor, the steps of the lighting probe deployment method as described above can be implemented.
[0027] In order to achieve the above-mentioned purpose, a storage medium is further provided, on which a lighting probe deployment program is stored. When the lighting probe deployment program is executed by a processor, the steps of any of the above-mentioned lighting probe deployment methods are implemented.
[0028] The present application provides a method, apparatus, device and storage medium for placing lighting probes. Compared with the method of placing probes in related arts which results in low effectiveness of the placed probes, in the present application, the structure of a target object in a virtual scene is determined, and the structure of the lighting probes currently placed in the virtual scene is determined; the positional relationship between the bounding box in the leaf node of the structure of the target object and the bounding box in the corresponding leaf node of the structure of the lighting probe is detected, and based on the detection result, invalid lighting probes in the virtual scene are eliminated to retain valid probes, wherein the invalid probes include probes within the target object and / or probes intersecting with the target object. It can be understood that in the present application, the probes in the target object and / or the probes intersecting with the target object in the virtual scene are eliminated through the bounding box in the leaf node corresponding to the structure of the target object in the virtual scene and the bounding box in the leaf node corresponding to the structure of the lighting probe. Therefore, the probes that may affect the acquisition of the final lighting information and increase the amount of invalid lighting information calculation are eliminated, thereby improving the effectiveness of the deployed probes. Furthermore, in the present application, invalid probes can also be eliminated through the corresponding structure of the target object in the virtual scene. Therefore, the deployment efficiency of the probes is further improved, the probe deployment time and task amount are reduced, and the effectiveness of the deployed probes is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 This is a schematic diagram of the flow chart of the first embodiment of the illumination probe deployment method of the present application;
[0030] Figure 2 This is a detailed flow chart of step S20 in the first embodiment of the illumination probe placement method of the present application;
[0031] Figure 3 A schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present application;
[0032] Figure 4 A schematic diagram of the effect without global illumination involved in the illumination probe placement method of the present application;
[0033] Figure 5 A schematic diagram of the effect of global illumination involved in the illumination probe deployment method of the present application;
[0034] Figure 6 A schematic diagram of visualization of the illumination probe involved in the illumination probe deployment method of the present application;
[0035] Figure 7 A schematic diagram of an AABB box corresponding to the BVH structure involved in the illumination probe placement method of the present application;
[0036] Figure 8 The BVH structure of the 2D object involved in the illumination probe placement method of this application;
[0037] Fig. 9 The BVH establishment process of the 3D target object involved in the illumination probe placement method of this application;
[0038] Fig.10 A schematic diagram of whether the probe involved in the illumination probe placement method of the present application and the target object intersect;
[0039] Fig.11 This is a schematic diagram of the scene involved in the illumination probe deployment method of the present application. DETAILED DESCRIPTION
[0040] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0041] The present application embodiment provides a method for placing an illumination probe. In one embodiment of the illumination probe placement method of the present application, the illumination probe placement device is applied. Figure 1 , the method comprising:
[0042] Step S10, determining the structure of the target object in the virtual scene, and determining the structure of the lighting probe currently deployed in the virtual scene;
[0043] Step S20, detect the positional relationship between the bounding box in the leaf node of the target object's structure and the bounding box in the corresponding leaf node of the lighting probe's structure, and based on the detection results, eliminate invalid lighting probes in the virtual scene to retain valid probes, wherein the invalid probes include probes within the target object and / or probes intersecting with the target object.
[0044] In this embodiment, it should be noted that:
[0045] Global illumination: refers to the indirect lighting in 3D scene rendering;
[0046] Light Probe: A global illumination rendering technology that corresponds to a virtual point or sphere in a three-dimensional scene, carrying the lighting information of this spatial area.
[0047] As an example, in order to improve the realism of the rendered image, it is necessary to perform global illumination calculation on the target objects in the virtual scene, and light probes are one of the methods to achieve global illumination calculation. Among them, the reasonable layout of light probes will affect the rendering effect and rendering performance. Figure 4 , Figure 5 as well as Figure 6 It shows the effect comparison with and without global illumination and the visualization of light probes. Figure 4The effect without global illumination is shown. In the picture, there is only directional light (sun) in the environment. Under normal circumstances, the directional light shines into the box, and other places in the box that are not directly illuminated should also be illuminated by reflected light, such as Figure 5 As shown, Figure 5 There is a global illumination effect, and Figure 6 This is a diagram of a light probe visualization.
[0048] The background involved in this embodiment is:
[0049] In the related art, probes are placed by gridding the three-dimensional space. This method of placing probes may cause some probes to appear inside the target object, and the lighting information calculated based on such probes is invalid (i.e., the lighting information calculated based on such probes may affect the final calculation effect and also increase the amount of invalid calculations).
[0050] The purpose of this embodiment is to improve the effectiveness of the deployed probes, and because the present application eliminates invalid probes (with an automated feature), time is saved and the performance of the overall deployed probes is further improved.
[0051] In the present application, the probes in the target object and / or the probes intersecting with the target object in the virtual scene are eliminated through the bounding box in the leaf node corresponding to the structure corresponding to the target object in the virtual scene, and the bounding box in the leaf node corresponding to the structure of the illumination probe. Thus, the probes that may affect the acquisition of the final illumination information and increase the amount of invalid illumination information calculation are eliminated, thereby improving the effectiveness of the deployed probes. Furthermore, in the present application, invalid probes can also be eliminated through the structure corresponding to the target object in the virtual scene. Thus, the efficiency of probe deployment is further improved, the amount and time of probe deployment tasks are reduced, and the effectiveness of the deployed probes is improved.
[0052] In the present application, the positional relationship between the bounding box in the leaf node of the BVH structure of the target object and the bounding box in the corresponding leaf node of the BVH structure of the lighting probe is detected to accurately determine whether the lighting probe is valid or invalid.
[0053] In the present application, a variety of methods are used to determine the bounding boxes of lighting probes in the virtual scene that do not intersect with the bounding box corresponding to the target object, and the lighting probes corresponding to the non-intersecting bounding boxes are retained as valid probes (probes that increase the amount of invalid lighting information calculation are eliminated to improve the effectiveness of the deployed probes).
[0054] In the present application, the bounding boxes that do not intersect with the target object are determined from the bounding boxes of the illumination probes that intersect with the bounding box corresponding to the target object, and the corresponding illumination probes are retained as valid probes, so that all truly valid probes are retained.
[0055] In the present application, invalid lighting probes in a virtual scene are determined by GPU hardware instead of CPU, and the invalid lighting probes are eliminated, thereby quickly judging whether the lighting probes are inside the target object, thereby improving rendering efficiency.
[0056] The specific steps are as follows:
[0057] Step S10, determining the structure of the target object in the virtual scene, and determining the structure of the lighting probe currently deployed in the virtual scene;
[0058] As an example, a virtual scene refers to a virtual scene environment generated by a computer, which can provide a multimedia virtual world. Users can control operable target objects or virtual objects in the virtual scene through operating devices or operating interfaces, observe virtual objects such as objects, animals, and scenery in the virtual scene from the perspective of virtual objects, or interact with virtual objects such as objects, animals, and scenery in the virtual scene or other virtual objects through virtual objects.
[0059] As an example, a virtual scene is usually generated by an application in a computer device such as a terminal, and is displayed based on hardware (such as a screen) in the terminal.
[0060] As an example, the target object may be virtual objects such as objects, animals, and scenery with features in a virtual scene. Objects may be buildings and trees in a virtual scene. Animals may be pets or monsters in a virtual scene. The scenery may be a mountain with certain landforms and features in a virtual scene.
[0061] As an example, after determining the target object, determine the structure of the target object;
[0062] As an example, the structure corresponding to the target object may be a BVH (Bounding Volume Hierarchies) structure or an OBB (oriented bounding box) structure.
[0063] As an example, in this embodiment, a specific description is given by taking the case where the structure corresponding to the target object is a BVH structure.
[0064] Among them, BVH (Bounding Volume Hierarchies): is a tree data structure, also known as a BVH tree. In a 3D scene, BVH is used to manage objects in the scene. All geometric objects will be wrapped in the leaf nodes of the bounding volume. The bounding volume is wrapped in a larger bounding volume, and the final root node will wrap the entire scene recursively.
[0065] As an example, the BVH structure can be represented by AABB boxes (axis-aligned bounding boxes, a 3D AABB is a simple hexahedron with each side parallel to a coordinate plane) in different leaf nodes, such as Figure 7 As shown (the AABB space structure surrounded by the black border in the figure is the BVH structure).
[0066] That is, in this embodiment, the AABB box corresponding to the root node may be the spatial structure corresponding to all target objects (scene corresponding structure), while the spatial structure corresponding to a single target object may be the AABB box corresponding to the leaf node.
[0067] As an example, a BVH structure may be established for all target objects in a three-dimensional scene.
[0068] To better understand the BVH structure, you can first understand the BVH structure of a 2D object, such as Figure 8 shown.
[0069] from Figure 8 It can be seen that BVH is essentially a tree data structure. Each leaf node corresponds to the overall AABB box of the element contained in the node (including specific vertex information of the target object, such as vertex position, normal, etc.). The top-level root node is the AABB box of the entire scene. The overall range of the lighting probe can be determined through the AABB box of the root node. The overall range is used to determine the layout range of the probe.
[0070] Fig. 9 Shows the BVH building process for a 3D target object.
[0071] If the structure is a BVH structure;
[0072] In this embodiment, the BVH structure of the lighting probe currently deployed in the virtual scene is also determined;
[0073] As mentioned above, the layout range of the probe can be determined by the bounding box of the root node. Initially, the probes are evenly distributed within this range, and then those unreasonable probes are eliminated. In practical applications, the probe can be a sphere with a center point p and a radius r. A BVH structure can also be established for the sphere (lighting probe) (including multiple leaf nodes, and the corresponding leaf nodes include bounding boxes such as AABB boxes). For the multiple lighting probes currently deployed, there are corresponding multiple BVH structures.
[0074] Step S20, detect the positional relationship between the bounding box in the leaf node of the target object's structure and the bounding box in the corresponding leaf node of the lighting probe's structure, and based on the detection results, eliminate invalid lighting probes in the virtual scene to retain valid probes, wherein the invalid probes include probes within the target object and / or probes intersecting with the target object.
[0075] After determining the structure of (each) target object and the structure of the lighting probe, the positional relationship between the bounding box in the leaf node of the target object's structure and the bounding box in the corresponding leaf node of the lighting probe's structure is detected, and invalid lighting probes in the virtual scene are eliminated to retain valid probes, wherein the invalid probes include probes within the target object.
[0076] According to the structure of the target object and the structure of the lighting probe, invalid lighting probes in the virtual scene are eliminated to retain valid probes, wherein the invalid probes include probes that do not intersect with the target object.
[0077] According to the structure of the target object and the structure of the lighting probe, invalid lighting probes in the virtual scene are adaptively eliminated to retain valid probes, wherein the invalid probes include probes in the target object and probes that do not intersect with the target object.
[0078] In this embodiment, since the probe can be adjusted adaptively, time can be saved.
[0079] In this embodiment, since the placement positions of the probes can be adjusted adaptively, the instability caused by manual layout is avoided and the workload is saved.
[0080] In this embodiment, since invalid probes are removed, the effectiveness of the deployed probes can be improved.
[0081] In this embodiment, the positional relationship between the bounding box in the leaf node of the BVH structure of the target object and the bounding box in the corresponding leaf node of the BVH structure of the lighting probe is detected, and based on the detection result of the positional relationship, the lighting probe in the virtual scene is adjusted to retain the valid probe.
[0082] The bounding box in the leaf node of the BVH structure of the target object and the bounding box in the corresponding leaf node of the BVH structure of the light probe are checked for intersection (the position relationship is intersection), and the intersection detection result (such as Fig.10 As shown in the figure), adjust the lighting probes in the virtual scene to retain valid probes.
[0083] It should be noted that when detecting the positional relationship, a check is performed to see whether the bounding box in the leaf node of the BVH structure of the target object and the bounding box in the corresponding leaf node of the BVH structure of the lighting probe at its corresponding position rather than other positions intersect.
[0084] Among them, the detection result of the positional relationship can be that the bounding box of the target object (the bounding box in the leaf node of the BVH structure of the target object) and the bounding box of the corresponding lighting probe (the bounding box in the corresponding leaf node of the BVH structure of the lighting probe) intersect or do not intersect.
[0085] If the structure is a BVH structure;
[0086] The step of detecting the positional relationship between the bounding box in the leaf node of the structure of the target object and the bounding box in the corresponding leaf node of the structure of the illumination probe, and removing invalid illumination probes in the virtual scene according to the detection result to retain valid probes, includes:
[0087] Step S21, detect whether the bounding box in the leaf node of the BVH structure of the target object and the bounding box in the corresponding leaf node of the BVH structure of the lighting probe intersect, determine the bounding box of the lighting probe in the virtual scene that does not intersect with the bounding box corresponding to the target object, and retain the lighting probe corresponding to the non-intersecting bounding box as a valid probe.
[0088] It should be noted that the ultimate goal of positional relationship detection is to remove probes inside or on the target object and retain probes that do not intersect with the target object.
[0089] The manner in which the bounding box of the target object intersects with the bounding box of the corresponding light probe includes:
[0090] Determine the distance between the center position of the bounding box of the target object and the bounding box of the corresponding light probe, and determine the half-side length of the bounding box of the target object and the half-side length of the bounding box of the light probe. If the distance is less than the sum of the two half-side lengths, then determine that the bounding box of the target object and the bounding box of the corresponding light probe intersect, where the half-side length is half of the distance between the two points corresponding to the maximum and minimum of the bounding box;
[0091] Specifically, when the distance between the central positions of two AABB bounding boxes a and b is less than the sum of their two half-sizes (the half side lengths of the bounding box of the target object and the bounding box of the light probe), they intersect. Here, the half side length is half of the distance between the two points corresponding to the maximum and minimum values of the bounding box.
[0092] Or:
[0093] If the coordinate value of the minimum value point in the corresponding bounding box of the target object is less than or equal to the coordinate value of the maximum value point in the corresponding bounding box of the light probe and greater than or equal to its corresponding minimum value point, or if the coordinate value of the maximum value point in the corresponding bounding box of the target object is greater than or equal to the coordinate value of the minimum value point in the corresponding bounding box of the light probe and less than or equal to its corresponding maximum value point, then it is determined that the bounding box of the target object and the corresponding bounding box of the light probe intersect. Here, the coordinate values include the abscissa value, the ordinate value, or the vertical coordinate value.
[0094] Specifically, the coordinate values include the abscissa value, the ordinate value, or the vertical coordinate value. That is, if the minimum value point or the maximum value point in the corresponding bounding box of the target object uses the abscissa for comparison, then the bounding box of the corresponding light probe also uses the abscissa for comparison.
[0095] In this embodiment, the AABB box can be determined by the minimum value point and the maximum value point. Here, the coordinate of the maximum value point can be represented by max, or the coordinate of the minimum value point is represented by min.
[0096] As Fig.11 shown, Bmax (the maximum value point in the corresponding bounding box of the target object) is included within Amin (the minimum value point in the corresponding bounding box of the light probe) and Amax (the maximum value point in the corresponding bounding box of the light probe) of A. Similarly, in the same way, another case is that Amax (the maximum value point in the corresponding bounding box of the light probe) is included between Bmin (the minimum value point in the corresponding bounding box of the target object) and Bmax (the maximum value point in the corresponding bounding box of the target object).
[0097] It can be understood that x, y, and z correspond to the three coordinate values. For point A (in the corresponding bounding box of the light probe) and point B (in the corresponding bounding box of the target object),
[0098] If Amax.x < Bmin.x or Amin.x > Bmax.x, then they do not intersect;
[0099] If Amax.y < Bmin.y or Amin.y > Bmax.y, then they do not intersect;
[0100] If Amax.z < Bmin.z or Amin.z > Bmax.z, then they do not intersect.
[0101] Among them, if Amax.x is the horizontal coordinate of the maximum point in the bounding box corresponding to the light probe, Amax.y is the vertical coordinate of the maximum point in the bounding box corresponding to the light probe, and Amax.x is the vertical coordinate of the maximum point in the bounding box corresponding to the light probe, then Bmax.x is the horizontal coordinate of the maximum point in the bounding box corresponding to the target object, Bmax.y is the vertical coordinate of the maximum point in the bounding box corresponding to the target object, and Bmax.x is the vertical coordinate of the maximum point in the bounding box corresponding to the target object.
[0102] In this embodiment, since whether two AABB boxes intersect is accurately determined, a basis is provided for accurately removing invalid probes.
[0103] The present application provides a method, apparatus, device and storage medium for placing lighting probes. Compared with the method of placing probes in related arts which results in low effectiveness of the placed probes, in the present application, the structure of a target object in a virtual scene is determined, and the structure of the lighting probes currently placed in the virtual scene is determined; the positional relationship between the bounding box in the leaf node of the structure of the target object and the bounding box in the corresponding leaf node of the structure of the lighting probe is detected, and based on the detection result, invalid lighting probes in the virtual scene are eliminated to retain valid probes, wherein the invalid probes include probes within the target object and / or probes intersecting with the target object. It can be understood that in the present application, the probes in the target object and / or the probes intersecting with the target object in the virtual scene are eliminated through the bounding box in the leaf node corresponding to the structure of the target object in the virtual scene and the bounding box in the leaf node corresponding to the structure of the lighting probe. Therefore, the probes that may affect the acquisition of the final lighting information and increase the amount of invalid lighting information calculation are eliminated, thereby improving the effectiveness of the deployed probes. Furthermore, in the present application, invalid probes can also be eliminated through the corresponding structure of the target object in the virtual scene. Therefore, the deployment efficiency of the probes is further improved, the probe deployment time and task amount are reduced, and the effectiveness of the deployed probes is improved.
[0104] Further, based on the first embodiment of the present application, another embodiment of the present application is provided. In this embodiment, after the step of determining the bounding box of the lighting probe in the virtual scene that does not intersect with the bounding box corresponding to the target object, the following steps are included:
[0105] Step S22: determine, from the bounding boxes of the illumination probes that intersect with the bounding box corresponding to the target object, the bounding boxes that do not intersect with the target object, and retain the corresponding illumination probes as valid probes.
[0106] After the positional relationship detection (intersection detection) of the target object's bounding box and the lighting probe's bounding box is performed, the positional relationship detection (intersection detection) is then judged based on the bounding boxes of the target object and the lighting probe. The ultimate goal is to eliminate the probes inside or on the target object and retain the probes that do not intersect with the target object.
[0107] That is, a bounding box that does not intersect with the target object is determined from the bounding boxes of the lighting probes that intersect with the bounding box corresponding to the target object, and the corresponding lighting probes are retained as valid probes.
[0108] It can be understood that it is still necessary to distinguish whether the probe intersects with the target object or does not actually intersect with the target object, but the probe falls within (is included in) the bounding box (AABB box) corresponding to the target object.
[0109] Among them, refer to Figure 2 The step of determining, from the bounding boxes of the illumination probes that intersect with the bounding box corresponding to the target object, the bounding boxes that do not intersect with the target object, and retaining the corresponding illumination probes as valid probes, comprises:
[0110] Step S221, determining the vertex closest to the corresponding probe from the corresponding vertices of the bounding box of the target object;
[0111] Step S222, determining m points from the vertex closest to the corresponding probe and the triangular face determined by the target object, wherein the m points are points inside the triangular face or on the triangular edge corresponding to the triangular face, and the m points are points with the shortest distance from the center point of the corresponding probe among the points of the triangular face, and the normal of the triangular face is N;
[0112] Step S223, if the center point of the illumination probe is point p, a directed line PM is determined based on point p and point m, and the direction is from point p to point m;
[0113] Step S224, if the angle between the directed line PM and the normal line N is an obtuse angle, and the distance between point p and point m is greater than the radius of the corresponding probe, it is determined that the corresponding probe does not intersect the target object and is retained as a valid probe.
[0114] Specifically, first determine the vertex closest to the center point (the center point p of the corresponding sphere) of the corresponding probe (whose bounding box intersects with the corresponding bounding box of the target object) from the corresponding vertices in the AABB box of the target object, then determine the triangular face containing this vertex from the target object, and then calculate the shortest distance d from the corresponding probe to the triangular face containing this vertex. It should be noted that this shortest distance is not the shortest distance from a point to a plane (triangular face), that is, the perpendicular point from a point to a plane in space may be outside the triangular face, so the point corresponding to the shortest distance (point m) is inside the triangle, on the corresponding edge of the triangle, or at the vertex of the triangle.
[0115] It can be understood that the point closest to the corresponding probe in the target object is point m.
[0116] It can be understood that the normal of the triangular surface is N.
[0117] Connect the probe center point p and point m, the direction is from p to m, recorded as direction PM. If the angle between PM and the normal N is an acute angle, the probe is inside the model and the probe is invalid.
[0118] If the angle between PM and the normal N is obtuse, the probe is outside the model. At this time, if the distance d between the center point p and the point m is less than the radius r, it means that the probe intersects with the model and the probe is invalid. Otherwise, the probe is valid.
[0119] If the angle between the directed line PM and the normal line N is an obtuse angle, and the distance between point p and point m is greater than a preset distance, it is determined that the corresponding probe does not intersect the target object, wherein the preset distance is greater than the radius of the corresponding probe.
[0120] It is understandable that in actual use, the probe and the target object should not be too close (mainly because the effect is not good), so the preset distance R can be 1.5r.
[0121] In the present application, the bounding boxes that do not intersect with the target object are determined from the bounding boxes of the illumination probes that intersect with the bounding box corresponding to the target object, and the corresponding illumination probes are retained as valid probes, so that all truly valid probes are retained.
[0122] Furthermore, based on the above-mentioned embodiments in the present application, another embodiment of the present application is provided. In this embodiment, invalid lighting probes in the virtual scene are determined through GPU hardware parallel computing acceleration, and the invalid lighting probes are eliminated.
[0123] In this embodiment, by using GPU hardware acceleration (parallel computing) rather than just CPU determination, it is quickly determined whether the probe is inside the target object, and invalid probes inside the target object are eliminated, thereby reducing the amount of calculation and improving rendering efficiency.
[0124] That is, in this embodiment, a corresponding hardware acceleration interface is provided, and whether the probe is inside the target object is quickly determined through the hardware acceleration interface, thereby improving the determination efficiency.
[0125] Reference Figure 3 , Figure 3 It is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present application.
[0126] like Figure 3 As shown, the illumination probe deployment device may include: a processor 1001 , a memory 1005 , and a communication bus 1002 . The communication bus 1002 is used to realize the connection and communication between the processor 1001 and the memory 1005 .
[0127] Optionally, the illumination probe deployment device may also include a user interface, a network interface, a camera, an RF (Radio Frequency) circuit, a sensor, a WiFi module, etc. The user interface may include a display screen (Display), an input submodule such as a keyboard (Keyboard), and the optional user interface may also include a standard wired interface and a wireless interface. The network interface may include a standard wired interface and a wireless interface (such as a WI-FI interface).
[0128] Those skilled in the art will understand that Figure 3 The illumination probe deployment device structure shown in the figure does not constitute a limitation of the illumination probe deployment device, and may include more or fewer components than shown in the figure, or a combination of certain components, or a different arrangement of components.
[0129] like Figure 3 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, and a light probe deployment program. The operating system is a program that manages and controls the hardware and software resources of the light probe deployment device, and supports the operation of the light probe deployment program and other software and / or programs. The network communication module is used to realize the communication between the cameras inside the memory 1005, and the communication with other hardware and software in the device.
[0130] exist Figure 3 In the illumination probe placement device shown, the processor 1001 is used to execute the illumination probe placement program stored in the memory 1005 to implement the steps of any of the illumination probe placement methods described above.
[0131] The specific implementation of the illumination probe deployment device of the present application is basically the same as the embodiments of the illumination probe deployment method described above, and will not be repeated here.
[0132] The present application also provides a lighting probe deployment device, the device comprising:
[0133] A determination module, used to determine the structure of the target object in the virtual scene and the structure of the lighting probe currently deployed in the virtual scene;
[0134] A culling module is used to detect the positional relationship between the bounding box in the leaf node of the structure of the target object and the bounding box in the corresponding leaf node of the structure of the lighting probe, and according to the detection result, to cull invalid lighting probes in the virtual scene to retain valid probes, wherein the invalid probes include probes in the target object and / or probes intersecting with the target object;
[0135] and / or if the structure is a BVH structure;
[0136] The position relationship detection unit is used to achieve:
[0137] Check whether the bounding box in the leaf node of the BVH structure of the target object and the bounding box in the corresponding leaf node of the BVH structure of the lighting probe intersect, determine the bounding box of the lighting probe in the virtual scene that does not intersect with the bounding box corresponding to the target object, and retain the lighting probe corresponding to the non-intersecting bounding box as a valid probe;
[0138] And / or the position relationship detection unit is used to implement:
[0139] Determine the distance between the center position of the bounding box of the target object and the bounding box of the corresponding light probe, and determine the half-side length of the bounding box of the target object and the half-side length of the bounding box of the light probe. If the distance is less than the sum of the two half-side lengths, then determine that the bounding box of the target object intersects the bounding box of the corresponding light probe, where the half-side length is half of the distance between the two points corresponding to the maximum and minimum of the bounding box; or:
[0140] If the coordinate value of the minimum point in the bounding box corresponding to the target object is less than or equal to the coordinate value of the maximum point in the bounding box corresponding to the illumination probe and is greater than or equal to the coordinate value of its corresponding minimum point, or if the coordinate value of the maximum point in the bounding box corresponding to the target object is greater than or equal to the coordinate value of the minimum point in the bounding box corresponding to the illumination probe and is less than or equal to the coordinate value of its corresponding maximum point, then it is determined that the bounding box of the target object intersects with the bounding box of the corresponding illumination probe, wherein the coordinate value includes abscissa value, ordinate value or ordinate value;
[0141] And / or the rejection module is used to implement:
[0142] Determine the bounding boxes that do not intersect with the target object from the bounding boxes of the lighting probes that intersect with the bounding boxes corresponding to the target object, and retain the corresponding lighting probes as valid probes;
[0143] And / or the rejection module is used to implement:
[0144] Determine the vertex closest to the corresponding probe from the corresponding vertices of the bounding box of the target object;
[0145] Determine m points from the vertex closest to the corresponding probe and the triangular face determined by the target object, wherein the m points are points inside the triangular face or on the triangular edge corresponding to the triangular face, and the m points are the points with the shortest distance from the center point of the corresponding probe among the points of the triangular face, and the normal of the triangular face is N;
[0146] If the center point of the light probe is point p, a directed line PM is determined based on points p and m, and the direction is from p to m;
[0147] If the angle between the directed line PM and the normal line N is an obtuse angle, and the distance between point p and point m is greater than the radius of the corresponding probe, it is determined that the corresponding probe does not intersect the target object and is retained as a valid probe;
[0148] and / or if the angle between the directed line PM and the normal line N is an obtuse angle, and the distance between the point p and the point m is greater than a preset distance, then determining that the corresponding probe does not intersect the target object, wherein the preset distance is greater than the radius of the corresponding probe;
[0149] And / or the culling module is used to implement: determining invalid lighting probes in the virtual scene through GPU hardware parallel computing acceleration, and culling the invalid lighting probes.
[0150] The specific implementation of the illumination probe placement device of the present application is basically the same as the embodiments of the illumination probe placement method described above, and will not be repeated here.
[0151] An embodiment of the present application provides a storage medium, and the storage medium stores one or more programs, and the one or more programs can also be executed by one or more processors to implement the steps of any of the above-mentioned illumination probe deployment methods.
[0152] The specific implementation of the storage medium of the present application is basically the same as the above-mentioned embodiments of the illumination probe deployment method, and will not be repeated here.
[0153] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned illumination probe deployment method when executed by a processor.
[0154] The specific implementation of the computer program product of the present application is basically the same as the various embodiments of the above-mentioned illumination probe deployment method, and will not be repeated here.
[0155] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0156] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0157] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus hardware platform, or by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the relevant technology, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM) and includes several instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0158] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A method for placing an illumination probe, characterized in that: The method comprises: Determine the structure of the target object in the virtual scene, and determine the structure of the lighting probe currently deployed in the virtual scene; The positional relationship between the bounding box in the leaf node of the target object's structure and the bounding box in the corresponding leaf node of the lighting probe's structure is detected, and based on the detection results, invalid lighting probes in the virtual scene are eliminated to retain valid probes, wherein the invalid probes include probes within the target object and / or probes intersecting with the target object.
2. The illumination probe deployment method according to claim 1, characterized in that: If the structure is a BVH structure; The step of detecting the positional relationship between the bounding box in the leaf node of the structure of the target object and the bounding box in the corresponding leaf node of the structure of the illumination probe, and removing invalid illumination probes in the virtual scene according to the detection result to retain valid probes, includes: The bounding box in the leaf node of the BVH structure of the target object and the bounding box in the corresponding leaf node of the BVH structure of the lighting probe are checked for intersection, and the bounding box of the lighting probe in the virtual scene that does not intersect with the bounding box corresponding to the target object is determined, and the lighting probe corresponding to the non-intersecting bounding box is retained as a valid probe.
3. The illumination probe deployment method according to claim 2, characterized in that: The target object's bounding box and the corresponding light probe's bounding box intersect in the following ways: Determine the distance between the center position of the bounding box of the target object and the bounding box of the corresponding light probe, and determine the half-side length of the bounding box of the target object and the half-side length of the bounding box of the light probe. If the distance is less than the sum of the two half-side lengths, then determine that the bounding box of the target object intersects the bounding box of the corresponding light probe, where the half-side length is half of the distance between the two points corresponding to the maximum and minimum of the bounding box; or: If the coordinate value of the minimum point in the corresponding bounding box of the target object is less than or equal to the coordinate value of the maximum point in the corresponding bounding box of the illumination probe and is greater than or equal to the coordinate value of its corresponding minimum point, or if the coordinate value of the maximum point in the corresponding bounding box of the target object is greater than or equal to the coordinate value of the minimum point in the corresponding bounding box of the illumination probe and is less than or equal to the coordinate value of its corresponding maximum point, then it is determined that the bounding box of the target object and the bounding box of the corresponding illumination probe intersect, wherein the coordinate value includes abscissa value, ordinate value or ordinate value.
4. The illumination probe deployment method according to claim 2, characterized in that: After the step of determining the bounding box of the lighting probe in the virtual scene that does not intersect with the bounding box corresponding to the target object, the method further includes: From the bounding boxes of the lighting probes that intersect with the bounding box corresponding to the target object, a bounding box that does not intersect with the target object is determined, and the corresponding lighting probe is retained as a valid probe.
5. The illumination probe deployment method according to claim 4, characterized in that: The step of determining, from the bounding boxes of the illumination probes that intersect with the bounding box corresponding to the target object, the bounding boxes that do not intersect with the target object, and retaining the corresponding illumination probes as valid probes, comprises: Determine the vertex closest to the corresponding probe from the corresponding vertices of the bounding box of the target object; Determine m points from the vertex closest to the corresponding probe and the triangular face determined by the target object, wherein the m points are points inside the triangular face or on the triangular edge corresponding to the triangular face, and the m points are the points with the shortest distance from the center point of the corresponding probe among the points of the triangular face, and the normal of the triangular face is N; If the center point of the light probe is point p, a directed line PM is determined based on points p and m, and the direction is from p to m; If the angle between the directed line PM and the normal line N is an obtuse angle, and the distance between point p and point m is greater than the radius of the corresponding probe, it is determined that the corresponding probe does not intersect the target object and is retained as a valid probe.
6. The illumination probe deployment method according to claim 5, characterized in that: If the angle between the directed line PM and the normal line N is an obtuse angle, and the distance between point p and point m is greater than a preset distance, it is determined that the corresponding probe does not intersect the target object, wherein the preset distance is greater than the radius of the corresponding probe.
7. The illumination probe deployment method according to claim 1, characterized in that: The invalid lighting probes in the virtual scene are determined and eliminated through GPU hardware parallel computing acceleration.
8. An illumination probe deployment device, characterized in that: The device comprises: A determination module, used to determine the structure of the target object in the virtual scene and the structure of the lighting probe currently deployed in the virtual scene; A culling module is used to detect the positional relationship between the bounding box in the leaf node of the structure of the target object and the bounding box in the corresponding leaf node of the structure of the lighting probe, and according to the detection result, to cull invalid lighting probes in the virtual scene to retain valid probes, wherein the invalid probes include probes in the target object and / or probes intersecting with the target object; and / or if the structure is a BVH structure; The position relationship detection unit is used to achieve: Check whether the bounding box in the leaf node of the BVH structure of the target object and the bounding box in the corresponding leaf node of the BVH structure of the lighting probe intersect, determine the bounding box of the lighting probe in the virtual scene that does not intersect with the bounding box corresponding to the target object, and retain the lighting probe corresponding to the non-intersecting bounding box as a valid probe; And / or the position relationship detection unit is used to implement: Determine the distance between the center position of the bounding box of the target object and the bounding box of the corresponding light probe, and determine the half-side length of the bounding box of the target object and the half-side length of the bounding box of the light probe. If the distance is less than the sum of the two half-side lengths, then determine that the bounding box of the target object intersects the bounding box of the corresponding light probe, where the half-side length is half of the distance between the two points corresponding to the maximum and minimum of the bounding box; or: If the coordinate value of the minimum point in the bounding box corresponding to the target object is less than or equal to the coordinate value of the maximum point in the bounding box corresponding to the illumination probe and is greater than or equal to the coordinate value of its corresponding minimum point, or if the coordinate value of the maximum point in the bounding box corresponding to the target object is greater than or equal to the coordinate value of the minimum point in the bounding box corresponding to the illumination probe and is less than or equal to the coordinate value of its corresponding maximum point, then it is determined that the bounding box of the target object intersects with the bounding box of the corresponding illumination probe, wherein the coordinate value includes abscissa value, ordinate value or ordinate value; And / or the rejection module is used to implement: Determine the bounding boxes that do not intersect with the target object from the bounding boxes of the lighting probes that intersect with the bounding boxes corresponding to the target object, and retain the corresponding lighting probes as valid probes; And / or the rejection module is used to implement: Determine the vertex closest to the corresponding probe from the corresponding vertices of the bounding box of the target object; Determine m points from the vertex closest to the corresponding probe and the triangular face determined by the target object, wherein the m points are points inside the triangular face or on the triangular edge corresponding to the triangular face, and the m points are the points with the shortest distance from the center point of the corresponding probe among the points of the triangular face, and the normal of the triangular face is N; If the center point of the light probe is point p, a directed line PM is determined based on points p and m, and the direction is from p to m; If the angle between the directed line PM and the normal line N is an obtuse angle, and the distance between point p and point m is greater than the radius of the corresponding probe, it is determined that the corresponding probe does not intersect the target object and is retained as a valid probe; and / or if the angle between the directed line PM and the normal line N is an obtuse angle, and the distance between the point p and the point m is greater than a preset distance, then determining that the corresponding probe does not intersect the target object, wherein the preset distance is greater than the radius of the corresponding probe; And / or the culling module is used to implement: determining invalid lighting probes in the virtual scene through GPU hardware parallel computing acceleration, and culling the invalid lighting probes.
9. An illumination probe deployment device, characterized in that: It comprises a memory, a processor and an illumination probe placement program stored in the memory and executable on the processor, wherein the processor implements the steps of the illumination probe placement method according to any one of claims 1 to 7 when executing the illumination probe placement program.
10. A storage medium, characterized in that: The storage medium stores an illumination probe placement program, which, when executed by a processor, implements the steps of the illumination probe placement method according to any one of claims 1 to 7.