Baking Method, Device, Equipment, and Storage Medium for Virtual Scenes
By determining the connectivity relationship of the light probes in a virtual scene, dividing the light probe sets and baking, the problem of low light reality when the light probe is located in different virtual spaces is solved, and a more efficient and accurate lighting rendering effect is achieved.
Patent Information
- Application Number
- CN202210470156.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-28
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2042-04-28
AI Technical Summary
In a virtual scene, when the light probe is located in a different virtual space, directly interpolation of the lighting information leads to a problem of low light reality.
By determining the connectivity relationship between the light probes, the light probe set is divided, and baking and rendering is performed based on the connectivity relationship vector set to ensure the accuracy of the lighting information.
It improves the realism of the lighting of the virtual scene, reduces light leakage, and improves rendering efficiency and accuracy.
Smart Images

Figure CN115120970B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular, to a baking method, apparatus, device, and storage medium for a virtual scene. Background Art
[0002] With the development of multimedia technology, there are more and more game types with richer functions. In order to provide players with a more realistic gaming experience, technicians are committed to improving the fineness of game graphics. For example, technicians improve the fineness of game graphics as a whole by enhancing the authenticity of lighting in the game graphics.
[0003] In related technologies, light probes are often used to process the lighting effects in game graphics, that is, multiple light probes are arranged in the game scene. When baking a certain position point in the game scene, the light probes adjacent to this position will be recorded. Then, during subsequent rendering, the lighting information of the recorded light probes is directly interpolated to obtain the lighting information of this position.
[0004] However, in some cases, two light probes adjacent to a certain position point in the game scene may be located in different virtual spaces. For example, one light probe is located outdoors and the other is located indoors, and the indoors and outdoors are not connected. The lighting information obtained by directly interpolating the lighting information of these two light probes is not accurate enough, resulting in a low lighting authenticity at this position point. Summary of the Invention
[0005] Embodiments of this application provide a baking method, apparatus, device, and storage medium for a virtual scene, which can improve the baking effect of the virtual scene. The technical solutions are as follows:
[0006] On the one hand, a baking method for a virtual scene is provided. The method includes:
[0007] Determine a connectivity relationship vector of multiple light probes in the virtual scene based on the connectivity relationship between the multiple light probes;
[0008] Determine a connectivity relationship vector group of the position point based on the connectivity relationship between the position point in the virtual scene and the light probes adjacent to the position point. The connectivity relationship vector group includes the connectivity relationship vectors of the light probes adjacent to and connected to the position point;
[0009] Bake the virtual scene based on the connectivity relationship vector group of the position point.
[0010] On the one hand, a baking apparatus for a virtual scene is provided. The apparatus includes:
[0011] A connectivity relationship vector determination module, configured to determine a connectivity relationship vector of the multiple light probes based on the connectivity relationship between multiple light probes in a virtual scene;
[0012] A connectivity relationship vector group determination module, configured to determine a connectivity relationship vector group of the position point based on the connectivity relationship between the position point in the virtual scene and the light probes adjacent to the position point, where the connectivity relationship vector group includes the connectivity relationship vectors of the light probes adjacent to and connected to the position point;
[0013] A baking module, configured to bake the virtual scene based on the connectivity relationship vector group of the position point.
[0014] In a possible implementation manner, the connectivity relationship vector determination module is configured to, based on the connectivity relationship between multiple light probes in the virtual scene, divide the multiple light probes into multiple light probe groups, where the light probes in each light probe group are connected to each other; determine the connectivity relationship vectors of the light probes in the multiple light probe groups, where the connectivity relationship vectors of the light probes in the same light probe group are the same, and the connectivity relationship vectors of the light probes in different light probe groups are orthogonal to each other.
[0015] In a possible implementation manner, the connectivity relationship vector determination module is configured to perform any one of the following:
[0016] For a first light probe and a second light probe among the multiple light probes, when the connection line between the first light probe and the second light probe is not blocked by any virtual object, divide the first light probe and the second light probe into the same light probe group;
[0017] When the connection line between the first light probe and the second light probe is blocked by any virtual object, divide the first light probe and the second light probe into different light probe groups.
[0018] In a possible implementation manner, the connectivity relationship vector determination module is configured to perform any one of the following:
[0019] For a first light probe and a second light probe among the multiple light probes, when the connection line between the first light probe and the second light probe is not blocked by any virtual object or is only blocked by a first type of virtual object, divide the first light probe and the second light probe into the same light probe group, where the first type of virtual object is a transparent virtual object in the virtual scene;
[0020] When the line connecting the first light probe and the second light probe is blocked by any virtual object of the second type, the first light probe and the second light probe are divided into different light probe groups, and the virtual object of the second type is an opaque virtual object in the virtual scene.
[0021] In a possible implementation manner, the connection relationship vector determination module is configured to assign an initial connection relationship vector to the light probes in the multiple light probe groups based on the relative position relationship between the multiple light probe groups. The light probes in each light probe group have the same initial connection relationship vector, and the light probes in any two adjacent and non-connected light probe groups among the multiple light probe groups have different initial connection relationship vectors; the initial connection relationship vectors of the light probes in the multiple light probe groups are optimized by using the simulated annealing method to obtain the connection relationship vectors of the light probes in the multiple light probe groups.
[0022] In a possible implementation manner, the connection relationship vector group determination module is configured to perform any one of the following:
[0023] When the position point is connected to the light probes adjacent to the position point, add the connection relationship vectors of the light probes adjacent to the position point to the connection relationship vector group of the position point;
[0024] When the position point is not connected to the light probes adjacent to the position point, do not add the connection relationship vectors of the light probes adjacent to the position point to the connection relationship vector group of the position point.
[0025] In a possible implementation manner, the device further includes:
[0026] The connection relationship determination module is configured to perform a ray detection on the light probes adjacent to the position point based on the position point to determine the connection relationship between the position point and the adjacent light probes.
[0027] In a possible implementation manner, the connection relationship determination module is configured to emit a ray from the position point to the light probes adjacent to the position point; when the ray contacts any virtual object, determine that the position point is not connected to the adjacent light probes; when the ray does not contact any virtual object, determine that the position point is connected to the adjacent light probes.
[0028] In a possible implementation, the connectivity relationship determination module is configured to start from the position point and emit a ray to a light probe adjacent to the position point; in a case where the ray does not contact any virtual object or only contacts a first type of virtual object in the virtual scene, it is determined that the position point is connected to the adjacent light probe, and the first type of virtual object is a transparent virtual object in the virtual scene; in a case where the ray contacts any second type of virtual object in the virtual scene, it is determined that the position point is not connected to the adjacent light probe, and the second type of virtual object is an opaque virtual object in the virtual scene.
[0029] In a possible implementation, the baking module is configured to, for the static virtual objects in the virtual scene, bake the static objects based on the connectivity relationship vector groups of multiple position points on the static virtual objects and the light maps of the static virtual objects; for the dynamic objects in the virtual scene, bake the dynamic objects based on the connectivity relationship vector groups of multiple position points on the dynamic objects.
[0030] In a possible implementation, the number of the position points is multiple, and the apparatus further includes:
[0031] A position point merging module, configured to merge the same connectivity relationship vector groups in the connectivity relationship vector groups of multiple position points to obtain the merged connectivity relationship vector group of the multiple position points, and the merged connectivity relationship vector group corresponds to at least one position point among the multiple position points.
[0032] In a possible implementation, the apparatus further includes:
[0033] A rendering module, configured to render the multiple position points based on the connectivity relationship vector groups of the position points and the textures of the multiple light probes.
[0034] In a possible implementation, the rendering module is configured to, based on the connectivity relationship vector group of the position point, determine at least one target light probe connected to the position point from the light probes adjacent to the position point; sample the textures of the at least one target light probe at the position point to obtain the light information of the at least one target light probe at the position point; and fuse the light information of the at least one target light probe at the position point to obtain the target light information of the position point.
[0035] In a possible implementation, the rendering module is configured to perform any one of the following:
[0036] Add the light information of the at least one target light probe at the position point to obtain the target light information of the position point;
[0037] Based on the lighting weights between the at least one target lighting probe and the position point, perform a weighted sum of the lighting information of the at least one target lighting probe at the position point to obtain the target lighting information of the position point, where the lighting weight is negatively correlated with the distance between the target lighting probe and the position point.
[0038] On the one hand, a computer device is provided. The computer device includes one or more processors and one or more memories. At least one computer program is stored in the one or more memories, and the computer program is loaded and executed by the one or more processors to implement the baking method of the virtual scene.
[0039] On the one hand, a computer-readable storage medium is provided. At least one computer program is stored in the computer-readable storage medium, and the computer program is loaded and executed by a processor to implement the baking method of the virtual scene.
[0040] On the one hand, a computer program product or a computer program is provided. The computer program product or the computer program includes program code. The program code is stored in a computer-readable storage medium. A processor of a computer device reads the program code from the computer-readable storage medium, and the processor executes the program code, so that the computer device executes the baking method of the virtual scene described above.
[0041] Through the technical solution provided by the embodiments of the present application, when baking a virtual scene, based on the connectivity relationship between multiple lighting probes, determine the connectivity relationship vector of the multiple lighting probes. Based on the connectivity relationship between multiple position points in the virtual scene and adjacent lighting probes, determine a group of connectivity relationship vectors of the multiple position points. The connectivity relationship vectors stored in the group of connectivity relationship vectors are the connectivity relationship vectors of the lighting probes connected to the corresponding position points, that is, the connectivity relationship vectors of the lighting probes that will affect the lighting of the position points. Based on the group of connectivity relationship vectors of the multiple position points, bake the virtual scene so that the group of connectivity relationship vectors of the multiple position points is pre-bound to the position points. Since the group of connectivity relationship vectors of the multiple position points can reflect the connectivity relationship between the multiple position points and adjacent lighting probes, when rendering based on the group of connectivity relationship vectors of the multiple position points later, more accurate lighting information can be obtained, thereby improving the authenticity of the lighting. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] To more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the accompanying drawings required for the description of the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can be obtained based on these drawings.
[0043] Figure 1 It is a schematic diagram of the implementation environment of a baking method for a virtual scene provided by an embodiment of the present application;
[0044] Figure 2 It is a flowchart of a baking method for a virtual scene provided by an embodiment of the present application;
[0045] Figure 3 It is a flowchart of another baking method for a virtual scene provided by an embodiment of the present application;
[0046] Figure 4 It is a schematic diagram of the connection relationship between a lighting probe and a position point provided by an embodiment of the present application;
[0047] Figure 5 It is a comparison diagram of rendering effects provided by an embodiment of the present application;
[0048] Figure 6 It is a comparison diagram of rendering effects provided by an embodiment of the present application;
[0049] Figure 7 It is a schematic diagram of the structure of a baking device for a virtual scene provided by an embodiment of the present application;
[0050] Figure 8 It is a schematic diagram of the structure of a terminal provided by an embodiment of the present application;
[0051] Figure 9 It is a schematic diagram of the structure of a server provided by an embodiment of the present application. Detailed implementation manners
[0052] To make the objectives, technical solutions, and advantages of the present application clearer, the following will further describe the embodiments of the present application in detail with reference to the accompanying drawings.
[0053] In the present application, terms such as "first" and "second" are used to distinguish the same items or similar items with basically the same functions and effects. It should be understood that there is no logical or temporal dependency between "first", "second", and "nth", nor are the quantity and execution order limited.
[0054] It should be noted that the information involved in this application (including but not limited to user device information, user personal information, etc.), data (including but not limited to data for analysis, stored data, displayed data, etc.), and signals are all authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with the relevant laws, regulations, and standards of relevant countries and regions.
[0055] Unreal Engine 4: A game development engine launched by Epic Games. Compared with other engines, the Unreal Engine is not only efficient and all-round, but also allows for direct preview of the development effects, giving developers stronger capabilities.
[0056] Virtual scene: A virtual scene displayed (or provided) when an application runs on a terminal. The virtual scene can be a simulation environment of the real world, a semi-simulated and semi-fictional virtual environment, or a purely fictional virtual environment. The virtual scene can be any one of a two-dimensional virtual scene, a 2.5D virtual scene, or a three-dimensional virtual scene. The embodiments of this application do not limit the dimension of the virtual scene. For example, the virtual scene can include the sky, land, ocean, etc. The land can include environmental elements such as deserts and cities, and users can control virtual objects to move in the virtual scene.
[0057] Virtual object: An object controlled by a user in a virtual scene.
[0058] Virtual body: An object that moves or is stationary in a virtual scene. Moving virtual bodies include animals, vehicles, and characters in the virtual scene. Stationary virtual bodies include walls, stones, and the ground in the virtual scene.
[0059] Lighting probe: Can capture and use information related to light passing through the empty space in the scene. Similar to lightmaps, lighting probes store "baked" information about the lighting in the scene. The difference is that lightmaps store lighting information about light hitting the surfaces in the scene, while lighting probes store information about light passing through the empty space in the scene.
[0060] Lightmap: Used to add the fusion of lighting textures on the basis of the original object model texture rendering in a virtual scene, so that the object model renders a lighting effect. Lightmap is a technology that can enhance the lighting effect of a static scene.
[0061] Greedy Algorithm: An algorithm that, under a certain criterion, gives priority to samples that best meet the criterion and finally considers samples that do not meet the criterion, ultimately obtaining an answer. In other words, when solving a problem, it always makes the best choice as it appears at the moment. It does not consider the global optimal solution from the overall optimal perspective but rather considers a local optimal solution in a certain sense.
[0062] Simulated Annealing: The Simulated Annealing (SA) algorithm is derived from the principle of solid annealing and is a probability-based algorithm. The algorithm idea is as follows: Start from a relatively high initial temperature and gradually lower the temperature until the thermal equilibrium condition is met. At each temperature, perform n rounds of search. In each round of search, add a random perturbation to the old solution to generate a new solution and accept the new solution according to certain rules.
[0063] Figure 1 It is a schematic diagram of the implementation environment of a baking method for a virtual scene provided by an embodiment of the present application. Refer to Figure 1 , and the implementation environment may include: a first terminal 110, a second terminal 120, a server 130, and a communication network 140.
[0064] The first terminal 110 provides a first application program for baking a virtual scene. Schematically, the first application program includes a first graphics engine, which can be used in the development process of the virtual scene. Optionally, the above graphics engine includes Unity3D, Unreal Engine, Frostbite Engine, etc., which are not limited herein. The first terminal 110 includes various forms of terminal devices such as mobile phones, tablets, desktop computers, and portable laptops.
[0065] The second terminal 120 installs and runs a second application program that supports rendering virtual scenes. Schematically, the second application program includes a second graphics engine, which can be used in the running and display process of virtual scenes. Optionally, the above-mentioned first graphics engine and the second graphics engine can be the same graphics engine, or different application versions of the same graphics engine (for example, the first graphics engine is the developer version, and the second graphics engine is the application running version), which is not limited herein. The second application program can be any one of game programs such as virtual reality application programs, three-dimensional map programs, first-person shooting (FPS) games, third-person shooting (TPS) games, multiplayer online battle arena games (MOBA), massive multiplayer online role-playing games (MMORPG), multiplayer gunfight survival games, etc. The user controls the master virtual object located in the virtual scene through the second terminal 120. The second terminal 120 includes various forms of terminal devices such as mobile phones, tablets, desktop computers, and portable laptops.
[0066] The server 130 is used to provide backend services for the first application program and / or the second application program. For example, it provides backend data calculation support for the first application program and backend application logic support for the second application program. Optionally, the server 130 undertakes the main computing work, and the first terminal 110 and the second terminal 120 undertake the secondary computing work; or, the server 130 undertakes the secondary computing work, and the first terminal 110 and the second terminal 120 undertake the main computing work; or, the server 130, the first terminal 110, and the second terminal 120 adopt a distributed computing architecture for collaborative computing.
[0067] It should be noted that the above-mentioned server 130 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or 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, content delivery network (CDN), and big data and artificial intelligence platforms. In some embodiments, the above-mentioned server 130 can also be implemented as a node in a blockchain system. Blockchain is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, and encryption algorithms.
[0068] After introducing the implementation environment of the embodiments of the present application, the application scenarios of the embodiments of the present application will be introduced in combination with the above implementation environment. In the following description process, the terminal is the first terminal 110 in the above implementation environment, and the server is the server 130 in the above implementation environment. The technical solution provided by the embodiments of the present application can be applied to the scenario of game production and can also be applied to the scenario of animation production.
[0069] When the technical solution provided by the embodiments of the present application is applied to the scenario of game production, after the game production personnel arrange the light probes in the virtual scene, executing the technical solution provided by the embodiments of the present application through the terminal can achieve baking of the virtual scene. When the baked virtual scene is rendered later, a better lighting effect can be presented.
[0070] It should be noted that in the above description process, it is described by taking the terminal executing the technical solution provided by the embodiments of the present application as an example. In other possible implementation manners, the technical solution provided by the embodiments of the present application can also be executed by the server, that is, the server uses the technical solution provided by the embodiments of the present application to bake the virtual scene. The embodiments of the present application do not make any limitations in this regard.
[0071] After introducing the implementation environment and application scenarios of the embodiments of the present application, the baking method of the virtual scene provided by the embodiments of the present application will be introduced below. Refer to Figure 2 , taking the execution subject as the terminal as an example, the method includes the following steps.
[0072] 201. The terminal determines a connectivity relationship vector of a plurality of light probes in the virtual scene based on the connectivity relationship between the plurality of light probes in the virtual scene.
[0073] Among them, a light probe is used to detect the light distribution of a virtual light source in the virtual scene. The virtual light source is the source of light provided in the virtual scene. In some embodiments, the above virtual light source includes a light source that can form lighting effects such as point light, parallel light, and spotlight. The virtual light source corresponding to the virtual scene can be one or more. The embodiments of the present application do not make any limitations in this regard. In some embodiments, the connectivity relationship vectors of any two non-connected light probes among the plurality of light probes are orthogonal to each other, and the connectivity relationship vectors of any two connected light probes among the plurality of light probes are not orthogonal to each other. Whether the light probes are connected can be determined by whether the connectivity relationship vectors of the light probes are orthogonal.
[0074] 202. The terminal determines a connectivity relationship vector group of the position point based on the connectivity relationship between the position point in the virtual scene and the light probes adjacent to the position point. The connectivity relationship vector group includes the connectivity relationship vectors of the light probes adjacent to and connected to the position point.
[0075] Among them, the method for determining the connectivity relationship between the position points and the light probes in the virtual scene is the same as that for determining the connectivity relationship between the light probes. The connectivity relationship vector group of the position points is used to record the connectivity relationship vectors of the light probes that are adjacent to and connected to the position point. In this way, during the subsequent rendering process, the light probes that are adjacent to and connected to the position point can be quickly determined through the connectivity relationship vector group of the position point, with relatively high efficiency.
[0076] 203. The terminal bakes the virtual scene based on the connectivity relationship vector group of the position point.
[0077] Among them, the process of baking the virtual scene is also the process of preprocessing the virtual scene. By preprocessing the virtual scene, the computational amount of subsequent other processes can be reduced, and the efficiency of subsequent other processes can be improved.
[0078] Through the technical solution provided by the embodiments of the present application, when baking a virtual scene, based on the connectivity relationship between multiple light probes, the connectivity relationship vectors of the multiple light probes are determined. Based on the connectivity relationship between multiple position points and adjacent light probes in the virtual scene, the connectivity relationship vector groups of the multiple position points are determined. The connectivity relationship vectors stored in the connectivity relationship vector groups are the connectivity relationship vectors of the light probes that are connected to the corresponding position points, that is, the connectivity relationship vectors of the light probes that will affect the lighting of the position points. Based on the connectivity relationship vector groups of the multiple position points, the virtual scene is baked, so that the connectivity relationship vector groups of the multiple position points are pre-bound to the position points. Since the connectivity relationship vector groups of the multiple position points can reflect the connectivity relationship between the multiple position points and adjacent light probes, when rendering based on the connectivity relationship vector groups of the multiple position points subsequently, more accurate lighting information can be obtained, thereby improving the authenticity of the lighting.
[0079] The above steps 201-203 are a brief introduction to the technical solution provided by the embodiments of the present application. Below, some examples will be combined to more clearly illustrate the technical solution provided by the embodiments of the present application. See Figure 3 , taking the execution entity as the terminal as an example, the method includes:
[0080] 301. The terminal determines multiple light probes in the virtual scene.
[0081] In a possible implementation manner, the terminal generates multiple light probes in the virtual scene at a target spacing. The light probes are used to detect the light distribution in the virtual scene by the virtual light source, that is, the lighting information. In some embodiments, the light probes use spherical harmonic functions to store the lighting information. In some embodiments, the virtual scene is a static virtual scene, and the geometric structure in the virtual scene does not change.
[0082] Among them, multiple light probes refer to two or more light probes.
[0083] In this implementation, multiple light probes generated by the terminal in the virtual scene are evenly distributed in the virtual scene, and can form a relatively delicate light display effect.
[0084] In some embodiments, the number of multiple light probes in the virtual scene is positively correlated with the number of virtual objects in the virtual scene. That is, the more virtual objects there are in the virtual scene, the more light probes are generated; the fewer virtual objects there are in the virtual scene, the fewer light probes are generated. Through this implementation, when the number of virtual objects in the virtual scene is large, a larger number of light probes are generated to refine the lighting effect of the virtual objects. When the number of virtual objects in the virtual scene is small, a smaller number of light probes are generated to reduce the computational load of baking and rendering the virtual scene and improve the efficiency of baking and rendering. In some embodiments, the terminal divides the virtual scene into multiple virtual spaces, and the terminal generates light probes in the multiple virtual spaces based on the number of virtual objects in the multiple virtual spaces. In each virtual space, the number of light probes is positively correlated with the number of virtual objects in the virtual space. By dividing the virtual scene into multiple virtual spaces, light probes can be generated more delicately according to the number of virtual objects, thereby achieving a better light display effect.
[0085] In a possible implementation, the terminal determines the shadow point of the virtual object in the virtual scene. The shadow point is the target point of the shadow area formed on the side of the virtual object facing away from the virtual light source when the virtual light source in the virtual scene irradiates the virtual object. The terminal generates multiple light probes in the virtual scene based on the shadow point of the virtual object in the virtual scene.
[0086] In some embodiments, the target point of the shadow area is the midpoint of the shadow area, and the midpoint is also the geometric center of the shadow area. Alternatively, the target point of the shadow area is a point on the boundary of the shadow area, and the embodiments of the present application do not make any limitations in this regard.
[0087] In this implementation, the terminal can generate light probes according to the shadow points of the virtual objects, so that the number and distribution of the light probes match the number and distribution of the virtual objects in the virtual scene, thereby reducing the number of light probes as much as possible while ensuring the lighting quality.
[0088] For example, the terminal determines the bounding box of a virtual object in a virtual scene. Starting from a virtual light source in the virtual scene, the terminal emits light rays towards the virtual object in the virtual scene. The area enclosed by the intersection points of the light rays and the bounding box is the shadow area of the virtual object, and the terminal at the shadow area of the virtual object is the shadow point of the virtual object. The terminal generates a light probe above the shadow point of the virtual object.
[0089] It should be noted that the terminal can generate a light probe in the virtual scene through any of the above methods, or use other methods to generate a light probe. The embodiments of the present application do not limit this. In some embodiments, the above implementation manner is implemented by a first graphics engine. In some embodiments, a technician can also manually add a light probe in the virtual scene through the first graphics engine.
[0090] It should be noted that the above step 301 is an optional step. The terminal can either determine multiple light probes in the light probe by executing the above step 301, or directly execute the following step 302 when multiple light probes have been generated in the virtual scene. The embodiments of the present application do not limit this.
[0091] 302. The terminal determines the connectivity relationship vector of the multiple light probes based on the connectivity relationship between the multiple light probes in the virtual scene.
[0092] Among them, the connectivity relationship between the light probes includes two types: connected and unconnected. The relevant descriptions of connected and unconnected will be described in the following sub-steps. In some embodiments, the connectivity relationship between the light probes is also referred to as the visibility between the light probes. If two light probes are connected, it means that the two light probes are mutually visible, that is, at the position of any one of the two light probes, the other light probe can be seen without occlusion. The connectivity relationship vector is used to represent the connectivity relationship between multiple light probes. The connectivity relationship vectors of two unconnected light probes are orthogonal to each other, that is, the dot product of the connectivity relationship vectors of two unconnected light probes is 0. The connectivity relationship vectors of two connected light probes are not orthogonal to each other, that is, the dot product of the connectivity relationship vectors of two connected light probes is not 0. In subsequent use, by determining whether the connectivity vectors of two light probes are orthogonal, that is, whether the dot product is 0, it can be determined whether the two light probes are connected.
[0093] The above step 302 includes the following sub-steps 3021-3022 or sub-steps 3023-3024.
[0094] 3021. The terminal divides the multiple light probes into multiple light probe groups based on the connectivity relationship between the multiple light probes in the virtual scene, and the light probes in each light probe group are mutually connected.
[0095] In a possible implementation, for the first light probe and the second light probe among the multiple light probes, when the line connecting the first light probe and the second light probe is not blocked by any virtual object, the terminal divides the first light probe and the second light probe into the same light probe group. When the line connecting the first light probe and the second light probe is blocked by any virtual object, the terminal divides the first light probe and the second light probe into different light probe groups. In some embodiments, the light probes in the same light probe group are also referred to as strongly connected light probes.
[0096] Among them, the line connecting the first light probe and the second light probe is a virtual line segment, which is invisible when rendering the virtual scene. During the baking process of the virtual scene, technicians can set the line segment to be visible or invisible according to actual needs, and this application embodiment does not make any limitations in this regard. In addition, the line connecting the first light probe and the second light probe being blocked by a virtual object means that there is an intersection between the line and the virtual object in the virtual scene.
[0097] In this implementation, whether two light probes are connected means whether the line connecting the two light probes is blocked by the virtual object in the virtual scene. When the line connecting the two light probes is blocked by the virtual object in the virtual scene, it is determined that the two light probes are not connected; when the line connecting the two light probes is not blocked by the virtual object in the virtual scene, it is determined that the two light probes are connected. By dividing multiple light probes into multiple light probe groups, subsequent processing of the light probes can be performed in units of light probe groups, thereby improving the efficiency of subsequent processing.
[0098] For example, the terminal performs ray detection from the first light probe to the second light probe, that is, emits rays from the first light probe to the second light probe. When the rays are not blocked by any virtual object, the terminal divides the first light probe and the second light probe into the same light probe group. When the rays are blocked by any virtual object, the terminal divides the first light probe and the second light probe into different light probe groups. The above is described by taking the terminal performing ray detection from the first light probe to the second light probe as an example. In other possible implementation manners, the terminal can also perform ray detection from the second light probe to the first light probe, which is not limited in the embodiments of this application. In some embodiments, when determining whether the rays are blocked by a virtual object, the terminal can use the convex polyhedron surrounding the virtual object as an aid to achieve this, and the convex polyhedron does not intersect with the surrounded virtual object. When the rays contact the convex polyhedron surrounding any virtual object, it is determined that the rays are not blocked by the virtual object; when the rays do not contact the convex polyhedron of any virtual object, it is determined that the rays are blocked by the virtual object. In some embodiments, this method is also called the convex hull expansion method.
[0099] In a possible implementation manner, for the first light probe and the second light probe among the multiple light probes, when the connection line between the first light probe and the second light probe is not blocked by any virtual object or is only blocked by the first type of virtual object, the first light probe and the second light probe are divided into the same light probe group, and the first type of virtual object is a transparent virtual object in the virtual scene. When the connection line between the first light probe and the second light probe is blocked by any second type of virtual object, the first light probe and the second light probe are divided into different light probe groups, and the second type of virtual object is an opaque virtual object in the virtual scene.
[0100] In this implementation manner, whether two light probes are connected means whether the connection line between the two light probes is not blocked by a virtual object, or is only blocked by a transparent virtual object in the virtual scene. When the connection line between the two light probes is not blocked by a virtual object or is only blocked by a transparent virtual object in the virtual scene, it is determined that the two light probes are connected; when the connection line between the two light probes is blocked by an opaque virtual object in the virtual scene, it is determined that the two light probes are not connected.
[0101] For example, the terminal performs a ray detection from the first light probe to the second light probe, that is, emits a ray from the first light probe to the second light probe. When the ray is not blocked by any virtual object, the terminal divides the first light probe and the second light probe into the same light probe group. Alternatively, when the ray is blocked by a virtual object, the terminal determines the type of the virtual object. When the virtual object is a first type of virtual object, the terminal divides the first light probe and the second light probe into the same light probe group. When the virtual object is a second type of virtual object, the terminal divides the first light probe and the second light probe into different light probe groups. In some embodiments, when determining whether a ray is blocked by a virtual object, the terminal can use a convex polyhedron enclosing the virtual object as an aid, and the convex polyhedron does not intersect the enclosed virtual object. When the ray contacts the convex polyhedron enclosing any virtual object, it is determined that the ray is not blocked by the virtual object; when the ray does not contact the convex polyhedron of any virtual object, it is determined that the ray is blocked by the virtual object. Accordingly, when the ray contacts the convex polyhedron of the virtual object, the terminal determines the type of the virtual object enclosed by the convex polyhedron, for example, queries based on the identifier of the convex polyhedron to determine the identifier of the virtual object enclosed by the convex polyhedron. Based on the identifier of the virtual object, the type of the virtual object is queried, and the type includes the above-mentioned transparent virtual object or opaque virtual object.
[0102] In a possible implementation manner, the terminal divides the virtual scene into multiple virtual spaces. The terminal divides the multiple light probes into multiple light probe groups based on the connectivity relationship between the light probes in each virtual space. The light probes in the same light probe group belong to the same virtual space, and the light probes in the same light probe group are interconnected.
[0103] In this implementation manner, the terminal can first divide the virtual scene into multiple virtual spaces, and group the multiple light probes in units of virtual spaces, thereby improving the fineness of grouping the light probes. Among them, this implementation manner can be combined with any of the above implementation manners, that is, the method for determining the connectivity relationship between light probes in the above implementation manner is adopted in the divided virtual spaces.
[0104] For example, based on the positions of light probes in a virtual scene, the terminal divides the virtual scene into multiple virtual spaces, and each virtual space includes at least one light probe. For any one of the multiple virtual spaces, the terminal determines the connectivity relationship between the light probes in the virtual space, that is, performs ray detection based on the light probes in the virtual space to determine the connectivity relationship between the light probes in the virtual space. For the method by which the terminal determines the connectivity relationship between the light probes, refer to the relevant descriptions in the previous two embodiments, which will not be elaborated here. The terminal divides the light probes that are connected to each other in the virtual space into a light probe group, and the light probes in different light probe groups in the same virtual space are not connected to each other. When there is a virtual space that only includes one light probe among the multiple virtual spaces, the terminal separately divides the light probe in the virtual space into a light probe group. Alternatively, when there is a virtual space that only includes one light probe among the multiple virtual spaces, the terminal merges the virtual space that only includes one light probe with an adjacent virtual space to reduce the number of virtual spaces.
[0105] Through step 3021 above, the terminal can reflect the connectivity relationship between the light probes by dividing the light probe groups, that is, the light probes in the same light probe group are connected to each other, and the light probes in different light probe groups are not connected to each other.
[0106] 3022. The terminal determines the connectivity relationship vectors of the light probes in the multiple light probe groups. The connectivity relationship vectors of the light probes in the same light probe group are the same, and the connectivity relationship vectors of the light probes in different light probe groups are orthogonal to each other.
[0107] In a possible implementation manner, based on the relative position relationship between the multiple light probe groups, the terminal assigns initial connectivity relationship vectors to the light probes in the multiple light probe groups. The light probes in each light probe group have the same initial connectivity relationship vector, and the light probes in any two adjacent and non-connected light probe groups among the multiple light probe groups have different initial connectivity relationship vectors. The terminal uses the simulated annealing method to optimize the initial connectivity relationship vectors of the light probes in the multiple light probe groups to obtain the connectivity relationship vectors of the light probes in the multiple light probe groups.
[0108] Among them, the relative positional relationship between the light probe groups includes whether the light probe groups are adjacent or not adjacent in the virtual scene. The purpose of allocating the initial connectivity relationship vector based on the relative positional relationship between the light probe groups is to: as much as possible, make the light probes in adjacent light probe groups have different initial connectivity relationship vectors. Correspondingly, the initial connectivity relationship vector of the light probe group can reflect the relative positional relationship between the light probe groups. The position of the light probe group is determined by the positions of the light probes in the light probe group. For example, the terminal determines the average position of the light probes in the light probe group as the position of the light probe group, and the average position is also the position where the geometric center of the geometric body surrounded by the light probes in the light probe group is located.
[0109] In this implementation manner, the terminal can allocate the initial connectivity relationship vector for the light probe groups according to the relative positional relationship between the light probe groups, and further optimize the initial connectivity relationship vector of the light probes by the simulated annealing method. The connectivity relationship vectors of the light probes in the obtained multiple light probe groups can more accurately reflect the connectivity relationship between the multiple light probe groups.
[0110] In some embodiments, based on the relative positional relationship between the multiple light probe groups, the process of allocating the initial connectivity relationship vector for the light probes in the multiple light probe groups can be regarded as the process of allocating colors to the nodes in a graph (Graph), where the graph includes multiple nodes. The above-mentioned light probe groups can be regarded as the nodes in the graph. Since the light probes in each light probe group have the same initial connectivity relationship vector, the light probe group can be used to represent the light probes in the light probe group. The relative positional relationship between the light probe groups is reflected by the connection lines between the nodes. There are connection lines between adjacent nodes, and there are no connection lines between non-adjacent nodes. In this case, it can be transformed into the problem of allocating color vectors to multiple nodes in the graph. Here, the initial connectivity vector is equivalent to the initial color vector, and the color vector here is equivalent to the connectivity relationship vector.
[0111] For example, the terminal generates a first graph based on the relative position relationship between multiple light probe groups. The first graph has multiple nodes, each node corresponding to a light probe group. A connection between two nodes indicates that the two light probe groups corresponding to the two nodes are adjacent. The terminal uses a greedy algorithm to assign an initial color vector to the multiple nodes in the first graph. The initial color vector is used to represent the color of the nodes in the first graph, and this initial color vector is equivalent to the above-mentioned initial connectivity relationship vector. The purpose of the greedy algorithm is to make the color vectors of adjacent nodes as different as possible, and the color vectors of non-adjacent nodes can be the same. The greedy algorithm is a step-by-step algorithm. In each processing, the terminal assigns different initial color vectors to a node and the nodes adjacent to it. Using the greedy algorithm can obtain an optimal result locally in the graph. The terminal uses the simulated annealing method to optimize the initial color vectors of the nodes based on the connections between the nodes, and obtains the color vectors of the multiple nodes. The purpose of using the simulated annealing method to optimize the initial color vectors of the nodes is: while ensuring that the initial color vectors can reflect the connection relationship between the nodes, minimize the types of the initial color vectors as much as possible. That is, on the premise that the initial color vectors of adjacent nodes are different, the initial color vectors of non-adjacent nodes can be the same, so as to reduce the number of color vectors and reduce the occupation of storage space. Through the above implementation, the terminal can obtain the connectivity relationship vector (color vector) of the light probes in the multiple light probe groups. When the terminal uses the simulated annealing method to optimize the initial color vectors of the nodes based on the connections between the nodes, it can be implemented based on the following formula (1).
[0112]
[0113] Wherein, i and j represent two light probes in the same light probe group, x is a position point in the virtual scene, is the visibility of the position point x to the light probe i, that is, the connectivity relationship between the position point x and the light probe, is the visibility of the position point x to the light probe j, that is, the connectivity relationship between the position point x and the light probe j, and both have a value range of 0 - 1. is the interpolation coefficient of the position point x to the light probe i, is the interpolation coefficient of the position point x to the light probe j. The interpolation coefficient is negatively correlated with the distance between the position point and the light probe. The farther the distance between the position point and the light probe, the smaller the interpolation coefficient. In some embodiments, the interpolation coefficient uses trilinear interpolation with coordinate differences.
[0114] In some embodiments, the connectivity relationship vector of a light probe group has multiple components, each component being used to represent the connectivity relationship between this light probe group and other light probe groups. The connectivity relationship vector of a light probe group refers to the connectivity relationship vector shared by the light probes in the light probe group. Among them, the connectivity relationship vector of this light probe group is also the connectivity relationship vector shared by the light probes in this light probe group. In some embodiments, the dimension of the connectivity relationship vector of this light probe group is the same as the number of connectivity relationship vectors (different light probe groups may share the same connectivity relationship vector). For example, when the number of connectivity relationship vectors is 8, the dimension of the connectivity relationship vector of this light probe group is 8, and each component of the connectivity relationship vector is used to represent the connectivity relationship between this light probe group and other light probe groups. In some embodiments, the value of the component of the connectivity relationship vector is 0 or 1.
[0115] In some embodiments, the terminal can store textures in units of light probe groups, that is, store the light information of the light probes in the same light probe group in the same texture, and store the light information of the light probes in different light probe groups in different textures, which is convenient for subsequent calls. In some embodiments, when any light probe has no light information, pure black is used to replace the light information of this light probe.
[0116] Alternatively, the above step 302 can also be implemented through the following sub-steps 3023-3024.
[0117] 3023. The terminal assigns initial connectivity relationship vectors to the multiple light probes.
[0118] In a possible implementation manner, the terminal assigns initial connectivity relationship vectors to the multiple light probes according to the distance between any two light probes among the multiple light probes. Any two adjacent light probes among the multiple light probes have the same initial connectivity relationship vector. Here, adjacent means light probes whose distance meets the target distance condition. For example, two light probes with a distance less than or equal to the distance threshold are adjacent light probes, and the distance threshold is set by those skilled in the art according to the actual situation, and the embodiments of the present application do not limit this. In step 3023, when the initial connectivity relationship vectors of two light probes are the same, it can indicate that the two light probes are adjacent, but it cannot indicate whether the two light probes are connected.
[0119] In this implementation manner, the terminal can quickly assign initial connectivity relationship vectors to multiple light probes according to the distance between the light probes, improving the efficiency of assigning initial connectivity relationship vectors.
[0120] 3024. Based on the connectivity relationships among the multiple light probes, the terminal optimizes the initial connectivity relationship vectors of the multiple light probes to obtain the connectivity relationship vectors of the multiple light probes.
[0121] Among them, the purpose of optimizing the initial connectivity relationship vectors of the multiple light probes is to make the obtained connectivity relationship vectors of the light probes reflect the connectivity relationships among the light probes.
[0122] In a possible implementation manner, the process of allocating initial connectivity relationship vectors to the multiple light probes based on the connectivity relationships among the multiple light probes can be regarded as the process of allocating colors to nodes in a graph (Graph), where the graph includes multiple nodes. The above-mentioned light probes can be regarded as nodes in the graph, and the connectivity relationships among the light probes are reflected by the connections between the nodes. There are connections between connected nodes, and there are no connections between unconnected nodes. In this case, it can be transformed into the problem of allocating color vectors to multiple nodes in the graph. Here, the initial connectivity vector is equivalent to the initial color vector, and the color vector is equivalent to the connectivity relationship vector.
[0123] In a possible implementation manner, the terminal generates a second graph (Graph) based on the connectivity relationships among the multiple light probes. The second graph includes multiple nodes, and each node corresponds to a light probe. In the second graph, if there is a connection between two nodes, it means the two nodes are connected; if there is no connection between two nodes, it means the two nodes are not connected. The terminal optimizes the initial color vectors corresponding to the multiple nodes based on the connections between the nodes in the second graph to obtain the color vectors of each node, that is, the color vectors of each light probe.
[0124] For example, the terminal generates a second graph based on the connectivity relationships among the multiple light probes. The second graph has multiple nodes, and each node corresponds to a light probe. If there is a connection between two nodes, it means the two light probes corresponding to the two nodes are connected. The initial connectivity vector of the light probe corresponding to the node is also the initial color vector of the node. The terminal uses the simulated annealing method to optimize the initial color vectors of the nodes based on the connections between the nodes to obtain the color vectors of the multiple nodes. The purpose of using the simulated annealing method to optimize the initial color vectors of the nodes is: while ensuring that the initial color vectors can reflect the connection relationships between the nodes, minimize the types of the initial color vectors. That is, on the premise that the initial color vectors of connected nodes are different, the initial color vectors of unconnected nodes can be the same, so as to reduce the number of color vectors and reduce the occupation of storage space. Through the above implementation manner, the terminal can obtain the connectivity relationship vectors (color vectors) of the multiple light probes.
[0125] In some embodiments, the connectivity relationship vector of the light probe is bound and stored with the light probe. When multiple light probes correspond to the same connectivity relationship vector, the connectivity relationship vector is stored only once, and the corresponding relationship between the connectivity relationship vector and the multiple light probes is set.
[0126] 303. The terminal performs a ray detection on the light probes adjacent to the position point based on the position point in the virtual scene, and determines the connectivity relationship between the position point and the adjacent light probes.
[0127] Among them, the light probes adjacent to the position point refer to the light probes whose distance from the position point meets the target distance condition. For example, the light probes whose distance from the position point is less than or equal to the distance threshold, and the distance threshold is set by those skilled in the art according to the actual situation, and the embodiments of the present application do not limit this. Alternatively, the N light probes with the smallest distance from the position point are all light probes adjacent to the position point, where N is a positive integer, such as 8. The connectivity relationship between the position point and the adjacent light probes includes two types: connected and unconnected. In addition, the number of position points in the virtual scene is multiple. For the sake of easy understanding, in the subsequent description process, an example is given in which the terminal processes the first position point in the virtual scene. The method for the terminal to process other position points belongs to the same inventive concept as the method for processing this position point.
[0128] In a possible implementation manner, the terminal emits a ray from the position point to the light probes adjacent to the position point. When the ray contacts any virtual object, the terminal determines that the position point and the adjacent light probe are not connected. When the ray does not contact any virtual object, the terminal determines that the position point and the adjacent light probe are connected.
[0129] The number of light probes adjacent to the position point is one or more. For the sake of easy understanding, in the following description process, an example is given in which the number of light probes adjacent to the position point is one.
[0130] In this implementation manner, whether the position point and the adjacent light probe are connected refers to whether the line connecting the position point and the adjacent light probe is blocked by the virtual objects in the virtual scene. When the line connecting the position point and the adjacent light probe is blocked by the virtual objects in the virtual scene, it is determined that the position point and the adjacent light probe are not connected; when the line connecting the position point and the adjacent light probe is not blocked by the virtual objects in the virtual scene, it is determined that the position point and the adjacent light probe are connected.
[0131] For example, the terminal performs a ray detection on the adjacent light probe based on this position point, that is, starting from this position point, it emits a ray towards the adjacent light probe. When the ray is not blocked by any virtual object, the terminal determines that this position point and the adjacent light probe are connected to each other. When the ray is blocked by any virtual object, the terminal determines that this position point and the adjacent light probe are not connected to each other. The above is described by taking the terminal performing a ray detection on the adjacent light probe based on the position point as an example. In other possible implementation manners, the terminal can also perform a ray detection on this position point based on the adjacent light probe. The embodiments of the present application do not limit this. In some embodiments, when determining whether the ray is blocked by a virtual object, the terminal can use the convex polyhedron enclosing the virtual object as an aid to achieve this, and the convex polyhedron does not intersect with the enclosed virtual object. When the ray contacts the convex polyhedron enclosing any virtual object, it is determined that the ray is not blocked by the virtual object; when the ray does not contact the convex polyhedron of any virtual object, it is determined that the ray is blocked by the virtual object. In some embodiments, this method is also called the convex hull expansion method.
[0132] In a possible implementation manner, the terminal takes this position point as the starting point and emits a ray towards the light probe adjacent to this position point. When the ray contacts any virtual object or only contacts the first type of virtual object in the virtual scene, the terminal determines that this position point is connected to the adjacent light probe, and the first type of virtual object is the transparent virtual object in the virtual scene. When the ray contacts any second type of virtual object in the virtual scene, the terminal determines that this position point is not connected to the adjacent light probe, and the second type of virtual object is the opaque virtual object in the virtual scene.
[0133] In this implementation manner, whether this position point and the adjacent light probe are connected means whether the line connecting this position point and the adjacent light probe is not blocked by a virtual object, or only blocked by the transparent virtual object in the virtual scene. When the line connecting this position point and the adjacent light probe is not blocked by a virtual object, or only blocked by the transparent virtual object in the virtual scene, it is determined that this position point and the adjacent light probe are connected; when the line connecting this position point and the adjacent light probe is blocked by the opaque virtual object in the virtual scene, it is determined that this position point and the adjacent light probe are not connected.
[0134] For example, the terminal performs a ray detection on the adjacent light probe based on this position point, that is, it emits a ray from this position point to the adjacent light probe. When the ray is not blocked by any virtual object, the terminal determines that this position point and the adjacent light probe are connected to each other. Or, when the ray is blocked by a virtual object, the terminal determines the type of this virtual object. When this virtual object is a first type of virtual object, the terminal determines that this position point and the adjacent light probe are connected to each other. When this virtual object is a second type of virtual object, the terminal determines that this position point and the adjacent light probe are not connected to each other. In some embodiments, when determining whether the ray is blocked by a virtual object, the terminal can use a convex polyhedron that encloses the virtual object as an aid, and this convex polyhedron does not intersect with the enclosed virtual object. When the ray contacts the convex polyhedron that encloses any virtual object, it is determined that the ray is not blocked by the virtual object; when the ray does not contact the convex polyhedron of any virtual object, it is determined that the ray is blocked by the virtual object. Correspondingly, when the ray contacts the convex polyhedron of the virtual object, the terminal determines the type of the virtual object enclosed by this convex polyhedron, such as querying based on the identifier of this convex polyhedron to determine the identifier of the virtual object enclosed by this convex polyhedron. Based on the identifier of this virtual object, query the type of this virtual object, and the types include the above-mentioned transparent virtual object or opaque virtual object.
[0135] In some embodiments, the connectivity relationship (visibility) between the position point and the light probe is not discrete (including connected and unconnected), and can also be continuous (represented by the degree of connectivity, 0 indicating completely unconnected, and 1 indicating completely connected), and the embodiments of the present application do not limit this.
[0136] 304. The terminal determines a connectivity relationship vector group of this position point based on the connectivity relationship between the position point in the virtual scene and the adjacent light probe to this position point, and this connectivity relationship vector group includes the connectivity relationship vectors of the light probes that are adjacent to and connected to this position point.
[0137] By determining the connectivity relationship vector group of this position point, that is, by recording the light probes that are adjacent to and connected to this position point through the connectivity relationship vector group, in the subsequent process of rendering this position point, the light probes that are adjacent to and connected to this position point are determined through the connectivity relationship vector group of this position point, and then the light information of the light probes that are adjacent to and connected to this position point is sampled for rendering, avoiding sampling the light information of the light probes that are not connected to this position point during the rendering process, thereby improving the authenticity of the lighting of this position point.
[0138] In a possible implementation, when the lighting probe adjacent to the position point is connected, the terminal adds the connection relationship vector of the lighting probe adjacent to the position point to the connection relationship vector group of the position point.
[0139] In this implementation, the terminal stores the connection relationship vectors of the lighting probes adjacent and connected to the position point through the connection relationship vector group. During subsequent rendering, the lighting probes adjacent and connected to the position point can be quickly determined through the connection relationship vector group, improving the rendering efficiency.
[0140] In some embodiments, the connection relationship vector group is also referred to as a Mask. The Mask is divided into a Mask Map and a Mask Volume. The Mask Map is for static virtual objects in the virtual scene, and the Mask Volume is for dynamic virtual objects in the virtual scene. The terminal determines the type of Mask according to whether the position point is in a dynamic virtual object or a static virtual object in the virtual scene.
[0141] For example, when the position point belongs to a static virtual object in the virtual scene and the lighting probe adjacent to the position point is connected, the terminal adds the connection relationship vector of the lighting probe adjacent to the position point to the Mask Map of the position point. When the position point belongs to a dynamic object in the virtual scene and the lighting probe adjacent to the position point is connected, the terminal adds the connection relationship vector of the lighting probe adjacent to the position point to the Mask Volume of the position point.
[0142] In a possible implementation, when the lighting probe adjacent to the position point is not connected, the terminal does not add the connection relationship vector of the lighting probe adjacent to the position point to the connection relationship vector group of the position point.
[0143] In some embodiments, when the connection relationship (visibility) between the position point and the lighting probe is continuous (represented by a connection parameter, 0 means completely unconnected, 1 means completely connected), the terminal can also perform the following processing:
[0144] In a possible implementation, when the connectivity parameter between the position point and the adjacent light probe is greater than or equal to the connectivity parameter threshold, the terminal adds the connectivity relation vector of the adjacent light probe and the connectivity parameter between the adjacent light probe and the position point to the connectivity relation vector group of the position point at the same time. The connectivity parameter threshold is set by those skilled in the art according to the actual situation, and the embodiments of the present application do not limit this. When the connectivity parameter between the position point and the adjacent light probe is less than the connectivity parameter threshold, the terminal does not add the connectivity relation vector of the adjacent light probe and the connectivity parameter between the adjacent light probe and the position point to the connectivity relation vector group of the position point at the same time. Alternatively, the terminal directly adds the connectivity parameter and the connectivity relation vector of the light probe adjacent to the position point to the connectivity relation vector group of the position point at the same time, and then determines whether to sample based on the connectivity parameter during the subsequent rendering process, so as to improve the flexibility of the method.
[0145] Optionally, in addition to determining the connectivity relation vector group of the position point through step 304 above and using the connectivity relation vector group to record the light probes adjacent to and connected to the position point, the terminal can also record the light probes adjacent to and connected to the position point in the following manner.
[0146] In a possible implementation, the terminal determines the connectivity relation vector of the position point based on the connectivity relation vector of the light probes adjacent to and connected to the position point and the connectivity relation vector of the light probes adjacent to and not connected to the position point. Among them, the connectivity relation vector of the position point is orthogonal to the connectivity relation vector of the light probes adjacent to and not connected to the position point, and the connectivity relation vectors of the light probes adjacent to and not connected to the position point are not orthogonal to each other. During subsequent rendering, based on the connectivity relation vector of the position point and the connectivity relation vectors of the light probes adjacent to the position point, the light probes adjacent to and connected to the position point and the light probes adjacent to and not connected to the position point can be determined from the light probes adjacent to the position point.
[0147] Optionally, after step 304, the terminal can also perform the following steps.
[0148] In a possible implementation, the terminal merges the same connectivity relation vector groups in the connectivity relation vector groups of the multiple position points to obtain the merged connectivity relation vector group of the multiple position points, and the merged connectivity relation vector group corresponds to at least one position point among the multiple position points.
[0149] In a virtual scene, the number of position points is relatively large, and the light probes corresponding to adjacent position points may be the same. In this case, the terminal can merge the connectivity relation vector groups of the position points corresponding to the same light probe, thereby reducing the number of stored connectivity relation vector groups.
[0150] For example, the terminal merges the same connectivity relation vectors in the connectivity relation vector groups of the multiple position points into one connectivity relation vector group. The terminal uses an Indirection texture to indicate the correspondence between the merged connectivity relation vector group and the position points. For instance, the terminal scans the Mask Volume in M×M data blocks, merges the data blocks with the same data into one data block, thereby constructing a compressed data block Atlas, and uses the Indirection texture to save the index of the data block in the Atlas. This method can compress the size of the Mask Volume to less than 10% of the original size, making the overhead of the Mask Volume acceptable.
[0151] 305. The terminal bakes the virtual scene based on the connectivity relation vector group of the position points.
[0152] In a possible implementation, for the static virtual objects in the virtual scene, the terminal bakes the static objects based on the connectivity relation vector groups of multiple position points on the static virtual objects and the light maps of the static virtual objects.
[0153] Among them, the process of baking the static object is also the process of baking the connectivity relation vector groups of multiple position points on the static object and the light map onto the surface of the static object. Through baking, the amount of computation during subsequent rendering can be reduced, thereby improving the rendering efficiency. In some embodiments, the above implementation is also the process in which the terminal bakes the Mask Map and the light map of the static object Figure 1 onto the surface of the static object together.
[0154] In a possible implementation, for the dynamic objects in the virtual scene, the terminal bakes the dynamic objects based on the connectivity relation vector groups of multiple position points on the dynamic objects.
[0155] Among them, the process of baking the dynamic object is also the process of baking the connectivity relation vector groups of multiple position points on the dynamic object onto the surface of the dynamic object. Through baking, the amount of computation during subsequent rendering can be reduced, thereby improving the rendering efficiency. In some embodiments, the above implementation is also the process in which the terminal bakes the Mask Volume of the dynamic object onto the surface of the dynamic object. Here, the dynamic object refers to an object that moves freely in the virtual scene.
[0156] It should be noted that, in the process of describing the above steps 301-305, the example is that the terminal executes the above steps 301-305. In other possible embodiments, the above steps 301-305 may also be executed by the server. For example, if the server is a cloud baking platform, the server can realize the baking of the virtual scene by executing the above steps 301-305.
[0157] Optionally, after step 305, the terminal can further execute the following step 306. It should be noted that step 306 is the rendering process of the virtual scene. The terminal executing step 306 can be the same terminal as the above steps 301-305, or it can be other terminals. For example, as described in the real-time environment, the first terminal executes the above steps 301-305, and the second terminal executes step 306. Or, the following step 306 is executed by the server. The embodiments of the present application do not limit the execution entity.
[0158] 306. The terminal renders the multiple position points based on the connectivity relationship vector group of the position points and the textures of the multiple light probes.
[0159] In a possible implementation manner, the terminal determines at least one target light probe connected to the position point from the light probes adjacent to the position point based on the connectivity relationship vector group of the position point. The terminal samples the textures of the at least one target light probe at the position point to obtain the light information of the at least one target light probe at the position point. The terminal fuses the light information of the at least one target light probe at the position point to obtain the target light information of the position point.
[0160] Wherein, during the rendering process, this position point is also called a Render Point.
[0161] In this implementation manner, the terminal can quickly determine the target light probe through the connectivity relationship vector group of the position point, and thus perform rendering based on the light information of the target light probe. Since the target light probe is a light probe adjacent to and connected to the position point, using the light information of the target light probe for rendering can achieve a more realistic light effect.
[0162] To describe the above implementation manner more clearly, the above implementation manner will be described in three parts below.
[0163] The first part: The terminal determines at least one target light probe connected to the position point from the light probes adjacent to the position point based on the connectivity relationship vector group of the position point.
[0164] In a possible implementation, the terminal determines the light probes adjacent to the position point and the connectivity relationship vector of the light probe in the virtual scene. The terminal compares the connectivity relationship vector in the connectivity relationship vector group of the position point with the light probes adjacent to the position point and the connectivity relationship vector of the light probe, and determines at least one target light probe from the light probes adjacent to the position point. That is, when the connectivity relationship vector group of any light probe adjacent to the position point is stored in the connectivity relationship vector group of the position point, the light probe is determined as a target light probe of the position point. When the connectivity relationship vector of any light probe adjacent to the position point is not stored in the connectivity relationship vector group of the position point, the light probe is not a target light probe of the position point.
[0165] In a possible implementation, the connectivity relationship vector group of the position point further includes the connectivity parameter between the position point and the adjacent light probes. The terminal determines at least one target light probe from the light probes adjacent to the position point based on the connectivity parameter. For example, for the light probes adjacent to the position point, when the connectivity parameter of the adjacent light probe is greater than or equal to the connectivity parameter threshold, the terminal determines the adjacent light probe as a target light probe. When the connectivity parameter of the adjacent light probe is less than the connectivity parameter threshold, the terminal does not determine the adjacent light probe as a target light probe. Since the connectivity parameter threshold is set by the technician according to the actual situation, the technician can change the lighting at the position point by adjusting the connectivity parameter threshold.
[0166] Second part: The terminal samples the texture of the at least one target light probe at the position point to obtain the lighting information of the at least one target light probe at the position point.
[0167] Among them, the lighting information is used to reflect information such as the lighting color and intensity of the target light probe at the position point. When sampling the texture of the target light probe, the target light probe can be regarded as a light source for sampling.
[0168] In some embodiments, the lighting information of at least one target light probe adjacent to the position point is stored in the same texture. The terminal can obtain the lighting information of at least one target light probe at the position point by performing 1 time of hardware-accelerated trilinear interpolation sampling from the texture, which greatly reduces the number of samplings.
[0169] Third part: The terminal fuses the lighting information of the at least one target light probe at the position point to obtain the target lighting information of the position point.
[0170] In a possible implementation, the terminal adds up the lighting information of the at least one target lighting probe at this position point to obtain the target lighting information at this position point.
[0171] In this implementation, the terminal can directly add up the lighting information of the at least one target lighting probe at this position point to obtain the target lighting information at this position point, with relatively high speed and efficiency.
[0172] In a possible implementation, the terminal performs weighted summation on the lighting information of the at least one target lighting probe at this position point based on the lighting weight between the at least one target lighting probe and this position point, to obtain the target lighting information at this position point, where the lighting weight is negatively correlated with the distance between the target lighting probe and this position point.
[0173] In this implementation, the terminal can directly perform weighted summation on the lighting information of the at least one target lighting probe at this position point to obtain the target lighting information at this position point, and the accuracy of the target lighting information at this position point is relatively high.
[0174] In some embodiments, when this position point is located on a dynamic object in the virtual scene, the terminal can also project the dynamic object onto the virtual ground and use the connected relationship vector group corresponding to the virtual ground to render the position points on the dynamic object. In this way, when the position of the dynamic object changes, the connected relationship vector group can also be obtained in a timely manner, so as to obtain a better lighting effect.
[0175] It should be noted that the above step 306 is described by taking the rendering of a position point in the virtual scene as an example. The method for the terminal to render other position points in the virtual scene belongs to the same inventive concept as the method for rendering this position point, and the implementation process will not be elaborated.
[0176] The following will combine Figure 4 and the above steps 301 - 306 to describe the technical solution provided by the embodiments of the present application.
[0177] See Figure 4, during the rendering process, for the position point 401 in the virtual scene, there are four light probes around it, namely light probe 402, light probe 403, light probe 404, and light probe 405. Among them, light probe 402, light probe 403, and light probe 404 belong to the same light probe group, and light probe 405 belongs to another light probe group. The two light probe groups are separated by the virtual wall 406 in the virtual scene. That is, light probe 402, light probe 403, and light probe 404 are interconnected with each other, and there is no connection between light probe 402, light probe 403, light probe 404 and light probe 405. This position point 401 is connected to light probe 402, light probe 403, and light probe 404. Then, the connection relationship vector group (Mask) of this position point 401 also includes the connection relationship vectors (color vectors) of light probe 402, light probe 403, and light probe 404. When rendering this position point 401 subsequently, sample the light information of light probe 402, light probe 403, and light probe 404 at this position point 401, and do not sample the light information of light probe 405.
[0178] All the above optional technical solutions can be combined arbitrarily to form the optional embodiments of the present application, which will not be elaborated one by one here.
[0179] When using the solutions in the related technologies, there is a serious problem of light leakage. The manifestation of light leakage in the rendering result is the generation of unwanted light points in the dark areas and obvious and unnatural local darkening in the bright areas. For example, the virtual scene includes a virtual wall. On one side of the virtual wall is the outdoor with a virtual light source of relatively high brightness, and on the other side of the virtual wall is the indoor without a virtual light source. In the case of light leakage, there will be unwanted light points on the indoor side of the virtual wall, and there will also be unnatural local darkening on the outdoor side of the virtual wall. Through the technical solutions provided by the embodiments of the present application, the phenomenon of light leakage in the virtual scene can be eliminated.
[0180] During the experiment, two terminals were used. Terminal 1 was equipped with an i9-9900K processor and an RTX3070 graphics card, and Terminal 2 was equipped with a Ryzen 7 1800X processor and a GTX1080ti graphics card. Both terminals were equipped with 32GB of system memory. As can be seen from Table 1 below, the technical solutions provided by the embodiments of the present application have a time overhead close to the baseline light leakage GI (Global Illumination) during rendering and are significantly lower than the light leakage of the visibility-based GI (a comparative solution) scheme.
[0181] Table 1
[0182]
[0183]
[0184] See Figure 5 , the top row is the final rendering result, the middle row is the lighting result without post-processing, and the bottom row is the difference between the lighting result and the annotated image. In Figure 5 , (a) is the original algorithm, and obvious light leakage can be seen on the ceiling and floor; (b) is the rendering result rendered using RTXGI (a comparison method); (c) and (d) are both rendering results adopting the technical solution provided by the embodiment of the present application, wherein (c) only uses geometric information to divide lighting probes, while (d) also considers the difference in lighting information; (e) is the light leakage-free result rendered using light maps.
[0185] It can be seen that the technical solution provided by the embodiment of the present application can effectively suppress light leakage, and the accuracy of the final rendering is better than that of the RTXGI algorithm.
[0186] Figure 6 Shows the effect of suppressing light leakage of dynamic objects by the technical solution provided by the embodiment of the present application. In Figure 6 , a is the effect diagram without adopting the technical solution provided by the embodiment of the present application, b is the effect diagram adopting the technical solution provided by the embodiment of the present application, and c is a comparison diagram of local details. In c, the upper part is the effect diagram without adopting the technical solution provided by the embodiment of the present application, and the lower part is the effect diagram adopting the technical solution provided by the embodiment of the present application.
[0187] Through the technical solution provided by the embodiment of the present application, when baking a virtual scene, based on the connectivity relationship between multiple lighting probes, the connectivity relationship vectors of multiple lighting probes are determined. Based on the connectivity relationship between multiple position points in the virtual scene and adjacent lighting probes, a connectivity relationship vector group of multiple position points is determined. The connectivity relationship vectors stored in the connectivity relationship vector group are the connectivity relationship vectors of the lighting probes connected to the corresponding position points, that is, the connectivity relationship vectors of the lighting probes that will affect the lighting of the position points. Based on the connectivity relationship vector group of multiple position points, the virtual scene is baked, so that the connectivity relationship vector group of multiple position points is pre-bound to the position points. Since the connectivity relationship vector group of multiple position points can reflect the connectivity relationship between multiple position points and adjacent lighting probes, when rendering based on the connectivity relationship vector group of multiple position points subsequently, more accurate lighting information can be obtained, thereby improving the authenticity of lighting.
[0188] The embodiment of the present application provides a method for suppressing light leakage in global illumination technology for light probes. Compared with the light leakage suppression method based on the bounding volume, the method provided by the embodiment of the present application can automatically preprocess the virtual scene during the baking stage, so it can save labor costs and ensure the synchronization of the virtual scene and light information at the same time; compared with the light leakage suppression method based on visibility, the method provided by the embodiment of the present application avoids the operations of depth information sampling and judgment during runtime, and at the same time, by splitting the light probes with different connectivity relation vector values into different textures, the texture sampling times are reduced as much as possible, and the overhead is reduced, so that this method can be applied to mobile games.
[0189] Figure 7 is a schematic structural diagram of a baking device for a virtual scene provided by an embodiment of the present application. Refer to Figure 7 The device includes: a connectivity relation vector determination module 701, a connectivity relation vector group determination module 702, and a baking module 703.
[0190] The connectivity relation vector determination module 701 is configured to determine the connectivity relation vectors of multiple light probes in the virtual scene based on the connectivity relations between the multiple light probes.
[0191] The connectivity relation vector group determination module 702 is configured to determine the connectivity relation vector group of a position point in the virtual scene based on the connectivity relations between the position point in the virtual scene and the light probes adjacent to the position point. The connectivity relation vector group includes the connectivity relation vectors of the light probes adjacent to and connected to the position point.
[0192] The baking module 703 is configured to bake the virtual scene based on the connectivity relation vector group of the position point.
[0193] In a possible implementation manner, the connectivity relation vector determination module 701 is configured to divide the multiple light probes into multiple light probe groups based on the connectivity relations between the multiple light probes in the virtual scene, and the light probes in each light probe group are connected to each other. Determine the connectivity relation vectors of the light probes in the multiple light probe groups. The connectivity relation vectors of the light probes in the same light probe group are the same, and the connectivity relation vectors of the light probes in different light probe groups are orthogonal to each other.
[0194] In a possible implementation manner, the connectivity relation vector determination module 701 is configured to perform any one of the following:
[0195] For a first light probe and a second light probe among the multiple light probes, when the connection line between the first light probe and the second light probe is not blocked by any virtual object, divide the first light probe and the second light probe into the same light probe group.
[0196] When the line connecting the first light probe and the second light probe is blocked by any virtual object, the first light probe and the second light probe are divided into different light probe groups.
[0197] In a possible implementation, the connection relationship vector determination module 701 is configured to perform any one of the following:
[0198] For the first light probe and the second light probe among the multiple light probes, when the line connecting the first light probe and the second light probe is not blocked by any virtual object or is only blocked by the first type of virtual object, the first light probe and the second light probe are divided into the same light probe group, and the first type of virtual object is a transparent virtual object in the virtual scene.
[0199] When the line connecting the first light probe and the second light probe is blocked by any second type of virtual object, the first light probe and the second light probe are divided into different light probe groups, and the second type of virtual object is an opaque virtual object in the virtual scene.
[0200] In a possible implementation, the connection relationship vector determination module 701 is configured to assign an initial connection relationship vector to the light probes in the multiple light probe groups based on the relative position relationship between the multiple light probe groups. The light probes in each light probe group have the same initial connection relationship vector, and the light probes in any two adjacent and non-connected light probe groups among the multiple light probe groups have different initial connection relationship vectors; the initial connection relationship vectors of the light probes in the multiple light probe groups are optimized by using the simulated annealing method to obtain the connection relationship vectors of the light probes in the multiple light probe groups.
[0201] In a possible implementation, the connection relationship vector group determination module 702 is configured to perform any one of the following:
[0202] When the position point is connected to the adjacent light probes, the connection relationship vectors of the adjacent light probes of the position point are added to the connection relationship vector group of the position point.
[0203] When the position point is not connected to the adjacent light probes, the connection relationship vectors of the adjacent light probes of the position point are not added to the connection relationship vector group of the position point.
[0204] In a possible implementation, the device further includes:
[0205] A connection relationship determination module, configured to perform a ray detection on the light probes adjacent to the position point based on the position point, and determine the connection relationship between the position point and the adjacent light probes.
[0206] In a possible implementation, the connectivity relationship determination module is configured to emit a ray starting from the position point to a light probe adjacent to the position point. When the ray contacts any virtual object, it is determined that the position point is not connected to the adjacent light probe. When the ray does not contact any virtual object, it is determined that the position point is connected to the adjacent light probe.
[0207] In a possible implementation, the connectivity relationship determination module is configured to emit a ray starting from the position point to a light probe adjacent to the position point. When the ray does not contact any virtual object or only contacts the first type of virtual object in the virtual scene, it is determined that the position point is connected to the adjacent light probe, where the first type of virtual object is a transparent virtual object in the virtual scene. When the ray contacts any second type of virtual object in the virtual scene, it is determined that the position point is not connected to the adjacent light probe, where the second type of virtual object is an opaque virtual object in the virtual scene.
[0208] In a possible implementation, the baking module 703 is configured to bake the static virtual object in the virtual scene based on the connectivity relationship vector group of multiple position points on the static virtual object and the light map of the static virtual object. For the dynamic object in the virtual scene, bake the dynamic object based on the connectivity relationship vector group of multiple position points on the dynamic object.
[0209] In a possible implementation, the number of the position points is multiple, and the device further includes:
[0210] A position point merging module, configured to merge the same connectivity relationship vector groups in the connectivity relationship vector groups of multiple position points to obtain the merged connectivity relationship vector group of the multiple position points, and the merged connectivity relationship vector group corresponds to at least one position point among the multiple position points.
[0211] In a possible implementation, the device further includes:
[0212] A rendering module, configured to render the multiple position points based on the connectivity relationship vector group of the position points and the textures of the multiple light probes.
[0213] In a possible implementation, the rendering module is configured to determine at least one target light probe connected to the position point from the light probes adjacent to the position point based on the connectivity relation vector group of the position point. Sample the textures of the at least one target light probe at the position point to obtain the light information of the at least one target light probe at the position point. Fuse the light information of the at least one target light probe at the position point to obtain the target light information of the position point.
[0214] In a possible implementation, the rendering module is configured to perform any one of the following:
[0215] Add the light information of the at least one target light probe at the position point to obtain the target light information of the position point.
[0216] Based on the light weight between the at least one target light probe and the position point, perform weighted summation on the light information of the at least one target light probe at the position point to obtain the target light information of the position point, where the light weight is negatively correlated with the distance between the target light probe and the position point.
[0217] It should be noted that when baking a virtual scene by the baking device for the virtual scene provided in the above embodiment, only the above division of each functional module is used for illustration. In practical applications, the above functions can be assigned to different functional modules according to needs, that is, the internal structure of the computer device is divided into different functional modules to complete all or part of the functions described above. In addition, the image generation device provided in the above embodiment and the image generation method embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be elaborated here.
[0218] Through the technical solution provided in the embodiments of the present application, when baking a virtual scene, based on the connectivity relationship between multiple light probes, determine the connectivity relationship vectors of the multiple light probes. Based on the connectivity relationship between multiple position points in the virtual scene and adjacent light probes, determine the connectivity relationship vector group of the multiple position points. The connectivity relationship vectors stored in the connectivity relationship vector group are the connectivity relationship vectors of the light probes connected to the corresponding position points, that is, the connectivity relationship vectors of the light probes that will affect the lighting of the position points. Bake the virtual scene based on the connectivity relationship vector group of the multiple position points, so that the connectivity relationship vector group of the multiple position points is pre-bound to the position points. Since the connectivity relationship vector group of the multiple position points can reflect the connectivity relationship between the multiple position points and adjacent light probes, when rendering based on the connectivity relationship vector group of the multiple position points subsequently, more accurate light information can be obtained, thereby improving the realism of the lighting.
[0219] An embodiment of the present application provides a computer device for executing the above method. The computer device can be implemented as a terminal or a server. First, the structure of the terminal will be introduced below:
[0220] Figure 8 FIG. 4 is a schematic structural diagram of a terminal provided by an embodiment of the present application. Generally, the terminal 800 includes one or more processors 801 and one or more memories 802.
[0221] The processor 801 may include one or more processing cores, such as a quad-core processor or an octa-core processor. The processor 801 may be implemented in at least one of the following hardware forms: DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 801 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the wake state, also known as the CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 801 may be integrated with a GPU (Graphics Processing Unit), and the GPU is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 801 may also include an AI (Artificial Intelligence) processor, which is used to process computational operations related to machine learning.
[0222] The memory 802 may include one or more computer-readable storage media, and the computer-readable storage media may be non-transitory. The memory 802 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices and flash storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 802 is used to store at least one computer program, and the at least one computer program is used to be executed by the processor 801 to implement the baking method of the virtual scene provided in the method embodiment of the present application.
[0223] In some embodiments, the terminal 800 may further optionally include: a peripheral device interface 803 and at least one peripheral device. The processor 801, the memory 802, and the peripheral device interface 803 may be connected by a bus or signal lines. Each peripheral device may be connected to the peripheral device interface 803 through a bus, signal lines, or a circuit board. Specifically, the peripheral device includes at least one of a radio frequency circuit 804, a display screen 805, a camera assembly 806, an audio circuit 807, and a power supply 808.
[0224] The peripheral device interface 803 can be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 801 and the memory 802. In some embodiments, the processor 801, the memory 802, and the peripheral device interface 803 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 801, the memory 802, and the peripheral device interface 803 can be implemented on a separate chip or circuit board, and this embodiment does not limit this.
[0225] The radio frequency circuit 804 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 804 communicates with a communication network and other communication devices through electromagnetic signals. The radio frequency circuit 804 converts an electrical signal into an electromagnetic signal for transmission, or converts a received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 804 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, and so on.
[0226] The display screen 805 is used to display a UI (User Interface). The UI may include graphics, text, icons, videos, and any combination thereof. When the display screen 805 is a touch display screen, the display screen 805 also has the ability to collect touch signals on or above the surface of the display screen 805. The touch signal can be input to the processor 801 as a control signal for processing. At this time, the display screen 805 can also be used to provide virtual buttons and / or a virtual keyboard, also known as soft buttons and / or a soft keyboard.
[0227] The camera assembly 806 is used to collect images or videos. Optionally, the camera assembly 806 includes a front camera and a rear camera. Generally, the front camera is set on the front panel of the terminal, and the rear camera is set on the back of the terminal.
[0228] The audio circuit 807 may include a microphone and a speaker. The microphone is used to collect sound waves of the user and the environment, and convert the sound waves into electrical signals for input to the processor 801 for processing, or input to the radio frequency circuit 804 to achieve voice communication.
[0229] The power supply 808 is used to supply power to each component in the terminal 800. The power supply 808 can be alternating current, direct current, a disposable battery, or a rechargeable battery.
[0230] In some embodiments, the terminal 800 further includes one or more sensors 809. The one or more sensors 809 include, but are not limited to: an acceleration sensor 810, a gyroscope sensor 811, a pressure sensor 812, an optical sensor 813, and a proximity sensor 814.
[0231] The acceleration sensor 810 can detect the magnitudes of accelerations on the three coordinate axes of the coordinate system established with the terminal 800.
[0232] The gyroscope sensor 811 can detect the body direction and rotation angle of the terminal 800. The gyroscope sensor 811 can cooperate with the acceleration sensor 810 to collect the 3D actions of the user on the terminal 800.
[0233] The pressure sensor 812 can be disposed on the side frame of the terminal 800 and / or the lower layer of the display screen 805. When the pressure sensor 812 is disposed on the side frame of the terminal 800, it can detect the holding signal of the user on the terminal 800, and the processor 801 can perform left / right hand recognition or quick operation according to the holding signal collected by the pressure sensor 812. When the pressure sensor 812 is disposed on the lower layer of the display screen 805, the processor 801 can control the operable controls on the UI interface according to the pressure operation of the user on the display screen 805.
[0234] The optical sensor 813 is used to collect the ambient light intensity. In one embodiment, the processor 801 can control the display brightness of the display screen 805 according to the ambient light intensity collected by the optical sensor 813.
[0235] The proximity sensor 814 is used to collect the distance between the user and the front of the terminal 800.
[0236] Those skilled in the art can understand that Figure 8 the structure shown in does not constitute a limitation on the terminal 800, and it may include more or fewer components than shown in the figure, or combine certain components, or adopt a different component layout.
[0237] The above computer device can also be implemented as a server. The structure of the server will be introduced below:
[0238] Figure 9It is a schematic structural diagram of a server provided by an embodiment of the present application. The server 900 may vary greatly due to different configurations or performances, and may include one or more processors (Central Processing Units, CPUs) 901 and one or more memories 902. Among them, at least one computer program is stored in the one or more memories 902, and the at least one computer program is loaded and executed by the one or more processors 901 to implement the methods provided in the above-mentioned method embodiments. Of course, the server 900 may also have components such as wired or wireless network interfaces, keyboards, and input / output interfaces for input and output. The server 900 may also include other components for implementing device functions, which will not be elaborated here.
[0239] In an exemplary embodiment, a computer-readable storage medium is also provided, such as a memory including a computer program. The above computer program can be executed by a processor to complete the baking method of the virtual scenario in the above embodiment. For example, the computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a Compact Disc Read-Only Memory (CD-ROM), magnetic tape, floppy disk, and optical data storage device, etc.
[0240] In an exemplary embodiment, a computer program product or a computer program is also provided. The computer program product or the computer program includes program code, and the program code is stored in a computer-readable storage medium. The processor of the computer device reads the program code from the computer-readable storage medium, and the processor executes the program code, so that the computer device executes the methods provided in the above various optional implementation manners.
[0241] In some embodiments, the computer program involved in the embodiments of the present application may be deployed to be executed on one computer device, or on multiple computer devices located at one place. Or, it may be executed on multiple computer devices distributed at multiple places and interconnected through a communication network. The multiple computer devices distributed at multiple places and interconnected through a communication network may form a blockchain system.
[0242] Those of ordinary skill in the art can understand that all or part of the steps for implementing the above embodiments can be completed by hardware, or can be completed by a program instructing relevant hardware. The program can be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk, or an optical disc, etc.
[0243] The above are only optional embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present application shall be included within the protection scope of the present application.
Claims
1. A baking method for a virtual scene, characterized in that, The method includes: Based on the connectivity relationship between multiple light probes in a virtual scene, determining a connectivity relationship vector of the multiple light probes, where the connectivity relationship indicates the visibility between light probes, and the connectivity relationship vector is used to represent the connectivity relationship between the multiple light probes; Based on the position point in the virtual scene and the connectivity relationship between the position point and the adjacent light probes, determining a connectivity relationship vector group of the position point, where the connectivity relationship vector group includes the connectivity relationship vectors of the light probes adjacent to and connected to the position point; Based on the connectivity relationship vector group of the position point, baking the virtual scene.
2. The method according to claim 1, characterized in that, The determining the connectivity relationship vector of the multiple light probes based on the connectivity relationship between multiple light probes in a virtual scene includes: Based on the connectivity relationship between multiple light probes in the virtual scene, dividing the multiple light probes into multiple light probe groups, where the light probes in each light probe group are connected to each other; Determining the connectivity relationship vectors of the light probes in the multiple light probe groups, where the connectivity relationship vectors of the light probes in the same light probe group are the same, and the connectivity relationship vectors of the light probes in different light probe groups are orthogonal to each other.
3. The method according to claim 2, wherein The dividing the multiple light probes into multiple light probe groups based on the connectivity relationship between multiple light probes in the virtual scene includes any one of the following: For a first light probe and a second light probe among the multiple light probes, when the line connecting the first light probe and the second light probe is not blocked by any virtual object, dividing the first light probe and the second light probe into the same light probe group; When the line connecting the first light probe and the second light probe is blocked by any virtual object, dividing the first light probe and the second light probe into different light probe groups.
4. The method according to claim 2, wherein The dividing the multiple light probes into multiple light probe groups based on the connectivity relationship between multiple light probes in the virtual scene includes any one of the following: For a first light probe and a second light probe among the multiple light probes, when the line connecting the first light probe and the second light probe is not blocked by any virtual object or is only blocked by a first type of virtual object, dividing the first light probe and the second light probe into the same light probe group, where the first type of virtual object is a transparent virtual object in the virtual scene; When the line connecting the first light probe and the second light probe is blocked by any second type of virtual object, dividing the first light probe and the second light probe into different light probe groups, where the second type of virtual object is an opaque virtual object in the virtual scene.
5. The method according to claim 2, characterized in that The determining the connectivity relationship vectors of the light probes in the multiple light probe groups includes: Based on the relative position relationships among the multiple light probe groups, assign an initial connectivity relationship vector to the light probes in the multiple light probe groups. The light probes in each light probe group have the same initial connectivity relationship vector, and the light probes in any two adjacent and non-connected light probe groups among the multiple light probe groups have different initial connectivity relationship vectors; Use the simulated annealing method to optimize the initial connectivity relationship vectors of the light probes in the multiple light probe groups to obtain the connectivity relationship vectors of the light probes in the multiple light probe groups.
6. The method according to claim 1, characterized in that, The determining the connectivity relationship vector group of the position point based on the position point in the virtual scene and the connectivity relationship between the position point and the adjacent light probes includes any one of the following: When the position point is connected to the adjacent light probes of the position point, add the connectivity relationship vectors of the adjacent light probes of the position point to the connectivity relationship vector group of the position point; When the position point is not connected to the adjacent light probes of the position point, do not add the connectivity relationship vectors of the adjacent light probes of the position point to the connectivity relationship vector group of the position point.
7. The method according to claim 1, wherein Before the determining the connectivity relationship vector group of the position point based on the position point in the virtual scene and the connectivity relationship between the position point and the adjacent light probes, the method further includes: Based on the position point, perform ray detection on the light probes adjacent to the position point to determine the connectivity relationship between the position point and the adjacent light probes.
8. The method according to claim 7, characterized in that, The performing ray detection on the light probes adjacent to the position point based on the position point to determine the connectivity relationship between the position point and the adjacent light probes includes: Taking the position point as the starting point, emit a ray towards the light probes adjacent to the position point; When the ray contacts any virtual object, determine that the position point is not connected to the adjacent light probes; When the ray does not contact any virtual object, determine that the position point is connected to the adjacent light probes.
9. The method according to claim 7, wherein The performing ray detection on the light probes adjacent to the position point based on the position point to determine the connectivity relationship between the position point and the adjacent light probes includes: Taking the position point as the starting point, emit a ray towards the light probes adjacent to the position point; When the ray does not contact any virtual object or only contacts the first type of virtual objects in the virtual scene, determine that the position point is connected to the adjacent light probes, where the first type of virtual objects are the transparent virtual objects in the virtual scene; When the ray contacts any second type of virtual object in the virtual scene, determine that the position point is not connected to the adjacent light probes, where the second type of virtual objects are the opaque virtual objects in the virtual scene.
10. The method according to claim 1, wherein The baking the virtual scene based on the connectivity relationship vector group of the position point includes: For the static virtual objects in the virtual scene, bake the static virtual objects based on the connectivity relationship vector groups of multiple position points on the static virtual objects and the light maps of the static virtual objects; For the dynamic objects in the virtual scene, bake the dynamic objects based on the connected relationship vector group of multiple position points on the dynamic objects.
11. The method according to claim 1, characterized in that, The number of the position points is multiple. Before baking the virtual scene based on the connected relationship vector group of the position points, the method further includes: Merge the same connected relationship vector groups in the connected relationship vector groups of multiple position points to obtain the merged connected relationship vector group of the multiple position points, and the merged connected relationship vector group corresponds to at least one position point among the multiple position points.
12. The method according to claim 1, characterized in that, After baking the virtual scene based on the connected relationship vector group of the position points, the method further includes: Render the multiple position points based on the connected relationship vector group of the position points and the textures of the multiple light probes.
13. The method according to claim 12, wherein The rendering of the multiple position points based on the connected relationship vector group of the position points and the textures of the multiple light probes includes: Based on the connected relationship vector group of the position points, determine at least one target light probe connected to the position point from the light probes adjacent to the position point; Sample the textures of the at least one target light probe at the position point to obtain the light information of the at least one target light probe at the position point; Fuse the light information of the at least one target light probe at the position point to obtain the target light information of the position point.
14. The method according to claim 13, wherein The fusing of the light information of the at least one target light probe at the position point to obtain the target light information of the position point includes any one of the following: Add the light information of the at least one target light probe at the position point to obtain the target light information of the position point; Based on the light weight between the at least one target light probe and the position point, perform weighted summation on the light information of the at least one target light probe at the position point to obtain the target light information of the position point, and the light weight is negatively correlated with the distance between the target light probe and the position point.
15. A baking device for a virtual scene, characterized in that, The device includes: A connected relationship vector determination module, configured to determine the connected relationship vectors of the multiple light probes based on the connected relationship between the multiple light probes in the virtual scene, where the connected relationship indicates the visibility between the light probes, and the connected relationship vector is used to represent the connected relationship between the multiple light probes; A connected relationship vector group determination module, configured to determine the connected relationship vector group of the position point based on the connected relationship between the position point in the virtual scene and the light probes adjacent to the position point, where the connected relationship vector group includes the connected relationship vectors of the light probes adjacent to and connected to the position point; A baking module, configured to bake the virtual scene based on the connected relationship vector group of the position points.
16. The device according to claim 15, characterized in that, The connected relationship vector determination module is configured to: Based on the connected relationship between the multiple light probes in the virtual scene, divide the multiple light probes into multiple light probe groups, and the light probes in each light probe group are connected to each other; Determine the connectivity relation vectors of the light probes in the multiple light probe groups. The connectivity relation vectors of the light probes in the same light probe group are the same, and the connectivity relation vectors of the light probes in different light probe groups are orthogonal to each other.
17. The device according to claim 16, characterized in that, The connectivity relation vector determination module is used to perform any one of the following: For a first light probe and a second light probe among the multiple light probes, when the line connecting the first light probe and the second light probe is not blocked by any virtual object, divide the first light probe and the second light probe into the same light probe group; When the line connecting the first light probe and the second light probe is blocked by any virtual object, divide the first light probe and the second light probe into different light probe groups.
18. The device according to claim 16, wherein The connectivity relation vector determination module is used to perform any one of the following: For a first light probe and a second light probe among the multiple light probes, when the line connecting the first light probe and the second light probe is not blocked by any virtual object or is only blocked by a first type of virtual object, divide the first light probe and the second light probe into the same light probe group, where the first type of virtual object is a transparent virtual object in the virtual scene; When the line connecting the first light probe and the second light probe is blocked by any second type of virtual object, divide the first light probe and the second light probe into different light probe groups, where the second type of virtual object is an opaque virtual object in the virtual scene.
19. The device according to claim 16, characterized in that, The connectivity relation vector determination module is used to: Based on the relative position relationship between the multiple light probe groups, assign initial connectivity relation vectors to the light probes in the multiple light probe groups. The light probes in each light probe group have the same initial connectivity relation vector, and the light probes in any two adjacent and non-connected light probe groups among the multiple light probe groups have different initial connectivity relation vectors; Use the simulated annealing method to optimize the initial connectivity relation vectors of the light probes in the multiple light probe groups to obtain the connectivity relation vectors of the light probes in the multiple light probe groups.
20. The device according to claim 15, characterized in that The connectivity relation vector group determination module is used to perform any one of the following: When the position point is connected to the adjacent light probes, add the connectivity relation vectors of the adjacent light probes of the position point to the connectivity relation vector group of the position point; When the position point is not connected to the adjacent light probes, do not add the connectivity relation vectors of the adjacent light probes of the position point to the connectivity relation vector group of the position point.
21. The device according to claim 15, characterized in that, The device further includes: A connectivity relation determination module, configured to perform a ray detection on the light probes adjacent to the position point based on the position point, and determine the connectivity relation between the position point and the adjacent light probes.
22. The device according to claim 21, characterized in that, The connectivity relation determination module is used to: Starting from the position point, emit rays towards the light probes adjacent to the position point; When the ray contacts any virtual object, it is determined that the position point is not connected to the adjacent light probe; When the ray does not contact any virtual object, it is determined that the position point is connected to the adjacent light probe.
23. The device according to claim 21, characterized in that, The connection relationship determination module is used for: Taking the position point as the starting point, emitting a ray towards the light probe adjacent to the position point; When the ray does not contact any virtual object or only contacts the first type of virtual object in the virtual scene, it is determined that the position point is connected to the adjacent light probe, and the first type of virtual object is a transparent virtual object in the virtual scene; When the ray contacts any second type of virtual object in the virtual scene, it is determined that the position point is not connected to the adjacent light probe, and the second type of virtual object is an opaque virtual object in the virtual scene.
24. The device according to claim 15, characterized in that, The baking module is used for: For the static virtual objects in the virtual scene, baking the static virtual objects based on the connection relationship vector group of multiple position points on the static virtual objects and the light map of the static virtual objects; For the dynamic objects in the virtual scene, baking the dynamic objects based on the connection relationship vector group of multiple position points on the dynamic objects.
25. The device according to claim 15, characterized in that, The number of the position points is multiple, and the device further includes: A position point merging module, configured to merge the same connection relationship vector groups in the connection relationship vector groups of multiple position points to obtain the merged connection relationship vector group of the multiple position points, and the merged connection relationship vector group corresponds to at least one position point among the multiple position points.
26. The device according to claim 15, characterized in that, The device further includes: A rendering module, configured to render the multiple position points based on the connection relationship vector group of the position points and the textures of the multiple light probes.
27. The device according to claim 26, wherein, The rendering module is used for: Based on the connection relationship vector group of the position points, determining at least one target light probe connected to the position point from the light probes adjacent to the position point; Sampling the textures of the at least one target light probe at the position point to obtain the light information of the at least one target light probe at the position point; Fusing the light information of the at least one target light probe at the position point to obtain the target light information of the position point.
28. The device according to claim 27, characterized in that, The rendering module is used to perform any one of the following: Adding the light information of the at least one target light probe at the position point to obtain the target light information of the position point; Based on the light weight between the at least one target light probe and the position point, performing weighted summation on the light information of the at least one target light probe at the position point to obtain the target light information of the position point, and the light weight is negatively correlated with the distance between the target light probe and the position point.
29. A computer device, characterized in that, The computer device includes one or more processors and one or more memories, and at least one computer program is stored in the one or more memories. The computer program is loaded and executed by the one or more processors to implement the baking method of the virtual scene according to any one of claims 1 to 14.
30. A computer-readable storage medium, characterized in that, At least one computer program is stored in the computer-readable storage medium, and the computer program is loaded and executed by a processor to implement the baking method of the virtual scene according to any one of claims 1 to 14.
31. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the baking method of the virtual scene according to any one of claims 1 to 14.
Citation Information
Patent Citations
Dynamic global illumination method, electronic equipment and computer readable storage medium
CN112712582A
Illumination rendering method and device, computer equipment and storage medium
CN112927341A