Illumination probe configuration method and device, storage medium and electronic equipment
By obtaining the visible and invisible distances of the sampling points on the virtual mesh model, and using the clustering algorithm to reasonably configure the lighting probe, the problem of low configuration efficiency of the lighting probe is solved, and more accurate and efficient lighting simulation is achieved.
Patent Information
- Application Number
- CN202510551929.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-28
- Publication Date
- 2025-08-15
AI Technical Summary
The configuration of light probes in the prior art lacks targetedness, resulting in low configuration efficiency and cannot meet the actual lighting simulation needs.
By obtaining the visible and invisible distances between sampling points on the virtual mesh model, the clustering algorithm is used to classify the sampling points and the lighting probe is reasonably configured.
The configuration efficiency of the light probe is improved, the accuracy and efficiency of light simulation are ensured, light leakage or overexposure in light calculations is avoided, and the distribution of the light probe is optimized.
Smart Images

Figure CN120495511A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular to a configuration method, device, storage medium, and electronic device for an illumination probe. Background Art
[0002] Light Probes are points that record spatial lighting information. By sampling lighting data from them, they can approximate the lighting conditions of the surrounding area. When configuring Light Probes, it's common to evenly distribute them within the model space of a virtual grid model. This means they're evenly spaced throughout the entire simulation space according to a predetermined pattern.
[0003] However, this uniform distribution approach has significant drawbacks. It fails to fully consider relevant information about the virtual mesh model, such as its shape, structure, and lighting-sensitive areas. This lack of utilization of this information results in a lack of targeted Light Probe configuration, failing to accurately meet the needs of actual lighting simulations. This, in turn, leads to low Light Probe configuration efficiency. Consequently, this results in low Light Probe configuration efficiency.
[0004] To address the above-mentioned problems, no effective solutions have been proposed so far. Summary of the Invention
[0005] The embodiments of the present application provide a method, device, storage medium, and electronic device for configuring a light probe, so as to at least solve the technical problem of low configuration efficiency of the light probe.
[0006] According to one aspect of an embodiment of the present application, a method for configuring a light probe is provided, comprising: obtaining at least two sampling points on a virtual grid model; obtaining a first distance between mutually visible sampling points among the at least two sampling points based on position information of the sampling points on the virtual grid model; obtaining a second distance between mutually invisible sampling points among the at least two sampling points based on a feasible path of the sampling points on the virtual grid model; clustering the at least two sampling points using the first distance and the second distance to obtain a clustering result; and configuring at least one light probe associated with the virtual grid model using the clustering result to obtain a configuration result.
[0007] According to another aspect of an embodiment of the present application, a configuration device for a lighting probe is further provided, including: a first acquisition unit for acquiring at least two sampling points on a virtual grid model; a second acquisition unit for acquiring a first distance between mutually visible sampling points among the at least two sampling points based on position information of the sampling points on the virtual grid model; a third acquisition unit for acquiring a second distance between mutually invisible sampling points among the at least two sampling points based on a feasible path of the sampling points on the virtual grid model; a clustering unit for clustering the at least two sampling points using the first distance and the second distance to obtain a clustering result; and a configuration unit for configuring at least one lighting probe associated with the virtual grid model using the clustering result to obtain a configuration result.
[0008] As an optional solution, the second acquisition unit includes: a first acquisition module for acquiring a first sampling point and a second sampling point, wherein the first sampling point and the second sampling point are mutually visible sampling points among the at least two sampling points; a second acquisition module for, when the position information indicates that the first sampling point and the second sampling point are located in different grid structures in the virtual grid model, acquiring a global spatial distance between the first sampling point and the second sampling point in the virtual grid model, and determining the global spatial distance as the first distance; and a third acquisition module for, when the position information indicates that the first sampling point and the second sampling point are located in the same grid structure in the virtual grid model, acquiring a local spatial distance between the first sampling point and the second sampling point in a target grid structure, and determining the local spatial distance as the first distance, wherein the target grid structure is the grid structure in which the first sampling point and the second sampling point are located.
[0009] As an optional solution, the second acquisition module includes: a first acquisition submodule, configured to acquire a straight-line distance between the first sampling point and the second sampling point in the virtual grid model, wherein the global space distance includes the straight-line distance.
[0010] As an optional solution, the third acquisition module includes: a second acquisition submodule, used to obtain the shortest path distance between the first sampling point and the second sampling point along the surface of the target grid structure, wherein the local spatial distance includes the shortest path distance.
[0011] As an optional solution, the above-mentioned configuration unit includes: a clustering module, which is used to cluster the above-mentioned at least two sampling points into K clusters when the above-mentioned clustering result indicates that the above-mentioned at least two sampling points are clustered, where K is a natural number; a fourth acquisition module, which is used to obtain the cluster center corresponding to each cluster in the above-mentioned K clusters; an initialization module, which is used to initialize the above-mentioned cluster center as an illumination probe to obtain the above-mentioned at least one illumination probe; and a configuration module, which is used to configure the above-mentioned at least one illumination probe based on the above-mentioned at least two sampling points to obtain the above-mentioned configuration result.
[0012] As an optional solution, the at least one illumination probe includes a first probe, and the configuration module includes: a third acquisition submodule, used to obtain a third distance between the first probe and each target sampling point among the at least two sampling points; a processing submodule, used to invert the third distance and perform normalization processing to obtain a first weight of each target sampling point to the first probe; a combining submodule, used to combine the centroid coordinates of each target sampling point and the first weight to obtain a second weight of the first vertex with respect to the first probe, wherein the first vertex is the vertex associated with the first probe in the virtual grid model; and a configuration submodule, used to configure the association relationship between the first vertex and the first probe using the second weight, wherein the configuration result includes the association relationship.
[0013] As an optional solution, the clustering unit includes: a first selection module for selecting P sampling points from the at least two sampling points as initial centroids; an allocation module for allocating each of the at least two sampling points to a sampling point cluster where the nearest initial centroid is located; a second selection module for selecting, from the at least two sampling points, an actual sampling point in each of the sampling point clusters that minimizes the total distance as a new centroid, and obtaining a current clustering result, wherein the total distance is calculated using the first distance and / or the second distance; and a first determination module for determining the current clustering result as the final clustering result when the centroid no longer changes or the maximum number of iterations is reached.
[0014] As an optional solution, the third acquisition unit includes: a fifth acquisition module, configured to acquire a third sampling point and a fourth sampling point, wherein the third sampling point and the fourth sampling point are mutually invisible sampling points among the at least two sampling points; a sixth acquisition module, configured to acquire at least one feasible path from the third sampling point to the fourth sampling point on the virtual grid model; and determine, among the at least one feasible path, the feasible path with the shortest path distance as a target feasible path; and a second determination module, configured to determine the path distance of the target feasible path as the second distance.
[0015] As an optional solution, the above-mentioned device also includes: a baking unit, which is used to configure at least one lighting probe associated with the above-mentioned virtual grid model using the above-mentioned clustering result, and after obtaining the configuration result, perform lighting baking on the above-mentioned virtual grid model based on the above-mentioned configuration result to obtain a baking result; an optimization unit, which is used to configure at least one lighting probe associated with the above-mentioned virtual grid model using the above-mentioned clustering result, and after obtaining the configuration result, use the above-mentioned baking result to reversely optimize the above-mentioned configuration result to obtain a new configuration result.
[0016] According to another aspect of the present application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the electronic device to perform the above-described method for configuring an illumination probe.
[0017] According to another aspect of an embodiment of the present application, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the above-mentioned method for configuring the illumination probe through the computer program.
[0018] In an embodiment of the present application, at least two sampling points on a virtual grid model are obtained; based on position information of the sampling points on the virtual grid model, a first distance between mutually visible sampling points among the at least two sampling points is obtained; based on a feasible path of the sampling points on the virtual grid model, a second distance between mutually invisible sampling points among the at least two sampling points is obtained; the at least two sampling points are clustered using the first distance and the second distance to obtain a clustering result; and using the clustering result, at least one illumination probe associated with the virtual grid model is configured to obtain a configuration result.
[0019] Based on the positional information of the sampling points on the virtual mesh model, we can obtain the initial distance between mutually visible sampling points. Mutual visibility means that there are no obstacles between the two points, and light can propagate in a straight line. By calculating the distance between these visible points, we can understand the direct propagation path of light on the model surface and thus determine where to place Light Probes to more effectively capture direct lighting information.
[0020] Based on the feasible paths between sample points on the virtual mesh model, a second distance between mutually invisible sample points can be obtained. A feasible path is a possible detour between two points after accounting for model obstacles. Calculating these distances between invisible points can provide insights into light propagation within the model or around complex structures, thereby determining where to place Light Probes to best simulate indirect lighting effects.
[0021] Properly calculating the second distance ensures a smooth transition in probe placement in invisible areas. If the second distance between two invisible sampling points is small, indicating they are close after bypassing an obstacle, they can be merged into a single cluster and assigned a single probe to avoid sudden changes in lighting calculations.
[0022] The first and second distances are used to measure directly visible and indirectly visible areas, respectively. The accuracy of visibility differentiation has a direct impact on the rationality of light probe configuration. If invisible points are mistakenly considered visible, it may cause "light leakage" or "overexposure" in the lighting calculation; conversely, if visible points are mistakenly considered invisible, the number of probes may increase unnecessarily, reducing calculation efficiency.
[0023] Cluster at least two sampling points using the first and second distances to obtain a clustering result. The clustering algorithm divides the sampling points into different groups based on the similarity of their distances. In the light probe configuration, similar distance features may indicate that the sampling points have similar lighting conditions. For example, sampling points that are close to each other and visible to each other may be in similar lighting environments and can be grouped together; while sampling points that are far apart or invisible to each other may be in different lighting areas and should be grouped together.
[0024] Clustering spatially close and visibility-related sampling points into the same cluster can optimize probe configuration. If the sampling points at the boundary of two clusters are sparse, clustering can be used to merge them into a larger cluster to avoid "breaks" in the lighting calculation.
[0025] Using the clustering results, at least one Light Probe associated with the virtual mesh model is configured to obtain a configuration result. Based on the clustering results, Light Probes can be placed at each cluster center or at representative sampling points. This ensures a more rational distribution of Light Probes, taking into account both the direct propagation path of light on the model surface and the indirect lighting conditions of complex structures. This achieves the goal of targeted Light Probe configuration, thereby achieving the technical effect of improving Light Probe configuration efficiency and resolving the technical problem of low Light Probe configuration efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0027] Figure 1 is a schematic diagram of an application environment of an optional method for configuring illumination probes according to an embodiment of the present application;
[0028] Figure 2is a schematic diagram of a process of an optional method for configuring an illumination probe according to an embodiment of the present application;
[0029] Figure 3 is a schematic diagram of an optional method for configuring an illumination probe according to an embodiment of the present application;
[0030] Figure 4 is a schematic diagram of another optional configuration method of the illumination probe according to an embodiment of the present application;
[0031] Figure 5 is a schematic diagram of another optional configuration method of the illumination probe according to an embodiment of the present application;
[0032] Figure 6 is a schematic diagram of another optional configuration method of the illumination probe according to an embodiment of the present application;
[0033] Figure 7 is a schematic diagram of another optional configuration method of the illumination probe according to an embodiment of the present application;
[0034] Figure 8 is a schematic diagram of another optional configuration method of the illumination probe according to an embodiment of the present application;
[0035] Figure 9 is a schematic diagram of another optional configuration method of the illumination probe according to an embodiment of the present application;
[0036] Figure 10 is a schematic diagram of an optional configuration device for an illumination probe according to an embodiment of the present application;
[0037] Figure 11 It is a schematic structural diagram of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0038] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.
[0039] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in a sequence other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0040] According to one aspect of the embodiment of the present application, a method for configuring an illumination probe is provided. Optionally, as an optional implementation, the above-mentioned method for configuring an illumination probe can be applied to, but is not limited to, Figure 1 In the environment shown, the environment may include, but is not limited to, a user device 102 and a server 112 . The user device 102 may include, but is not limited to, a display 104 , a processor 106 , and a memory 108 . The server 112 includes a database 114 and a processing engine 116 .
[0041] The specific process can be as follows:
[0042] Step S102: the user device 102 obtains a configuration request for a lighting probe for a virtual grid model;
[0043] Step S104, sending the configuration request to the server 112 via the network 110;
[0044] In steps S106-S114, the server 112 responds to the configuration request and obtains, through the processing engine 116, at least two sampling points on the virtual grid model; obtains a first distance between mutually visible sampling points among the at least two sampling points based on the position information of the sampling points on the virtual grid model; obtains a second distance between mutually invisible sampling points among the at least two sampling points based on a feasible path of the sampling points on the virtual grid model; clusters the at least two sampling points based on the first distance and the second distance to obtain a clustering result; and configures at least one light probe associated with the virtual grid model using the clustering result to obtain a configuration result.
[0045] In step S116 , the configuration result is sent to the user device 102 via the network 110 . The user device 102 displays the configuration result on the display 104 via the processor 106 and stores the configuration result in the memory 108 .
[0046] remove Figure 1In addition to the examples shown, the above-mentioned user equipment can be a terminal device configured with a target client, which can include but is not limited to at least one of the following: a mobile phone (such as an Android phone, an iOS phone, etc.), a laptop, a tablet computer, a PDA, an MID (Mobile Internet Devices), a PAD, a desktop computer, a smart TV, etc. The target client can be a video client, an instant messaging client, a browser client, an education client, etc. The above-mentioned network can include but is not limited to: a wired network, a wireless network, wherein the wired network includes: a local area network, a metropolitan area network and a wide area network, and the wireless network includes: Bluetooth, WIFI and other networks that realize wireless communication. The above-mentioned server can be a single server, or it can be a server cluster composed of multiple servers, or a cloud server. The above is only an example, and no limitation is made to this in this embodiment.
[0047] As an example, terminal devices may include, but are not limited to, mobile phones, computers, intelligent voice interaction devices, smart home appliances, vehicle-mounted terminals, aircraft, etc. This embodiment can be applied to various scenarios, including but not limited to digital humans, virtual humans, games, virtual reality, and extended reality (XR).
[0048] For example, the server can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, as well as big data and artificial intelligence platforms.
[0049] Alternatively, as an optional implementation, Figure 2 As shown, the configuration method of the illumination probe can be executed by an electronic device, which can be, for example, Figure 1 The user device or server shown in the figure includes the following steps:
[0050] S202, obtaining at least two sampling points on the virtual grid model;
[0051] In an optional embodiment, the virtual grid model can be a model constructed in a computer and composed of a large number of grid units for simulating three-dimensional space structures, such as terrain and building models in a game scene.
[0052] In an optional embodiment, the sampling points may be points with specific position information selected on the virtual grid model for use in subsequent distance calculation and illumination probe configuration analysis.
[0053] Specifically, this embodiment selects at least two representative points from the virtual grid model as sampling points. This step determines the basic data for subsequent analysis.
[0054] To illustrate further, let's assume a simple virtual game scene, which is a small indoor room composed of multiple small blocks (grid units) with walls, furniture, etc. At least two sampling points are randomly selected on the virtual grid model of this room.
[0055] For example, select a sampling point A at the corner of the room, select a sampling point B on the ground in the center of the room, and select a sampling point C on the wall next to the window of the room.
[0056] S204, obtaining a first distance between mutually visible sampling points among at least two sampling points based on position information of the sampling points on the virtual grid model;
[0057] In an optional embodiment, the position information may be three-dimensional coordinate data of the sampling point in the virtual grid model, which clarifies the specific position of the sampling point in space.
[0058] In an optional embodiment, the mutually visible sampling points may be a pair of sampling points in a virtual grid model where there are no obstacles blocking the two points and light can propagate in a straight line between the two points.
[0059] In an optional embodiment, the first distance may be a straight-line distance between mutually visible sampling points, which is an indicator for measuring the length of a direct light propagation path between two points.
[0060] Specifically, this embodiment uses the location information of the sampling points to determine whether the sampling points are visible to each other. If they are visible, the straight-line distance between them is calculated to obtain the first distance. This step obtains relevant information about the direct light propagation path.
[0061] To further illustrate, for example, each sampling point in the virtual grid model has corresponding three-dimensional coordinate position information. Assume that the coordinates of sampling point A are (1, 1, 0), the coordinates of sampling point B are (5, 5, 0), and the coordinates of sampling point C are (8, 2, 2), and assume that the room height direction is the z-axis.
[0062] Determine whether there is an obstacle, such as a wall, blocking the line of sight between sampling points A and B. In this simple scenario, there are no obstacles between A and B, so they are visible to each other. Calculate the straight-line distance (first distance) between A and B based on their 3D coordinates.
[0063] Determine whether there is an obstacle between sampling point A and sampling point C. Since there is a wall blocking the distance from the corner of the room to the wall next to the window, A and C are not visible to each other, and the first distance between them is not calculated.
[0064] When judging between sampling points B and C, B and C are not visible to each other due to the wall blocking, so the first distance is not calculated.
[0065] S206, obtaining a second distance between mutually invisible sampling points among at least two sampling points based on a feasible path of the sampling points on the virtual grid model;
[0066] In an optional embodiment, the feasible path may be a possible detour path between two points taking into account obstacles in the virtual grid model.
[0067] In an optional embodiment, the mutually invisible sampling points may be a pair of sampling points in the virtual grid model where light cannot directly propagate between the two points due to obstruction by obstacles.
[0068] In an optional embodiment, the second distance may be the distance between mutually invisible sampling points along a feasible path, reflecting the path length of the light traveling around obstacles.
[0069] Specifically, this embodiment determines a feasible path based on the obstacles between the sampling points, and then calculates the distance between mutually invisible sampling points along the feasible path to obtain the second distance. This step obtains relevant information about the indirect lighting propagation path.
[0070] To further illustrate, for example, for sampling points A and C that are invisible to each other, a feasible path around a wall may be considered.
[0071] Suppose you start from A, walk along the wall to the door of the room (bypassing the wall blocking A and C), and then follow the path from the door to the window to reach C. By simulating this path in a virtual grid model, calculate the number of grid cells on the path or use a path planning algorithm (such as the A* algorithm) to calculate the path length.
[0072] Assuming that the detour path passes through 10 grid cells and each grid cell has a side length of 1 unit, the second distance between A and C is 10. For sampling points B and C that are invisible to each other, a feasible path around the wall is also planned. Assuming that the detour path passes through 15 grid cells, the second distance between B and C is 15.
[0073] S208, clustering at least two sampling points according to the first distance and the second distance to obtain a clustering result;
[0074] In an optional embodiment, the clustering result may be a result of dividing at least two sampling points into different groups according to distance similarity using a clustering algorithm.
[0075] Specifically, this embodiment uses a clustering algorithm to divide at least two sampling points into different groups based on the similarity between the first distance and the second distance to obtain a clustering result. This step classifies the sampling points and provides a basis for the subsequent configuration of light probes.
[0076] To further illustrate, the number of clusters can be set to 2. To initialize two cluster centers, two sampling points can be randomly selected as initial centers, such as A and B. The distance from each sampling point to the two cluster centers is calculated (including a comprehensive consideration of the first distance and the second distance, which can be calculated using methods such as weighted averaging).
[0077] For example, for sampling point C, calculate its distance to A and B, and assign it to the cluster with the closer cluster center according to the distance. Assuming that the distance from C to A (considering the combination of the first distance and the second distance) is closer after calculation, C is assigned to the cluster centered on A.
[0078] The cluster centers are recalculated, taking the average coordinates of all the sampling points in each cluster as the new cluster centers. This process is repeated until the cluster centers no longer change or the set number of iterations is reached. Finally, the clustering results are obtained, for example, sampling points A and C are in one cluster, and sampling point B is in another cluster.
[0079] S210 , configuring at least one lighting probe associated with the virtual grid model using the clustering result to obtain a configuration result.
[0080] In an optional embodiment, the lighting probe may be a point that records spatial lighting information, and by sampling lighting data from the point, the lighting conditions of the surrounding area can be approximately represented.
[0081] In an optional embodiment, the configuration result may be a final configuration solution obtained after reasonably distributing the illumination probes on the virtual grid model based on the clustering result.
[0082] Specifically, this embodiment sets illumination probes at each cluster center or at a representative sampling point based on the clustering results to obtain the final illumination probe configuration result. This step completes the reasonable distribution of illumination probes and improves the accuracy of illumination simulation.
[0083] To further illustrate, it is optional to set a light probe at each cluster center or a representative sampling point.
[0084] For the first cluster (including A and C), you can choose to set a light probe at point A (or point C, depending on actual needs and the influence range of the cluster center).
[0085] For the second cluster (containing B), set up a light probe at point B.
[0086] The final lighting probe configuration result is: lighting probes are set at point A (or point C) and point B respectively to more accurately capture the lighting information within their respective clusters and improve the accuracy of lighting simulation.
[0087] Optionally, this embodiment can be applied to business scenarios that require model rendering, such as games, movies, animations, and autonomous driving.
[0088] Specifically, using film and television / animation production as an example, high-density sampling points can be generated on the surface of character models (such as clothing wrinkles and faces). Visible points (such as areas of the same material) are clustered using the first distance to share lighting information. Invisible points (such as those obscured by body parts) are associated using the second distance to simulate diffuse reflections of ambient light. The clustering results are used to generate hierarchical probes to accelerate rendering. This can speed up lighting baking in animated films, improve rendering efficiency, and dynamically adjust probes around character models to enhance realism.
[0089] Taking the business scenario of autonomous driving simulation as an example, sampling points can be generated in key areas such as intersections and tunnel entrances and exits. Directly visible sampling points (such as lane markings) are used for fast ray tracing. Path planning algorithms (such as A*) are used to calculate indirect distances to occluded areas and simulate sensor detection ranges. Clustering results guide the probe density of virtual sensors in the simulator, balancing accuracy and performance. This enhances the realism of the simulation scene, reduces test bias in perception algorithms, and simulates LiDAR point cloud data for verification of perception algorithms.
[0090] It should be noted that this embodiment aims to rationally configure Light Probes on a virtual grid model through a series of steps. First, at least two sampling points are selected on the virtual grid model as the basis for subsequent analysis. Next, based on the location information of the sampling points, a first distance between mutually visible sampling points and a second distance along a feasible path between mutually invisible sampling points are calculated. The sampling points are then clustered using the first and second distances to obtain clustering results. Finally, Light Probes are configured on the virtual grid model based on the clustering results to obtain a configuration result.
[0091] By considering the visibility and distance information between sampling points, the propagation of light in the virtual grid model can be simulated more accurately, enabling the light probe to capture lighting information more effectively, thereby improving the accuracy of lighting simulation.
[0092] Cluster analysis can group sampling points with similar lighting conditions into one category, avoiding the blind distribution of lighting probes and making the configuration of lighting probes more reasonable, taking into account both the direct path of light propagation on the model surface and the indirect lighting conditions at complex structures.
[0093] Proper configuration of light probes can reduce unnecessary calculations and improve the efficiency of lighting calculations. For example, in areas with small lighting changes, the number of light probes can be reduced to avoid wasting resources; in areas with large lighting changes, the number of light probes can be increased to improve the accuracy of capturing lighting information.
[0094] Through targeted lighting probe configuration, we can better simulate the lighting effects in the real world, make the lighting in the virtual scene more natural and realistic, and enhance the user experience.
[0095] To illustrate further, the optional Figure 3 As shown, at least two sampling points 304 (e.g., sampling point 1, sampling point 2, sampling point 3, and sampling point 4) on a virtual grid model 302 are obtained; based on position information of the sampling points 304 on the virtual grid model 302, a first distance 306 between mutually visible sampling points (e.g., sampling point 1, sampling point 2, and sampling point 3 are mutually visible) among the at least two sampling points is obtained; based on a feasible path of the sampling points 304 on the virtual grid model 302, a second distance 308 between mutually invisible sampling points (e.g., sampling point 1 and sampling point 4 are mutually invisible) among the at least two sampling points is obtained; the at least two sampling points 304 are clustered using the first distance 306 and the second distance 308 to obtain a clustering result 310; and using the clustering result 310, at least one light probe 312 (e.g., light probe 1, light probe 2, light probe 3, and light probe 4) associated with the virtual grid model is configured to obtain a configuration result 314.
[0096] Optionally, the content of this embodiment is applicable to other embodiments mentioned above, or combined with other embodiments mentioned above.
[0097] Through the embodiments provided herein, based on the positional information of sampling points on a virtual grid model, a first distance between mutually visible sampling points can be obtained. Mutually visible means that there are no obstacles between the two points, and light can propagate in a straight line. By calculating the distance between these visible points, the direct propagation path of light on the model surface can be determined, thereby clarifying where to place light probes to more effectively capture direct lighting information.
[0098] Based on the feasible paths between sample points on the virtual mesh model, a second distance between mutually invisible sample points can be obtained. A feasible path is a possible detour between two points after accounting for model obstacles. Calculating these distances between invisible points can provide insights into light propagation within the model or around complex structures, thereby determining where to place Light Probes to best simulate indirect lighting effects.
[0099] Properly calculating the second distance ensures a smooth transition in probe placement in invisible areas. If the second distance between two invisible sampling points is small, indicating they are close after bypassing an obstacle, they can be merged into a single cluster and assigned a single probe to avoid sudden changes in lighting calculations.
[0100] The first and second distances are used to measure directly visible and indirectly visible areas, respectively. The accuracy of visibility differentiation has a direct impact on the rationality of light probe configuration. If invisible points are mistakenly considered visible, it may cause "light leakage" or "overexposure" in the lighting calculation; conversely, if visible points are mistakenly considered invisible, the number of probes may increase unnecessarily, reducing calculation efficiency.
[0101] Cluster at least two sampling points using the first and second distances to obtain a clustering result. The clustering algorithm divides the sampling points into different groups based on the similarity of their distances. In the light probe configuration, similar distance features may indicate that the sampling points have similar lighting conditions. For example, sampling points that are close to each other and visible to each other may be in similar lighting environments and can be grouped together; while sampling points that are far apart or invisible to each other may be in different lighting areas and should be grouped together.
[0102] Clustering spatially close and visibility-related sampling points into the same cluster can optimize probe configuration. If the sampling points at the boundary of two clusters are sparse, clustering can be used to merge them into a larger cluster to avoid "breaks" in the lighting calculation.
[0103] Using the clustering results, at least one Light Probe associated with the virtual mesh model is configured to obtain a configuration result. Based on the clustering results, Light Probes can be placed at each cluster center or at representative sampling points. This ensures a more rational distribution of Light Probes, taking into account both the direct propagation path of light on the model surface and the indirect lighting conditions of complex structures. This allows for targeted Light Probe configuration, thereby achieving the technical effect of improving Light Probe configuration efficiency.
[0104] As an optional solution, obtaining a first distance between mutually visible first sampling points among at least two sampling points based on position information of the sampling points on the virtual grid model includes:
[0105] S1-1, obtaining a first sampling point and a second sampling point, wherein the first sampling point and the second sampling point are mutually visible sampling points among at least two sampling points;
[0106] S1-2, when the position information indicates that the first sampling point and the second sampling point are located in different grid structures in the virtual grid model, obtaining a global spatial distance between the first sampling point and the second sampling point in the virtual grid model, and determining the global spatial distance as a first distance;
[0107] S1-3. When the position information indicates that the first sampling point and the second sampling point are located in the same grid structure in the virtual grid model, a local spatial distance between the first sampling point and the second sampling point on a target grid structure is obtained, and the local spatial distance is determined as a first distance, wherein the target grid structure is the grid structure in which the first sampling point and the second sampling point are located.
[0108] In an optional embodiment, the components of the grid structure virtual grid model are the basic units that constitute the model. Different grid structures have different shapes and characteristics, such as triangular grid surfaces, quadrilateral grid surfaces, hexahedral grids, etc.
[0109] To further illustrate, in a large open world game, different areas of the terrain use different grid structures, such as a quadrilateral grid surface in a plain area and a triangular grid surface in a mountainous area. When two sampling points are located on different grid structures in the plain and mountainous areas, respectively, the global spatial distance calculation takes into account the impact of the overall terrain undulation on the distance; when two sampling points are located on the same type of grid structure (such as both are triangular grid surfaces), the local spatial distance is calculated based on the length of the triangle side.
[0110] For example, in a virtual building scene, different floors and rooms may use different mesh structures, such as hexahedral meshes for floors and triangular meshes for rooms. When calculating distance, global spatial distances across floors are calculated based on the side lengths and height differences of the hexahedral meshes, while local spatial distances within the same floor are calculated based on the side lengths and angles of the triangular meshes.
[0111] In an optional embodiment, the first sampling point may be one of the at least two sampling points that are visible to each other. The second sampling point may be another sampling point of the at least two sampling points that is visible to the first sampling point.
[0112] In an optional embodiment, the global space distance may be the distance between the first sampling point and the second sampling point when they are located in different grid structures in the virtual grid model, and may be the distance across multiple grid units.
[0113] In an optional embodiment, the local spatial distance may be the distance between the first sampling point and the second sampling point when they are located in the same grid structure (target grid structure) in the virtual grid model, and is the distance within a single grid unit.
[0114] In an optional embodiment, the target grid structure may be a grid structure where the first sampling point and the second sampling point are located.
[0115] It should be noted that this embodiment aims to obtain a first distance between mutually visible first sampling points from at least two sampling points based on the position information of the sampling points on a virtual grid model. First, a first sampling point and a second sampling point that are mutually visible are determined from the at least two sampling points. Then, a determination is made based on the positional relationship between the two sampling points in the virtual grid model: if they are located in different grid structures, their global spatial distance in the virtual grid model is calculated and determined as the first distance; if they are located in the same grid structure (the target grid structure), their local spatial distance on the target grid structure is calculated and determined as the first distance. In this way, the distance between mutually visible sampling points can be accurately obtained, providing basic data for subsequent related analysis and processing.
[0116] Optionally, the content of this embodiment is applicable to other embodiments mentioned above, or combined with other embodiments mentioned above.
[0117] According to the embodiments provided herein, a first sampling point and a second sampling point are obtained, wherein the first sampling point and the second sampling point are mutually visible sampling points among at least two sampling points. When the position information indicates that the first sampling point and the second sampling point are located in different grid structures in a virtual grid model, a global spatial distance between the first sampling point and the second sampling point in the virtual grid model is obtained, and the global spatial distance is determined as a first distance. When the position information indicates that the first sampling point and the second sampling point are located in the same grid structure in the virtual grid model, a local spatial distance between the first sampling point and the second sampling point on a target grid structure is obtained, and the local spatial distance is determined as a first distance. The target grid structure is the grid structure in which the first sampling point and the second sampling point are located. By distinguishing different grid structures and adopting corresponding distance calculation methods, the actual distance between the sampling points can be more accurately reflected, and distance errors caused by differences in grid structures can be avoided, thereby achieving the technical effect of improving the configuration efficiency of light probes.
[0118] As an optional solution, obtaining the global space distance between the first sampling point and the second sampling point in the virtual grid model includes:
[0119] A straight-line distance between the first sampling point and the second sampling point in the virtual grid model is obtained, wherein the global space distance includes the straight-line distance.
[0120] In an optional embodiment, the straight-line distance may refer to the length of the shortest path connecting two points in space, that is, the distance from the starting point to the end point along a straight line, such as Euclidean distance, Manhattan distance, Chebyshev distance, etc.
[0121] It should be noted that this embodiment aims to obtain the global spatial distance between the first and second sampling points in the virtual grid model, where the global spatial distance includes the straight-line distance. First, the first and second sampling points are determined. Then, the Euclidean distance between the two points is calculated to obtain their straight-line distance in the virtual grid model. Finally, it is clarified that the straight-line distance is part of the global spatial distance. This method provides basic straight-line distance information for subsequent analysis and processing, and also lays the foundation for further consideration of other distance factors to determine the complete global spatial distance.
[0122] To further illustrate, in a virtual building model, for example, the first sampling point is located at a corner of the building's roof with coordinates (10, 20, 30); the second sampling point is located at the center of the building's ground with coordinates (5, 15, 0). The straight-line distance d is calculated using the Euclidean distance formula. This straight-line distance is a portion of the global spatial distance between the first and second sampling points in the virtual building model.
[0123] Optionally, the content of this embodiment is applicable to other embodiments mentioned above, or combined with other embodiments mentioned above.
[0124] Through the embodiments provided in the present application, the straight-line distance between the first sampling point and the second sampling point in the virtual grid model is obtained, wherein the global space distance includes the straight-line distance. By obtaining the straight-line distance as part of the global space distance, basic data can be provided for subsequent distance analysis and processing, thereby achieving the technical effect of improving the accuracy of distance calculation.
[0125] As an optional solution, obtaining the local spatial distance between the first sampling point and the second sampling point on the target grid structure includes:
[0126] The shortest path distance between the first sampling point and the second sampling point along the surface of the target grid structure is obtained, wherein the local spatial distance includes the shortest path distance.
[0127] In an optional embodiment, the shortest path distance may refer to the total cost value corresponding to the path with the minimum total cost (such as distance, time, cost, etc.) among the paths from the starting point to the end point in a network (such as a graph, grid, map, etc.). The shortest path distance may be calculated using methods such as the Dijkstra algorithm (applicable to weighted graphs without negative-weighted edges), the Floyd-Warshall algorithm (applicable to weighted graphs with arbitrary edge weights), the A* algorithm (applicable to heuristic search), etc.
[0128] It should be noted that this embodiment aims to obtain the local spatial distance between the first sampling point and the second sampling point on the target grid structure, where the local spatial distance includes the shortest path distance. First, the positions of the first sampling point and the second sampling point are determined by positioning coordinates or other means. Then, a path search algorithm is used to find the shortest path from the first sampling point to the second sampling point on the surface of the target grid structure. The lengths of the edges on the shortest path are then accumulated to obtain the shortest path distance. Finally, it is determined that the shortest path distance is part of the local spatial distance. In this way, basic local spatial distance information can be provided for subsequent related analysis and processing, and it also lays the foundation for further considering other distance factors to determine the complete local spatial distance.
[0129] To further illustrate, in a terrain grid model, the first sampling point is located at the foot of a mountain with coordinates (0, 0, 0); the second sampling point is located at the top of a mountain with coordinates (100, 100, 500). Using the Dijkstra algorithm, we find the shortest path on the terrain grid surface. Taking into account the undulations of the terrain and obstacles, the shortest path found winds up the mountainside. The lengths of the edges on the path are calculated and accumulated, resulting in a shortest path distance of 600 meters. This distance is the shortest path distance portion of the local spatial distance.
[0130] Optionally, the content of this embodiment is applicable to other embodiments mentioned above, or combined with other embodiments mentioned above.
[0131] Through the embodiments provided in the present application, the shortest path distance between the first sampling point and the second sampling point along the surface of the target grid structure is obtained, wherein the local spatial distance includes the shortest path distance. By obtaining the shortest path distance as part of the local spatial distance, more accurate distance data can be provided for subsequent distance analysis and processing, especially when the actual path of the grid structure surface needs to be considered, thereby achieving the technical effect of improving the accuracy of distance calculation.
[0132] As an optional solution, the clustering results are used to configure at least one lighting probe associated with the virtual grid model, and the configuration results are obtained, including:
[0133] S2-1, when the clustering result indicates that at least two sampling points are clustered into K clusters, where K is a natural number;
[0134] S2-2, obtain the cluster center corresponding to each cluster in the K clusters;
[0135] S2-3, initialize the cluster center as a light probe to obtain at least one light probe;
[0136] S2-4: Based on the at least two sampling points, configure at least one light probe to obtain a configuration result.
[0137] In an optional embodiment, the K clusters may be K different category sets into which the sampling points are divided by clustering results, where K is a natural number.
[0138] In an optional embodiment, the cluster center may be the center position of all sampling points in each cluster, representing the feature point of the cluster.
[0139] In an optional embodiment, the configuration result may be the final state or parameter settings obtained after configuring the Light Probe.
[0140] It should be noted that this embodiment aims to use clustering results to configure at least one Light Probe associated with a virtual grid model. First, a clustering algorithm is used to perform cluster analysis on at least two sampling points, resulting in K clusters. The cluster centers of each cluster are then calculated. These cluster centers are then initialized as Light Probes. Finally, the Light Probes are configured based on the lighting information of the sampling points to obtain the final configuration. This approach allows for the optimal configuration of Light Probes based on the distribution and lighting characteristics of the sampling points, improving the accuracy and realism of lighting simulation within the virtual grid model.
[0141] To further illustrate, for example, in a virtual indoor scene, there are multiple sampling points distributed in different rooms and corners for collecting lighting information. These sampling points are divided into 5 clusters (K=5) through the K-means clustering algorithm, and each cluster represents an area with similar lighting characteristics. The cluster center position of each cluster is calculated, and these 5 cluster centers are initialized as 5 lighting probes. Then, according to the lighting intensity and color information of the sampling point, the parameters of each lighting probe are adjusted to make the lighting effect of the indoor scene more realistic. For example, a lighting probe is initialized at the cluster center position corresponding to the cluster near the window, and its lighting intensity is set to be higher and the color is whiter to simulate the effect of natural light.
[0142] Optionally, the content of this embodiment is applicable to other embodiments mentioned above, or combined with other embodiments mentioned above.
[0143] Through the embodiments provided in the present application, the clustering results indicate that at least two sampling points are clustered into K clusters, where K is a natural number; the cluster center corresponding to each cluster in the K clusters is obtained; the cluster center is initialized as an illumination probe to obtain at least one illumination probe; based on at least two sampling points, at least one illumination probe is configured to obtain a configuration result, and the sampling points are divided into different clusters through cluster analysis, and the illumination probes are initialized according to the cluster centers, which can more accurately simulate the illumination characteristics of different areas and improve the accuracy of illumination simulation, thereby achieving the technical effect of improving the accuracy of distance calculation.
[0144] As an optional solution, at least one illumination probe includes a first probe, and the at least one illumination probe is configured based on at least two sampling points to obtain a configuration result, including:
[0145] S3-1, obtaining a third distance between the first probe and each target sampling point among the at least two sampling points;
[0146] S3-2, inverting the third distance and performing normalization processing to obtain a first weight of each target sampling point to the first probe;
[0147] S3-3, combining the centroid coordinates of each target sampling point and the first weight to obtain a second weight of the first vertex with respect to the first probe, wherein the first vertex is a vertex associated with the first probe in the virtual grid model;
[0148] S3-4: Using the second weight, configure an association relationship between the first vertex and the first probe, wherein the configuration result includes the association relationship.
[0149] In an optional embodiment, the third distance may be the distance between the first probe and each target sampling point.
[0150] In an optional embodiment, the first weight may be a weight of each target sampling point to the first probe obtained by inverting and normalizing the third distance.
[0151] In an optional embodiment, the centroid coordinates of each target sampling point may be the center coordinates of the position of each target sampling point.
[0152] In an optional embodiment, the first vertex may be a vertex associated with the first probe in the virtual mesh model.
[0153] In an optional embodiment, the second weight may be a weight with respect to the first vertex obtained by combining the barycentric coordinates of each target sampling point and the first weight.
[0154] In an optional embodiment, the association relationship may be a configuration relationship between the first vertex and the first probe.
[0155] In an optional embodiment, the configuration result may be a final result including an association relationship between the first vertex and the first probe.
[0156] It should be noted that this embodiment mainly configures the first probe in at least one illumination probe based on at least two sampling points to obtain a configuration result. First, the third distance between the first probe and each target sampling point is obtained; then the third distance is inverted and normalized to obtain a first weight; then the center of gravity coordinates of each target sampling point and the first weight are combined to obtain the second weight of the first vertex with respect to the first probe; finally, the second weight is used to configure the association relationship between the first vertex and the first probe, and this association relationship is used as part of the configuration result. In this way, the relationship between the illumination probe and the vertices of the virtual mesh model can be reasonably configured according to the distribution of the sampling points and the illumination characteristics, thereby improving the accuracy and authenticity of the illumination simulation.
[0157] To further illustrate, for example, in a virtual indoor room, there are multiple sampling points distributed in different positions of the room for collecting lighting information. There is a lighting probe (first probe) located in the center of the room. Several sampling points that are closer to the first probe are selected as target sampling points. Calculate the third distance between the first probe and these target sampling points, for example, the distances are 2 meters, 3 meters, and 4 meters respectively. These distances are inverted and normalized to obtain the first weights, such as the normalized weights are 0.5, 0.3, and 0.2 respectively. Calculate the centroid coordinates of these target sampling points, assuming them to be (x0, y0, z0). Combining the centroid coordinates and the first weight, obtain the second weight of the first vertex (such as a corner vertex in the room) with respect to the first probe. Configure the association relationship between the first vertex and the first probe according to the second weight, such as setting the intensity ratio of the first vertex receiving light from the first probe.
[0158] Optionally, the content of this embodiment is applicable to other embodiments mentioned above, or combined with other embodiments mentioned above.
[0159] Through the embodiment provided by the present application, a third distance between the first probe and each target sampling point in at least two sampling points is obtained; the third distance is inverted and normalized to obtain a first weight of each target sampling point with respect to the first probe; the centroid coordinates of each target sampling point and the first weight are combined to obtain a second weight of the first vertex with respect to the first probe, wherein the first vertex is a vertex associated with the first probe in the virtual grid model; the association relationship between the first vertex and the first probe is configured using the second weight, wherein the configuration result includes the association relationship, and the weight is calculated by comprehensively considering factors such as the distance and centroid coordinates of the target sampling point, so that the association relationship between the illumination probe and the vertex can be more accurately configured, thereby improving the accuracy of the illumination simulation and achieving the technical effect of improving the accuracy of the distance calculation.
[0160] As an optional solution, clustering is performed on at least two sampling points using the first distance and the second distance to obtain a clustering result, including:
[0161] S4-1, selecting P sampling points from at least two sampling points as initial centroids;
[0162] S4-2, assigning each of the at least two sampling points to the sampling point cluster where the nearest initial centroid is located;
[0163] S4-3, selecting, from the at least two sampling points, an actual sampling point in each sampling point cluster that minimizes the total distance as a new centroid, and obtaining a current clustering result, wherein the total distance is calculated using the first distance and / or the second distance;
[0164] S4-4, when the centroid no longer changes or the maximum number of iterations is reached, the current clustering result is determined as the final clustering result.
[0165] In an optional embodiment, the P sampling points may be the number of sampling points corresponding to an initial centroid selected from at least two sampling points.
[0166] In an optional embodiment, the initial centroids may be P sampling points randomly selected at the beginning of the clustering algorithm as the initial cluster centers.
[0167] In an optional embodiment, the sampling point cluster may be obtained by dividing at least two sampling points into different groups according to the distance between the sampling point and the centroid.
[0168] In an optional embodiment, the actual sampling point may be a specific sampling point in each sampling point cluster used to update the centroid.
[0169] In an optional embodiment, the new centroid may be a cluster center recalculated based on the distribution of actual sampling points in each sampling point cluster.
[0170] In an optional embodiment, the current clustering result may be a division of sampling points obtained according to a new centroid during each iteration.
[0171] In an optional embodiment, the total distance may be an indicator for measuring the distance between the sampling point and the centroid, and is calculated by using the first distance and / or the second distance.
[0172] In an optional embodiment, the centroid no longer changes may be that during the iteration process, the new centroid is at the same position as the centroid of the previous iteration, indicating that the clustering result has stabilized.
[0173] In an optional embodiment, the maximum number of iterations may be a maximum iteration limit set to prevent the algorithm from falling into an infinite loop.
[0174] In an optional embodiment, the final clustering result may be a stable sampling point division result obtained after multiple iterations when the centroid no longer changes or the maximum number of iterations is reached.
[0175] It should be noted that this embodiment aims to obtain reasonable clustering results by clustering at least two sampling points. First, P sampling points are randomly selected from the sampling points as the initial centroids, and then each sampling point is assigned to the cluster with the closest centroid. Next, the actual sampling point that minimizes the total distance is selected in each cluster as the new centroid, and the clustering results are updated. This process is repeated until the centroid no longer changes or the maximum number of iterations is reached, ultimately resulting in a stable clustering result. This solution can group similar sampling points into the same cluster based on the distance relationship between the sampling points, providing a foundation for subsequent data analysis and processing.
[0176] To further illustrate, for example, in each sampling point cluster, the actual sampling point that minimizes the total distance is optionally selected as the new centroid. The total distance can be calculated using the first distance and / or the second distance. For example, for each sampling point cluster, the first distance and the second distance are calculated between all sampling points in the cluster and each sampling point in the cluster. The total distance is then calculated based on certain weights (e.g., a first distance weight of 0.6 and a second distance weight of 0.4), and the actual sampling point with the minimum total distance is selected as the new centroid. Based on the new centroid, the sampling point clusters are re-divided to obtain the current clustering result.
[0177] Optionally, the content of this embodiment is applicable to other embodiments mentioned above, or combined with other embodiments mentioned above.
[0178] Through the embodiments provided in the present application, P sampling points are selected from at least two sampling points as initial centroids; each of the at least two sampling points is assigned to a sampling point cluster closest to the initial centroid; the actual sampling point in each sampling point cluster that minimizes the total distance is selected from the at least two sampling points as a new centroid, and a current clustering result is obtained, wherein the total distance is calculated using the first distance and / or the second distance; when the centroid no longer changes or the maximum number of iterations is reached, the current clustering result is determined as the final clustering result. Through a reasonable clustering algorithm, similar sampling points can be accurately divided into the same cluster, thereby improving the accuracy of data classification.
[0179] As an optional solution, based on a feasible path of the sampling points on the virtual grid model, obtaining a second distance between at least two sampling points that are invisible to each other includes:
[0180] S5-1, obtaining a third sampling point and a fourth sampling point, wherein the third sampling point and the fourth sampling point are sampling points that are invisible to each other among the at least two sampling points;
[0181] S5-2, obtaining at least one feasible path from the third sampling point to the fourth sampling point on the virtual grid model;
[0182] S5-3, determining the feasible path with the smallest path distance among at least one feasible path as the target feasible path;
[0183] S5-4, determining the path distance of the target feasible path as the second distance.
[0184] In an optional embodiment, the third sampling point may be a specific sampling point selected from at least two sampling points, used for invisibility determination and distance calculation with the fourth sampling point. The fourth sampling point may be another specific sampling point corresponding to the third sampling point, and is mutually invisible to the third sampling point.
[0185] In an optional embodiment, the at least one feasible path may be multiple feasible paths that may exist from the third sampling point to the fourth sampling point.
[0186] In an optional embodiment, the target feasible path may be a feasible path with the smallest path distance among at least one feasible path.
[0187] In an optional embodiment, the path distance may be the sum of the lengths of all grid cells on the feasible path, which is used to measure the distance between sampling points.
[0188] It should be noted that this embodiment aims to calculate the second distance between at least two mutually invisible sampling points using a virtual grid model. First, a third and fourth sampling points that are mutually invisible are selected from the sampling points. Then, a feasible path from the third to the fourth sampling point is searched in the virtual grid model. The feasible path with the smallest path distance is selected as the target feasible path. Finally, the path distance of the target feasible path is used as the second distance. This solution takes into account the invisibility between sampling points, provides a more accurate distance metric, and lays a foundation for subsequent analysis and processing.
[0189] To further illustrate, in a game map, various game areas, obstacles, and other locations can be used as sampling points. The third and fourth sampling points are game areas blocked by mountains. A game map is constructed within a virtual grid model, and a search is performed for feasible paths from the third to the fourth sampling points. There may be paths that bypass the mountains. The path with the shortest path distance is selected as the target feasible path, and the distance of this path is used as the second distance for character movement calculation and task planning in the game.
[0190] Optionally, the content of this embodiment is applicable to other embodiments mentioned above, or combined with other embodiments mentioned above.
[0191] According to the embodiments provided herein, a third sampling point and a fourth sampling point are obtained, wherein the third sampling point and the fourth sampling point are mutually invisible sampling points among at least two sampling points; at least one feasible path from the third sampling point to the fourth sampling point on a virtual grid model is obtained; a feasible path with the smallest path distance among the at least one feasible path is determined as a target feasible path; and the path distance of the target feasible path is determined as a second distance. By considering the invisibility between the sampling points and using the virtual grid model and a path search algorithm, the distance between the sampling points can be more accurately calculated.
[0192] As an optional solution, after configuring at least one Light Probe associated with the virtual grid model using the clustering result and obtaining the configuration result, the method further includes:
[0193] S6-1, based on the configuration result, performing lighting baking on the virtual mesh model to obtain a baking result;
[0194] S6-2, using the baking result, reversely optimize the configuration result to obtain a new configuration result.
[0195] In an optional embodiment, the configuration result may be a result obtained after configuring the light probes according to the clustering result, including information such as the position, quantity, and parameters of the light probes.
[0196] In an optional embodiment, lighting baking may be a process of calculating and storing lighting information in a virtual mesh model, so that the model can simulate real lighting effects when rendered.
[0197] In an optional embodiment, the baking result may be virtual mesh model data containing lighting information obtained after lighting baking, including lighting intensity, color, shadow, etc.
[0198] In an optional embodiment, reverse optimization can be a process of adjusting and improving configuration results using baking results to improve the quality and effect of lighting calculations.
[0199] In an optional embodiment, the new configuration result may be a light probe configuration result obtained after reverse optimization.
[0200] It should be noted that this embodiment is an iterative optimization process. It aims to initially configure Light Probes based on clustering results, then perform lighting baking to obtain a baked result. The baked result is then used to reverse-optimize the configured result, continuously improving the quality of lighting calculations. First, Light Probes associated with the virtual mesh model are configured based on the clustering results to obtain a configured result. Next, lighting baking is performed on the virtual mesh model based on the configured result, obtaining a baked result containing lighting information. Finally, the baked result is used to reverse-optimize the configured result to obtain a new configuration result, further improving the lighting effect.
[0201] To illustrate further, in a large-scale game scene, for example, a clustering algorithm can be used to classify objects within the scene and configure Light Probes based on the classification results. For example, buildings, vegetation, and terrain can be clustered separately, and appropriate Light Probes can be configured for each category. Light baking is then performed to achieve the scene's lighting effect. If the lighting in certain areas is found to be unnatural, such as too dark inside a building or uneven lighting transitions in vegetation, the baking results can be used to reverse-optimize the Light Probe configuration, adding or adjusting the probe positions and parameters to make the scene's lighting more realistic and aesthetically pleasing.
[0202] In addition to reverse optimization, machine learning algorithms can be introduced to train models using large amounts of baking results and configuration result data to automatically learn the relationship between light probe configuration and lighting effects, achieving more intelligent configuration optimization.
[0203] Optionally, the content of this embodiment is applicable to other embodiments mentioned above, or combined with other embodiments mentioned above.
[0204] Through the embodiments provided in the present application, based on the configuration results, the virtual grid model is subjected to lighting baking to obtain the baking results; using the baking results, the configuration results are reversely optimized to obtain new configuration results. By reversely optimizing the configuration results, the configuration of the lighting probe can be adjusted according to the actual lighting baking results, so that the lighting effect of the virtual grid model is more realistic and natural, and problems such as uneven lighting, overbrightness or overdarkness are reduced, thereby achieving the technical effect of improving the configuration accuracy of the lighting probe.
[0205] As an optional solution, and for ease of understanding, the above light probe configuration method is applied to lighting rendering scenes in 3D games. This light probe-based global illumination (GI) solution is used to improve game image quality and realism. This embodiment uses machine learning methods to reversely optimize the distribution of light probes based on the loss of light baking in complex standard scenes, which is more rigorous and reasonable.
[0206] Specifically, the process of this embodiment is as follows:
[0207] S7-1, clustering of sampling points on the triangular mesh surface: clustering the sampling points of the triangular mesh using a K-Mediods-based clustering method, and initializing the light probes with the cluster centers (Mediod);
[0208] The formula of K-Mediods clustering algorithm is as follows:
[0209]
[0210] Here, E represents the total energy or the sum of squared distances of the entire dataset, which is used to measure the quality of the clustering results. K is the number of clusters, that is, the number of clusters into which the dataset is desired to be divided. Cj represents the jth cluster, which contains all the sample points within that cluster. p is any sample point in cluster Cj. oi is the medoid (center point) of the i-th cluster, representing that cluster. dist(p, oi) represents the distance between sample point p and the center point oi of its cluster.
[0211] In an optional embodiment, the lighting probe distribution requirements are to avoid light leakage (sampling points on opposite sides are associated with different lighting probes to minimize light leakage, etc.), reasonable association (sampling points on the same side and close to each other are associated with the same lighting probe), and lighting continuity (the distance calculation formula should be continuous for the triangular mesh surface to avoid lighting discontinuity). The requirements are summarized as same-surface association (sampling points on the same surface are associated with the same probe point and the distance is short), opposite-surface association (sampling points on opposite surfaces are associated with different probe points and the distance is long), and GI continuity (ensuring the continuity of global illumination).
[0212] This embodiment proposes a sampling point pathfinding distance algorithm as the distance calculation formula of the clustering algorithm. The algorithm appropriately increases the distance of invisible sampling points while ensuring continuity. Specifically, the Euclidean distance is used between visible sampling points of different triangular mesh surfaces, the mesh surface distance (Mesh Surface Distance) is used for sampling points of the same triangular mesh surface, and the distance of invisible sampling points is calculated using the pathfinding algorithm between sampling points.
[0213] To illustrate further, the optional Figure 4 As shown in the figure, using only the Euclidean distance results in the invisible sampling points (white point and point A) being close to each other, which is prone to light leakage problems.
[0214] Optional e.g. Figure 5 As shown in Figure 2, using only the geometric surface distance between invisible sampling points will result in discontinuity between visible and invisible sampling points (point A).
[0215] Optional e.g. Figure 6As shown in Figure 3, the Euclidean distance is used between visible sampling points, and the invisible sampling points are connected through the path-finding algorithm to achieve the expected goal while ensuring smoothness.
[0216] S7-2, initialize the association between vertices and light probes: This step is the middle link of the entire process. After the light probes are obtained through clustering, the vertices of the triangle mesh are initially associated with the light probes.
[0217] To further illustrate, an optional method is to calculate the distance between the sampling point and the nearest n detection points, and then invert and normalize the distance from the sampling point to the detection point and add it to the vertex as the weight, as shown in the following formula:
[0218]
[0219] Among them, p1, p2, ..., p m are sampling points in the same triangle, is a vertex about the exploration point o i The weight of is the sampling point p to the detection point o i The weight of , bary(p) represents the coordinates of the center of gravity of the sampling point p.
[0220] In order to ensure smoothness, each vertex needs to be associated with multiple probe points with the largest weight. In practice, each vertex is associated with two probe points, such as Figure 7 Each sampling point shown is only associated with the nearest probe point, resulting in a narrow transition area and an uneven transition. Figure 8 The more probe points are associated with each sample point shown, the larger the transition area will be and the smoother the result will be.
[0221] S7-3, gradient descent optimization of the weights of vertices and light probes in the standard scene: In the standard scene, the gradient descent algorithm is used to optimize the weights of vertices and light probes, and finally the association relationship between vertices and light probes is obtained.
[0222] In an optional embodiment, step S7-2 has obtained the association between the initialized vertices and the light probes, and this association can be represented by a matrix W. It is necessary to complete the generation of this association in the model space (solving W), which will ensure that the model has good performance in various lighting scenarios. The loss function is defined as follows:
[0223]
[0224] Among them, N sce represents the number of scenes with different lighting conditions, It represents the fitting error of the GI of the i-th scene object under the current association relationship W.
[0225] Based on the lighting bake, the current loss is defined:
[0226] E loss =w‖T(Y)·B·W·SH-I‖ 2
[0227] Where w is the directional weight matrix, T(Y) is the spherical harmonic basis function after convolution (T can also be called the transfer function), B is the barycentric coordinate matrix, SH is the spherical harmonic coefficient matrix obtained after baking, and I is the actual lighting data.
[0228] Solve the gradient of the loss with respect to W:
[0229]
[0230] It can be seen from this that gradient descent can be used to optimize W.
[0231] It should be noted that simply using gradient descent cannot obtain the ideal light probe distribution result within a limited time. Therefore, the methods of steps S7-1 and S7-2 are adopted as geometric priors, and on this basis, the weights (the weights of light probes in the mesh vertices) are further optimized by gradient descent.
[0232] In order to ensure that the probes distributed in the model space can make the model instance have a good performance in any lighting environment, it is necessary to build scenes with different complex lighting, but this will consume too many resources.
[0233] Therefore, this embodiment adopts the design of standard scene and constructs a single standard scene with complex lighting conditions, such as Figure 9 As shown, by rotating the object 904 in the standard scene 902, multiple sets of lighting information 906 are obtained. This only requires building a complex standard scene, improving resource utilization. Based on the geometric prior, the final relationship between the vertex and the light probe can be quickly optimized.
[0234] Optionally, the content of this embodiment is applicable to other embodiments mentioned above, or combined with other embodiments mentioned above.
[0235] The embodiments provided herein utilize geometric priors to minimize light leaks and significantly shorten optimization time. By optimizing the distribution of light probes based on the loss of baked illumination in complex standard scenes through machine learning, we can better represent the GI information of objects. Illumination based solely on geometric information often results in smoother results.
[0236] It is understandable that in the specific implementation of this application, related data such as user information is involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.
[0237] It should be noted that for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.
[0238] According to another aspect of the embodiment of the present application, a device for configuring an illumination probe for implementing the above-mentioned configuration method of the illumination probe is also provided. Figure 10 As shown, the device includes:
[0239] A first acquiring unit 1002 is configured to acquire at least two sampling points on the virtual grid model;
[0240] A second acquiring unit 1004 is configured to acquire a first distance between mutually visible sampling points among at least two sampling points based on position information of the sampling points on the virtual grid model;
[0241] A third obtaining unit 1006 is configured to obtain a second distance between mutually invisible sampling points among at least two sampling points based on a feasible path of the sampling points on the virtual grid model;
[0242] A clustering unit 1008 is configured to cluster at least two sampling points according to the first distance and the second distance to obtain a clustering result;
[0243] The configuration unit 1010 is configured to configure at least one lighting probe associated with the virtual grid model using the clustering result to obtain a configuration result.
[0244] For a specific embodiment, reference may be made to the example shown in the above-mentioned method for configuring the illumination probe, which will not be described in detail in this example.
[0245] As an optional solution, the second obtaining unit 1004 includes:
[0246] A first acquisition module is configured to acquire a first sampling point and a second sampling point, wherein the first sampling point and the second sampling point are mutually visible sampling points among at least two sampling points;
[0247] a second acquiring module, configured to, when the position information indicates that the first sampling point and the second sampling point are located in different grid structures in the virtual grid model, acquire a global spatial distance between the first sampling point and the second sampling point in the virtual grid model, and determine the global spatial distance as a first distance;
[0248] a third acquisition module, configured to, when the position information indicates that the first sampling point and the second sampling point are located in the same grid structure in the virtual grid model, acquire a local spatial distance between the first sampling point and the second sampling point on a target grid structure, and determine the local spatial distance as a first distance, wherein the target grid structure is the grid structure in which the first sampling point and the second sampling point are located.
[0249] For a specific embodiment, reference may be made to the example shown in the above-mentioned method for configuring the illumination probe, which will not be described in detail in this example.
[0250] As an optional solution, the second acquisition module includes:
[0251] The first acquisition submodule is configured to acquire a straight-line distance between the first sampling point and the second sampling point in the virtual grid model, wherein the global space distance includes the straight-line distance.
[0252] For a specific embodiment, reference may be made to the example shown in the above-mentioned method for configuring the illumination probe, which will not be described in detail in this example.
[0253] As an optional solution, the third acquisition module includes:
[0254] The second acquisition submodule is configured to acquire the shortest path distance between the first sampling point and the second sampling point along the surface of the target grid structure, wherein the local spatial distance includes the shortest path distance.
[0255] For a specific embodiment, reference may be made to the example shown in the above-mentioned method for configuring the illumination probe, which will not be described in detail in this example.
[0256] As an optional solution, the configuration unit 1010 includes:
[0257] A clustering module, used for clustering at least two sampling points into K clusters when the clustering result indicates that the sampling points are clustered, where K is a natural number;
[0258] The fourth acquisition module is used to obtain the cluster center corresponding to each cluster in the K clusters;
[0259] An initialization module, configured to initialize the cluster center as a light probe to obtain at least one light probe;
[0260] The configuration module is used to configure at least one illumination probe based on at least two sampling points to obtain a configuration result.
[0261] For a specific embodiment, reference may be made to the example shown in the above-mentioned method for configuring the illumination probe, which will not be described in detail in this example.
[0262] As an optional solution, at least one illumination probe includes a first probe, and a configuration module includes:
[0263] A third acquisition submodule is configured to acquire a third distance between the first probe and each target sampling point of the at least two sampling points;
[0264] a processing submodule, configured to invert the third distance and perform normalization processing to obtain a first weight of each target sampling point to the first probe;
[0265] a combining submodule, configured to combine the centroid coordinates of each target sampling point and the first weight to obtain a second weight of the first vertex with respect to the first probe, wherein the first vertex is a vertex associated with the first probe in the virtual grid model;
[0266] The configuration submodule is configured to configure the association relationship between the first vertex and the first probe using the second weight, wherein the configuration result includes the association relationship.
[0267] For a specific embodiment, reference may be made to the example shown in the above-mentioned method for configuring the illumination probe, which will not be described in detail in this example.
[0268] As an optional solution, the clustering unit 1008 includes:
[0269] A first selection module is configured to select P sampling points from at least two sampling points as initial centroids;
[0270] an allocation module, configured to allocate each of the at least two sampling points to a sampling point cluster where a nearest initial centroid is located;
[0271] A second selection module is configured to select, from the at least two sampling points, an actual sampling point in each sampling point cluster that minimizes the total distance as a new centroid, and obtain a current clustering result, wherein the total distance is calculated using the first distance and / or the second distance;
[0272] The first determination module is used to determine the current clustering result as the final clustering result when the centroid no longer changes or the maximum number of iterations is reached.
[0273] For a specific embodiment, reference may be made to the example shown in the above-mentioned method for configuring the illumination probe, which will not be described in detail in this example.
[0274] As an optional solution, the third obtaining unit 1006 includes:
[0275] a fifth acquisition module, configured to acquire a third sampling point and a fourth sampling point, wherein the third sampling point and the fourth sampling point are sampling points that are invisible to each other among the at least two sampling points;
[0276] a sixth acquisition module, configured to acquire at least one feasible path from the third sampling point to the fourth sampling point on the virtual grid model;
[0277] Determine the feasible path with the smallest path distance among at least one feasible path as the target feasible path;
[0278] The second determining module is configured to determine the path distance of the target feasible path as the second distance.
[0279] For a specific embodiment, reference may be made to the example shown in the above-mentioned method for configuring the illumination probe, which will not be described in detail in this example.
[0280] As an optional solution, the device further includes:
[0281] a baking unit, configured to configure at least one lighting probe associated with the virtual mesh model using the clustering result, and after obtaining a configuration result, perform lighting baking on the virtual mesh model based on the configuration result to obtain a baking result;
[0282] The optimization unit is configured to configure at least one lighting probe associated with the virtual grid model using the clustering result, and after obtaining the configuration result, reversely optimize the configuration result using the baking result to obtain a new configuration result.
[0283] For a specific embodiment, reference may be made to the example shown in the above-mentioned method for configuring the illumination probe, which will not be described in detail in this example.
[0284] According to another aspect of the embodiment of the present application, an electronic device for implementing the above-mentioned configuration method of the illumination probe is also provided. The electronic device can be, but is not limited to, Figure 1 The user device 102 or server 112 shown in FIG. 1 is used as an example to illustrate the embodiment. Figure 11 As shown, the electronic device includes a memory 1102 and a processor 1104. The memory 1102 stores a computer program, and the processor 1104 is configured to execute the steps in any of the above method embodiments through the computer program.
[0285] In an optional embodiment, the electronic device may be located in at least one network device among a plurality of network devices of a computer network.
[0286] In an optional embodiment, the processor may be configured to execute the following steps via a computer program:
[0287] S8-1, obtaining at least two sampling points on the virtual grid model;
[0288] S8-2, based on the position information of the sampling points on the virtual grid model, obtaining a first distance between mutually visible sampling points among at least two sampling points;
[0289] S8-3, obtaining a second distance between mutually invisible sampling points among at least two sampling points based on a feasible path of the sampling points on the virtual grid model;
[0290] S8-4, clustering at least two sampling points according to the first distance and the second distance to obtain a clustering result;
[0291] S8-5, using the clustering result, configuring at least one lighting probe associated with the virtual grid model to obtain a configuration result.
[0292] Alternatively, those skilled in the art will appreciate that Figure 11 The structure shown is for illustration only. Figure 11 It does not limit the structure of the above electronic device. For example, the electronic device may also include Figure 11 More or fewer components (such as network interfaces, etc.) as shown in, or with Figure 11 Different configurations shown.
[0293] Among them, the memory 1102 can be used to store software programs and modules, such as the program instructions / modules corresponding to the configuration method and device of the illumination probe in the embodiment of the present application. The processor 1104 executes various functional applications and data processing by running the software programs and modules stored in the memory 1102, that is, realizes the above-mentioned configuration method of the illumination probe. The memory 1102 may include a high-speed random access memory, and may also include a 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 1102 may further include a memory remotely located relative to the processor 1104, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned networks include but are not limited to the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Among them, the memory 1102 can be used to store, but is not limited to, information such as sampling points, first distances, second distances, clustering results, and configuration results. As an example, if Figure 11 As shown, the memory 1102 may include, but is not limited to, the first acquisition unit 1002, the second acquisition unit 1004, the third acquisition unit 1006, the clustering unit 1008, and the configuration unit 1010 in the above-mentioned light probe configuration device. In addition, it may also include, but is not limited to, other module units in the above-mentioned light probe configuration device, which will not be repeated in this example.
[0294] Optionally, the transmission device 1106 is configured to receive or send data via a network. Specific examples of the network may include a wired network and a wireless network. In one embodiment, the transmission device 1106 includes a network interface controller (NIC), which can be connected to other network devices and a router via a network cable to communicate with the Internet or a local area network. In one embodiment, the transmission device 1106 is a radio frequency (RF) module, which is configured to communicate with the Internet wirelessly.
[0295] In addition, the electronic device further includes: a display 1108 for displaying information such as the sampling points, the first distance, the second distance, the clustering results, and the configuration results; and a connection bus 1110 for connecting the various module components in the electronic device.
[0296] In other embodiments, the user device or server may be a node in a configured system, wherein the configured system may be a blockchain system, and the blockchain system may be a configured system formed by connecting multiple nodes via network communication. The nodes may form a peer-to-peer network, and any computing device, such as a server, user device, or other electronic device, may become a node in the blockchain system by joining the peer-to-peer network.
[0297] According to one aspect of the present application, a computer program product is provided, comprising a computer program / instructions containing program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via a communication component and / or installed from a removable medium. When the computer program is executed by a central processing unit, the various functions provided in the embodiments of the present application are performed.
[0298] The serial numbers of the above embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0299] It should be noted that the computer system of the electronic device is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0300] A computer system includes a central processing unit (CPU), which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) or programs loaded from the storage unit into random access memory (RAM). The RAM also stores various programs and data required for system operation. The CPU, the read-only memory, and the RAM are connected to each other via a bus. Input / output interfaces (I / O interfaces) are also connected to the bus.
[0301] The following components are connected to the input / output interface: an input section including a keyboard, mouse, etc.; an output section including a cathode ray tube (CRT), a liquid crystal display (LCD), and a speaker; a storage section including a hard disk; and a communication section including a network interface card such as a local area network card and a modem. The communication section performs communication processing via a network such as the Internet. A drive is also connected to the input / output interface as needed. Removable media such as magnetic disks, optical disks, magneto-optical disks, semiconductor memories, etc. are installed in the drive as needed so that computer programs read from them can be installed into the storage section as needed.
[0302] In particular, according to an embodiment of the present application, the processes described in the various method flow charts can be implemented as computer software programs. For example, an embodiment of the present application includes a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for executing the methods shown in the flow charts. In such an embodiment, the computer program can be downloaded and installed from a network via a communication portion, and / or installed from a removable medium. When the computer program is executed by a central processing unit, the various functions defined in the system of the present application are performed.
[0303] According to one aspect of the present application, a computer-readable storage medium is provided, and a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in the various optional implementations described above.
[0304] In an optional embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:
[0305] S8-1, obtaining at least two sampling points on the virtual grid model;
[0306] S8-2, based on the position information of the sampling points on the virtual grid model, obtaining a first distance between mutually visible sampling points among at least two sampling points;
[0307] S8-3, obtaining a second distance between mutually invisible sampling points among at least two sampling points based on a feasible path of the sampling points on the virtual grid model;
[0308] S8-4, clustering at least two sampling points according to the first distance and the second distance to obtain a clustering result;
[0309] S8-5, using the clustering result, configuring at least one lighting probe associated with the virtual grid model to obtain a configuration result.
[0310] Alternatively, in the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program that has a predetermined function and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories), or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0311] In an optional embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing hardware related to the electronic device through a program, and the program may be stored in a computer-readable storage medium, which may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0312] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0313] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above-mentioned computer-readable storage medium. Based on this understanding, the technical solution of the present application, 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, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which can be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods of each embodiment of the present application.
[0314] In the above embodiments of the present application, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0315] In the several embodiments provided in this application, it should be understood that the disclosed user equipment can be implemented in other ways. Among them, the device embodiments described above are merely illustrative. For example, the division of units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, and can be electrical or other forms.
[0316] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or configured on multiple network units. Some or all of these units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0317] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0318] The above is only a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A method for configuring an illumination probe, characterized in that: include: Obtain at least two sampling points on the virtual grid model; acquiring, based on position information of the sampling points on the virtual grid model, a first distance between mutually visible sampling points among the at least two sampling points; acquiring, based on a feasible path of the sampling point on the virtual grid model, a second distance between mutually invisible sampling points among the at least two sampling points; Clustering the at least two sampling points using the first distance and the second distance to obtain a clustering result; At least one lighting probe associated with the virtual grid model is configured using the clustering result to obtain a configuration result.
2. The method according to claim 1, characterized in that The acquiring, based on the position information of the sampling points on the virtual grid model, a first distance between mutually visible first sampling points among the at least two sampling points, includes: Acquire a first sampling point and a second sampling point, wherein the first sampling point and the second sampling point are mutually visible sampling points among the at least two sampling points; When the position information indicates that the first sampling point and the second sampling point are located in different grid structures in the virtual grid model, obtaining a global space distance between the first sampling point and the second sampling point in the virtual grid model, and determining the global space distance as the first distance; When the position information indicates that the first sampling point and the second sampling point are located in the same grid structure in the virtual grid model, a local spatial distance between the first sampling point and the second sampling point on a target grid structure is obtained, and the local spatial distance is determined as the first distance, wherein the target grid structure is the grid structure in which the first sampling point and the second sampling point are located.
3. The method according to claim 2, characterized in that The obtaining of the global space distance between the first sampling point and the second sampling point in the virtual grid model includes: Obtain a straight-line distance between the first sampling point and the second sampling point in the virtual grid model, wherein the global space distance includes the straight-line distance.
4. The method according to claim 2, characterized in that The obtaining of the local spatial distance between the first sampling point and the second sampling point on the target grid structure includes: Acquire the shortest path distance between the first sampling point and the second sampling point along the surface of the target grid structure, wherein the local spatial distance includes the shortest path distance.
5. The method according to claim 1, wherein The configuring at least one lighting probe associated with the virtual grid model using the clustering result to obtain a configuration result includes: The clustering result indicates that the at least two sampling points are clustered into K clusters, where K is a natural number; Obtain the cluster center corresponding to each cluster in the K clusters; Initializing the cluster center as a light probe to obtain the at least one light probe; The at least one illumination probe is configured based on the at least two sampling points to obtain the configuration result.
6. The method according to claim 5, characterized in that The at least one illumination probe includes a first probe, and configuring the at least one illumination probe based on the at least two sampling points to obtain the configuration result includes: acquiring a third distance between the first probe and each target sampling point among the at least two sampling points; Inverting the third distance and performing normalization processing to obtain a first weight of each target sampling point to the first probe; Combining the centroid coordinates of each target sampling point and the first weight to obtain a second weight of a first vertex with respect to the first probe, wherein the first vertex is a vertex associated with the first probe in the virtual grid model; The association relationship between the first vertex and the first probe is configured using the second weight, wherein the configuration result includes the association relationship.
7. The method according to any one of claims 1 to 6, characterized in that Clustering the at least two sampling points using the first distance and the second distance to obtain a clustering result includes: Selecting P sampling points from the at least two sampling points as initial centroids; Assigning each of the at least two sampling points to the sampling point cluster where the nearest initial centroid is located; Selecting, from the at least two sampling points, an actual sampling point in each sampling point cluster that minimizes the total distance as a new centroid, and obtaining a current clustering result, wherein the total distance is calculated using the first distance and / or the second distance; When the centroid no longer changes or the maximum number of iterations is reached, the current clustering result is determined as the final clustering result.
8. The method according to any one of claims 1 to 6, characterized in that The acquiring, based on the feasible path of the sampling point on the virtual grid model, a second distance between mutually invisible sampling points among the at least two sampling points, comprises: Acquire a third sampling point and a fourth sampling point, wherein the third sampling point and the fourth sampling point are sampling points that are invisible to each other among the at least two sampling points; Acquire at least one feasible path from the third sampling point to the fourth sampling point on the virtual grid model; Determine the feasible path with the smallest path distance among the at least one feasible path as the target feasible path; The path distance of the target feasible path is determined as the second distance.
9. The method according to any one of claims 1 to 6, characterized in that After configuring at least one lighting probe associated with the virtual grid model using the clustering result to obtain a configuration result, the method further includes: Based on the configuration result, performing lighting baking on the virtual grid model to obtain a baking result; The configuration result is reversely optimized using the baking result to obtain a new configuration result.
10. A device for configuring an illumination probe, characterized in that: include: A first acquisition unit is used to acquire at least two sampling points on the virtual grid model; a second acquiring unit, configured to acquire, based on position information of the sampling points on the virtual grid model, a first distance between mutually visible sampling points among the at least two sampling points; a third acquiring unit, configured to acquire, based on a feasible path of the sampling point on the virtual grid model, a second distance between mutually invisible sampling points among the at least two sampling points; a clustering unit, configured to cluster the at least two sampling points according to the first distance and the second distance to obtain a clustering result; A configuration unit is configured to configure at least one lighting probe associated with the virtual grid model using the clustering result to obtain a configuration result.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program executes the method according to any one of claims 1 to 9 when executed by an electronic device.
12. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.
13. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 9 through the computer program.