Rendering scenario-based indirect illumination processing method and related apparatus

By acquiring voxel textures and using ray collection and sampling methods for assigned textures, indirect lighting calculations are simplified, solving the problem of high computational complexity in existing technologies and improving the efficiency of indirect lighting in rendered scenes.

WO2026031974A1PCT designated stage Publication Date: 2026-02-12TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2025/108826
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-08-07
Filing Date
2025-07-16
Publication Date
2026-02-12

AI Technical Summary

Technical Problem

In existing technologies, indirect lighting calculation methods based on rendering scenes are too cumbersome and complex, with a large amount of computation, resulting in low efficiency.

Method used

By acquiring the voxel texture of the scene to be rendered, the indirect lighting in the voxel texture is collected by multiple rays emitted from each pixel in the allocated texture and stored to form a light map. Light sampling is performed by combining the position offset of the object to be rendered and the allocation size to achieve fast indirect lighting calculation.

Benefits of technology

It simplifies the indirect lighting calculation process and significantly improves computational efficiency by eliminating the need to rely on the geometric information of vertices in the geometry cache to generate screen probes or surface finite elements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025108826_12022026_PF_FP_ABST
    Figure CN2025108826_12022026_PF_FP_ABST
Patent Text Reader

Abstract

The present application discloses a rendering scenario-based indirect illumination processing method and a related apparatus, applied to scenarios such as artificial intelligence. The method comprises: first acquiring a voxel texture formed by indirect illumination of each voxel in a voxelized scenario of a scenario to be rendered; then, on the basis of a plurality of first rays emitted by each pixel in an allocated map of the scenario to be rendered, collecting a plurality of indirect illuminations corresponding to a plurality of voxels in the voxel texture, so as to obtain indirect illumination of each pixel; for a plurality of pixels in the allocated map, storing a plurality of indirect illuminations corresponding to the plurality of pixels, so as to obtain an illumination map of the scenario to be rendered; and on the basis of a position to be rendered of an object to be rendered in the scenario to be rendered, a position offset of said object in the allocated map, and an allocated size, performing sampling on the illumination map to obtain indirect illumination of said position. In the method, rendering scenario-based indirect illumination calculation is relatively simple and straightforward, considerable time is saved, and the efficiency of rendering scenario-based indirect illumination calculation is improved.
Need to check novelty before this filing date? Find Prior Art

Description

An indirect lighting processing method based on a rendered scene and a related device

[0001] The present application claims priority to the Chinese patent application No. 2024110830816, filed on August 7, 2024, entitled "An indirect lighting processing method based on a rendered scene and a related device", the whole content of which is incorporated herein by reference. TECHNICAL FIELD

[0002] The present application relates to the technical field of computer, in particular to an indirect lighting processing based on a rendered scene. BACKGROUND

[0003] At present, lighting rendering based on a rendered scene needs to calculate global lighting. The global lighting includes direct lighting of scene light sources and indirect lighting of multiple bounces of scene light rays. Since the indirect lighting involves multiple transmissions of scene light rays, it is particularly important to calculate the indirect lighting.

[0004] In related technologies, the indirect lighting calculation method based on a rendered scene refers to generating a screen probe or a surface finite element for indirect lighting calculation through the geometric information of vertices in the geometry cache of a to-be-rendered scene, to obtain the indirect lighting of the rendered scene.

[0005] However, the above method generates a screen probe or a surface finite element for indirect lighting calculation through the geometric information of vertices, which is too cumbersome and complex, has a large amount of calculation and needs to spend a lot of time, resulting in low efficiency of indirect lighting calculation based on a rendered scene. SUMMARY

[0006] To solve the above technical problems, the present application provides an indirect lighting processing method based on a rendered scene and a related device, which does not need to generate a screen probe or a surface finite element for indirect lighting calculation through the geometric information of vertices in the geometry cache of a to-be-rendered scene, so that the indirect lighting calculation is relatively simple and direct, a lot of time is saved, and the efficiency of indirect lighting calculation based on a rendered scene is improved.

[0007] The present application discloses the following technical solutions:

[0008] In one aspect, the present application provides an indirect lighting processing method based on a rendered scene, which comprises:

[0009] Obtaining a voxel texture of a to-be-rendered scene; the voxel texture includes indirect lighting of each voxel in a voxelized scene of the to-be-rendered scene;

[0010] According to a plurality of first rays emitted by each pixel in an allocated map of the to-be-rendered scene, performing lighting collection on indirect lighting corresponding to a voxel in the voxel texture, to obtain indirect lighting of the each pixel.

[0011] store the indirect light corresponding to each pixel in the assigned map, and obtain a light map of the scene to be rendered;

[0012] According to the rendering position of the object to be rendered in the scene to be rendered and the assignment area of the object to be rendered in the assigned map, the light map is sampled for light, and the indirect light of the rendering position is obtained.

[0013] In another aspect, the embodiments of the present application provide an indirect light processing device based on a rendering scene, which comprises an acquisition unit, a collection unit, a storage unit and a sampling unit;

[0014] The acquisition unit is configured to acquire a voxel texture of a scene to be rendered, wherein the voxel texture comprises indirect light of each voxel in a voxelized scene of the scene to be rendered;

[0015] The collection unit is configured to collect indirect light corresponding to a voxel in the voxel texture according to a plurality of first rays emitted by each pixel in an assigned map of the scene to be rendered, and obtain indirect light of the each pixel;

[0016] The storage unit is configured to store indirect light corresponding to each pixel in the assigned map, and obtain a light map of the scene to be rendered;

[0017] The sampling unit is configured to sample the light map for light according to a rendering position of an object to be rendered in the scene to be rendered and an assignment area of the object to be rendered in the assigned map, and obtain indirect light of the rendering position.

[0018] In another aspect, the embodiments of the present application provide a computer device, which comprises a processor and a memory:

[0019] The memory is configured to store a computer program and transmit the computer program to the processor;

[0020] The processor is configured to execute the method according to the instructions in the computer program.

[0021] In another aspect, the embodiments of the present application provide a computer readable storage medium for storing a computer program, when the computer program is run on a computer device, so that the computer device executes the method according to any one of the preceding aspects.

[0022] In another aspect, an embodiment of the present application provides a computer program product, comprising a computer program which, when running on a computer device, causes the computer device to execute the method of any one of the preceding aspects.

[0023] It can be seen from the above technical solution that the voxel texture formed by the indirect lighting of each voxel in the voxelized scene of the to-be-rendered scene is first acquired; then, based on a plurality of first rays emitted by each pixel in the assigned map of the to-be-rendered scene, a plurality of indirect lightings corresponding to a plurality of voxels in the voxel texture are collected to obtain the indirect lighting of each pixel; and the indirect lightings corresponding to the plurality of pixels are stored for the plurality of pixels to obtain the lighting map of the to-be-rendered scene. In this way, on the basis of the voxels in the voxel texture of the to-be-rendered scene providing indirect lightings, for the assigned map of the to-be-rendered scene, the indirect lightings of the voxels in the voxel texture are collected by the pixel emitting a plurality of first rays, and are correspondingly stored, so that the lighting baking can be quickly realized to obtain the lighting map of the to-be-rendered scene. Based on the to-be-rendered position of the to-be-rendered object in the to-be-rendered scene, the position offset and the assignment size of the to-be-rendered object in the assigned map, the indirect lighting of the to-be-rendered position is sampled from the lighting map. In this way, on the basis of the pixels in the lighting map of the to-be-rendered scene providing indirect lightings, for the to-be-rendered position of the to-be-rendered object in the to-be-rendered scene, the indirect lighting of the corresponding pixel in the lighting map is directly sampled through the position offset and the assignment size of the to-be-rendered object in the assigned map, so that the indirect lighting of the to-be-rendered position can be quickly obtained. Based on this, the method is based on the assigned map of the to-be-rendered scene, relies on the indirect lightings provided by the voxels in the voxel texture of the to-be-rendered scene, quickly realizes the lighting baking to obtain the lighting map of the to-be-rendered scene, and relies on the position offset and the assignment size of the to-be-rendered object in the assigned map to sample the lighting map, quickly realizes the indirect lighting calculation to obtain the indirect lighting of the to-be-rendered position. That is, the method does not need to rely on the geometric information of the vertices in the geometry cache of the to-be-rendered scene to generate screen probes or surface finite elements for the indirect lighting calculation, so that the indirect lighting calculation is relatively simple and direct, a lot of time is saved, and the efficiency of the indirect lighting calculation based on the to-be-rendered scene is improved. BRIEF DESCRIPTION OF DRAWINGS

[0024] FIG. 1 is a system schematic diagram of a method for processing indirect lighting based on a rendering scene according to an embodiment of the present application;

[0025] FIG. 2 is a flowchart of a method for processing indirect lighting based on a rendering scene according to an embodiment of the present application;

[0026] FIG. 3 is a schematic diagram of a lighting map of a to-be-rendered scene according to an embodiment of the present application;

[0027] FIG. 4 is a schematic diagram of a rendering effect of a to-be-rendered scene according to an embodiment of the present application;

[0028] FIG. 5 is a schematic diagram of a voxelized scene of a to-be-rendered scene according to an embodiment of the present application;

[0029] FIG. 6 is a schematic diagram of a rendering effect of the to-be-rendered scene after a change in a scene light source according to an embodiment of the present application;

[0030] FIG. 7 is a flowchart of another method for processing indirect lighting based on a rendered scene according to an embodiment of the present application;

[0031] FIG. 8 is a structural diagram of a device for processing indirect lighting based on a rendered scene according to an embodiment of the present application;

[0032] FIG. 9 is a structural diagram of a server according to an embodiment of the present application;

[0033] FIG. 10 is a structural diagram of a terminal according to an embodiment of the present application. DETAILED DESCRIPTION

[0034] Embodiments of the present application will be described below with reference to the accompanying drawings.

[0035] At present, in a lighting rendering process based on a rendered scene, a screen probe or a surface finite element is generated based on geometric information of a vertex in a geometry buffer of a to-be-rendered scene to perform indirect lighting calculation, and indirect lighting of the rendered scene is obtained. However, it is found through research that the generation of the screen probe or the surface finite element based on the geometric information of the vertex to perform the indirect lighting calculation is too complicated and complex, and a large amount of calculation is required, which takes a lot of time, resulting in a low efficiency of the indirect lighting calculation based on the rendered scene.

[0036] The embodiments of the present application provide a method for processing indirect lighting based on a rendered scene. Based on an assigned map of a to-be-rendered scene, indirect lighting provided by a voxel in a voxel texture of the to-be-rendered scene is relied on to quickly perform lighting baking to obtain a lighting map of the to-be-rendered scene. For a to-be-rendered position of a to-be-rendered object in the to-be-rendered scene, the lighting map is sampled based on a position offset and an assigned size of the to-be-rendered object in the assigned map to quickly perform indirect lighting calculation to obtain indirect lighting of the to-be-rendered position. That is, the method does not need to rely on geometric information of a vertex in a geometry buffer of the to-be-rendered scene to generate a screen probe or a surface finite element to perform indirect lighting calculation, so that the indirect lighting calculation is relatively simple and direct, a lot of time is saved, and the efficiency of the indirect lighting calculation based on the rendered scene is improved.

[0037] Next, a system architecture of the method for processing indirect lighting based on a rendered scene will be introduced. Referring to FIG. 1, FIG. 1 is a system schematic diagram of the method for processing indirect lighting based on a rendered scene according to an embodiment of the present application, and the system includes a computer device 100 configured to execute the method for processing indirect lighting based on a rendered scene.

[0038] The computer device 100 acquires a voxel texture of the to-be-rendered scene; the voxel texture comprises indirect illuminations of each voxel in a voxelized scene of the to-be-rendered scene.

[0039] As an example, the to-be-rendered scene is scene X; then the computer device 100 acquires a voxel texture formed by indirect illuminations of each voxel in a voxelized scene of scene X, which is texture X. The texture X comprises a plurality of voxels in the voxelized scene of scene X and a plurality of indirect illuminations corresponding to the plurality of voxels.

[0040] The computer device 100 performs illumination collection on the plurality of indirect illuminations corresponding to the plurality of voxels in the voxel texture according to a plurality of first rays emitted by each pixel in an assigned map of the to-be-rendered scene, to obtain an indirect illumination of each pixel.

[0041] As an example, based on the above example, the assigned map of the to-be-rendered scene is map X of scene X; then the computer device 100 collects the plurality of indirect illuminations corresponding to the plurality of voxels in the texture X based on a plurality of first rays emitted by each pixel (Pixel) in the map X of scene X, to obtain an indirect illumination of each pixel.

[0042] The computer device 100 stores the plurality of indirect illuminations corresponding to the plurality of pixels in the assigned map, to obtain an illumination map of the to-be-rendered scene.

[0043] As an example, based on the above example, the computer device 100 stores the plurality of indirect illuminations corresponding to the plurality of pixels in the map X, to obtain an illumination map of scene X as map X'.

[0044] The computer device 100 performs illumination sampling on the illumination map according to a to-be-rendered position of a to-be-rendered object in the to-be-rendered scene, a position offset of the to-be-rendered object in the assigned map, and an assignment size, to obtain an indirect illumination of the to-be-rendered position.

[0045] As an example, based on the above example, the to-be-rendered object is an object, and the to-be-rendered position of the to-be-rendered object in the to-be-rendered scene is a texture coordinate (u, v) of the object in scene X; the computer device 100 samples the map X' based on the texture coordinate (u, v) of the object in scene X, a position offset of the object in the map X, and an assignment size, to obtain an indirect illumination of (u, v).

[0046] That is, on the basis that the voxels in the voxel texture of the scene to be rendered provide indirect lighting, the pixel emits a plurality of first rays to collect the indirect lighting of the voxels in the voxel texture and correspondingly stores for the assigned map of the scene to be rendered, so that the light baking can be quickly realized to obtain the light map of the scene to be rendered; on the basis that the pixel provides indirect lighting in the light map of the scene to be rendered, the indirect lighting of the corresponding pixel in the light map is directly sampled through the position offset and the assignment size in the assigned map of the object to be rendered in the scene to be rendered, so that the indirect lighting of the position to be rendered can be quickly obtained.

[0047] It should be noted that in the embodiments of the present application, the computer device can be a server or a terminal, and the method provided by the embodiments of the present application can be executed by the terminal or the server alone, or by the terminal and the server together. When the method provided by the embodiments of the present application is executed by the terminal or the server alone, the execution method is similar to the embodiment corresponding to FIG. 1, and mainly the computer device is replaced by the terminal or the server. In addition, when the method provided by the embodiments of the present application is executed by the terminal and the server together, the steps that need to be reflected on the front-end interface can be executed by the terminal, and some steps that need to be calculated in the background and do not need to be reflected on the front-end interface can be executed by the server.

[0048] The terminal can be a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart voice interaction device, a vehicle-mounted terminal, an extended reality device, or an aircraft, but is not limited thereto. The server can be a standalone physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing cloud computing services, but is not limited thereto. The terminal and the server can be directly or indirectly connected through wired or wireless communication, which is not limited in the present application. For example, the terminal and the server can be connected through a network, which can be a wired or wireless network.

[0049] Next, taking that the computer device executes the method provided by the embodiments of the present application as an example, the indirect lighting processing method based on a rendering scene provided by the embodiments of the present application will be described in detail in combination with the drawings.

[0050] Referring to FIG. 2, FIG. 2 is a flowchart of an indirect lighting processing method based on a rendering scene provided by the embodiments of the present application, and the method comprises:

[0051] S201: Obtain a voxel texture of a scene to be rendered; the voxel texture comprises indirect lighting of each voxel in a voxelized scene of the scene to be rendered.

[0052] S202: Collect indirect lighting corresponding to voxels in the voxel texture according to a plurality of first rays emitted by each pixel in an assigned map of the scene to be rendered, to obtain indirect lighting of each pixel.

[0053] S203: Obtain the light map of the rendering scene by storing the indirect light corresponding to each pixel in the allocated map of the rendering scene.

[0054] In the related art, in the light rendering process based on the rendering scene, the screen probe or surface finite element is generated by the geometric information of the vertex in the geometric cache of the rendering scene to perform indirect light calculation, and the indirect light of the rendering scene is obtained. However, through research, it is found that the generation of the screen probe or the surface finite element by the geometric information of the vertex to perform indirect light calculation is too complicated and complex, and the calculation amount is large, which needs to spend more time, resulting in low efficiency of the indirect light calculation based on the rendering scene.

[0055] Therefore, in the embodiment of the present application, in order to not rely on the geometric information of the vertex in the geometric cache of the rendering scene to generate the screen probe or the surface finite element to perform indirect light calculation, it is considered that the indirect light can be collected by the voxel in the voxelized scene of the rendering scene, and the voxel texture is stored correspondingly, and the pixel in the allocated map of the rendering scene has a corresponding relationship with the voxel in the voxelized scene, so the indirect light of the related voxel can be collected through the pixel of the allocated map, thereby quickly obtaining the accurate indirect light related to the pixel.

[0056] The pixel in the allocated map of the rendering scene can represent the surface point of the rendering object in the rendering scene, and the indirect light corresponding to the voxel in the voxel texture can be collected and stored based on the multiple rays emitted by the pixel, which can quickly realize light baking to obtain a light map, and the light map is used to realize indirect light calculation based on the rendering scene. Based on this, the voxel texture formed by the indirect light of each voxel in the voxelized scene of the rendering scene is obtained; then, based on the multiple first rays emitted by each pixel in the allocated map of the rendering scene, the multiple indirect lights corresponding to the multiple voxels in the voxel texture are collected, and the indirect light of each pixel is obtained; and the light map of the rendering scene is obtained by storing the indirect light corresponding to the pixel in the allocated map.

[0057] The voxel texture of the scene to be rendered refers to a three-dimensional texture formed by storing indirect illumination of each voxel in the voxelized scene of the scene to be rendered; the voxelized scene of the scene to be rendered refers to a scene in which each object to be rendered in the scene to be rendered is represented by a voxel; each voxel in the voxelized scene of the scene to be rendered refers to each three-dimensional mesh of each object to be rendered in the scene to be rendered; the indirect illumination of each voxel refers to mixed illumination of direct illumination of a scene light source collected by a plurality of rays emitted by each voxel and stored illumination of other voxels; the allocated map of the scene to be rendered refers to a two-dimensional map obtained by allocating a resolution area in the initial map for each object to be rendered in the scene to be rendered; each pixel in the allocated map of the scene to be rendered represents a surface point of an object to be rendered in the scene to be rendered; the indirect illumination of each pixel refers to mixed illumination of a plurality of indirect illuminations corresponding to a plurality of voxels in the voxel texture collected by a plurality of rays emitted by each pixel; and the light map of the scene to be rendered refers to a two-dimensional map obtained by storing the indirect illumination of each pixel in the allocated map of the scene to be rendered.

[0058] The S201-S203 can convert to the voxelized scene through the pixels in the allocated map to emit the first rays, take the position in the voxelized scene as the position of the pixel, and take the position as the starting point of the first rays, and emit a plurality of first rays around the position, so that the indirect illumination corresponding to the voxels in contact with the first rays in the voxelized scene in the voxel texture can be collected to obtain the indirect illumination corresponding to the pixel.

[0059] Therefore, based on the plurality of first rays emitted by each pixel in the allocated map of the scene to be rendered, the plurality of indirect illuminations corresponding to the plurality of voxels in the voxel texture can be collected and stored correspondingly, so that the illumination baking can be quickly realized, and the light map of the scene to be rendered is obtained, which provides a directly samplable light map for subsequent indirect illumination calculation based on the scene to be rendered.

[0060] Referring to FIG. 3, FIG. 3 is a schematic diagram of a light map of a scene to be rendered provided by an embodiment of the present application. The diagram represents the light map obtained by performing the above S201-S203 on the scene to be rendered.

[0061] As an example of S201-S203, the scene to be rendered is scene X, and the assigned map of the scene to be rendered is map X of scene X. The computer device obtains a voxel texture of indirect illumination of each voxel in the voxelized scene of scene X as texture X; the texture X includes a plurality of voxels in the voxelized scene of scene X and a plurality of indirect illuminations corresponding to the plurality of voxels; the computer device collects the plurality of indirect illuminations corresponding to the plurality of voxels in the texture X based on a plurality of first rays emitted by each pixel in the map X of scene X, to obtain indirect illumination of each pixel; and the computer device stores the plurality of indirect illuminations corresponding to the plurality of pixels for the plurality of pixels in the map X, to obtain the light map of scene X as map X'.

[0062] S204: performing illumination sampling on the light map according to a to-be-rendered position of a to-be-rendered object in the scene to be rendered and an assigned region of the to-be-rendered object in the assigned map, to obtain indirect illumination of the to-be-rendered position.

[0063] In the embodiments of the present application, after the light map of the scene to be rendered is obtained by performing S201-S203, a pixel in the light map of the scene to be rendered can represent a pixel on a surface of the to-be-rendered object in the scene to be rendered, and the assigned map is a reassignment of the to-be-rendered object in the scene to be rendered, and the pixels included therein have a clear correspondence with the light map.

[0064] Therefore, based on the pixel in the light map of the scene to be rendered providing indirect illumination, and based on the to-be-rendered position of the to-be-rendered object in the scene to be rendered and the assigned region of the to-be-rendered object in the assigned map, the indirect illumination of the corresponding pixel in the light map can be sampled, so as to obtain the indirect illumination of the to-be-rendered position.

[0065] The to-be-rendered position of the to-be-rendered object in the scene to be rendered refers to a texture coordinate of the to-be-rendered object in the scene to be rendered; the assigned region of the to-be-rendered object in the assigned map can be identified by a texture coordinate offset corresponding to the assigned region in the assigned map; and the assigned size of the assigned region of the to-be-rendered object in the assigned map refers to a region size corresponding to the assigned region in the assigned map.

[0066] The S204 is performed for the to-be-rendered position of the to-be-rendered object in the scene to be rendered. Since the pixel in the light map of the scene to be rendered provides indirect illumination, the indirect illumination of the corresponding pixel in the light map can be directly sampled through the assigned region of the to-be-rendered object in the assigned map, so as to quickly realize indirect illumination calculation and obtain the indirect illumination of the to-be-rendered position.

[0067] Referring to FIG. 4, FIG. 4 is a schematic diagram of a rendering effect of a to-be-rendered scene according to an embodiment of the present application. In FIG. 4, (a) represents a rendering effect diagram of the to-be-rendered scene with indirect lighting turned off; and (b) represents a rendering effect diagram of the to-be-rendered scene obtained by turning on the indirect lighting processing method provided in the present application, i.e., the rendering effect diagram of the to-be-rendered scene obtained by performing S204 on the basis of the light map of the to-be-rendered scene represented in FIG. 3.

[0068] As an example of S204, on the basis of the examples of S201-S203, the to-be-rendered object is an object, and the to-be-rendered position of the to-be-rendered object in the to-be-rendered scene is the texture coordinate (u, v) of the object in the scene X; the computer device samples the map X' to obtain the indirect lighting of (u, v) based on the texture coordinate (u, v) of the object in the scene X, the position offset of the object in the map X, and the allocation size.

[0069] As can be seen from the above technical solution, the light baking is quickly realized based on the allocated map of the to-be-rendered scene, and the indirect lighting is quickly calculated based on the position offset and the allocation size of the to-be-rendered object in the allocated map, which makes the indirect lighting calculation simple and direct, saves a lot of time, and improves the efficiency of the indirect lighting calculation based on the to-be-rendered scene.

[0070] In the embodiment of the present application, the allocated map of the to-be-rendered scene in S202 above refers to a two-dimensional map obtained by allocating a resolution area for each to-be-rendered object in the initial map; therefore, the process of obtaining the allocated map of the to-be-rendered scene refers to: first, determining the position offset and the allocation size of each to-be-rendered object in the initial map according to the resolution of each to-be-rendered object in the to-be-rendered scene; and then, performing area allocation on the initial map according to the position offset and the allocation size of each to-be-rendered object in the initial map to obtain the allocated map, wherein the position offset and the allocation size of the allocated area of each to-be-rendered object in the allocated map are the position offset and the allocation size of each to-be-rendered object in the allocated map. Based on this, the present application provides a possible implementation manner, and the obtaining step of the allocated map of the to-be-rendered scene in S202 above may, for example, include the following S1-S2 (not shown in the figure).

[0071] S1: determining the position offset and the allocation size of each to-be-rendered object in the initial map according to the resolution of each to-be-rendered object in the to-be-rendered scene.

[0072] S2: performing regional allocation on the initial map according to the position offset and the allocation size of each to-be-rendered object in the initial map, to obtain an allocated map.

[0073] The position offset of each to-be-rendered object in the initial map refers to a texture coordinate offset of a to-be-allocated region of each to-be-rendered object in the initial map; and the allocation size of each to-be-rendered object in the initial map refers to a region size corresponding to the to-be-allocated region of each to-be-rendered object in the initial map.

[0074] The S1-S2 is performed on the initial map, and the position offset and the allocation size of each to-be-rendered object in the initial map are determined according to the resolution of each to-be-rendered object in the to-be-rendered scene, so as to perform regional allocation on the initial map and obtain an accurate allocated map of the to-be-rendered scene. The pixels in the allocated map of the to-be-rendered scene can represent the surface points of the to-be-rendered objects in the to-be-rendered scene, and the multiple indirect illuminations corresponding to the multiple voxels in the voxel texture are stored, so as to quickly realize illumination baking to obtain an accurate basic map for the light map.

[0075] As an example of the S1-S2, on the basis of the above-mentioned example of S201-S203, the to-be-rendered object is an object, and the initial map is a map x; the computer device determines the position offset and the allocation size of each object to-be-allocated region in the map x according to the resolution of each object in the scene X; and the computer device performs regional allocation on the map x according to the position offset and the allocation size of each object to-be-allocated region in the map x to obtain a map X.

[0076] In the embodiment of the present application, when the plurality of first rays emitted by each pixel in the allocated texture of the to-be-rendered scene are used to collect the plurality of indirect illuminations corresponding to the plurality of voxels in the voxel texture to obtain the indirect illumination of each pixel in S202, for each pixel, each first ray emitted by the pixel can collect the plurality of indirect illuminations corresponding to the plurality of voxels in the voxel texture that the first ray hits to obtain the indirect illumination collected by each first ray, and then the plurality of first rays collect the plurality of indirect illuminations. In this case, the plurality of indirect illuminations collected by the plurality of first rays also need to be mixed to obtain the indirect illumination of the pixel. Therefore, on the basis of the plurality of indirect illuminations collected by the plurality of first rays, the normal direction of the pixel, the ray direction of each first ray, the probability density of the ray directions corresponding to the plurality of first rays, and the number of the plurality of first rays are considered to affect the contribution degree of the indirect illumination collected by each first ray to the indirect illumination of the pixel. First, the first weight of each first ray is determined by the normal direction of the pixel, the ray direction of each first ray, the probability density of the plurality of ray directions corresponding to the plurality of first rays, and the number of the plurality of first rays. Then, the indirect illumination of the pixel is weighted calculated by combining the plurality of indirect illuminations collected by the plurality of first rays and the plurality of first weights corresponding to the plurality of first rays. Based on this, the present application provides a possible implementation manner, and S202 may, for example, include S2021-S2023 (not shown in the figure) as follows.

[0077] S2021: For each pixel, the indirect illumination corresponding to the voxels in the voxel texture is collected according to the plurality of first rays emitted by the pixel to obtain the plurality of indirect illuminations collected by the plurality of first rays.

[0078] S2022: The first weight of each first ray is determined according to the normal direction of the pixel, the ray direction of each first ray, the probability density of the ray directions corresponding to the plurality of first rays, and the number of the plurality of first rays.

[0079] S2023: The indirect illumination of the pixel is obtained by weighted calculation according to the indirect illumination collected by the plurality of first rays and the first weight corresponding to the plurality of first rays.

[0080] The indirect illumination collected by the first ray refers to the collected illumination formed by the plurality of indirect illuminations corresponding to the plurality of voxels in the voxel texture that the first ray hits. The normal direction of the pixel refers to the normal direction of the surface point of the to-be-rendered object in the to-be-rendered scene represented by the pixel. The ray direction of each first ray refers to the emission direction of each first ray. The probability density of the ray directions corresponding to the plurality of first rays refers to the emission probability of the ray directions corresponding to the plurality of first rays. The first weight of each first ray represents the contribution degree of the indirect illumination collected by each first ray to the indirect illumination of the pixel.

[0081] The S2021-S2023 is for each pixel in the allocated map of the scene to be rendered, the indirect illumination collected by each first ray emitted by the pixel, according to the normal direction of the pixel, the ray direction of each first ray, the probability density of the plurality of ray directions corresponding to the plurality of first rays, and the first weight of each first ray determined according to the number of the plurality of first rays, the contribution of the indirect illumination collected by each first ray to the indirect illumination of the pixel is considered, the plurality of indirect illuminations collected by the plurality of first rays are mixed to obtain the accurate indirect illumination of the pixel, which provides accurate indirect illumination data for subsequent corresponding storage to quickly realize illumination baking to obtain a light map.

[0082] As an example of S2021-S2023, on the basis of the above-mentioned example of S201-S203, the normal direction of the pixel is PixelNormal, the ray direction of the first ray is Ray1Direction, the probability density of the plurality of ray directions corresponding to the plurality of first rays is Pdf1, and the number of the plurality of first rays is N1. The computer device collects the plurality of indirect illuminations corresponding to the plurality of voxels in the texture X through each first ray emitted by the pixel to obtain the indirect illumination collected by each first ray, and then the plurality of first rays collect the plurality of indirect illuminations. The computer device first determines the first weight of each first ray through PixelNormal, each Ray1Direction, each Pdf1, and N1; then combines the plurality of indirect illuminations collected by the plurality of first rays and the plurality of first weights corresponding to the plurality of first rays to weight calculate the indirect illumination of the pixel. The calculation formula of the first weight of the first ray is as follows:

[0083] Wherein, weight1 represents the first weight of the first ray.

[0084] In the embodiment of the application, since the voxelized scene of the scene to be rendered in the above-mentioned S201 refers to a scene in which each object to be rendered in the scene to be rendered is represented by a voxel; therefore, each object to be rendered in the scene to be rendered is converted into a voxel representation, and the voxelized scene of the scene to be rendered is obtained. Based on this, the application provides a possible implementation manner, and the obtaining step of the voxelized scene of the scene to be rendered in the above-mentioned S201 may, for example, include S3 (not shown in the figure): voxel conversion is performed on each object to be rendered in the scene to be rendered to obtain a voxelized scene.

[0085] Wherein, the voxel conversion refers to representing the object to be rendered by a voxel.

[0086] The S3 converts each object to be rendered in the scene to be rendered into a voxel representation to obtain a voxelized scene, which lays a foundation for subsequent storage of indirect illumination collected by voxels in the voxelized scene to form a voxel texture.

[0087] Referring to FIG. 5, FIG. 5 is a schematic diagram of a voxelized scene of a to-be-rendered scene according to an embodiment of the present application. The diagram represents the voxelized scene of the to-be-rendered scene obtained by performing S3 on the to-be-rendered scene.

[0088] As an example of S3, on the basis of the example of S201-S203, the to-be-rendered object is an object; and the computer device converts each object in the scene X into a voxel representation to obtain the voxelized scene of the scene X.

[0089] In the embodiment of the present application, since the voxel texture of the to-be-rendered scene in S201 refers to a three-dimensional texture formed by storing the indirect illumination of each voxel in the voxelized scene of the to-be-rendered scene, and the indirect illumination of each voxel refers to the mixed illumination of the direct illumination of the scene light source collected by the multiple rays emitted by each voxel and the stored illumination of other voxels; therefore, the obtaining process of the voxel texture of the to-be-rendered scene refers to: first, based on the multiple second rays emitted by each voxel in the voxelized scene of the to-be-rendered scene, collecting the direct illumination of the scene light source of the to-be-rendered scene and the stored illumination of other voxels in the voxelized scene to obtain the indirect illumination of each voxel; and then, storing the indirect illumination corresponding to each of the multiple voxels in the voxelized scene to obtain the voxel texture. Based on this, the present application provides a possible implementation manner, and the obtaining step of the voxel texture of the to-be-rendered scene in S201 may, for example, include S4-S5 as follows.

[0090] S4: According to the multiple second rays emitted by each voxel, collecting the direct illumination of the scene light source of the to-be-rendered scene and the stored illumination of other voxels in the voxelized scene to obtain the indirect illumination of each voxel.

[0091] S5: Storing the indirect illumination corresponding to each of the multiple voxels in the voxelized scene to obtain the voxel texture.

[0092] The S4-S5 can quickly realize the indirect illumination collection of the voxel, and correspondingly store the voxel texture of the to-be-rendered scene, thereby providing the indirectly illuminated voxel that can be collected for subsequent fast realization of the illumination baking based on the allocated map of the to-be-rendered scene to obtain the illumination map.

[0093] As an example of S4-S5, based on the example of S201-S203 above, the computer device collects direct lighting of the scene light source of the scene X and stored lighting of other voxels in the voxelized scene based on a plurality of second rays emitted by each voxel in the voxelized scene of the scene X, to obtain indirect lighting of each voxel; and the computer device stores a plurality of indirect lightings corresponding to a plurality of voxels for a plurality of voxels in the voxelized scene to obtain a texture X.

[0094] In the embodiment of the present application, when the indirect lighting of each voxel is obtained by collecting the direct lighting of the scene light source of the scene to be rendered and the stored lighting of other voxels in the voxelized scene based on a plurality of second rays emitted by each voxel in the voxelized scene of the scene to be rendered in S4 above, for each voxel, the direct lighting of the scene light source and the stored lighting of other voxels can be collected by each second ray emitted by the voxel to obtain the indirect lighting collected by each second ray, and then a plurality of indirect lightings are collected by a plurality of second rays. In this case, the indirect lighting of the voxel also needs to be obtained by mixing the indirect lightings collected by the second rays. Therefore, based on the plurality of indirect lightings collected by the plurality of second rays, the normal direction of the voxel, the ray direction of each second ray, the probability density of the ray direction corresponding to each second ray, and the number of the plurality of second rays will all affect the contribution degree of the indirect lighting collected by each second ray to the indirect lighting of the voxel. First, the first weight of each second ray is determined by the normal direction of the voxel, the ray direction of each second ray, the probability density of the ray direction corresponding to each second ray, and the number of the plurality of second rays. Then, the indirect lighting of the voxel is weighted calculated by combining the plurality of indirect lightings collected by the plurality of second rays and the plurality of first weights corresponding to the plurality of second rays. Based on this, the present application provides a possible implementation manner, and S4 above may, for example, include S41-S43 (not shown in the figure) as follows.

[0095] S41: For each voxel, the direct lighting of the scene light source and the stored lighting of other voxels are collected by illumination collection based on a plurality of second rays emitted by the voxel, to obtain a plurality of indirect lightings collected by a plurality of second rays.

[0096] S42: The second weight of each second ray is determined according to the normal direction of the voxel, the ray direction of each second ray, the probability density of the ray direction corresponding to each second ray, and the number of the plurality of second rays.

[0097] S43: The indirect lighting of the voxel is obtained by weighted calculation according to the indirect lighting collected by each second ray and the second weight corresponding to each second ray.

[0098] The plurality of indirect illuminations collected by the plurality of second rays refers to the plurality of collected illuminations formed by the direct illumination of the scene light source and the stored illumination of other voxels; the normal direction of the voxel refers to the normal direction of the three-dimensional mesh representing the object to be rendered in the scene to be rendered; the ray direction of each second ray refers to the emission direction of each second ray; the probability density of the plurality of ray directions corresponding to the plurality of second rays refers to the plurality of emission probabilities corresponding to the plurality of ray directions corresponding to the plurality of second rays; and the second weight of each second ray represents the contribution degree of the indirect illumination collected by each second ray to the indirect illumination of the voxel.

[0099] The S41-S43 is for each voxel in the voxel texture of the scene to be rendered. The indirect illumination collected by each second ray emitted by the voxel is calculated by weighting according to the normal direction of the voxel, the ray direction of each second ray, the probability density of the plurality of ray directions corresponding to the plurality of second rays, and the second weight of each second ray determined by the number of the plurality of second rays. The contribution degree of the indirect illumination collected by each second ray to the indirect illumination of the voxel is considered, the plurality of indirect illuminations collected by the plurality of second rays is mixed, and the accurate indirect illumination of the voxel is obtained, which provides accurate indirect illumination data for subsequent storage of the voxel texture.

[0100] As an example of S41-S43, based on the example of S4-S5 above, the normal direction of the voxel is VoxelNormal, the ray direction of the second ray is Ray2Direction, the probability density of the plurality of ray directions corresponding to the plurality of second rays is Pdf2, and the number of the plurality of second rays is N2. The computer device collects the direct illumination of the scene light source and the stored illumination of other voxels through each second ray emitted by the voxel to obtain the indirect illumination collected by each second ray, and then collects the plurality of indirect illuminations by the plurality of second rays. The computer device first determines the second weight of each second ray by VoxelNormal, each Ray2Direction, each Pdf2, and N2; and then combines the plurality of indirect illuminations collected by the plurality of second rays and the plurality of second weights corresponding to the plurality of second rays to weight calculate the indirect illumination of the voxel. The calculation formula of the second weight of the second ray is as follows:

[0101] weight2 represents the second weight of the second ray.

[0102] In the embodiment of the present application, in the implementation of sampling the indirect illumination of the pixel corresponding to the rendering position in the light map based on the rendering position of the object to be rendered in the scene to be rendered, the position offset and the allocation size of the object to be rendered in the allocated map in the above S204, since the pixel in the light map of the scene to be rendered can represent the surface point of the object to be rendered in the scene to be rendered, therefore, by the rendering position of the object to be rendered in the scene to be rendered, the position offset and the allocation size of the object to be rendered in the allocated map, the pixel position of the pixel corresponding to the rendering position in the light map can be determined as the sampling position; on this basis, the indirect illumination of the pixel of the sampling position in the light map is sampled, and the indirect illumination of the rendering position is obtained. Based on this, the present application provides a possible implementation manner, and the above S204 may, for example, include the following S2041-S2042 (not shown in the figure).

[0103] S2041: determining the sampling position of the rendering position in the light map according to the rendering position of the object to be rendered in the scene to be rendered and the allocation region of the object to be rendered in the allocated map.

[0104] S2042: performing illumination sampling on the light map according to the sampling position to obtain the indirect illumination of the rendering position.

[0105] The sampling position of the rendering position in the light map refers to the pixel position of the pixel corresponding to the rendering position in the light map.

[0106] The S2041-S2042 first determines the pixel position of the pixel corresponding to the rendering position in the light map as the sampling position by the rendering position of the object to be rendered in the scene to be rendered, the position offset and the allocation size of the object to be rendered in the allocated map, and considers the allocated region of the object to be rendered in the allocated map; and then samples the indirect illumination of the pixel of the sampling position in the light map, and accurately obtains the indirect illumination of the rendering position.

[0107] As an example of S2041-S2042, on the basis of the example of the above S204, the computer device determines the pixel position of the pixel corresponding to the object in the map X' as the sampling position (u', v') by the (u, v) of the object in the scene X, the position offset and the allocation size of the object in the map X; the computer device samples the indirect illumination of the pixel of (u', v') in the map X', and obtains the indirect illumination of (u, v).

[0108] Further, in the embodiments of the present application, it is considered that in the light rendering process of the scene to be rendered, the scene light source of the scene to be rendered can change, and the changed scene light source causes the indirect light of each voxel in the voxelized scene of the scene to be rendered to change, thereby causing the voxel texture of the scene to be rendered to change; therefore, when the scene light source of the scene to be rendered changes, the changed scene light source needs to be acquired, so as to update the voxel texture of the scene to be rendered through the changed scene light source. Based on this, the present application provides a possible implementation manner, and the method can further include the following S6-S7 (not shown in the figure).

[0109] S6: If the scene light source changes, the changed scene light source is acquired.

[0110] S7: The voxel texture is updated according to the changed scene light source.

[0111] The S6-S7 is for the case that the scene light source of the scene to be rendered changes, and the voxel texture of the scene to be rendered is updated through the changed scene light source, thereby facilitating subsequent fast realization of light baking based on the allocated map of the scene to be rendered to obtain a more accurate indirect light of the voxel.

[0112] As an example of S6-S7, on the basis of the above-mentioned examples of S201-S203 and S204, when the scene light source of the scene X changes, the computer device acquires the changed scene light source; and the computer device updates the texture X of the scene X through the changed scene light source.

[0113] In the embodiments of the present application, it is considered that the changed scene light source actually affects the direct light of the scene light source of the scene to be rendered and the stored light of other voxels in the voxelized scene, so that the indirect light of each voxel in the voxelized scene of the scene to be rendered changes, thereby causing the voxel texture of the scene to be rendered to change; therefore, when the above-mentioned S7 updates the voxel texture of the scene to be rendered through the changed scene light source, each voxel in the voxelized scene of the scene to be rendered needs to emit a plurality of third rays, so as to re-collect the direct light of the changed scene light source and the stored light of other voxels in the voxelized scene, and obtain the updated indirect light of each voxel; thereby, the voxel texture of the scene to be rendered is updated through the plurality of updated indirect lights corresponding to the plurality of voxels. Based on this, the present application provides a possible implementation manner, and the above-mentioned S7 can include the following S71-S72 (not shown in the figure).

[0114] S71: The direct light of the changed scene light source and the stored light of other voxels are collected according to the plurality of third rays emitted by each voxel, and the updated indirect light of each voxel is obtained.

[0115] S72: updating the voxel texture according to the updated indirect light of each voxel.

[0116] The updated indirect light of each voxel refers to the mixed light of the changed direct light of the scene light source and the stored light of other voxels collected by the multiple rays emitted by each voxel.

[0117] The S71-S72 re-emits multiple third rays from each voxel in the voxelized scene of the scene to be rendered, re-collects the changed direct light of the scene light source and the stored light of other voxels in the voxelized scene, which can quickly realize the re-collection of the indirect light of the voxel when the scene light source changes, thereby updating the voxel texture of the scene to be rendered, and providing more accurate indirect light of the voxel for subsequent light baking based on the allocated map of the scene to be rendered to obtain the light map.

[0118] As an example of S71-S72, based on the example of S6-S7 described above, the computer device re-collects the changed direct light of the scene light source and the stored light of other voxels in the voxelized scene of the scene X based on the multiple third rays emitted by each voxel in the voxelized scene of the scene X, to obtain the updated indirect light of each voxel; the computer device updates the texture X of the scene X through the multiple updated indirect lights of the multiple voxels.

[0119] Referring to FIG. 6, FIG. 6 is a schematic diagram of the rendering effect of the scene to be rendered after the scene light source changes according to an embodiment of the present application. The diagram represents the rendering effect diagram of the scene to be rendered obtained by executing the above S6, the above S71-S72 based on the (b) in the above FIG. 4 when the scene light source of the scene to be rendered changes.

[0120] In addition, in the embodiments of the present application, considering that the object to be rendered in the scene to be rendered may move during the light rendering process of the scene to be rendered, that is, multiple voxels in the voxelized scene of the scene to be rendered may move, and that the indirect light of each voxel in the voxelized scene changes after the movement of the multiple voxels, thereby changing the voxel texture of the scene to be rendered; therefore, when the object to be rendered in the scene to be rendered moves, the multiple voxels in the voxelized scene of the scene to be rendered after the movement need to be obtained, so as to update the voxel texture of the scene to be rendered through the multiple voxels after the movement. Based on this, the present application provides a possible implementation manner, and the method may further include the following S8-S9 (not shown in the figure).

[0121] S8: If the object to be rendered moves, obtaining the multiple voxels in the voxelized scene after the movement.

[0122] S9: updating the voxel texture according to the multiple voxels after the movement.

[0123] The plurality of voxels after the movement in the voxelized scene refers to a plurality of three-dimensional meshes of a plurality of to-be-rendered objects after the movement in the to-be-rendered scene. If the voxelized scene includes N voxels, the plurality of voxels after the movement in the voxelized scene is N voxels after the movement.

[0124] The S8-S9 is for the case that the to-be-rendered object in the to-be-rendered scene moves, and the voxel texture of the to-be-rendered scene is updated through the plurality of voxels after the movement in the voxelized scene of the to-be-rendered scene, so as to facilitate subsequent fast implementation of light baking based on the allocated map of the to-be-rendered scene to obtain a light map providing more accurate indirect light of the voxel.

[0125] As an example of S8-S9, on the basis of the above-mentioned examples of S201-S203 and S204, when the object in the scene X moves, the computer device needs to obtain the plurality of voxels after the movement in the voxelized scene of the scene X; the computer device updates the texture X of the scene X through the plurality of voxels after the movement.

[0126] In the embodiment of the present application, it is considered that the plurality of voxels after the movement in the voxelized scene causes the indirect light of each voxel after the movement in the voxelized scene to change, so that the voxel texture of the to-be-rendered scene changes; therefore, when the above-mentioned S9 is specifically implemented by updating the voxel texture of the to-be-rendered scene through the plurality of voxels after the movement, each voxel after the movement in the voxelized scene of the to-be-rendered scene needs to emit a plurality of fourth rays in order to re-collect the direct light of the scene light source and the stored light of other voxels to obtain the updated indirect light of each voxel after the movement; and the voxel texture of the to-be-rendered scene is updated through the plurality of voxels after the movement and the plurality of updated indirect lights corresponding to the plurality of voxels after the movement. Based on this, the present application provides a possible implementation manner, and the above-mentioned S9 may, for example, include the following S91-S92 (not shown in the figure).

[0127] S91: According to the plurality of fourth rays emitted by each voxel after the movement, the direct light of the scene light source and the stored light of other voxels are collected to obtain the updated indirect light of each voxel after the movement.

[0128] S92: According to the plurality of voxels after the movement and the updated indirect light corresponding to the plurality of voxels after the movement, the voxel texture is updated.

[0129] The updated indirect light of each voxel after the movement refers to the mixed light of the direct light of the scene light source and the stored light of other voxels collected by the plurality of rays emitted by each voxel after the movement.

[0130] The S91-S92 each voxel in the voxelized scene of the to-be-rendered scene after movement emits a plurality of fourth rays again, and re-collects the direct light of the scene light source of the to-be-rendered scene and the stored light of other voxels in the voxelized scene, so that the indirect light of the voxel is quickly re-collected when the to-be-rendered object in the to-be-rendered scene moves, thereby updating the voxel texture of the to-be-rendered scene, and providing more accurate indirect light of the voxel for subsequent light baking based on the allocated map of the to-be-rendered scene to quickly obtain the light map.

[0131] As an example of S91-S92, on the basis of the example of S8-S9 described above, the computer device re-collects the direct light of the scene light source and the stored light of other voxels based on the plurality of fourth rays emitted by each voxel in the voxelized scene of the scene X after movement, to obtain the updated indirect light of each voxel after movement; and the computer device updates the texture X of the scene X by the plurality of voxels after movement and the plurality of updated indirect lights corresponding to the plurality of voxels after movement.

[0132] In summary, referring to FIG. 7, FIG. 7 is a flowchart of another method for processing indirect light based on a rendered scene provided by an embodiment of the present application, and the method comprises the following S710-S715.

[0133] S701: determining the position offset and the allocation size of each to-be-rendered object in the initial map according to the resolution of each to-be-rendered object in the to-be-rendered scene.

[0134] S702: performing regional allocation on the initial map according to the position offset and the allocation size of each to-be-rendered object in the initial map, to obtain the allocated map of the to-be-rendered scene.

[0135] S703: performing voxel conversion on each to-be-rendered object in the to-be-rendered scene, to obtain the voxelized scene of the to-be-rendered scene.

[0136] S704: performing light collection on the direct light of the scene light source of the to-be-rendered scene and the stored light of other voxels in the voxelized scene according to the plurality of second rays emitted by each voxel, to obtain the indirect light of each voxel.

[0137] S705: storing the plurality of indirect lights corresponding to the plurality of voxels in the voxelized scene, to obtain the voxel texture of the to-be-rendered scene.

[0138] S706: performing light collection on the plurality of indirect lights corresponding to the plurality of voxels in the voxel texture according to the plurality of first rays emitted by each pixel in the allocated map, to obtain the indirect light of each pixel.

[0139] S707: storing the plurality of indirect lights corresponding to the plurality of pixels in the allocated map, to obtain the light map of the to-be-rendered scene.

[0140] S708: judging whether the scene light source is changed or the object to be rendered is moved; if not, performing S709; if yes, performing S710-S712 and returning to perform S706 when the scene light source is changed, and performing S713-S715 and returning to perform S706 when the object to be rendered is moved.

[0141] S709: performing illumination sampling on the illumination map according to the position to be rendered of the object to be rendered in the scene to be rendered, the position offset of the object to be rendered in the allocated map and the allocated size, to obtain the indirect illumination of the position to be rendered.

[0142] S710: obtaining the changed scene light source.

[0143] S711: performing illumination collection on the direct illumination of the changed scene light source and the stored illumination of other voxels according to the multiple third rays emitted by each voxel, to obtain the updated indirect illumination of each voxel.

[0144] S712: updating the voxel texture according to the multiple updated indirect illuminations corresponding to the multiple voxels.

[0145] S713: obtaining the multiple voxels moved in the voxelized scene.

[0146] S714: performing illumination collection on the direct illumination of the scene light source and the stored illumination of other voxels according to the multiple fourth rays emitted by each voxel moved, to obtain the updated indirect illumination of each voxel moved.

[0147] S715: updating the voxel texture according to the multiple voxels moved, and the multiple updated indirect illuminations corresponding to the multiple voxels moved.

[0148] It can be seen from the technical solution that, based on the allocated map of the to-be-rendered scene, indirect lighting provided by voxels in the voxel texture of the to-be-rendered scene is relied on to quickly realize lighting baking to obtain the lighting map of the to-be-rendered scene. When the scene light source of the to-be-rendered scene does not change and the to-be-rendered object in the to-be-rendered scene does not move, the indirect lighting at the to-be-rendered position is quickly calculated by relying on the position offset of the to-be-rendered object in the allocated map and the allocated size to sample the lighting map according to the to-be-rendered position of the to-be-rendered object in the to-be-rendered scene. In addition, when the scene light source of the to-be-rendered scene changes, the voxel texture of the to-be-rendered scene is updated by the changed scene light source. When the to-be-rendered object in the to-be-rendered scene moves, the voxel texture of the to-be-rendered scene is updated by the plurality of voxels in the voxelized scene after the movement. In the case that the scene light source of the to-be-rendered scene changes or the to-be-rendered object in the to-be-rendered scene moves, the voxels in the updated voxel texture provide accurate indirect lighting. That is, the method does not need to rely on the geometric information of the vertices in the geometry buffer of the to-be-rendered scene to generate screen probes or surface finite elements to calculate indirect lighting, so that the indirect lighting calculation is relatively simple and direct, and a lot of time is saved. In the case that the scene light source of the to-be-rendered scene does not change and the to-be-rendered object in the to-be-rendered scene does not move, the indirect lighting calculation time of the to-be-rendered scene is equivalent to the sampling time of the lighting map. In the case that the scene light source of the to-be-rendered scene changes or the to-be-rendered object in the to-be-rendered scene moves, the voxel texture of the to-be-rendered scene can be updated to meet the indirect lighting calculation of the dynamic change of the to-be-rendered scene. Based on this, the method improves the indirect lighting calculation efficiency and effect based on the to-be-rendered scene.

[0149] It should be noted that the implementation manners provided by the present application in the above aspects can be further combined to provide more implementation manners.

[0150] Based on the indirect lighting processing method based on the to-be-rendered scene provided by the embodiment of FIG. 2, the present application further provides an indirect lighting processing device based on a to-be-rendered scene. Referring to FIG. 8, which is a structural diagram of an indirect lighting processing device based on a to-be-rendered scene provided by an embodiment of the present application, the indirect lighting processing device 800 based on the to-be-rendered scene includes an acquisition unit 801, a collection unit 802, a storage unit 803, and a sampling unit 804.

[0151] The acquisition unit 801 is configured to acquire a voxel texture of a to-be-rendered scene. The voxel texture includes indirect lighting of each voxel in a voxelized scene of the to-be-rendered scene.

[0152] The collection unit 802 is configured to collect indirect lighting corresponding to voxels in the voxel texture according to a plurality of first rays emitted by each pixel in the allocated map of the to-be-rendered scene, to obtain indirect lighting of each pixel.

[0153] The storage unit 803 is configured to store the indirect light corresponding to each of the plurality of pixels in the allocated map, and obtain a light map of the scene to be rendered.

[0154] The sampling unit 804 is configured to sample the light map according to a to-be-rendered position of a to-be-rendered object in the scene to be rendered and an allocated region of the to-be-rendered object in the allocated map, and obtain the indirect light of the to-be-rendered position.

[0155] In a possible implementation, the collection unit 802 is configured to:

[0156] For each pixel, the indirect light corresponding to each voxel in the voxel texture is collected according to a plurality of first rays emitted by the pixel, and a plurality of indirect lights collected by the plurality of first rays are obtained.

[0157] The first weight of each first ray is determined according to the normal direction of the pixel, the ray direction of each first ray, the probability density of the ray direction corresponding to each first ray, and the number of the plurality of first rays.

[0158] The indirect light of the pixel is obtained by performing weighted calculation on the indirect light collected by each first ray and the first weight corresponding to each first ray.

[0159] In a possible implementation, the collection unit 802 is further configured to:

[0160] The indirect light of each voxel is obtained by collecting the direct light of the scene light source and the stored light of other voxels in the voxelized scene according to a plurality of second rays emitted by each voxel.

[0161] The storage unit 803 is further configured to:

[0162] The indirect light corresponding to each of the plurality of voxels in the voxelized scene is stored, and a voxel texture is obtained.

[0163] In a possible implementation, the collection unit 802 is configured to:

[0164] For each voxel, the direct light of the scene light source and the stored light of other voxels are collected according to a plurality of second rays emitted by the voxel, and a plurality of indirect lights collected by the plurality of second rays are obtained.

[0165] The second weight of each second ray is determined according to the normal direction of the voxel, the ray direction of each second ray, the probability density of the ray direction corresponding to each second ray, and the number of the plurality of second rays.

[0166] The indirect illumination of the voxel is obtained by performing weighted calculation on the indirect illumination collected by the plurality of second rays respectively and the second weight corresponding to the plurality of second rays respectively.

[0167] In a possible implementation, the apparatus 800 further includes a conversion unit.

[0168] The conversion unit is configured to perform voxel conversion on each to-be-rendered object in the to-be-rendered scene to obtain a voxelized scene.

[0169] In a possible implementation, the apparatus 800 further includes a determination unit and an allocation unit.

[0170] The determination unit is configured to determine, according to the resolution of each to-be-rendered object in the to-be-rendered scene, a position offset and an allocation size of each to-be-rendered object in the initial map.

[0171] The allocation unit is configured to perform regional allocation on the initial map according to the position offset and the allocation size of each to-be-rendered object in the initial map to obtain an allocated map.

[0172] In a possible implementation, the sampling unit 804 is configured to:

[0173] According to the to-be-rendered position of the to-be-rendered object in the to-be-rendered scene, and the allocated region of the to-be-rendered object in the allocated map, the sampling unit 804 is configured to determine a to-be-sampled position of the to-be-rendered position in the light map.

[0174] The sampling unit 804 is configured to perform light sampling on the light map according to the to-be-sampled position to obtain the indirect illumination of the to-be-rendered position.

[0175] In a possible implementation, the apparatus further includes a first updating unit.

[0176] The obtaining unit 801 is further configured to, if the scene light source changes, obtain a changed scene light source.

[0177] The first updating unit is configured to update the voxel texture according to the changed scene light source.

[0178] In a possible implementation, the first updating unit is configured to:

[0179] According to the plurality of third rays emitted by each voxel, the first updating unit is configured to perform light collection on the direct illumination of the changed scene light source and the stored illumination of other voxels to obtain updated indirect illumination of each voxel.

[0180] The first updating unit is configured to update the voxel texture according to the updated indirect illumination of the plurality of voxels respectively.

[0181] In a possible implementation, the apparatus further includes a second updating unit.

[0182] The acquisition unit 801 is further configured to, if the to-be-rendered object moves, acquire a plurality of voxels in the voxelized scene after the movement;

[0183] The second updating unit is configured to update the voxel texture according to the plurality of voxels after the movement.

[0184] In a possible implementation, the second updating unit is configured to:

[0185] According to a plurality of fourth rays emitted according to each voxel after the movement, perform illumination collection on direct illumination of a scene light source and stored illumination of other voxels, to obtain updated indirect illumination of each voxel after the movement;

[0186] According to the plurality of voxels after the movement and the updated indirect illumination corresponding to the plurality of voxels after the movement respectively, update the voxel texture.

[0187] It can be seen from the above technical solution that the indirect lighting processing device based on the rendering scene comprises an acquisition unit, a collection unit, a storage unit and a sampling unit. The acquisition unit first acquires the voxel texture formed by the indirect lighting of each voxel in the voxelized scene of the to-be-rendered scene; the collection unit then collects the plurality of indirect lightings corresponding to the plurality of voxels in the voxel texture based on the plurality of first rays emitted by each pixel in the allocated map of the to-be-rendered scene, to obtain the indirect lighting of each pixel; the storage unit stores the plurality of indirect lightings corresponding to the plurality of pixels for the plurality of pixels in the allocated map, to obtain the lighting map of the to-be-rendered scene; on the basis of the voxels in the voxel texture of the to-be-rendered scene providing indirect lightings, for the allocated map of the to-be-rendered scene, the pixel emits a plurality of first rays to collect the indirect lightings of the voxels in the voxel texture and correspondingly stores, so that the lighting baking can be quickly realized to obtain the lighting map of the to-be-rendered scene. The sampling unit samples the lighting map based on the to-be-rendered position of the to-be-rendered object in the to-be-rendered scene, the position offset and the allocation size of the to-be-rendered object in the allocated map, to obtain the indirect lighting of the to-be-rendered position; on the basis of the pixels in the lighting map of the to-be-rendered scene providing indirect lightings, for the to-be-rendered position of the to-be-rendered object in the to-be-rendered scene, the indirect lighting of the corresponding pixel in the lighting map is directly sampled through the position offset and the allocation size of the to-be-rendered object in the allocated map, so that the indirect lighting of the to-be-rendered position can be quickly obtained. Based on this, the device quickly realizes the lighting baking to obtain the lighting map of the to-be-rendered scene based on the allocated map of the to-be-rendered scene, and relies on the indirect lightings provided by the voxels in the voxel texture of the to-be-rendered scene; the indirect lighting calculation of the to-be-rendered position is quickly realized by sampling the lighting map through the to-be-rendered position of the to-be-rendered object in the to-be-rendered scene, and relying on the position offset and the allocation size of the to-be-rendered object in the allocated map; that is, the device does not need to rely on the geometric information of the vertices in the geometry buffer of the to-be-rendered scene to generate screen probes or surface finite elements for indirect lighting calculation, so that the indirect lighting calculation is relatively simple and direct, a lot of time is saved, and the efficiency of the indirect lighting calculation based on the rendering scene is improved.

[0188] The embodiments of the present application further provide a computer device, which can be a server. Referring to FIG. 9, which is a structural diagram of a server provided by the embodiments of the present application, the server 900 can have great differences due to different configurations or performances, and can include one or more processors, such as a central processing unit (CPU) 922, and a memory 932, one or more storage media 930 (such as one or more mass storage devices) storing application programs 942 or data 944. The memory 932 and the storage media 930 can be temporary storage or persistent storage. The programs stored in the storage media 930 can include one or more modules (not shown in the diagram), each of which can include a series of instruction operations in the server. Furthermore, the CPU 922 can be configured to communicate with the storage media 930, and execute the series of instruction operations in the storage media 930 on the server 900.

[0189] The server 900 can further include one or more power supplies 926, one or more wired or wireless network interfaces 950, one or more input and output interfaces 958, and / or one or more operating systems 941, such as Windows Server TM , Mac OS X TM , Unix TM , Linux TM , FreeBSD TM , etc.

[0190] In the embodiments, the CPU 922 in the server 900 can execute the methods provided in the various optional implementations of the above embodiments.

[0191] The computer device provided by the embodiments of the present application can also be a terminal. Referring to FIG. 10, which is a structural diagram of a terminal provided by the embodiments of the present application. Taking a smart phone as an example, the smart phone includes: radio frequency (RF) circuit 1010, memory 1020, input unit 1030, display unit 1040, sensor 1050, audio circuit 1060, wireless fidelity (WiFi) module 1070, processor 1080, and power supply 1090, and the like. The input unit 1030 can include touch panel 1031 and other input devices 1032, and the display unit 1040 can include display panel 1041. The audio circuit 1060 can include speaker 1061 and microphone 1062. Those skilled in the art can understand that the structure of the smart phone shown in FIG. 10 does not constitute a limitation on the smart phone, and can include more or fewer components than shown, or combine certain components, or different component arrangements.

[0192] The memory 1020 can be used to store software programs and modules, and the processor 1080 executes various function applications and data processing of the smart phone by running the software programs and modules stored in the memory 1020. The memory 1020 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application program required by a function (such as a sound playing function, an image playing function, etc.), and the like; and the data storage area can store data created according to the use of the smart phone (such as audio data, a phone book, etc.), and the like. In addition, the memory 1020 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state memory device.

[0193] The processor 1080 is a control center of the smart phone, connects all parts of the smart phone through various interfaces and lines, and executes various functions and processes data of the smart phone by running or executing the software programs and / or modules stored in the memory 1020 and calling the data stored in the memory 1020. Optionally, the processor 1080 can include one or more processing units; preferably, the processor 1080 can integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, and an application program, and the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor can also not be integrated into the processor 1080.

[0194] In the embodiment, the processor 1080 in the smart phone can execute the method provided in various optional implementation manners of the above-mentioned embodiments.

[0195] According to an aspect of the present application, a computer readable storage medium is provided, the computer readable storage medium is used to store a computer program, when the computer program runs on a computer device, the computer program causes the computer device to execute the method provided in various optional implementation manners of the above-mentioned embodiments.

[0196] According to an aspect of the present application, a computer program product is provided, the computer program product includes a computer program stored in a computer readable storage medium. The processor of the computer device reads the computer program from the computer readable storage medium, and the processor executes the computer program, so that the computer device executes the method provided in various optional implementation manners of the above-mentioned embodiments.

[0197] The description of the flow or structure corresponding to each of the above-mentioned figures has its own emphasis, and the part not described in detail in a certain flow or structure can refer to the related description of other flows or structures.

[0198] The terms "first", "second", and the like in the description and in the claims of this application are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the terms so used are interchangeable under appropriate circumstances such that the embodiments of the application described herein are, for example, capable of practical implementation irrespective of the particular sequential or chronological order of the steps contained therein. Moreover, the term "comprising" and variations thereof, as used in enlisting the elements of this application, are intended to mean that the installation contain the recited elements, but not excluding others. In other words, it is meant to be an "inclusive inclusive" term and not an "exclusive exclusive" term.

[0199] In several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method can be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, for example, the division of the units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed units can be indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0200] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on a plurality of network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.

[0201] In addition, the functional units in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.

[0202] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for causing a computer device to perform all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a RAM, a magnetic disk or an optical disk, and various computer program storage media that can store computer programs.

[0203] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined target, and can be implemented entirely or partially by using software, hardware (such as a processing circuit or a memory) or a combination thereof. Similarly, one processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be a part of an integral module or unit that includes the functions of the module or unit.

[0204] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements for some technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for processing indirect lighting of a rendering scene, the method being performed by a computer device, the method comprising: obtaining a voxel texture of a scene to be rendered; the voxel texture comprising indirect lighting of each voxel in a voxelized scene of the scene to be rendered; performing light collection on indirect lighting corresponding to a voxel in the voxel texture according to a plurality of first rays emitted by each pixel in an assigned map of the scene to be rendered, to obtain indirect lighting of the each pixel; storing indirect lighting corresponding to a plurality of pixels respectively in the assigned map, to obtain a light map of the scene to be rendered; performing light sampling on the light map according to a rendering position of an object to be rendered in the scene to be rendered and an assigned area of the object to be rendered in the assigned map, to obtain indirect lighting of the rendering position.

2. The method of claim 1, wherein the performing light collection on indirect lighting corresponding to a voxel in the voxel texture according to a plurality of first rays emitted by each pixel in an assigned map of the scene to be rendered, to obtain indirect lighting of the each pixel, comprises: for the each pixel, performing light collection on indirect lighting corresponding to a voxel in the voxel texture according to a plurality of first rays emitted by the pixel, to obtain a plurality of indirect lightings collected by the plurality of first rays; determining a first weight of each first ray according to a normal direction of the pixel, a ray direction of each first ray, a probability density of ray directions corresponding to the plurality of first rays respectively, and a number of the plurality of first rays; and performing weighted calculation on indirect lightings collected by the plurality of first rays respectively and the first weights corresponding to the plurality of first rays respectively, to obtain indirect lighting of the pixel.

3. The method of claim 1, wherein the obtaining of the voxel texture comprises: performing light collection on direct lighting of a scene light source of the scene to be rendered and stored lighting of other voxels in the voxelized scene according to a plurality of second rays emitted by each voxel, to obtain indirect lighting of the each voxel; and storing indirect lighting corresponding to a plurality of voxels respectively in the voxelized scene, to obtain the voxel texture.

4. The method of claim 3, wherein the performing light collection on direct lighting of a scene light source of the scene to be rendered and stored lighting of other voxels in the voxelized scene according to a plurality of second rays emitted by each voxel, to obtain indirect lighting of the each voxel, comprises: for the each voxel, performing light collection on direct lighting of the scene light source and stored lighting of the other voxels according to a plurality of second rays emitted by the voxel, to obtain a plurality of indirect lightings collected by the plurality of second rays; determining a second weight of each second ray according to a normal direction of the voxel, a ray direction of each second ray, a probability density of ray directions corresponding to the plurality of second rays respectively, and a number of the plurality of second rays; and performing weighted calculation on indirect lightings collected by the plurality of second rays respectively and the second weights corresponding to the plurality of second rays respectively, to obtain indirect lighting of the voxel. ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ According to the indirect light illumination collected by the plurality of second rays respectively and the second weight corresponding to the plurality of second rays respectively, the indirect light illumination of the voxel is obtained by weighted calculation.

5. The method of claim 1, wherein the obtaining of the voxelized scene comprises: performing voxel conversion on each to-be-rendered object in the to-be-rendered scene to obtain the voxelized scene.

6. The method of claim 1, wherein the obtaining of the allocated map comprises: determining a position offset and an allocated size of each to-be-rendered object in the initial map according to a resolution of the each to-be-rendered object in the to-be-rendered scene; performing regional allocation on the initial map according to the position offset and the allocated size of the each to-be-rendered object in the initial map to obtain the allocated map.

7. The method of claim 1, wherein the performing of the illumination sampling on the light map according to the to-be-rendered position of the to-be-rendered object in the to-be-rendered scene and the allocated region of the to-be-rendered object in the allocated map to obtain the indirect light illumination of the to-be-rendered position comprises: determining a to-be-sampled position of the to-be-rendered position in the light map according to the to-be-rendered position of the to-be-rendered object in the to-be-rendered scene and the allocated region of the to-be-rendered object in the allocated map; performing the illumination sampling on the light map according to the to-be-sampled position to obtain the indirect light illumination of the to-be-rendered position.

8. The method of claim 3, further comprising: if the scene light source changes, obtaining a changed scene light source; updating the voxel texture according to the changed scene light source.

9. The method of claim 3, wherein the updating of the voxel texture according to the changed scene light source comprises: performing illumination collection on the direct light illumination of the changed scene light source and the stored light illumination of the other voxels according to a plurality of third rays emitted by each voxel to obtain updated indirect light illumination of the each voxel; updating the voxel texture according to the updated indirect light illumination corresponding to the plurality of voxels respectively.

10. The method of claim 3, further comprising: if the to-be-rendered object moves, obtaining a plurality of voxels in the voxelized scene after the movement; updating the voxel texture according to the plurality of voxels after the movement.

11. The method of claim 10, wherein the updating of the voxel texture according to the plurality of voxels after the movement comprises: performing illumination collection on the direct light illumination of the scene light source and the stored light illumination of the other voxels according to a plurality of fourth rays emitted by each voxel after the movement to obtain updated indirect light illumination of the each voxel after the movement; updating the voxel texture according to the plurality of voxels after the movement and the updated indirect light illumination corresponding to the plurality of voxels after the movement respectively.

12. An apparatus for indirect lighting processing based on rendering a scene, the apparatus comprising: an obtaining unit, a collecting unit, a storing unit and a sampling unit; the obtaining unit is configured to obtain a voxel texture of a to-be-rendered scene; the voxel texture comprises indirect light illumination of each voxel in a voxelized scene of the to-be-rendered scene; The collection unit is configured to perform indirect light collection on the indirect light of voxels corresponding to each pixel in the allocated map of the scene to be rendered according to a plurality of first rays emitted by the each pixel, to obtain the indirect light of the each pixel; The storage unit is configured to store the indirect light corresponding to a plurality of pixels respectively in the allocated map, to obtain the light map of the scene to be rendered; The sampling unit is configured to perform light sampling on the light map according to a to-be-rendered position of a to-be-rendered object in the scene to be rendered and an allocated area of the to-be-rendered object in the allocated map, to obtain the indirect light of the to-be-rendered position.

13. A computer device, comprising a processor and a memory: The memory is configured to store a computer program and transmit the computer program to the processor; The processor is configured to execute the method in any one of claims 1-11 according to instructions in the computer program.

14. A computer readable storage medium, configured to store a computer program, which, when executed on a computer device, causes the computer device to execute the method in any one of claims 1-11.

15. A computer program product, comprising a computer program, which, when executed on a computer device, causes the computer device to execute the method in any one of claims 1-11.

Citation Information

Patent Citations

  • Illumination rendering method and device for volume component

    CN116115997A

  • Global illumination rendering method

    CN117745926A

  • Illumination rendering method and device, equipment and storage medium

    CN117876572A

  • Real-time global illumination rendering method and device and electronic equipment

    CN117893670A

  • System, method, and computer program product for computing indirect lighting in a cloud network

    US20140327690A1