Method and device for generating a light probe in a virtual scene
By generating a set of lighting probes based on the ground plane and virtual resources, and removing invalid probes, the problem of unreasonable distribution of lighting probes in large-scale virtual scenes is solved, thereby improving lighting effects and saving resources.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHUHAI KINGSOFT ONLINE GAME TECH CO LTD
- Filing Date
- 2022-09-23
- Publication Date
- 2026-06-26
AI Technical Summary
Existing technologies struggle to flexibly deploy lighting probes in large-scale virtual scenes, resulting in unsatisfactory indirect lighting effects and high computational resource consumption.
A first set of lighting probes is generated based on the ground plane of the virtual scene, a second set of lighting probes is generated by combining the target virtual resources, and invalid probes are eliminated according to the probe optimization rules to form the target lighting probe set, ensuring the reasonable distribution and accuracy of the lighting probes.
It improves the accuracy of lighting probes, reduces the redundancy of invalid probes, lowers computational resource consumption, and enhances the richness of indirect lighting and user experience.
Smart Images

Figure CN115546387B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image rendering technology, and in particular to a method for generating lighting probes in a virtual scene. This application also relates to an apparatus for generating lighting probes in a virtual scene, a computing device, and a computer-readable storage medium. Background Technology
[0002] A light probe is a lighting rendering technique that can be used to collect lighting information received from all directions and then apply that information to the object being rendered, thereby affecting the final lighting effect of the object.
[0003] In virtual scenes, lighting is calculated in two parts: direct lighting and indirect lighting. Direct lighting is the intensity of light hitting an object's surface, while indirect lighting is the intensity of light after it bounces multiple times after hitting an object. Indirect lighting has a significant impact on the lighting effects of game graphics. Using lighting probes to record indirect lighting information is one of the existing technical solutions for handling indirect lighting in scenes. This solution has low performance overhead and a wide range of applications. In large-scale virtual scenes, lighting probes are usually distributed according to the density of objects in the scene. However, in practical applications, the types and sizes of objects in large-scale scenes vary greatly, making it difficult to define the density division dimension for all objects in the world. Current lighting probe tools cannot be flexibly deployed. As the scale of virtual scenes increases and the number of objects in the scene increases, there is an urgent need for a more reasonable lighting probe distribution method to improve the rationality and accuracy of lighting probe distribution, thereby enhancing the richness of indirect lighting effects. Summary of the Invention
[0004] In view of this, embodiments of this application provide a method for generating lighting probes in a virtual scene. This application also relates to an apparatus for generating lighting probes in a virtual scene, a computing device, and a computer-readable storage medium, to solve the aforementioned problems existing in the prior art.
[0005] According to a first aspect of the embodiments of this application, a method for generating a lighting probe in a virtual scene is provided, comprising:
[0006] Receive instructions to generate a lighting probe for the target virtual scene;
[0007] In response to the illumination probe generation command, a first set of illumination probes is generated based on the ground plane of the target virtual scene;
[0008] In the target virtual scene, a target virtual resource is determined, and a second set of lighting probes is generated based on the target virtual resource;
[0009] An initial light probe set is generated based on the first light probe set and the second light probe set;
[0010] Invalid probes in the initial lighting probe set are removed according to the preset probe optimization rules to obtain the target lighting probe set corresponding to the target virtual scene.
[0011] According to a second aspect of the embodiments of this application, an apparatus for generating lighting probes in a virtual scene is provided, comprising:
[0012] The receiving module is configured to receive instructions for generating lighting probes for the target virtual scene.
[0013] The first generation module is configured to generate a first set of lighting probes based on the ground plane of the target virtual scene in response to the lighting probe generation instruction.
[0014] The second generation module is configured to determine target virtual resources in the target virtual scene and generate a second set of lighting probes based on the target virtual resources;
[0015] The synthesis module is configured to generate an initial light probe set based on the first light probe set and the second light probe set;
[0016] The elimination module is configured to eliminate invalid probes in the initial lighting probe set according to preset probe optimization rules, so as to obtain the target lighting probe set corresponding to the target virtual scene.
[0017] According to a third aspect of the embodiments of this application, a computing device is provided, including a memory, a processor, and computer instructions stored in the memory and executable on the processor, wherein the processor executes the computer instructions to implement the steps of a method for generating a lighting probe in a virtual scene.
[0018] According to a fourth aspect of the embodiments of this application, a computer-readable storage medium is provided that stores computer instructions, which, when executed by a processor, implement the steps of a method for generating a lighting probe in a virtual scene.
[0019] The method for generating lighting probes in a virtual scene provided in this application includes receiving a lighting probe generation instruction for a target virtual scene; responding to the lighting probe generation instruction, generating a first lighting probe set based on the ground plane of the target virtual scene; determining a target virtual resource in the target virtual scene and generating a second lighting probe set based on the target virtual resource; generating an initial lighting probe set based on the first lighting probe set and the second lighting probe set; and removing invalid probes from the initial lighting probe set according to a preset probe optimization rule to obtain a target lighting probe set corresponding to the target virtual scene.
[0020] One embodiment of this application generates lighting probes from multiple dimensions, distributes the probes reasonably and accurately to ensure the effectiveness of lighting probe usage, and improves the accuracy of lighting probes. Simultaneously, it optimizes probes according to probe optimization rules, reducing redundancy of invalid lighting probes and alleviating computational resource consumption. During rendering, it can enhance the richness of indirect lighting and improve the user experience. Attached Figure Description
[0021] Figure 1 This is a flowchart of a method for generating a lighting probe in a virtual scene according to an embodiment of this application;
[0022] Figure 2 This is a schematic diagram of a first illumination probe set provided in an embodiment of this application;
[0023] Figure 3 This is a schematic diagram illustrating the target resource scope provided in an embodiment of this application;
[0024] Figure 4 This is a schematic diagram of a third illumination probe set provided in an embodiment of this application;
[0025] Figure 5 This is a schematic diagram of a fourth illumination probe set provided in an embodiment of this application;
[0026] Figure 6 This is a flowchart illustrating a method for generating a lighting probe in a virtual scene applied to a game scene, according to an embodiment of this application.
[0027] Figure 7 A schematic diagram of the structure of a device for generating a lighting probe in a virtual scene is provided in one embodiment of this application;
[0028] Figure 8 This application provides a structural block diagram of a computing device according to one embodiment. Detailed Implementation
[0029] Many specific details are set forth in the following description to provide a full understanding of this application. However, this application can be implemented in many other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this application; therefore, this application is not limited to the specific embodiments disclosed below.
[0030] The terminology used in one or more embodiments of this application is for the purpose of describing particular embodiments only and is not intended to limit the scope of one or more embodiments of this application. The singular forms “a,” “the,” and “the” used in one or more embodiments of this application and in the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” used in one or more embodiments of this application refers to and includes any or all possible combinations of one or more associated listed items.
[0031] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of this application, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of this application, and similarly, second may also be referred to as first. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to a determination."
[0032] First, the terms and concepts involved in one or more embodiments of this application will be explained.
[0033] Light probes are a lighting rendering technique that provides a way to capture and use information about light passing through empty spaces in a scene. So, it is usually done by placing a certain number of light probes in a virtual scene, baking the light information from various directions of the light probes, and at runtime, finding the light probes near virtual objects and generating the corresponding lighting information of the virtual objects in the scene.
[0034] In virtual graphics, lighting is calculated in two parts: direct lighting and indirect lighting. Direct lighting is the intensity of light shining directly onto the surface of an object, while indirect lighting is the intensity of light after it bounces multiple times after hitting the object.
[0035] Indirect lighting has a significant impact on the lighting effects of virtual scenes. Existing indirect lighting techniques generally fall into two categories: one uses voxels to store indirect lighting information, and the other uses lighting probes to record indirect lighting information. Using voxels to store lighting information and calculate indirect lighting in real time incurs high performance overhead and is unusable on low-end devices. Generally, the performance overhead of using lighting probes is acceptable; dynamic objects, static vegetation, and small static objects in the scene can use the lighting information on the probes to calculate indirect lighting. Typically, lighting probes are manually distributed in small-scale scenes, while in large scenes, they are distributed based on the density of objects in the scene—higher density areas have higher probe density, and lower density areas have lower probe density. For large-scale scenes, the types and sizes of objects vary greatly, making it difficult to define the density division dimensions for all objects in the world. Existing automatic lighting probe distribution tools cannot flexibly arrange the layout, and technicians cannot load all virtual objects to participate in the distribution calculation.
[0036] As virtual scenes grow larger and contain more objects, there is an urgent need for a method to distribute probes rationally and accurately, ensuring their effectiveness while improving accuracy and reducing redundancy. Based on this, this application provides a method for generating lighting probes in a virtual scene. This application also relates to an apparatus for generating lighting probes in a virtual scene, a computing device, and a computer-readable storage medium, which will be described in detail in the following embodiments.
[0037] Figure 1 The flowchart illustrates a method for generating a lighting probe in a virtual scene according to an embodiment of this application, specifically including the following steps:
[0038] Step 102: Receive the instruction to generate a lighting probe for the target virtual scene.
[0039] Light probes are a lighting rendering technique that provides a way to capture and use information about light passing through empty spaces in a scene. So, it is usually done by placing a certain number of light probes in a virtual scene, baking the light information from various directions of the light probes, and at runtime, finding the light probes near virtual objects and generating the corresponding lighting information of the virtual objects in the scene.
[0040] The target virtual scene specifically refers to the virtual scene displayed on the terminal's display interface, such as game scenes, animation scenes, movie virtual scenes, etc.
[0041] During the rendering of the target virtual scene, it is necessary to simulate a realistic lighting environment to make the rendered virtual scene more closely resemble a real-life environment. Simulating a realistic lighting environment involves direct lighting and indirect lighting. Indirect lighting refers to the intensity of light after it hits an object and bounces multiple times. When rendering the target virtual scene, lighting probes need to be created in advance. At this point, a lighting probe generation command for the target virtual scene is received. The user's terminal responds to this command by generating lighting probes within the target virtual scene.
[0042] Step 104: In response to the illumination probe generation command, generate a first set of illumination probes based on the ground plane of the target virtual scene.
[0043] Here, the ground plane can be understood as the horizontal plane in the target virtual scene. In the target virtual scene, all virtual objects are created based on the ground plane. The first lighting probe set specifically refers to the set of global lighting probe distributions generated based on the ground plane of the virtual scene.
[0044] Typically, a virtual scene can be divided into multiple grid regions, with lighting probes distributed at preset intervals within each grid region. However, in practical applications, more virtual objects are distributed closer to the ground plane of the virtual scene, such as buildings, hillsides, rivers, and other virtual resources. The further away from the ground plane, the fewer virtual resources there are. Therefore, during the generation of the first set of lighting probes, the density of lighting probes can be appropriately reduced as the height from the ground plane increases, thereby reducing some computational resources.
[0045] Based on this, in the method for generating lighting probes in a virtual scene provided in this application, a first set of lighting probes is generated based on the ground plane of the target virtual scene, including:
[0046] A height detection probe is generated based on the ground plane of the target virtual scene;
[0047] The probe density of the first illumination probe set is determined based on the height probe, wherein the probe density decreases as the height probe increases;
[0048] A first set of illumination probes is generated based on the probe density.
[0049] In the method provided in this application, the height of each probe layer can be customized based on the height of the ground plane, so that the closer to the ground, the greater the density of the light probes, and the farther away from the ground, the smaller the density of the light probes.
[0050] Specifically, after determining the ground plane of the target virtual scene, a height probe can be generated based on the ground plane. The height probe is used to determine the height distance from the ground plane. The closer to the ground plane, the smaller the height probe value, and the farther away from the ground plane, the larger the height probe value.
[0051] The probe density of the first illumination probe set can be determined based on the first illumination probe generation rule and the height probe. Specifically, the first illumination probe generation rule refers to a pre-defined density rule for generating the first illumination probes. For example, the first illumination probe generation rule can be set to (1 meter, 2 meters, 4 meters, 8 meters, 16 meters…), meaning that one layer of illumination probes is set at a height of 1 meter above the ground, another layer at a height of 2 meters, another layer at a height of 4 meters, and so on. It should be noted that in the method provided in this application, the probe density decreases as the value of the height probe increases; that is, the smaller the value of the height probe, the greater the probe density, and vice versa.
[0052] It should be noted that the probe density mentioned in this application refers not only to the height but also to the density on the horizontal plane. For example, a first layer of light probes is set at a height of 1 meter above the ground, and the distance between the first layer of light probes is 1 meter; a second layer of light probes is set at a height of 2 meters above the ground, and the distance between the second layer of light probes is 2 meters, and so on.
[0053] After determining the probe density of the first illumination probe set, the first illumination probe set can be generated based on this probe density. For example, the probe density is "First layer: height 1 meter, spacing 1 meter; Second layer: height 2 meters, spacing 2 meters; Third layer: height 4 meters, spacing 4 meters; Fourth layer: height 8 meters, spacing 8 meters...".
[0054] See Figure 2 , Figure 2 A schematic diagram of a first illumination probe set provided in an embodiment of this application is shown, as follows: Figure 2 As shown, in the target virtual scene, the closer the location is to the ground plane, the greater the density of distributed lighting probes; the farther the location is from the ground plane, the smaller the density of distributed lighting probes.
[0055] Step 106: Determine the target virtual resources in the target virtual scene, and generate a second set of lighting probes based on the target virtual resources.
[0056] Among them, target virtual resources can be understood as virtual resources generated in target virtual scenes. In practical applications, target virtual resources can be humanistic virtual resources automatically generated in virtual scenes according to needs, such as virtual buildings, rivers, etc.
[0057] The target virtual resources are the key parts that need to be processed and rendered in the target virtual scene. For these resources, more light probes need to be deployed. Each increase in the density of light probes makes the rendered image more realistic and detailed. Therefore, a second set of light probes can be generated based on the target virtual resources.
[0058] Specifically, generating a second set of lighting probes based on the target virtual resource includes:
[0059] Determine the target resource range corresponding to the target virtual resource;
[0060] A second set of illumination probes is generated within the target resource area.
[0061] In practical applications, a bounding box can be generated within the target virtual environment based on the target virtual resource. This bounding box encloses the target virtual resource, and the area of the bounding box can be considered the range of the target resource. See also... Figure 3 , Figure 3 A schematic diagram illustrating the target resource scope provided in an embodiment of this application is shown, such as... Figure 3 As shown, several factory buildings can be regarded as target virtual resources. Using the method provided in this application, the target virtual resources can be surrounded by a bounding box, and the area within the bounding box can be regarded as the target resource range corresponding to the several factory buildings.
[0062] After determining the target resource range, the distribution area of the illumination probes can be based on the target resource range, and a second set of illumination probes can be set within the target resource range. It should be noted that the second set of illumination probes does not conflict with the first set of illumination probes. The second set of illumination probes is generated within the target resource range.
[0063] Step 108: Generate an initial light probe set based on the first light probe set and the second light probe set.
[0064] After obtaining the first set of illumination probes and the second set of illumination probes, the two sets can be merged to generate the initial set of illumination probes. Specifically, the initial set of illumination probes refers to the set of unprocessed illumination probes obtained after the illumination probe layout is completed.
[0065] For example, if there are 500 light probes in the first light probe set and 300 light probes in the second light probe set, then by combining the two, an initial light probe set of 800 light probes can be obtained.
[0066] In practical applications, in virtual scenes, besides the main light source, there may be other light sources. These other light sources can also affect objects around the light source. Therefore, the method provided in this application further includes:
[0067] Identify the light source information in the target virtual scene;
[0068] A third set of illumination probes is generated based on the light source information;
[0069] An initial light probe set is generated based on the first light probe set, the second light probe set, and the third light probe set.
[0070] Specifically, the light source information refers to the light source information in the target virtual scene excluding the main light source. The main light source can be understood as a light source such as the sun or moon in the virtual scene. Light source information refers to other light sources in the target virtual scene besides the sun and moon, such as campfires, lamps, fireflies, mobile phone screens, television screens, etc.
[0071] Once the light source information is determined, a light probe can be generated in the direction of the light source, thus generating a third set of light probes. See [link to documentation]. Figure 4 , Figure 4 The diagram shows a third illumination probe set provided in an embodiment of this application. In practical applications, the number of illumination lines and the range of light radiation can be configured to generate the third illumination probe set based on the number of illumination lines and the range of light radiation.
[0072] In practical applications, if the target virtual scene also includes a third lighting probe set, then in the process of generating the initial lighting probe set, in addition to the first and second lighting probe sets, a third lighting probe set also needs to be added.
[0073] In another specific embodiment provided in this application, some areas may be deemed by those skilled in the art to require further reinforcement. Therefore, the method provided in this application can also receive probe layout instructions sent by those skilled in the art, and generate a set of lighting probes in the target virtual scene according to the probe layout instructions. Specifically, the method further includes:
[0074] Receive probe layout instructions;
[0075] A fourth set of illumination probes is generated in response to the probe layout command.
[0076] Specifically, the probe layout command refers to the custom lighting probe command issued by the technician. Specifically, the technician can define a custom area in the target virtual scene. The range of the custom area is not limited and can be a circle, rectangle, or other irregular shape. After the custom area is determined, the fourth lighting probe set can be generated in the custom area according to the custom lighting probe distribution settings.
[0077] See Figure 5 , Figure 5 A schematic diagram of a fourth illumination probe set provided in an embodiment of this application is shown, as follows: Figure 5 In the target virtual scene shown, the technicians delineated a rectangular area, within which a fourth set of illumination probes could be generated according to the preset probe density configuration.
[0078] After generating the fourth illumination probe set, it can be added to the initial illumination probe set for subsequent processing. It's important to note that in practical applications, there is no necessary correlation between the third and fourth illumination probe sets; either one can exist, or both can coexist. That is, in practice, if the third illumination probe set exists, the initial illumination probe set can be generated based on the first, second, third, and fourth illumination probe sets; conversely, if the third illumination probe set does not exist, the initial illumination probe set can be generated based on the first, second, and fourth illumination probe sets.
[0079] This completes the process of deploying and generating a set of lighting probes in the target virtual scene, thus generating an initial set of lighting probes for further processing.
[0080] Step 110: Eliminate invalid probes in the initial lighting probe set according to the preset probe optimization rules to obtain the target lighting probe set corresponding to the target virtual scene.
[0081] Specifically, the preset probe optimization rules refer to the rules for extracting some invalid probes from the initial lighting probe set, thereby obtaining the target lighting probe set corresponding to the target virtual scene. The target lighting probe set can be understood as the set of lighting probes finally generated in the target virtual scene.
[0082] Specifically, invalid probes in the initial illumination probe set are removed according to preset probe optimization rules, including:
[0083] The initial illumination probes in the initial illumination probe set are baked to obtain a probe ball corresponding to each initial illumination probe.
[0084] Invalid probes are identified based on each probe ball and the preset probe optimization rules;
[0085] The invalid probes are removed from the initial set of illumination probes.
[0086] In the method provided in this application, the light probes in the light probe set need to be baked before optimization and extraction. Baking the light probes specifically refers to the effect of light and light energy transmission. The light probes store baking information about the lighting in the scene. After baking each light probe, a probe ball corresponding to each initial light probe can be generated. The probe ball stores the baked light information.
[0087] After obtaining each probe ball, the system can determine which probes are invalid probes according to the preset probe optimization rules, thereby removing invalid probes from the initial illumination probe set and obtaining the final target illumination probe set.
[0088] Specifically, invalid probes are identified based on each probe ball and preset probe optimization rules, including:
[0089] Extract the illumination information for each probe ball;
[0090] Invalid probes are identified based on the illumination information of each probe ball and preset probe optimization rules.
[0091] In practical applications, each probe ball stores corresponding illumination information. The illumination information in each probe ball is extracted, and based on the illumination information of each probe ball and the preset optimization rules, it is further determined which illumination probes are invalid probes.
[0092] Specifically, the preset probe optimization rules include:
[0093] The lighting information meets the preset lighting rules;
[0094] The number of probe balls per unit space is less than a preset density threshold; or
[0095] The distance between two adjacent probe balls is greater than a preset distance threshold.
[0096] Specifically, the preset probe optimization rules can include various schemes, such as:
[0097] 1. Remove probes located inside virtual resources. For example, if the coordinates of a lighting probe are located inside a virtual resource, or if the distance between a lighting probe and the surface of an object is less than a preset threshold, the lighting probe can be identified as an invalid probe.
[0098] 2. Remove probes located below a specified plane. For example, when the coordinates of a light probe are below a preset distance below the specified plane, the light probe is determined to be an invalid probe. In the method provided in this application, the writing plane can be determined to participate in optimization according to the instructions of the technician.
[0099] 3. Remove probes outside the color threshold range. In this method, the light information stored in each probe ball is obtained. When the color in a certain light information does not meet the specified color threshold range, the light probe can be determined to be an invalid probe.
[0100] 4. Remove probes whose distance between probes is less than a threshold. For example, if a target illumination probe is identified, and the distance between the target illumination probe and the reference illumination probe is less than or equal to a preset distance threshold, then the reference illumination probe is identified as an invalid probe.
[0101] 5. Remove probes with excessively high density. For example, if the preset number of illumination probes is 3, but there are actually 5 illumination probes in a unit area, then 2 of them can be identified as invalid probes.
[0102] 6. Eliminate probes on the same plane. For example, if a target illumination probe is identified, search whether the other four illumination probes within a specified distance can form a tetrahedron. If they cannot form a tetrahedron, the target illumination probe is determined to be an invalid probe. If they can form a tetrahedron, it is necessary to further determine whether the distance between these illumination probes meets the preset distance threshold.
[0103] It should be noted that the above-mentioned probe optimization rules can be used in any combination. In this application, the specific combination of probe optimization rules is not limited. After the probe optimization rules are determined, the probe optimization rules are matched sequentially according to the illumination information of each probe ball, thereby filtering and eliminating illuminated probes, reducing the number of invalid probes, and reducing resource consumption.
[0104] In another specific embodiment provided in this application, it also includes:
[0105] The target virtual scene is generated by rendering based on the target lighting probe set, wherein the target lighting probe set includes lighting information corresponding to each lighting probe.
[0106] After obtaining the target lighting probe set, the target virtual scene can be rendered and generated based on the lighting information stored in the target lighting probe set. Specifically, during the rendering of the target virtual scene, the lighting information corresponding to each part is read when rendering each part, and the rendering calculation is performed in combination with the lighting information to generate the target virtual scene.
[0107] Typically, a probe-based lighting renderer obtains lighting information from one of the lighting probes between the surrounding lighting probes in the scene for rendering. Therefore, virtual objects in a virtual scene have constant ambient lighting across their entire surface. This lighting uses spherical harmonics, thus having rotational gradients but no spatial gradients; this is more noticeable in larger game object or particle systems. The lighting on the virtual object matches the lighting from the anchor point. If the virtual object crosses lighting gradients, certain parts of the game object may look incorrect.
[0108] Based on this, the method provided in this application can also use a Light Probe PorxyVolume (LPPV). The LPPV component generates a 3D mesh of interpolated lighting probes within the bounding box. The resolution of this mesh can be specified in the component's UI (User Interface). The spherical harmonic coefficients of the interpolated lighting probes are uploaded to a 3D texture. Subsequently, during rendering, the 3D texture containing the spherical harmonics is sampled to calculate the impact on diffuse ambient lighting, which adds spatial gradients to the probe-lit game object. The lighting probe proxy, independent of the generation and baking of lighting probes, is used for virtual objects to read higher-precision probe information. Using a proxy results in more interpolated probes; the higher the density, the richer the lighting information read by the object.
[0109] The method for generating lighting probes in a virtual scene provided in this application receives a lighting probe generation instruction for a target virtual scene; in response to the lighting probe generation instruction, generates a first lighting probe set based on the ground plane of the target virtual scene; determines a target virtual resource in the target virtual scene and generates a second lighting probe set based on the target virtual resource; generates an initial lighting probe set based on the first and second lighting probe sets; and removes invalid probes from the initial lighting probe set according to a preset probe optimization rule to obtain a target lighting probe set corresponding to the target virtual scene. This method can generate lighting probes from multiple dimensions, distribute the probes reasonably and accurately, ensure the effectiveness of lighting probe usage, improve the accuracy of lighting probes, and optimize probes according to the optimization rules, reducing the redundancy of invalid lighting probes and alleviating the consumption of computational resources. During rendering, it can improve the richness of indirect lighting and enhance the user experience.
[0110] Secondly, as the virtual scene rendering scheme performs data segmentation and supports streaming loading, and uses the lighting probe proxy method for virtual resources with high requirements for lighting accuracy, the richness of indirect lighting is further improved.
[0111] The following is in conjunction with the appendix Figure 6Taking the application of the method for generating lighting probes in a virtual scene provided in this application in a game scene as an example, the method for generating lighting probes in a virtual scene will be further explained. Figure 6 This application provides a flowchart illustrating a method for generating lighting probes in a virtual scene used in game scenarios, according to an embodiment of the present application. The method specifically includes the following steps:
[0112] Step 602: Receive the instruction to generate a lighting probe for the target game scene.
[0113] Step 604: Generate the first set of lighting probes based on the ground plane of the target game scene.
[0114] In the embodiment provided in this application, based on the height of the ground plane of the target game scene, a total of 5 layers of lighting probes are generated. Each layer has 35*35 lighting probes distributed on the plane. The height of the area is 100 meters. The first layer of probes is distributed at a height of 2 meters above the ground, the second layer at 10 meters, the third layer at 25 meters, the fourth layer at 50 meters, and the fifth layer at 90 meters. No probes are placed above 100 meters. In this way, 5 layers of probes are distributed at the height of the ground, but the distribution of probes in each layer is non-linear. The density is higher closer to the ground and lower in open high altitudes.
[0115] Step 606: Identify the target game resources in the target game scene and generate a second set of lighting probes based on the target game resources.
[0116] In the embodiments provided in this application, virtual buildings, mountains, and other game resources in the game scene are identified, and bounding boxes are used to enclose the target game resources. It should be noted that there can be one or more bounding boxes. For example, when the distance between target game resources is less than a threshold, one bounding box can be used to enclose multiple game resources; when the distance between target game resources is greater than or equal to the threshold, different bounding boxes can be used to enclose different game resources respectively. The area within the bounding box can be used as the target range area of the target game resource, and a second set of lighting probes is generated within the target range area.
[0117] Step 608: Identify the light source information in the target game scene and generate a third lighting probe set based on the light source information.
[0118] In the embodiments provided in this application, light sources in the target game scene can be identified, and a third set of lighting probes can be generated based on preset light source information.
[0119] Step 610: Receive the manual marking instruction sent by the user, and generate the fourth set of illumination probes based on the area marked by the manual marking instruction.
[0120] Step 612: Generate an initial light probe set based on the first light probe set, the second light probe set, the third light probe set, and the fourth light probe set.
[0121] Step 614: Bake the light probes in the initial light probe set to obtain the light information corresponding to each light probe.
[0122] Step 616: Based on the preset probe optimization rules and the illumination information corresponding to each illumination probe, determine the invalid probes in the initial illumination probe set.
[0123] Step 618: Remove invalid probes from the initial illumination probe set to obtain the target illumination probe set.
[0124] Step 620: Render and generate the target game scene based on the target lighting probe set.
[0125] This application provides a method to generate lighting probes from multiple dimensions, distribute the probes reasonably and accurately to ensure the effectiveness of lighting probe usage, and improve the accuracy of lighting probes. Simultaneously, it optimizes probes according to probe optimization rules, reducing redundancy of invalid lighting probes and alleviating computational resource consumption. During rendering, it can enhance the richness of indirect lighting and improve the user experience.
[0126] Secondly, as the virtual scene rendering scheme performs data segmentation and supports streaming loading, and uses the lighting probe proxy method for virtual resources with high requirements for lighting accuracy, the richness of indirect lighting is further improved.
[0127] Corresponding to the above-described embodiment of the method for generating lighting probes in a virtual scene, this application also provides an embodiment of an apparatus for generating lighting probes in a virtual scene. Figure 7 This diagram illustrates the structure of a device for generating lighting probes in a virtual scene according to an embodiment of this application. Figure 7 As shown, the device includes:
[0128] The receiving module 702 is configured to receive a lighting probe generation instruction for a target virtual scene;
[0129] The first generation module 704 is configured to generate a first set of lighting probes based on the ground plane of the target virtual scene in response to the lighting probe generation instruction.
[0130] The second generation module 706 is configured to determine target virtual resources in the target virtual scene and generate a second lighting probe set based on the target virtual resources;
[0131] Synthesis module 708 is configured to generate an initial light probe set based on the first light probe set and the second light probe set;
[0132] The elimination module 710 is configured to eliminate invalid probes in the initial lighting probe set according to a preset probe optimization rule, so as to obtain the target lighting probe set corresponding to the target virtual scene.
[0133] Optionally, the device further includes:
[0134] The recognition module is configured to recognize light source information in the target virtual scene;
[0135] The third generation module is configured to generate a third set of illumination probes based on the light source information;
[0136] The synthesis module 708 is further configured to generate an initial light probe set based on the first light probe set, the second light probe set, and the third light probe set.
[0137] Optionally, the device further includes:
[0138] The instruction receiving module is configured to receive probe layout instructions;
[0139] The fourth generation module is configured to generate a fourth set of illumination probes in response to the probe layout instructions;
[0140] The synthesis module 708 is further configured to generate an initial light probe set based on the first light probe set, the second light probe set, the third light probe set, and the fourth light probe set.
[0141] Optionally, the device further includes:
[0142] The instruction receiving module is configured to receive probe layout instructions;
[0143] The fourth generation module is configured to generate a fourth set of illumination probes in response to the probe layout instructions;
[0144] The synthesis module 708 is further configured to generate an initial light probe set based on the first light probe set, the second light probe set, and the fourth light probe set.
[0145] Optionally, the first generation module 704 is further configured to:
[0146] A height detection probe is generated based on the ground plane of the target virtual scene;
[0147] The probe density of the first illumination probe set is determined based on the height probe, wherein the probe density decreases as the height probe increases;
[0148] A first set of illumination probes is generated based on the probe density.
[0149] Optionally, the second generation module 706 is further configured to:
[0150] Determine the target resource range corresponding to the target virtual resource;
[0151] A second set of illumination probes is generated within the target resource area.
[0152] Optionally, the rejection module 710 is further configured to:
[0153] The initial illumination probes in the initial illumination probe set are baked to obtain a probe ball corresponding to each initial illumination probe.
[0154] Invalid probes are identified based on each probe ball and the preset probe optimization rules;
[0155] The invalid probes are removed from the initial set of illumination probes.
[0156] Optionally, the rejection module 710 is further configured to:
[0157] Extract the illumination information for each probe ball;
[0158] Invalid probes are identified based on the illumination information of each probe ball and preset probe optimization rules.
[0159] Optional, preset probe optimization rules include:
[0160] The lighting information meets the preset lighting rules;
[0161] The number of probe balls per unit space is less than a preset density threshold; or
[0162] The distance between two adjacent probe balls is greater than a preset distance threshold.
[0163] Optionally, the device further includes:
[0164] The rendering module is configured to render and generate the target virtual scene based on the target lighting probe set, wherein the target lighting probe set includes lighting information corresponding to each lighting probe.
[0165] The lighting probe generation apparatus for a virtual scene provided in this application receives a lighting probe generation instruction for a target virtual scene; in response to the lighting probe generation instruction, it generates a first lighting probe set based on the ground plane of the target virtual scene; it determines a target virtual resource in the target virtual scene and generates a second lighting probe set based on the target virtual resource; it generates an initial lighting probe set based on the first and second lighting probe sets; and it removes invalid probes from the initial lighting probe set according to a preset probe optimization rule to obtain a target lighting probe set corresponding to the target virtual scene. This apparatus can generate lighting probes from multiple dimensions, distribute the probes reasonably and accurately, ensure the effectiveness of lighting probe usage, improve the accuracy of lighting probes, and optimize probes according to the probe optimization rule, reducing the redundancy of invalid lighting probes and alleviating the consumption of computing resources. During rendering, it can improve the richness of indirect lighting and enhance the user experience.
[0166] Secondly, as the virtual scene rendering scheme performs data segmentation and supports streaming loading, and uses the lighting probe proxy method for virtual resources with high requirements for lighting accuracy, the richness of indirect lighting is further improved.
[0167] The above is a schematic scheme of a lighting probe generation device in a virtual scene according to this embodiment. It should be noted that the technical solution of the lighting probe generation device in the virtual scene and the technical solution of the lighting probe generation method in the virtual scene described above belong to the same concept. For details not described in detail in the technical solution of the lighting probe generation device in the virtual scene, please refer to the description of the technical solution of the lighting probe generation method in the virtual scene described above.
[0168] Figure 8 A structural block diagram of a computing device 800 according to an embodiment of this application is shown. The components of the computing device 800 include, but are not limited to, a memory 810 and a processor 820. The processor 820 is connected to the memory 810 via a bus 830, and a database 850 is used to store data.
[0169] The computing device 800 also includes an access device 840, which, together with the computing device 800, comprises one or more networks 860. Examples of these networks include combinations of public switched telephone networks (PSTN), local area networks (LAN), wide area networks (WAN), personal area networks (PAN), or communication networks such as the Internet. The access device 840 includes one or more of any type of wired or wireless network interface (e.g., a network interface card (NIC)), such as an IEEE 802.11 wireless local area network (WLAN) interface, a Wi-MAX interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and so on.
[0170] In one embodiment of this application, computing device 800 components and Figure 8 Other components, not shown, can also be connected to each other, for example, via a bus. It should be understood that... Figure 8 The illustrated block diagram of the computing device is for illustrative purposes only and is not intended to limit the scope of this application. Those skilled in the art can add or replace other components as needed.
[0171] Computing device 800 is any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or PCs. Computing device 800 is a mobile or stationary server.
[0172] The steps of the processor 820 computer instructions implement the method for generating the lighting probe in the virtual scene.
[0173] The above is an illustrative scheme of a computing device according to this embodiment. It should be noted that the technical solution of this computing device and the technical solution of the above-described method for generating lighting probes in a virtual scene belong to the same concept. For details not described in detail in the technical solution of the computing device, please refer to the description of the technical solution of the above-described method for generating lighting probes in a virtual scene.
[0174] An embodiment of this application also provides a computer-readable storage medium storing computer instructions that, when executed by a processor, implement the steps of the method for generating a lighting probe in a virtual scene as described above.
[0175] The above is an illustrative scheme of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium and the technical solution of the above-described method for generating lighting probes in a virtual scene belong to the same concept. For details not described in detail in the technical solution of the storage medium, please refer to the description of the technical solution of the above-described method for generating lighting probes in a virtual scene.
[0176] The foregoing has described specific embodiments of this application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired results. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0177] The computer instructions include computer program code, which may be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium may be appropriately added to or subtracted according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media may not include electrical carrier signals and telecommunication signals.
[0178] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0179] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0180] The preferred embodiments disclosed above are merely illustrative of this application. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the content of this application. These embodiments are selected and specifically described in this application to better explain the principles and practical applications of this application, thereby enabling those skilled in the art to better understand and utilize this application. This application is limited only by the claims and their full scope and equivalents.
Claims
1. A method for generating a lighting probe in a virtual scene, characterized in that, include: Receive instructions to generate a lighting probe for the target virtual scene; In response to the illumination probe generation command, a first illumination probe set is generated based on the ground plane of the target virtual scene, and the probe density of the first illumination probe set decreases as the value of the height probe increases; In the target virtual scene, a target virtual resource and the target resource range corresponding to the target virtual resource are determined, and a second lighting probe set is generated based on the target virtual resource range. The target resource includes the part in the target virtual scene that needs to be processed and rendered in a key manner. An initial light probe set is generated based on the first light probe set and the second light probe set; Invalid probes in the initial lighting probe set are removed according to the preset probe optimization rules to obtain the target lighting probe set corresponding to the target virtual scene.
2. The method as described in claim 1, characterized in that, The method further includes: Identify the light source information in the target virtual scene; A third set of illumination probes is generated based on the light source information; An initial light probe set is generated based on the first light probe set, the second light probe set, and the third light probe set.
3. The method as described in claim 2, characterized in that, The method further includes: Receive probe layout instructions; A fourth set of illumination probes is generated in response to the probe layout command; An initial light probe set is generated based on the first light probe set, the second light probe set, the third light probe set, and the fourth light probe set.
4. The method as described in claim 1, characterized in that, The method further includes: Receive probe layout instructions; A fourth set of illumination probes is generated in response to the probe layout command; An initial light probe set is generated based on the first light probe set, the second light probe set, and the fourth light probe set.
5. The method as described in claim 1, characterized in that, A first set of illumination probes is generated based on the ground plane of the target virtual scene, including: A height detection probe is generated based on the ground plane of the target virtual scene; The probe density of the first illumination probe set is determined based on the height probe, wherein the probe density decreases as the height probe increases; A first set of illumination probes is generated based on the probe density.
6. The method as described in claim 1, characterized in that, A second set of lighting probes is generated based on the target virtual resource range, including: Determine the target resource range corresponding to the target virtual resource; A second set of illumination probes is generated within the target resource area.
7. The method as described in claim 1, characterized in that, Invalid probes in the initial illumination probe set are removed according to preset probe optimization rules, including: The initial illumination probes in the initial illumination probe set are baked to obtain a probe ball corresponding to each initial illumination probe. Invalid probes are identified based on each probe ball and the preset probe optimization rules; The invalid probes are removed from the initial set of illumination probes.
8. The method as described in claim 7, characterized in that, Invalid probes are identified based on each probe ball and preset probe optimization rules, including: Extract the illumination information for each probe ball; Invalid probes are identified based on the illumination information of each probe ball and preset probe optimization rules.
9. The method as described in claim 8, characterized in that, The preset probe optimization rules include: The lighting information meets the preset lighting rules; The number of probe balls per unit space is less than a preset density threshold; or The distance between two adjacent probe balls is greater than a preset distance threshold.
10. The method as described in claim 1, characterized in that, Also includes: The target virtual scene is generated by rendering based on the target lighting probe set, wherein the target lighting probe set includes lighting information corresponding to each lighting probe.
11. A device for generating illumination probes in a virtual scene, characterized in that, include: The receiving module is configured to receive instructions for generating lighting probes for the target virtual scene. The first generation module is configured to generate a first set of lighting probes based on the ground plane of the target virtual scene in response to the lighting probe generation command. The probe density of the first set of lighting probes decreases as the value of the height probe increases. The second generation module is configured to determine the target virtual resources and the target resource range corresponding to the target virtual resources in the target virtual scene, and generate a second lighting probe set based on the target virtual resource range. The target resources include the parts in the target virtual scene that need to be processed and rendered in a key manner. The synthesis module is configured to generate an initial light probe set based on the first light probe set and the second light probe set; The elimination module is configured to eliminate invalid probes in the initial lighting probe set according to preset probe optimization rules, so as to obtain the target lighting probe set corresponding to the target virtual scene.
12. A computing device, comprising a memory, a processor, and computer instructions stored in the memory and executable on the processor, characterized in that, When the processor executes the computer instructions, it implements the steps of the method according to any one of claims 1-10.
13. A computer-readable storage medium storing computer instructions, characterized in that, When executed by a processor, the computer instructions implement the steps of the method according to any one of claims 1-10.