Method, device and equipment for rendering lighting information in game scenes
By using multi-level grid data structures and lighting probe grids in game scenes, the problem of high cost of lighting information sampling, transmission and storage is solved, and more efficient lighting information rendering is achieved.
Patent Information
- Application Number
- CN202210325539.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-30
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2041-03-30
AI Technical Summary
The sampling, transmission and storage costs of lighting information in game scenes are high, which affects the rendering efficiency of lighting information.
By leveraging the multi-level mesh data structure of the spatial area in the game scene, the spatial area is segmented, the spatial voxels containing objects are extracted, and the effective lighting probe and virtual lighting probe are set up for them to generate a probe grid. Transfer lighting information to the texture resource and render it based on the texture resource information.
It reduces the update, transmission and storage costs of lighting information sampling, improves the rendering efficiency of lighting information, and reduces dependence on GPU hardware.
Smart Images

Figure CN115131482B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of 3D rendering technology, and in particular to a method, device and equipment for rendering lighting information in a game scene. Background Art
[0002] With the rise of the gaming industry, many 3D games require scenes. Building rendering scenes and adding physical effects can visualize the game scenes and improve the gaming experience for players. Since the game scene is a virtual world described by computer technology, which is similar to the real world, the scene contains light, objects, and the light emitted by the objects in the game and the scene light source, which reflects or refracts. In order to improve the realism of the game scene, global illumination is usually used for rendering. Global illumination uses a series of complex algorithms to calculate the bounce of light between the surfaces of objects after it is emitted from the light source. It usually achieves accurate simulation at runtime, and the calculation overhead used is relatively large.
[0003] In actual development scenarios, for global illumination effects of dynamic objects, light probe collectors distributed in the game scene are usually used to sample illumination information pixel by pixel. As a location point in space, the light probe collector can store light samples from all directions to form illumination information in the game scene. However, sampling illumination information in units of pixels requires the use of more accurate light probes. The number of pixel textures in the game scene determines the number of light probes. A large number of pixel textures requires GPU hardware to quickly sample millions of light probes per frame, which makes the updating, transmission and storage costs of illumination information sampling in the game scene high, affecting the rendering efficiency of illumination information. Summary of the invention
[0004] In view of this, the present application provides a method, device and equipment for rendering lighting information in a game scene, the main purpose of which is to solve the problem that the updating, transmission and storage costs of lighting information sampling in the game scene of the prior art are high, which affects the rendering efficiency of the lighting information.
[0005] According to a first aspect of the present application, a method for rendering lighting information in a game scene is provided, comprising:
[0006] Using the data structure of the spatial region in the game scene to segment the spatial region, extracting the spatial voxels containing the object, the data structure being a grid data containing multiple levels;
[0007] Traversing the grid data of the multiple levels, setting effective light probes for the spatial voxels containing the object, and obtaining a first light probe grid of the spatial region, wherein the first light probe grid contains the effective light probes;
[0008] For the spatial voxels that do not contain the object, a virtual light probe is additionally set to obtain a second light probe grid of the spatial region, wherein the second light probe grid includes valid light probes and virtual light probes;
[0009] The lighting information collected by the second lighting probe grid is transmitted to the texture resource information, and the lighting information in the game scene is rendered according to the texture resource information.
[0010] Furthermore, the data structure is a tree structure formed by the spatial area, and the method of using the data structure of the spatial area in the game scene to divide the spatial area and extract spatial voxels containing objects specifically includes: using the tree structure formed by the spatial area to divide the spatial area into multiple levels to form multiple levels of spatial voxels; in the process of dividing the multi-level spatial area, judging whether the spatial voxels in the divided level contain objects; if so, dividing the spatial voxels in the divided level into the next level until the number of levels reaches a preset threshold, and extracting the spatial voxels containing objects.
[0011] Furthermore, effective lighting probes are set for the spatial voxels containing the objects to obtain a first lighting probe grid for the spatial region, specifically comprising: for the spatial voxels containing the objects, obtaining the grid positions of the spatial voxels in multiple levels of grid data; and setting effective lighting probes at the vertices in the first grid positions to obtain a first lighting probe grid for the spatial region.
[0012] Furthermore, the method of supplementing the virtual lighting probes for the spatial voxels that do not contain objects to obtain the second lighting probe grid of the spatial area specifically includes: traversing the multiple levels of grid data, and for the spatial voxels that do not contain objects in each level, obtaining the second grid position of the spatial voxel in the grid data of the multiple levels; determining whether valid lighting probes are set at the four vertices of the grid position; if not, supplementing the virtual lighting probes for the vertices in the grid position where the valid lighting probes are not set, to obtain the second lighting probe grid of the spatial area.
[0013] Furthermore, before transmitting the lighting information collected by the second lighting probe grid to the texture resource information and rendering the lighting information in the game scene according to the texture resource information, the method also includes: extracting the spatial logical relationship mapped by the lighting information in the second lighting probe grid, and storing the spatial logical relationship in the texture resource information.
[0014] Furthermore, rendering the lighting information in the game scene according to the texture resource information specifically includes: expanding the lighting information in the texture resource information into a three-dimensional block data set according to the spatial logical relationship, and using an indirect texture to record the hierarchical relationship between the three-dimensional block data sets; merging the three-dimensional block data sets using the hierarchical relationship between the three-dimensional block data sets in the indirect texture to form three-dimensional block texture information with a tree structure, wherein the three-dimensional block texture information records the spatial position of the lighting information in the game scene; and according to the spatial position of the viewpoint position in the game scene, reading the lighting information of the corresponding spatial position from the three-dimensional block texture information of the tree structure for rendering.
[0015] Furthermore, the lighting information in the texture resource information is expanded into the three-dimensional block data set according to the spatial logical relationship, and the hierarchical relationship between each three-dimensional block data set is recorded using indirect textures, specifically including: extracting the hierarchical distribution of effective lighting probes and virtual lighting probes in the second lighting probe grid according to the spatial logical relationship; expanding the lighting information in the texture resource information into the three-dimensional block data according to the hierarchical distribution of effective lighting probes and virtual lighting probes in the second lighting probe grid, and recording the hierarchical relationship between the three-dimensional block data sets using indirect textures.
[0016] Furthermore, the method of reading lighting information of a corresponding spatial position from the three-dimensional block texture information of the tree structure for rendering according to the spatial position of the viewpoint in the game scene specifically includes: obtaining an indirect texture representing the hierarchical relationship between three-dimensional block data sets from the three-dimensional block texture information of the tree structure according to the spatial position of the viewpoint in the game scene; and reading lighting information of a corresponding spatial position in the three-dimensional block texture information of the tree structure for rendering using the indirect texture representing the hierarchical relationship between three-dimensional block data sets.
[0017] According to a second aspect of the present application, a method for rendering lighting information in a game scene is provided, comprising:
[0018] Acquire close-distance voxels contained in the spatial voxels in the game scene, wherein the close-distance voxels are voxels that meet the distance condition in the voxels of a preset level formed by the segmentation of the spatial voxels in the game scene, and the distance condition is that the bounding box of the voxel intersects with the bounding box of the object in the game scene;
[0019] Creating effective lighting probes and virtual lighting probes for the near-distance voxels contained in the spatial voxels, and generating a probe grid of the spatial voxels, wherein the probe grid is used to capture lighting information in the game scene;
[0020] Merging and storing the lighting information captured by the probe grid of the spatial voxels into the texture resource information according to the viewpoint position in the game scene;
[0021] In response to a rendering instruction of the lighting information, a rendering task is established using the texture resource information to render the lighting information in the game scene.
[0022] Furthermore, the method of obtaining close-range voxels on the surface of objects in the game scene specifically includes: obtaining the spatial area covered by the object to be mounted in the game scene, and dividing each spatial voxel in the spatial area into voxels of a preset level; traversing each voxel in the preset level, and determining whether the bounding box of the divided voxel intersects with the bounding box of the object in the game scene; if so, determining that the divided voxel is a close-range voxel on the surface of the object in the game scene.
[0023] Furthermore, the creating of effective lighting probes and virtual lighting probes for the close-range voxels contained in the spatial voxels and generating a probe grid of the spatial voxels specifically includes: creating effective lighting probes for the close-range voxels in the spatial voxels that are within the hierarchy; adding virtual voxels corresponding to the hierarchy for the spatial voxels, and creating virtual lighting probes for the voxels in the virtual voxels that meet the adding conditions, wherein the virtual lighting probes are used to seamlessly interpolate the lighting data sampled by the close-range voxels in the hierarchy in the spatial voxels.
[0024] Furthermore, the method of adding virtual voxels corresponding to the levels for the spatial voxels and creating virtual lighting probes for the voxels in the virtual voxels that meet the adding conditions specifically includes: for levels greater than the first order in the spatial voxels, adding virtual voxels corresponding to the levels, and mapping the virtual voxels to the voxels in the corresponding levels in the spatial voxels; traversing the virtual voxels corresponding to the levels to determine whether there are valid lighting probes for the mapped voxels in the spatial voxels; if not, creating virtual lighting probes for the virtual voxels.
[0025] Furthermore, before merging and storing the illumination information captured by the probe grid of the spatial voxels into the texture resource information according to the viewpoint position in the game scene, the method further includes: expanding the illumination information captured by the probe grid of the spatial voxels into a three-dimensional block data set according to the viewpoint position in the game scene to form three-dimensional block texture information with a multi-level tree structure; in the process of expanding into the three-dimensional block data set, recording the hierarchical relationship mapped by the three-dimensional block data set into the indirect texture information;
[0026] The step of merging and storing the lighting information captured by the probe grid of the spatial voxels into the texture resource information according to the viewpoint position in the game scene specifically includes: merging and storing the three-dimensional block texture information and the indirect texture information into the texture resource information.
[0027] Furthermore, the method of expanding the lighting information captured by the probe grid of the spatial voxels into a three-dimensional block data set according to the viewpoint position in the game scene to form three-dimensional block texture information with a multi-level tree structure specifically includes: using the effective lighting probes in the probe grid to sample the lighting data in the game scene, and interpolating the lighting data to obtain the first lighting information of the viewpoint position in the game scene; using the virtual lighting probes in the probe grid to seamlessly interpolate the lighting data sampled by the close-range voxels in the hierarchy in the spatial voxels to obtain the second lighting information of the viewpoint position in the game scene; and expanding the first lighting information and the second lighting information of the viewpoint position in the game scene into a three-dimensional block data set to form three-dimensional block texture information with a multi-level tree structure.
[0028] Furthermore, the method of establishing a rendering task by utilizing the texture resource information to render the lighting information in the game scene specifically includes: establishing a rendering task by utilizing the texture resource information to obtain the hierarchical relationship of the three-dimensional block texture information mapping from the indirect texture information; querying the position information of the three-dimensional texture information in the tree structure according to the hierarchical relationship of the three-dimensional block texture information mapping; sampling the lighting information captured by the probe grid of the spatial voxels from the three-dimensional block texture information according to the position of the three-dimensional texture information in the tree structure, and rendering the lighting information.
[0029] Furthermore, querying the position information of the three-dimensional texture information in the tree structure according to the hierarchical relationship of the three-dimensional block texture information mapping specifically includes: extracting the level and offset of the three-dimensional block texture information in the tree structure according to the hierarchical relationship of the three-dimensional block texture information mapping; calculating the position information of the three-dimensional texture information in the tree structure according to the level and offset of the three-dimensional block texture information in the tree structure.
[0030] According to a third aspect of the present application, a rendering device for lighting information in a game scene is provided, comprising:
[0031] An extraction unit, used to segment the spatial region in the game scene using a data structure of the spatial region, and extract spatial voxels containing objects, wherein the data structure is grid data containing multiple levels;
[0032] A first setting unit is configured to traverse the grid data of the multiple levels, set effective light probes for the spatial voxels containing the objects, and obtain a first light probe grid of the spatial region, wherein the first light probe grid contains effective light probes;
[0033] A second setting unit is used to supplement and set virtual light probes for the spatial voxels that do not contain the object, so as to obtain a second light probe grid of the spatial region, wherein the second light probe grid includes valid light probes and virtual light probes;
[0034] The first rendering unit is used to transmit the lighting information collected by the second lighting probe grid to the texture resource information, and render the lighting information in the game scene according to the texture resource information.
[0035] Furthermore, the data structure is a tree structure formed by the spatial region, and the extraction unit includes: a segmentation module, used to use the tree structure formed by the spatial region to perform multi-level segmentation on the spatial region to form multiple levels of spatial voxels; a first judgment module, used to judge whether the spatial voxels in the segmented level contain objects during the segmentation of the multi-level spatial region; an extraction module, used to, if so, perform next-level segmentation on the spatial voxels in the segmented level until the number of levels reaches a preset threshold, and extract the spatial voxels containing objects.
[0036] Furthermore, the first setting unit includes: a first acquisition module, used to obtain the grid position of the spatial voxel containing the object in multiple levels of grid data; a first setting module, used to set effective lighting probes at the vertices in the first grid position to obtain a first lighting probe grid of the spatial area.
[0037] Furthermore, the second setting unit includes: a second acquisition module, used to traverse the multiple levels of grid data, and for each level of spatial voxels that do not contain objects, obtain the second grid position of the spatial voxel in the grid data of the multiple levels; a second judgment module, used to judge whether valid lighting probes are set at the four vertices of the grid position; and a second setting module, used to supplement the virtual lighting probes for the vertices in the grid position where the valid lighting probes are not set, if not, to obtain the second lighting probe grid of the spatial area.
[0038] Furthermore, the device also includes: an extraction unit, which is used to extract the spatial logical relationship mapped by the lighting information in the second lighting probe grid before transmitting the lighting information collected by the second lighting probe grid to the texture resource information and rendering the lighting information in the game scene according to the texture resource information, and store the spatial logical relationship in the texture resource information.
[0039] Furthermore, the first rendering unit includes: an expansion module, which is used to expand the lighting information in the texture resource information into a three-dimensional block data set according to the spatial logical relationship, and use indirect textures to record the hierarchical relationship between the three-dimensional block data sets; a merging module, which is used to merge the three-dimensional block data sets using the hierarchical relationship between the three-dimensional block data sets in the indirect texture to form three-dimensional block texture information with a tree structure, wherein the three-dimensional block texture information records the spatial position of the lighting information in the game scene; and a reading module, which is used to read the lighting information of the corresponding spatial position from the three-dimensional block texture information with the tree structure for rendering according to the spatial position of the viewpoint position in the game scene.
[0040] Furthermore, the expansion module is specifically used to extract the hierarchical distribution of valid light probes and virtual light probes in the second light probe grid according to the spatial logical relationship; the expansion module is also specifically used to expand the lighting information in the texture resource information into three-dimensional block data according to the hierarchical distribution of valid light probes and virtual light probes in the second light probe grid, and use indirect textures to record the hierarchical relationship between the three-dimensional block data sets.
[0041] Furthermore, the reading module is specifically used to obtain an indirect texture representing the hierarchical relationship between three-dimensional block data sets from the three-dimensional block texture information of the tree structure according to the spatial position of the viewpoint in the game scene; the reading module is also specifically used to use the indirect texture representing the hierarchical relationship between the three-dimensional block data sets to read the lighting information of the corresponding spatial position in the three-dimensional block texture information of the tree structure for rendering.
[0042] According to a fourth aspect of the present application, a device for rendering lighting information in a game scene is provided, comprising:
[0043] An acquisition unit is used to acquire close-distance voxels contained in the spatial voxels in the game scene, wherein the close-distance voxels are voxels that meet a distance condition among the voxels of a preset level formed by segmenting the spatial voxels in the game scene, and the distance condition is that a bounding box of the voxel intersects a bounding box of an object in the game scene;
[0044] A creation unit, used to create effective lighting probes and virtual lighting probes for the near-distance voxels contained in the spatial voxels, and generate a probe grid of the spatial voxels, wherein the probe grid is used to capture lighting information in the game scene;
[0045] A storage unit, for merging and storing the lighting information captured by the probe grid of the spatial voxels into the texture resource information according to the viewpoint position in the game scene;
[0046] The second rendering unit is used to respond to the rendering instruction of the lighting information, establish a rendering task using the texture resource information, and render the lighting information in the game scene.
[0047] Furthermore, the acquisition unit includes: a segmentation module, used to acquire the spatial area covered by the object to be mounted in the game scene, and divide each spatial voxel in the spatial area into voxels of a preset level; a third judgment module, used to traverse each voxel in the preset level, and judge whether the bounding box of the segmented voxel intersects with the bounding box of the object in the game scene; and a determination module, used to determine that if so, the segmented voxel is a close-range voxel on the surface of the object in the game scene.
[0048] Furthermore, the creation unit includes: a creation module, used to create effective lighting probes for the close voxels in the hierarchy among the spatial voxels; an addition module, used to add virtual voxels corresponding to the hierarchy for the spatial voxels, and create virtual lighting probes for the voxels in the virtual voxels that meet the adding conditions, and the virtual lighting probes are used to seamlessly interpolate the lighting data sampled by the close voxels in the hierarchy among the spatial voxels.
[0049] Furthermore, the addition module includes: an addition sub-module, which is used to add virtual voxels corresponding to the levels greater than the first order in the spatial voxels, and the virtual voxels are mapped to the voxels of the corresponding level in the spatial voxels; a judgment sub-module, which is used to traverse the virtual voxels corresponding to the level and judge whether there are valid lighting probes for the mapped voxels in the spatial voxels; and a creation sub-module, which is used to create virtual lighting probes for the virtual voxels if not.
[0050] Furthermore, the device also includes: an expansion unit, which is used to expand the lighting information captured by the probe grid of the spatial voxels into a three-dimensional block data set according to the viewpoint position in the game scene before merging and storing the lighting information captured by the probe grid of the spatial voxels into the texture resource information according to the viewpoint position in the game scene, so as to form three-dimensional block texture information with a multi-level tree structure; a recording unit, which is used to record the hierarchical relationship mapped by the three-dimensional block data set into the indirect texture information during the process of expanding to the three-dimensional block data set; and the storage unit is also used to merge the three-dimensional block texture information and the indirect texture information and store them in the texture resource information.
[0051] Furthermore, the expansion unit includes: a calculation module, which is used to use the effective lighting probes in the probe grid to sample the lighting data in the game scene, and perform interpolation operations on the lighting data to obtain first lighting information of the viewpoint position in the game scene; an interpolation module, which is used to use the virtual lighting probes in the probe grid to seamlessly interpolate the lighting data sampled by the close-range voxels in the spatial voxels within the hierarchy to obtain second lighting information of the viewpoint position in the game scene; and an expansion module, which is used to expand the first lighting information and the second lighting information of the viewpoint position in the game scene into a three-dimensional block data set to form three-dimensional block texture information with a multi-level tree structure.
[0052] Furthermore, the second rendering unit includes: an acquisition module, which is used to establish a rendering task using the texture resource information, and obtain the hierarchical relationship of the three-dimensional block texture information mapping from the indirect texture information; a query module, which is used to query the position information of the three-dimensional texture information in the tree structure according to the hierarchical relationship of the three-dimensional block texture information mapping; and a sampling module, which is used to sample the lighting information captured by the probe grid of the spatial voxel from the three-dimensional block texture information according to the position of the three-dimensional texture information in the tree structure, and render the lighting information.
[0053] Furthermore, the query module includes: an extraction submodule, used to extract the level and offset of the three-dimensional block texture information in the tree structure according to the hierarchical relationship of the three-dimensional block texture information mapping; and a calculation submodule, used to calculate the position information of the three-dimensional texture information in the tree structure according to the level and offset of the three-dimensional block texture information in the tree structure.
[0054] According to a fifth aspect of the present application, a computer device is provided, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method described in the first aspect when executing the computer program.
[0055] According to a sixth aspect of the present application, a readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method described in the first aspect are implemented.
[0056] In game scenes, lighting is a factor with a great influence and an indispensable part of visual style. Usually, static and dynamic objects in game scenes may have different sizes or complex model structures. These art assets are difficult to bake into effective light maps. The pixel-by-pixel sampling of light probes can avoid the lighting effects of moving objects and the feeling of incoordination of the entire scene using static light maps. It can bring unified indirect lighting to the scene, simplify the complexity of the rendering pipeline, and improve rendering efficiency. During the operation of the light probe, the lighting information can be sampled at the location of a certain light probe, and then the lighting information can be sampled from the positions of other light probes adjacent to the light probe, and then the lighting information obtained by these samples can be interpolated to calculate the lighting information of a certain position between these light probes.
[0057] As a way of collecting lighting information, lighting probes can be sampled object by object in the game scene, including object-by-object parameter sampling and object-by-object 3D texture sampling. In the process of object-by-object parameter sampling, the lighting change depends on the surface normal of the object. The surface normal of the object needs to be used in the solving stage, which is sufficient for small objects, but may cause lighting mismatch and discontinuity with adjacent larger models. Therefore, one-to-one collection, updating and sampling are performed on the CPU side. Each related object has its corresponding interpolated SH coefficient (Spherical Harmonic), which is relatively easy to maintain and low-cost. In the process of object-by-object 3D texture sampling, the hardware acceleration function is used to perform sampling interpolation calculations on the GPU side. Compared with the above-mentioned method of object-by-object parameter sampling, the sampling effect of lighting information is improved to a certain extent.
[0058] As another way to collect lighting information with light probes, you can sample each pixel in the game scene. Since the screen pixels are fixed, collecting lighting information in pixels instead of objects can provide more accurate light probes. When linear interpolation is performed between multiple light probes in pixels or compute shaders, GPU hardware can be used to quickly sample the lighting information captured by millions of light probes per frame.
[0059] By means of the above technical scheme, the present application provides a method, device and equipment for rendering lighting information in a game scene. Compared with the existing method of sampling lighting information object by object, the present application uses the method of sampling lighting information pixel by pixel. On the one hand, it can provide indirect lighting for a large number of complex objects and is applicable to a variety of lighting acquisition scenarios. On the other hand, it avoids the total number of objects sampled object by object due to the update cost of 3D textures from the CPU end to the GPU end and the transmission bandwidth. Compared with the existing method of sampling lighting information pixel by pixel, the present application obtains the close-range voxels contained in the spatial voxels in the game scene. The close-range voxels are voxels close to the surface of the object and require a larger number of lighting probes. Further, effective lighting probes and virtual lighting probes are created for the close-range voxels contained in the spatial voxels, and a probe grid of the spatial voxels is generated. The lighting probes and virtual lighting probes can be adaptively arranged. The virtual lighting probes serve as auxiliary effective lighting probes to provide seamless interpolation for the game scene, and the lighting information captured by the probe grid of the spatial voxels is merged and stored into the texture resource information according to the viewpoint position in the game scene. The texture resource information can cope with different game scenes. The lighting information of the game scene is sampled so that the pixels on the same screen can be interpolated to different surface densities according to their different spatial positions. Then, when responding to the rendering instruction of the lighting information, the rendering task is established using the texture resource information to render the lighting information in the game scene. The texture resource information caches the three-dimensional texture address of the game scene. Since the number of pixel textures in the game scene determines the number of lighting probes, and a large number of voxels can save the number of lighting probes through adaptive layout, there is no need for GPU hardware to quickly sample millions of lighting probes per frame, which reduces the update, transmission and storage costs of lighting information sampling in the game scene and improves the rendering efficiency of lighting information.
[0060] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0062] Figure 1 A schematic diagram showing a flow chart of a method for rendering lighting information in a game scene provided by an embodiment of the present application;
[0063] Figure 2a-2c A schematic diagram of a process of creating a light probe in a game scene provided by an embodiment of the present application is shown;
[0064] Figure 3 A schematic diagram showing a flow chart of another method for rendering lighting information in a game scene provided by an embodiment of the present application;
[0065] Figure 4 A schematic diagram showing a flow chart of another method for rendering lighting information in a game scene provided by an embodiment of the present application;
[0066] Figure 5a-5b A schematic diagram of a rendering process of lighting information in a game scene provided by an embodiment of the present application is shown;
[0067] Figure 6 A schematic diagram of the structure of a device for rendering lighting information in a game scene provided by an embodiment of the present application is shown;
[0068] Figure 7 A schematic diagram showing the structure of another device for rendering lighting information in a game scene provided by an embodiment of the present application is shown;
[0069] Figure 8 A schematic diagram showing the structure of another device for rendering lighting information in a game scene provided by an embodiment of the present application is shown;
[0070] Fig. 9 A schematic diagram showing the structure of another device for rendering lighting information in a game scene provided by an embodiment of the present application is shown;
[0071] Fig.10 A schematic diagram of the device structure of a computer device provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0072] Now the content of the present invention will be discussed with reference to several exemplary embodiments. It should be understood that these embodiments are discussed only to enable those skilled in the art to better understand and thus implement the content of the present invention, rather than implying any limitation on the scope of the present invention.
[0073] As used herein, the term "including" and variations thereof are to be interpreted as open-ended terms meaning "including but not limited to." The term "based on" is to be interpreted as "based, at least in part, on." The terms "one embodiment" and "an embodiment" are to be interpreted as "at least one embodiment." The term "another embodiment" is to be interpreted as "at least one other embodiment."
[0074] This embodiment provides a method for rendering lighting information in a game scene, such as Figure 1 As shown, the method is applied to the client of the scene rendering tool and includes the following steps:
[0075] 101. Use the data structure of the spatial region in the game scene to segment the spatial region and extract the spatial voxels containing the objects.
[0076] 102. Traverse the grid data of the multiple levels, set effective lighting probes for the spatial voxels containing the objects, and obtain a first lighting probe grid of the spatial area.
[0077] 103. For the spatial voxels that do not contain the object, virtual lighting probes are additionally set to obtain a second lighting probe grid for the spatial region.
[0078] 104. Transmit the lighting information collected by the second lighting probe grid to the texture resource information, and render the lighting information in the game scene according to the texture resource information.
[0079] The method for rendering lighting information in a game scene provided by an embodiment of the present invention divides the spatial region by using a data structure of the spatial region in the game scene to extract spatial voxels containing objects, wherein the data structure includes grid data of multiple levels, and each level includes a corresponding number of spatial voxels of the level. The grid data can be used to form a relative spatial position relationship between the spatial voxels and the objects in the spatial region to obtain spatial positions with relatively strong lighting changes, and effective lighting probes are set for the spatial voxels containing the objects to obtain a first lighting probe grid, so that the lighting probes can be adaptively arranged for the spatial positions with relatively strong lighting changes, and the grid data of multiple levels are traversed to supplement the virtual lighting probes for the spatial voxels that do not contain the objects to obtain The second light probe grid in the spatial area allows for effective interpolation transition between spatial voxels at different levels during the lighting information sampling process. For locations in the game scene where lighting density is unevenly distributed, it can provide more effective lighting information sampling results. The lighting information collected by the second light probe grid is transmitted to the texture resource information, and the lighting information in the game scene is rendered according to the texture resource information. Since the lighting information is collected by the effective light probes set around the objects, there is no need to use a large number of effective light probes to collect lighting information that meets the conditions, thereby simplifying the complexity of rendering. The virtual light probe can provide a supplementary interpolation effect in the process of effective light probes collecting lighting information, thereby ensuring the rich expressiveness of real-time rendering.
[0080] In the embodiment of the present invention, the data structure of the spatial region can be a tree structure formed by the spatial region, which can be a quadtree, an octree, a hexadecimal tree, etc. Specifically, in the process of segmenting the spatial region, the tree structure formed by the spatial region is used to perform multi-level segmentation on the spatial region to form multiple levels of spatial voxels, and in the process of segmenting the hierarchical spatial region, it is determined whether the spatial voxels in the level after segmentation contain objects. If so, the spatial voxels in the level after segmentation are segmented into the next level until the number of levels reaches a preset threshold, and the spatial voxels containing objects are extracted. Here, containing objects refers to spatial voxels close to the surface of the object.
[0081] It can be understood that in the process of dividing the spatial area, we start with a large voxel. Here, the large voxel is used as the spatial area to be divided first. It can be set based on the level of the minimum spatial voxel. For example, the minimum spatial voxel is 1*1*1, the number of levels of the spatial area is 3, and the spatial area is 8*8*8. It can also be customized. Then, before dividing the large voxel, determine whether the spatial area contains an object. If so, divide the large voxel, otherwise, do not divide the large voxel. Further, for the two sub-voxels formed after the division, determine whether each sub-voxel contains an object. Similarly, if so, divide the sub-voxel, otherwise, do not divide the sub-voxel. Each time the voxel is divided, a level of spatial voxels will be formed. The voxel size of the spatial voxel decreases as the level increases. For example, the spatial voxel of the first level, that is, the initial large spatial voxel, corresponds to the largest voxel, and the spatial voxel of the highest level, that is, the spatial voxel corresponding to multiple divisions of the spatial area, corresponds to the smallest voxel, and the size of the voxel doubles with each additional level. Finally, each spatial area will form multiple levels of grid data after segmentation, but the levels in the grid data are unevenly distributed, and only the areas around the object are small. Only the spatial regions that are close to the objects will be divided, and the hierarchical distribution of the spatial voxels after the division is also uneven. For example, for an 8*8*8 spatial region, the position of the object contained in the spatial region is in the upper left corner and is at the second level. After the first division, four 4*4*4 spatial voxels are formed, which are the spatial voxels of the first level. For the spatial voxels of the first level, only the spatial voxels containing objects will be divided into the spatial voxels of the second level, that is, the other three spatial voxels at the first level will not be divided. After the second division, four 2*2*2 spatial voxels are formed. Similarly, for the spatial voxels of the second level, only the spatial voxels containing objects will be divided into the spatial voxels of the third level. If the four spatial voxels on the second level all contain objects, then the spatial voxels of the third level formed after the four spatial voxels are divided, that is, each spatial voxel of the second level will form four 1*1*1 spatial voxels.
[0082] Since the level distribution in the grid data is uneven, in order to distribute different densities of light probes in the game scene, you can traverse multiple levels of grid data, for the spatial voxels containing objects, get the grid position of the spatial voxels in the grid data of multiple levels, set effective light probes at the four vertices of the grid position, and get the first light probe grid of the spatial area. Here, the spatial voxels are at different levels, and repeated vertices may appear. For example, the four vertex positions of the spatial area may only be at the first level, or they may be at the second or third level during the segmentation process. For multiple levels of grids, The grid data is obtained, and the grid position of the spatial voxel in the grid data of multiple levels is obtained, and it is determined whether valid light probes are set at the four vertices of the grid position. If not, virtual light probes are set for the vertices in the grid position where no valid light probes are set, to obtain a second light probe grid for the spatial area, so that the multi-level grid data is filled with valid light probes and virtual light probes. Here, the virtual light probe does not capture the lighting information, but is used for seamless interpolation in the subsequent lighting information sampling process using the effective light probe to improve the sampling result of the lighting information.
[0083] The following example uses a 2D quadtree as a specific application scenario. Figure 2a-2c As shown, first of all, the segmentation process of the spatial region is as follows: Figure 2a As shown in FIG. 1 , the spatial voxels formed by the spatial region are taken as the spatial voxels of the first level. Since the spatial voxels of the first level contain objects, the spatial voxels of the first level are then segmented to form four spatial voxels of the second level. It is further determined whether each spatial voxel of the second level contains an object. If so, the spatial voxels of the second level are segmented until the spatial voxels of the third level are reached. Secondly, the illumination probes (effective illumination probes and virtual illumination probes) are adaptively set within the spatial voxels, as shown in FIG. Figure 2b As shown, the solid circle here represents the effective light probe. Since the first-level space voxel contains an object, the effective light probes are placed at the four corners of the first-level space voxel. For the second-level space voxel, only the four corners of the space voxel containing the object are placed. Figure 2c For the solid line part in the figure, only the intersection of the solid line position is used to place the effective light probe. At this time, the same position as the first level may appear, and there is no need to repeatedly place the effective light probe. For the spatial voxels without effective light probes on different levels, such as Figure 2c In the dotted part of the image, virtual light probes are added. That is, virtual light probes are placed at the intersection of the dotted lines. Here, virtual light probes are represented by dotted circles, and finally a light probe grid containing valid light probes and virtual light probes is formed.
[0084] Furthermore, since the lighting information collection process is affected by the lighting probe positions in the lighting probe grid, the lighting information at different spatial positions will also be affected by each other. It is necessary to extract the spatial logical relationship mapped by the lighting information in the second lighting probe grid before rendering the lighting information, and store the spatial logical relationship in the texture resource information. Then, in the subsequent rendering process of the lighting information, the lighting information in the texture resource information is expanded into the three-dimensional block data set according to the spatial logical relationship, and the hierarchical relationship between the three-dimensional block data sets is recorded by indirect textures, and the hierarchical relationship between the three-dimensional block data sets is further recorded by the indirect textures. The three-dimensional block data sets are merged according to the hierarchical relationship between the layers to form three-dimensional block texture information with a tree structure. The three-dimensional block texture information records the spatial position of the lighting information in the game scene. According to the spatial position of the viewpoint in the game scene, the viewpoint position is equivalent to the spatial position corresponding to the viewing angle of the video device, and the spatial position is used as the lighting acquisition position. The lighting information of the corresponding spatial position is read from the three-dimensional block texture information with a tree structure for rendering. By pre-storing the spatial logical relationship of the lighting information, there is no need to spend a lot of resources to store and transmit the probe data, which saves storage and transmission overhead while ensuring rendering accuracy.
[0085] Furthermore, considering the distribution of effective light probes and virtual light probes in the second light probe grid, in the process of expanding the light information in the texture resource information into the three-dimensional block data set according to the spatial logical relationship, and using the indirect texture to record the hierarchical relationship between each three-dimensional block data set, firstly, according to the spatial logical relationship, the hierarchical distribution of effective light probes and virtual light probes in the second light probe grid is extracted, and then according to the hierarchical distribution of effective light probes and virtual light probes in the second light probe grid, the light information in the texture resource information is expanded into the three-dimensional block data, and the hierarchical relationship between the three-dimensional block data sets is recorded using the indirect texture. Since the indirect texture is not direct texture information, it is not necessary to transmit a large amount of texture information in the process of transmitting the texture resource information, so as to improve the transmission efficiency and sampling efficiency of the light information in the subsequent rendering process.
[0086] Furthermore, in order to accurately obtain the actual lighting information in the game world, in the process of reading the lighting information of the corresponding spatial position from the three-dimensional block texture information of the tree structure for rendering according to the spatial position of the viewpoint position in the game scene, firstly, according to the spatial position of the viewpoint position in the game scene, the indirect texture representing the hierarchical relationship between the three-dimensional block data sets is obtained from the three-dimensional block texture information of the tree structure, and then the indirect texture representing the hierarchical relationship between the three-dimensional block data sets is used to read the lighting information of the corresponding spatial position in the three-dimensional block texture information of the tree structure for rendering. Since the indirect texture stores the level and offset of the three-dimensional block data in the tree structure, the corresponding level and offset in the indirect texture can be sampled according to the world space position of the screen pixel to obtain the lighting information collected by the effective lighting probe.
[0087] This embodiment provides another method for rendering lighting information in a game scene, such as Figure 3 As shown, the method is applied to the client of the scene rendering tool and includes the following steps:
[0088] 201. Obtain the close-range voxels contained in the spatial voxels in the game scene.
[0089] Games are real-time, dynamic, interactive computer simulations. Many three-dimensional games use three-dimensional triangular meshes to represent the surface of objects. The detail layer of the surface is stored in the texture. When shading, it is necessary to first consider the objects that the light intersects with, and then select the multi-level texture of the detail layer corresponding to the surface of the object for shading calculation. Spatial voxels are the volume units of texture rendering in the game space. Objects containing spatial voxels can be expressed through stereo rendering or by extracting polygonal isosurfaces with given threshold contours.
[0090] For the lighting effects involved in the game scene, global illumination is usually used for rendering. Global illumination takes into account the direct light and as many diffuse reflection effects as possible, and the final light and shadow effects are closer to the real world. Specifically, global illumination refers to the calculation of light reflection around the game scene, which is responsible for producing many subtle shading effects, atmosphere and shiny metal reflection effects in the environment. In the existing global illumination method, all indirect lighting is pre-calculated and stored in the texture information with light maps. The light map allows the game scene to have an effect similar to global illumination. Since it is pre-calculated, it is only effective on static objects. For the global illumination of non-static objects, the use of light probes can simulate the effect of using light maps. The light probe can sample the lighting information of a specified point in 3D space in the pre-calculation stage before running, and then compile and package the collected information through spherical harmonics. When the game is running, these lighting information can be encoded through the shader program to quickly reconstruct the lighting effect. Similar to light maps, light probes store lighting information in the scene. However, whereas light maps store lighting information when light hits the surface of an object, light probes store lighting information when light passes through a vacuum area.
[0091] Among them, the spatial voxels in the game scene are equivalent to the three-dimensional spatial units in the game world. The close-range voxels are the voxels that meet the distance conditions in the preset layer of voxels formed by the segmentation of the spatial voxels in the game scene, which are equivalent to the voxels close to the surface of the object. The distance condition is used as the basis for determining the voxels close to the surface of the object. The bounding box of the voxel intersects with the bounding box of the object in the game scene. The distance condition is formed during the segmentation process of the spatial voxels. The pixels to be segmented and the pixels that have been segmented are judged according to the distance condition. If the bounding box of the voxel intersects with the bounding box of the object in the game scene, it means that the voxel is close to the surface of the object, that is, the close-range voxel.
[0092] In the embodiments of the present application, the placement of lighting probes in the game world is usually performed manually, and the placement position is adjusted according to the rendering results of the actual lighting information, which seriously wastes time and space, and the probes cannot effectively cover the surface of objects. By acquiring the close-range voxels contained in the spatial voxels in the game scene, the area on the surface of the object can be located from the game world, and the lighting probes can be adaptively arranged for the area on the surface of the object to collect lighting information with more environmental influence in the game scene, thereby improving the sampling efficiency of the lighting information.
[0093] The executor of this embodiment can be a rendering device or equipment for lighting information in the game scene, which can be configured on the client side of the scene rendering tool. After the game scene is arranged, it is necessary to arrange the position information of the lighting probe in the game scene. Since the lighting probe cannot be directly mounted on the game object, it usually needs to rely on the specified spatial area in the game scene. When adding a lighting probe to the game scene, the close-range voxels contained in the spatial pixels in the game scene can be obtained for the specified spatial area. The position of the close-range voxel in the game scene is used as the preferred position for placing the lighting probe, which can collect lighting information that better meets the needs of the game scene and improve the lighting rendering effect.
[0094] 202. Create effective lighting probes and virtual lighting probes for the close-distance voxels included in the spatial voxels, and generate a probe grid of the spatial voxels.
[0095] Among them, the effective light probe is a light collector arranged at a sampling point with a real position in the game world. It can capture light from all directions at the sampling point and encode the color information of the captured light into a set of coefficients that can be quickly evaluated during the game. Since the spatial pixel contains close-range voxels of a preset level, in order to ensure the interpolation effect of the light information sampled by the effective light probes arranged at different levels, the virtual light probe is an additional light collector formed to assist the effective light probe in subsequent GPU sampling. It can provide seamless interpolation when sampling between larger-level voxels and smaller-level voxels in the game scene.
[0096] In the example of the present application, the probe grid of the spatial voxel is equivalent to a grid of a tree structure, which is a preset level formed by the division of the spatial voxels. For example, the octree structure corresponds to a preset level of 3, that is, the spatial voxel is divided into 8 voxels, and the corners of each voxel form a 2*2*2 probe grid. In order to distribute lighting probes of different densities in the game world and adaptively minimize the total number of creations, close-range voxels will be recorded during the division of the spatial voxels. Close-range voxels have better lighting information sampling effects, and effective lighting probes are further created for close-range voxels.
[0097] It is understandable that although effective light probes can provide lighting information with interpolation effects, they still require more than gigabytes of resources. In order to be able to cope with game scenes of various sizes and types and reduce resource usage, virtual light probes are added between different levels of spatial pixels. The virtual light probes can be associated with effective light probes in each level, and the sampling interpolation results of different densities of effective light probes in different spatial pixels in the game world are used to reduce the resource overhead of the lighting information collection process.
[0098] 203. According to the viewpoint position in the game scene, the lighting information captured by the probe grid of the spatial voxels is merged and stored in the texture resource information.
[0099] Among them, the viewpoint position in the game scene is any sampling position for setting the lighting information in the game scene. For the viewpoint position, the effective lighting probe will continuously collect the changing lighting data in the game scene, and then in the process of interpolating the lighting data, the virtual lighting probe is used to provide sampling interpolation results of different densities for the lighting data collected by the effective lighting probe, so as to form a probe grid to capture the lighting information and merge it into the texture resource information.
[0100] It is understandable that the lighting information captured by the probe grid of spatial voxels includes pre-calculated lighting data. Many budget overheads are only generated during editing and will not appear at runtime. The lighting probe stores the lighting data that passes through the scene space and integrates it into the texture resource information. The texture resource information is equivalent to the light map of the dynamic object, and also includes the direct light source projected onto the surface of the object in the scene, as well as the indirect light source reflected between different objects. The surface information and bump information of the object can be described through the shader on the object material.
[0101] 204. In response to a rendering instruction of the lighting information, a rendering task is established using the texture resource information to render the lighting information in the game scene.
[0102] Since texture resource information can accurately provide the lighting information in the current game scene, the texture resource information can be further used to establish a rendering task to render the lighting information in the game scene. It can be understood that in the same way, each scene data frame in the game scene will establish a rendering task, and the scene rendering tool will submit the scene space in the game scene to the rendering queue at one time. Each renderable scene space, in addition to its own mesh and material, also has a bounding box and its matrix in the game scene.
[0103] Compared with the existing method of sampling lighting information object by object, the present application provides a rendering method for lighting information in a game scene by using a pixel-by-pixel sampling method. On the one hand, it can provide indirect lighting for a large number of complex objects and is applicable to a variety of lighting acquisition scenarios. On the other hand, it avoids the total number of objects sampled object by object due to the update cost of 3D textures from the CPU to the GPU and the transmission bandwidth. Compared with the existing method of sampling lighting information pixel by pixel, the present application obtains the close-range voxels contained in the spatial voxels in the game scene. The close-range voxels are voxels close to the surface of the object and require a larger number of lighting probes. It further creates effective lighting probes and virtual lighting probes for the close-range voxels contained in the spatial voxels, generates a probe grid of spatial voxels, and can adaptively layout lighting probes and virtual lighting probes. The virtual lighting probe serves as an auxiliary effective lighting probe to provide seamless interpolation for the game scene, and merges and stores the lighting information captured by the probe grid of the spatial voxels into the texture resource information according to the viewpoint position in the game scene. The texture resource information can cope with different game scenes. The lighting information of the game scene is sampled so that the pixels on the same screen can be interpolated to different surface densities according to their different spatial positions. Then, when responding to the rendering instruction of the lighting information, the rendering task is established using the texture resource information to render the lighting information in the game scene. The texture resource information caches the three-dimensional texture address of the game scene. Since the number of pixel textures in the game scene determines the number of lighting probes, and a large number of voxels can save the number of lighting probes through adaptive layout, there is no need for GPU hardware to quickly sample millions of lighting probes per frame, which reduces the update, transmission and storage costs of lighting information sampling in the game scene and improves the rendering efficiency of lighting information.
[0104] Further, as a refinement and extension of the specific implementation of the above embodiment, in order to fully illustrate the specific implementation process of this embodiment, this embodiment provides another method for rendering lighting information in a game scene, such as Figure 4 As shown, the method includes:
[0105] 301. Obtain a spatial region covered by the object to be mounted in the game scene, and divide each spatial voxel in the spatial region into voxels of a preset level.
[0106] Game scenes are made up of objects. Some objects are solid, such as a brick, and some objects have no fixed shape, such as a wisp of smoke. However, all objects occupy a volume in three-dimensional space. Objects can be opaque, meaning that light cannot pass through them, or transparent, meaning that light can pass through them. When rendering opaque objects, you only need to consider their surfaces, without knowing what the inside of the object looks like. When rendering transparent or translucent objects, you need to consider the reflection, refraction, scattering, absorption, and other behaviors caused by light passing through the object, which requires combining knowledge of the internal structure and properties of the object.
[0107] Light in the game scene can control the activities of the characters, affect the mood of the players, and also affect the way of perceiving various events. As a tool for game development, the game engine can observe various effects in real time during the production of the game, including intensity, color, shadow, etc., which can be flexibly adjusted during the production. Usually, for static objects in the game scene, global illumination can be used to bake light maps. When baking a light map, the objects in the game scene will calculate a map result based on the influence of light, and superimpose it on the objects in the game scene to create a lighting effect. The light map can contain direct light sources projected onto the surface of the object in the scene, as well as indirect light sources reflected between different objects. The surface information and bump information of the object can be described through the shader on the object material. Although the light map of static objects cannot change the lighting conditions of the game scene when the game is executed, the pre-calculated real-time global illumination system can calculate complex scene light source interactions in real time. By pre-calculating global illumination, it is possible to create a game environment with rich global illumination reflections and reflect the changes of light sources in real time. For dynamic objects in the game scene, you can set sampling points of light probes in the specified area to collect the light and dark information of the specified area. The specified area can be the space area covered by the object to be mounted in the game scene. Since the lighting information generated in the place with small lighting changes in the game scene is less, arranging too many light probes will cause waste. The preferred position is to set dense light probes in the lighting changes, shadows and lighting transition areas. Here, you can select the corresponding preferred position for the space area covered by the area to be mounted, and divide each space voxel in the space area into voxels of preset levels. The preset level here is the limited depth of the tree structure, which can be set according to the actual application scenario. The higher the number of levels, the more light probes are required.
[0108] 302. Traverse each voxel in the preset level and determine whether the bounding box of the segmented voxel intersects with the bounding box of the object in the game scene.
[0109] It can be understood that in order to arrange more lighting probes in the spatial pixels close to the surface of the object and a small number of lighting probes in the empty spatial pixels, the distance condition is determined for each voxel in the preset level. Here, the bounding box of the segmented voxel is equivalent to the smallest hexahedron that surrounds the segmented voxel and is parallel to the coordinate axis. The bounding box of the object in the game scene is equivalent to the smallest hexahedron that surrounds the object and is parallel to the coordinate axis. The bounding box has a simple structure and a small storage space. It is not suitable for complex virtual environments containing software deformations. By judging whether the bounding box of the segmented voxel intersects with the bounding box of the object in the game scene, it can be determined whether there is an object in the spatial voxel. The corresponding spatial voxels without objects do not need to be segmented or light probes need to be arranged.
[0110] 303. If yes, determine that the segmented voxel is a close-range voxel on the surface of an object in the game scene.
[0111] The above-mentioned judgment process can be executed before and after the segmentation of the spatial voxels, and the voxels that meet the judgment conditions are repeatedly segmented. If the voxels do not meet the judgment conditions, they will not be segmented. First, start with a large voxel as the original spatial voxel to be segmented, and then divide it evenly. The segmentation principle is that if it is close to the surface of the object, it will be subdivided, and each sub-voxel will be repeatedly segmented until the specified minimum voxel size is reached, that is, the preset level. This process will generate a tree structure of the preset level.
[0112] 304. Create effective lighting probes and virtual lighting probes for the near-distance voxels included in the spatial voxels, and generate a probe grid of the spatial voxels.
[0113] In an embodiment of the present application, an effective light probe, as a light probe arranged in a game scene, usually approaches the surface of an object to obtain the lighting conditions of the object's surface. Specifically, an effective light probe can be created for close-range voxels in the hierarchy of spatial voxels, virtual voxels corresponding to the hierarchy are added to the spatial voxels, and virtual light probes are created for voxels in the virtual voxels that meet the adding conditions. The virtual light probe is used to seamlessly interpolate the lighting data sampled by the close-range voxels in the hierarchy of spatial voxels.
[0114] Specifically, when adding virtual voxels corresponding to the level for the spatial voxels, and creating virtual light probes for the voxels in the virtual voxels that meet the addition conditions, virtual voxels corresponding to the level can be added for the levels greater than the first order in the spatial voxels. The virtual voxels are mapped to the voxels of the corresponding level in the spatial voxels, and the virtual voxels corresponding to the level are further traversed to determine whether there are valid light probes for the mapped voxels in the spatial voxels. If not, a virtual light probe is created for the virtual voxel. Here, voxels of different levels can be displayed in different colors, and virtual voxels and virtual light probes can be added for different levels. For places where there are no valid light probes around the close-range voxels where valid light probes are created, virtual light probes are created in addition.
[0115] 305. Expand the illumination information captured by the probe grid of the spatial voxels into a three-dimensional block data set according to the viewpoint position in the game scene to form three-dimensional block texture information with a multi-level tree structure.
[0116] In an embodiment of the present application, effective lighting probes in the probe grid can be used to sample lighting data in the game scene, and interpolation operations can be performed on the lighting data to obtain first lighting information of the viewpoint position in the game scene. Virtual lighting probes in the probe grid can be used to seamlessly interpolate lighting data sampled by close-range voxels in the spatial voxels within the hierarchy to obtain second lighting information of the viewpoint position in the game scene. The first lighting information and the second lighting information of the viewpoint position in the game scene can be further expanded to a three-dimensional block data set to form three-dimensional block texture information with a multi-level tree structure.
[0117] It should be noted that the three-dimensional texture information of the tree structure is combined with the lighting information captured by the effective lighting probe and the virtual lighting probe, and can transmit the lighting information to the GPU to form texture resource information.
[0118] 306. In the process of expanding to the three-dimensional block data set, the hierarchical relationship of the three-dimensional block data set mapping is recorded in the indirect texture information.
[0119] It should be noted that in order to complete the storage of three-dimensional block data sets, it is also necessary to use a tree structure to construct an indirect texture information containing a hierarchical expansion representation. The indirect texture information is sampled at runtime, and the obtained content is the hierarchical relationship of the three-dimensional block data in the tree structure, thereby calculating the sampling position of the cached light probe in the three-dimensional block data.
[0120] 307. Combine the three-dimensional block texture information and the indirect texture information and store them in texture resource information.
[0121] It can be understood that the texture resource information stores the lighting information in each spatial voxel in the game scene, and then interpolates between the lighting information captured by the nearest lighting probe by baking. The lighting information at any position within the spatial voxel will be projected onto the moving object after estimation.
[0122] 308. In response to a rendering instruction of the lighting information, establish a rendering task using the texture resource information to render the lighting information in the game scene.
[0123] In the example of the present application, the rendering task can be established by using texture resource information, and the hierarchical relationship of the three-dimensional block texture information mapping can be obtained from the indirect texture information. Then, based on the hierarchical relationship of the three-dimensional block texture information mapping, the position information of the three-dimensional texture information in the tree structure can be queried. Finally, according to the position of the three-dimensional texture information in the tree structure, the lighting information captured by the probe grid of the spatial voxels is sampled from the three-dimensional block texture information, and the lighting information is rendered.
[0124] Specifically, in the process of querying the position information of the three-dimensional texture information in the tree structure according to the hierarchical relationship of the three-dimensional block texture information mapping, the level and offset of the three-dimensional block texture information in the tree structure can be extracted according to the hierarchical relationship of the three-dimensional block texture information mapping, and the position information of the three-dimensional texture information in the tree structure can be calculated according to the level and offset of the three-dimensional block texture information in the tree structure.
[0125] The following takes 2D quadtree as an example of a specific application scenario. First, effective light probes are adaptively created in the spatial voxels in the game scene, and then an effective light probe is placed in each voxel corner. Specifically, each spatial voxel can be divided into 4 voxels, and the division is repeated for each voxel to form an octree structure of the spatial voxels, forming a 2*2*2 probe grid, recording the voxels close to the surface of the object, and placing effective light probes on these voxel nodes. Then, virtual voxels and virtual light probes are added to the level corresponding to the spatial voxels in the game scene. The virtual voxels and virtual light probes can achieve seamless interpolation of lighting information when sampling between voxels at a larger level and a smaller level, further increasing the effective light. The lighting information captured by the lighting probe and the virtual lighting probe is merged and stored in the texture resource information. The texture resource information can be expanded layer by layer during the rendering process. Each 3D block data in the texture resource information of each level has a separate number. Usually, the 3D block data of each level is a combination of the lighting information captured by the effective lighting probe and the virtual lighting probe. For the 3D block data that are not merged and stored, the merging process can continue. Since the expanded 3D block data set is a storage structure composed of multiple textures with the same block size layout, the storage structure can be indirectly addressed during the rendering process, so that after the 3D block data cache is completed, the 3D block data can be obtained from the cache. The entire rendering process is as follows Figure 5a-5b As shown, a tree structure is used to construct an indirect texture that is expanded layer by layer. The indirect texture is sampled during rendering runtime, and the obtained content is the level and offset of the three-dimensional block data cached in the tree structure, thereby calculating the sampling position for the light probe in the block cache.
[0126] The example of the present application forms a three-dimensional block data set by expanding the spatial voxels with hierarchical relationships in the tree structure into a set of lighting probes. The hierarchical relationship of each three-dimensional block data in the tree structure is stored in an indirect mapping texture. Then, during the rendering of the game scene, each frame of scene data updates the lighting information captured by the lighting probe in the tree structure according to the viewpoint position, and expands it to the three-dimensional block data set. During the expansion process, the hierarchical relationship is recorded to the indirect texture and then transmitted to the GPU. During sampling, according to the world position of the sampling point on the surface of the object, a hierarchical relationship in the corresponding tree structure is first obtained from the indirect texture, and finally the hierarchical relationship is used to sample the lighting information formed by the final lighting probe in the three-dimensional block data for rendering.
[0127] Further, as Figure 1 The specific implementation of the method, the embodiment of the present application provides a rendering device for lighting information in a game scene, such as Figure 6 As shown, the device includes: an extraction unit 41, a first setting unit 42, a second setting unit 43, and a first rendering unit 44.
[0128] The extraction unit 41 can be used to segment the spatial region in the game scene using the data structure of the spatial region, and extract the spatial voxels containing the object, wherein the data structure is grid data containing multiple levels;
[0129] A first setting unit 42 may be used to traverse the grid data of the multiple levels, set effective light probes for the spatial voxels containing the object, and obtain a first light probe grid of the spatial region, wherein the first light probe grid contains effective light probes;
[0130] A second setting unit 43 may be used to supplement virtual light probes for the spatial voxels that do not contain objects, so as to obtain a second light probe grid for the spatial region, wherein the second light probe grid includes valid light probes and virtual light probes;
[0131] The first rendering unit 44 may be configured to transmit the lighting information collected by the second lighting probe grid to the texture resource information, and render the lighting information in the game scene according to the texture resource information.
[0132] In specific application scenarios, such as Figure 7 As shown, the data structure is a tree structure formed by the spatial region, and the extraction unit 41 includes:
[0133] A segmentation module 411 may be used to segment the spatial region into multiple levels using the tree structure formed by the spatial region to form spatial voxels of multiple levels;
[0134] The first judgment module 412 may be used to judge whether the spatial voxels in the divided levels contain objects during the division of the multi-level spatial region;
[0135] The extraction module 413 may be used to, if yes, perform next-level segmentation on the spatial voxels in the segmented level until the number of levels reaches a preset threshold, and extract the spatial voxels containing the object.
[0136] In specific application scenarios, such as Figure 7 As shown, the first setting unit 42 includes:
[0137] The first acquisition module 421 may be used to acquire the grid position of the spatial voxel containing the object in the grid data of multiple levels;
[0138] The first setting module 422 may be used to set valid lighting probes at the vertices in the first grid position to obtain a first lighting probe grid of the spatial region.
[0139] In specific application scenarios, such as Figure 7As shown, the second setting unit 43 includes:
[0140] The second acquisition module 431 may be used to traverse the grid data of the multiple levels, and for a spatial voxel in each level that does not contain an object, acquire a second grid position of the spatial voxel in the grid data of the multiple levels;
[0141] The second judgment module 432 may be used to judge whether valid illumination probes are set at the four vertices of the grid position;
[0142] The second setting module 433 may be used to, if not, supplementarily set virtual light probes for vertices in the grid position where no valid light probes are set, to obtain a second light probe grid for the spatial area.
[0143] In specific application scenarios, such as Figure 7 As shown, the device also includes:
[0144] The extraction unit 45 can be used to extract the spatial logical relationship mapped by the lighting information in the second lighting probe grid before transmitting the lighting information collected by the second lighting probe grid to the texture resource information and rendering the lighting information in the game scene according to the texture resource information, and store the spatial logical relationship in the texture resource information.
[0145] In specific application scenarios, such as Figure 7 As shown, the first rendering unit 44 includes:
[0146] The expansion module 441 may be used to expand the illumination information in the texture resource information into the three-dimensional block data set according to the spatial logical relationship, and use indirect textures to record the hierarchical relationship between the three-dimensional block data sets;
[0147] A merging module 442 may be used to merge the three-dimensional block data sets by utilizing the hierarchical relationship between the three-dimensional block data sets in the indirect texture to form three-dimensional block texture information of a tree structure, wherein the three-dimensional block texture information records the spatial position of the illumination information in the game scene;
[0148] The reading module 443 can be used to read the lighting information of the corresponding spatial position from the three-dimensional block texture information of the tree structure for rendering according to the spatial position of the viewpoint position in the game scene.
[0149] In a specific application scenario, the expansion module 441 may be specifically used to extract the hierarchical distribution of valid light probes and virtual light probes in the second light probe grid according to the spatial logical relationship;
[0150] The expansion module 441 can also be specifically used to expand the lighting information in the texture resource information into three-dimensional block data according to the hierarchical distribution of effective lighting probes and virtual lighting probes in the second lighting probe grid, and use indirect textures to record the hierarchical relationship between the three-dimensional block data sets.
[0151] In a specific application scenario, the reading module 443 may be specifically used to obtain an indirect texture representing a hierarchical relationship between three-dimensional block data sets from the three-dimensional block texture information in the tree structure according to the spatial position of the viewpoint position in the game scene;
[0152] The reading module 443 may be specifically configured to use the indirect texture representing the hierarchical relationship between the three-dimensional block data sets to read the illumination information of the corresponding spatial position in the three-dimensional block texture information of the tree structure for rendering.
[0153] It should be noted that for other corresponding descriptions of the functional units involved in the rendering device for illumination information in a game scene provided in this embodiment, reference can be made to Figure 1 The corresponding description in will not be repeated here.
[0154] Further, as Figure 3 and Figure 4 The specific implementation of the method, the embodiment of the present application provides a rendering device for lighting information in a game scene, such as Figure 8 As shown, the device includes: an acquisition unit 51, a creation unit 52, a storage unit 53, and a second rendering unit 54.
[0155] The acquisition unit 51 may be used to acquire the close-distance voxels contained in the spatial voxels in the game scene, wherein the close-distance voxels are voxels that meet the distance condition in the voxels of the preset level formed by the spatial voxel segmentation in the game scene, and the distance condition is that the bounding box of the voxel intersects with the bounding box of the object in the game scene;
[0156] A creation unit 52 may be used to create effective lighting probes and virtual lighting probes for the near-distance voxels contained in the spatial voxels, and generate a probe grid of the spatial voxels, wherein the probe grid is used to capture lighting information in the game scene;
[0157] The storage unit 53 may be used to merge and store the lighting information captured by the probe grid of the spatial voxels into the texture resource information according to the viewpoint position in the game scene;
[0158] The second rendering unit 54 may be configured to respond to a rendering instruction of the lighting information, establish a rendering task using the texture resource information, and render the lighting information in the game scene.
[0159] Compared with the existing method of sampling lighting information object by object, the rendering device of lighting information in the game scene provided by the embodiment of the present invention uses the method of sampling lighting information pixel by pixel. On the one hand, it can provide indirect lighting for a large number of complex objects and is applicable to a variety of lighting acquisition scenarios. On the other hand, it avoids the total number of objects sampled object by object due to the update cost of 3D texture from the CPU end to the GPU end and the transmission bandwidth. Compared with the existing method of sampling lighting information pixel by pixel, the present application obtains the close-range voxels contained in the spatial voxels in the game scene. The close-range voxels are voxels close to the surface of the object and require a larger number of lighting probes. Further, effective lighting probes and virtual lighting probes are created for the close-range voxels contained in the spatial voxels, and a probe grid of the spatial voxels is generated. The lighting probes and virtual lighting probes can be adaptively arranged. The virtual lighting probes serve as auxiliary effective lighting probes to provide seamless interpolation for the game scene, and the lighting information captured by the probe grid of the spatial voxels is merged and stored into the texture resource information according to the viewpoint position in the game scene. The texture resource information can cope with different game scenes. The lighting information of the game scene is sampled so that the pixels on the same screen can be interpolated to different surface densities according to their different spatial positions. Then, when responding to the rendering instruction of the lighting information, the rendering task is established using the texture resource information to render the lighting information in the game scene. The texture resource information caches the three-dimensional texture address of the game scene. Since the number of pixel textures in the game scene determines the number of lighting probes, and a large number of voxels can save the number of lighting probes through adaptive layout, there is no need for GPU hardware to quickly sample millions of lighting probes per frame, which reduces the update, transmission and storage costs of lighting information sampling in the game scene and improves the rendering efficiency of lighting information.
[0160] In specific application scenarios, such as Fig. 9 As shown, the acquisition unit 51 includes:
[0161] The segmentation module 511 may be used to obtain a spatial region covered by the object to be mounted in the game scene, and segment each spatial voxel in the spatial region into voxels of a preset level;
[0162] The third judgment module 512 may be used to traverse each voxel in the preset level and judge whether the bounding box of the segmented voxel intersects with the bounding box of the object in the game scene;
[0163] The determination module 513 may be configured to, if yes, determine that the segmented voxel is a close-range voxel on the surface of an object in the game scene.
[0164] In specific application scenarios, such as Fig. 9 As shown, the creation unit 52 includes:
[0165] A creation module 521 may be used to create valid illumination probes for close voxels in the hierarchy among the spatial voxels;
[0166] The additional module 522 can be used to add virtual voxels corresponding to the level for the spatial voxels, and create virtual lighting probes for the voxels in the virtual voxels that meet the adding conditions. The virtual lighting probes are used to seamlessly interpolate the lighting data sampled by the close-range voxels in the level of the spatial voxels.
[0167] In specific application scenarios, such as Fig. 9 As shown, the additional module 522 includes:
[0168] The adding submodule 5221 may be used to add virtual voxels corresponding to the levels greater than the first order in the spatial voxels, and the virtual voxels are mapped to the voxels of the corresponding level in the spatial voxels;
[0169] The judgment submodule 5222 may be used to traverse the virtual voxels corresponding to the level and judge whether there is a valid illumination probe in the phase mapping voxel in the spatial voxel;
[0170] The creation submodule 5223 may be used to create a virtual lighting probe for the virtual voxel if no.
[0171] In specific application scenarios, such as Fig. 9 As shown, the device also includes:
[0172] The expansion unit 55 may be used to expand the illumination information captured by the probe grid of the spatial voxels into a three-dimensional block data set according to the viewpoint position in the game scene before merging and storing the illumination information captured by the probe grid of the spatial voxels according to the viewpoint position in the game scene into the texture resource information to form three-dimensional block texture information with a multi-level tree structure;
[0173] The recording unit 56 may be used to record the hierarchical relationship of the three-dimensional block data set mapping into the indirect texture information during the process of expanding the three-dimensional block data set;
[0174] The storage unit 53 may also be used to merge the three-dimensional block texture information and the indirect texture information and store them in the texture resource information.
[0175] In specific application scenarios, such as Fig. 9 As shown, the unfolding unit 55 includes:
[0176] The operation module 551 may be used to sample the illumination data in the game scene using the effective illumination probes in the probe grid, and perform interpolation operation on the illumination data to obtain first illumination information of the viewpoint position in the game scene;
[0177] An interpolation module 552 may be used to seamlessly interpolate illumination data sampled by close-distance voxels in the spatial voxels using virtual illumination probes in the probe grid to obtain second illumination information of a viewpoint position in the game scene;
[0178] The expansion module 553 can be used to expand the first illumination information and the second illumination information of the viewpoint position in the game scene into a three-dimensional block data set to form three-dimensional block texture information with a multi-level tree structure.
[0179] In specific application scenarios, such as Fig. 9 As shown, the second rendering unit 54 includes:
[0180] The acquisition module 541 may be used to establish a rendering task using the texture resource information, and acquire a hierarchical relationship of a three-dimensional block texture information mapping from the indirect texture information;
[0181] A query module 542, which can be used to query the position information of the three-dimensional texture information in the tree structure according to the hierarchical relationship of the three-dimensional block texture information mapping;
[0182] The sampling module 543 may be used to sample the illumination information captured by the probe grid of the spatial voxels from the 3D block texture information according to the position of the 3D texture information in the tree structure, and render the illumination information.
[0183] In specific application scenarios, such as Fig. 9 As shown, the query module 542 includes:
[0184] The extraction submodule 5421 may be used to extract the level and offset of the three-dimensional block texture information in the tree structure according to the hierarchical relationship of the three-dimensional block texture information mapping;
[0185] The calculation submodule 5422 may be used to calculate the position information of the three-dimensional texture information in the tree structure according to the level and offset of the three-dimensional block texture information in the tree structure.
[0186] It should be noted that for other corresponding descriptions of the functional units involved in the rendering device for illumination information in a game scene provided in this embodiment, reference can be made to Figure 1 -The corresponding description in Figure 2 will not be repeated here.
[0187] Based on the above Figure 1 The method shown in the embodiment of the present application accordingly provides a storage medium on which a computer program is stored, and when the program is executed by a processor, the above-mentioned Figure 1 The rendering method of lighting information in the game scene shown.
[0188] Based on the above Figure 3-Figure 4 The method shown in the embodiment of the present application accordingly provides a storage medium on which a computer program is stored, and when the program is executed by a processor, the above-mentioned Figure 3-Figure 4 The rendering method of lighting information in the game scene shown.
[0189] Based on this understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each implementation scenario of the present application.
[0190] Based on the above Figure 1 , Figure 3-Figure 4 The method shown, and Figure 6-Figure 9 In order to achieve the above-mentioned purpose, the embodiment of the present application also provides a physical device for rendering lighting information in a game scene, which can be a computer, a smart phone, a tablet computer, a smart watch, a server, or a network device, etc. The physical device includes a storage medium and a processor; the storage medium is used to store a computer program; the processor is used to execute the computer program to achieve the above-mentioned Figure 1 , Figure 3-Figure 4 The rendering method of lighting information in the game scene shown.
[0191] Optionally, the physical device may also include a user interface, a network interface, a camera, a radio frequency (RF) circuit, a sensor, an audio circuit, a WI-FI module, etc. The user interface may include a display, an input unit such as a keyboard, etc., and the optional user interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (such as a WI-FI interface), etc.
[0192] In an exemplary embodiment, see Fig.10 The physical device includes a communication bus, a processor, a memory and a communication interface, and may also include an input / output interface and a display device, wherein each functional unit can communicate with each other through the bus. The memory stores a computer program, and the processor is used to execute the program stored in the memory and execute the painting mounting method in the above embodiment.
[0193] Those skilled in the art will understand that the physical device structure for rendering lighting information in a game scene provided in this embodiment does not constitute a limitation on the physical device, and may include more or fewer components, or a combination of certain components, or different arrangements of components.
[0194] The storage medium may also include an operating system and a network communication module. The operating system is a program that manages the hardware and software resources of the physical device for the store search information processing, and supports the operation of the information processing program and other software and / or programs. The network communication module is used to realize the communication between the components inside the storage medium, and the communication with other hardware and software in the physical device for information processing.
[0195] Through the description of the above implementation methods, those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform, or by hardware. By applying the technical solution of the present application, compared with the current existing methods, the present application provides a terrain data frame in which the terrain elements in the game scene have not changed, indicating that the scene terrain has not changed. The mixed texture information formed by the last changed terrain data frame can be used to perform game scene rendering, without the need to perform multi-texture blending operations on each frame of the terrain scene, thereby reducing the time occupied by the texture rendering process and improving the rendering speed of the lighting information in the game scene.
[0196] Those skilled in the art will appreciate that the accompanying drawings are only schematic diagrams of a preferred implementation scenario, and the modules or processes in the accompanying drawings are not necessarily necessary for implementing the present application. Those skilled in the art will appreciate that the modules in the devices in the implementation scenario can be distributed in the devices of the implementation scenario according to the description of the implementation scenario, or can be changed accordingly and located in one or more devices different from the present implementation scenario. The modules of the above-mentioned implementation scenario can be combined into one module, or can be further split into multiple submodules.
[0197] The above serial numbers of this application are only for description and do not represent the advantages and disadvantages of the implementation scenarios. The above disclosure is only a few specific implementation scenarios of this application, but this application is not limited to them, and any changes that can be thought of by technicians in this field should fall within the scope of protection of this application.
Claims
1. A method for rendering lighting information in a game scene, characterized in that: include: Acquire close-distance voxels contained in the spatial voxels in the game scene, wherein the close-distance voxels are voxels that meet the distance condition in the voxels of a preset level formed by the segmentation of the spatial voxels in the game scene, and the distance condition is that the bounding box of the voxel intersects with the bounding box of the object in the game scene; Creating effective lighting probes and virtual lighting probes for the near-distance voxels contained in the spatial voxels, generating a probe grid of the spatial voxels, wherein the probe grid is used to capture lighting information in the game scene, the virtual lighting probe is used to associate effective lighting probes in each level, and the effective lighting probe is used to collect lighting data of changes in the game scene according to the viewpoint position to form lighting information captured by the probe grid; Merging and storing the lighting information captured by the probe grid of the spatial voxels into the texture resource information according to the viewpoint position in the game scene; In response to a rendering instruction of the lighting information, a rendering task is established using the texture resource information to render the lighting information in the game scene.
2. The method according to claim 1, characterized in that The obtaining of close-range voxels on the surface of an object in the game scene specifically includes: Acquire a spatial region covered by the object to be mounted in the game scene, and divide each spatial voxel in the spatial region into voxels of a preset level; Traverse each voxel in the preset hierarchy and determine whether the bounding box of the segmented voxel intersects with the bounding box of the object in the game scene; If so, it is determined that the segmented voxel is a close-range voxel on the surface of an object in the game scene.
3. The method according to claim 1, characterized in that The creating effective lighting probes and virtual lighting probes for the near-distance voxels contained in the spatial voxels to generate a probe grid of the spatial voxels specifically includes: Creating valid light probes for the near voxels in the hierarchy among the spatial voxels; Virtual voxels corresponding to the level are added to the spatial voxels, and virtual lighting probes are created for the voxels in the virtual voxels that meet the adding conditions. The virtual lighting probes are used to seamlessly interpolate the lighting data sampled by the close-distance voxels in the level of the spatial voxels.
4. The method according to claim 1, characterized in that: The step of adding virtual voxels corresponding to a level to the spatial voxels and creating virtual illumination probes for voxels in the virtual voxels that meet the adding conditions specifically includes: For the levels greater than the first order in the spatial voxels, virtual voxels corresponding to the levels are added, and the virtual voxels are mapped to the voxels of the corresponding levels in the spatial voxels; Traversing the virtual voxels corresponding to the level, and determining whether there is a valid illumination probe in the phase-mapped voxel in the spatial voxel; If not, a virtual light probe is created for the virtual voxel.
5. The method according to claim 4, characterized in that Before merging and storing the lighting information captured by the probe grid of the spatial voxels into the texture resource information according to the viewpoint position in the game scene, the method further includes: Expanding the illumination information captured by the probe grid of the spatial voxels into a three-dimensional block data set according to the viewpoint position in the game scene to form three-dimensional block texture information with a multi-level tree structure; In the process of expanding to the three-dimensional block data set, the hierarchical relationship of the three-dimensional block data set mapping is recorded in the indirect texture information; The step of merging and storing the lighting information captured by the probe grid of the spatial voxels into the texture resource information according to the viewpoint position in the game scene specifically includes: The three-dimensional block texture information and the indirect texture information are combined and stored in the texture resource information.
6. The method according to any one of claims 1 to 5, characterized in that The step of expanding the illumination information captured by the probe grid of the spatial voxels into a three-dimensional block data set according to the viewpoint position in the game scene to form three-dimensional block texture information with a multi-level tree structure specifically includes: Using the effective illumination probes in the probe grid to sample illumination data in the game scene, and performing an interpolation operation on the illumination data to obtain first illumination information of a viewpoint position in the game scene; Using the virtual lighting probes in the probe grid, the lighting data sampled by the close-distance voxels in the spatial voxels are seamlessly interpolated to obtain the second lighting information of the viewpoint position in the game scene; The first illumination information and the second illumination information of the viewpoint position in the game scene are expanded into a three-dimensional block data set to form three-dimensional block texture information with a multi-level tree structure.
7. The method according to claim 5, characterized in that The using the texture resource information to establish a rendering task to render the lighting information in the game scene specifically includes: Using the texture resource information to establish a rendering task, and obtaining a hierarchical relationship of three-dimensional block texture information mapping from the indirect texture information; According to the hierarchical relationship of the three-dimensional block texture information mapping, querying the position information of the three-dimensional texture information in the tree structure; The illumination information captured by the probe grid of the spatial voxels is sampled from the three-dimensional block texture information according to the position of the three-dimensional texture information in the tree structure, and the illumination information is rendered.
8. The method according to claim 7, characterized in that The querying of the position information of the three-dimensional texture information in the tree structure according to the hierarchical relationship of the three-dimensional block texture information mapping specifically includes: Extracting the level and offset of the three-dimensional block texture information in the tree structure according to the hierarchical relationship of the three-dimensional block texture information mapping; According to the level and offset of the three-dimensional block texture information in the tree structure, the position information of the three-dimensional texture information in the tree structure is calculated.
9. A device for rendering lighting information in a game scene, characterized in that: include: An acquisition unit is used to acquire close-distance voxels contained in the spatial voxels in the game scene, wherein the close-distance voxels are voxels that meet a distance condition among the voxels of a preset level formed by segmenting the spatial voxels in the game scene, and the distance condition is that a bounding box of the voxel intersects a bounding box of an object in the game scene; A creation unit, configured to create effective lighting probes and virtual lighting probes for the near-distance voxels contained in the spatial voxels, and generate a probe grid of the spatial voxels, wherein the probe grid is used to capture lighting information in the game scene, the virtual lighting probe is used to associate effective lighting probes in each level, and the effective lighting probe is used to collect lighting data of changes in the game scene according to the viewpoint position to form lighting information captured by the probe grid; A storage unit, for merging and storing the lighting information captured by the probe grid of the spatial voxels into the texture resource information according to the viewpoint position in the game scene; The second rendering unit is used to respond to the rendering instruction of the lighting information, establish a rendering task using the texture resource information, and render the lighting information in the game scene.
10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method for rendering lighting information in a game scene described in any one of claims 1 to 8 are implemented.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for rendering lighting information in a game scene described in any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Rendering method for dynamically calculating indirectly reflected high light based on optical probe interpolation
CN106204701A
Rendering method and device
CN111340926A
Illumination sampling method in game, device and computer equipment
CN111744183A