Illumination rendering method and device, electronic equipment and storage medium
By updating the spherical harmony coefficients of the lighting probes on both sides of the wall in game rendering, the problem of inaccurate lighting rendering caused by light leakage in the wall is solved, and efficient and accurate lighting rendering effect is achieved.
Patent Information
- Application Number
- CN202411562367.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-04
- Publication Date
- 2025-02-11
AI Technical Summary
The prior art cannot effectively solve the problem of inaccurate lighting rendering caused by wall light leakage during game rendering.
The spherical harmony coefficients of the light probes on both sides of the wall and the spherical harmony coefficients of the light probes on both sides of the wall are performed offline according to the spherical harmony coefficients of the light probes on both sides of the wall obtained by pre-baking in the preset game scene and the spherical harmony coefficients of the light probes on both sides of the wall are performed in an offline state. Updated to accurately avoid wall light leakage during real-time rendering.
Without adding additional consumption and memory package usage, this method improves baking efficiency, reduces manual workload, and ensures the accuracy of lighting rendering effects.
Smart Images

Figure CN119417971A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a lighting rendering method, device, electronic device and storage medium. Background Art
[0002] In game rendering development, the global illumination (GI) rendering solution based on light probes is a common GI rendering solution. Spherical harmonics (SH) are encoded into light probes through offline baking, so that when the scene is running, the lighting information in the light probes can be decoded in real time to illuminate the lighting color on the virtual objects, thus realizing indirect light rendering of virtual objects.
[0003] In the real-time rendering process, the prior art uses a real-time interpolation method based on a central processing unit (CPU) or a graphics processing unit (GPU) to decode the lighting information in the lighting probe and illuminate the lighting color of the virtual object. However, this method cannot solve the problem of inaccurate light color of the decoded lighting irradiated on the virtual object due to light leakage from the walls in the game scene. Summary of the invention
[0004] The purpose of the present application is to provide a lighting rendering method, device, electronic device and storage medium to address the deficiencies in the above-mentioned prior art, so as to solve the light leakage problem of the wall during the lighting rendering process and ensure the rendering effect.
[0005] To achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows:
[0006] In a first aspect, an embodiment of the present application provides a lighting rendering method, the method comprising:
[0007] Obtaining a pre-baking result of a preset game scene, the pre-baking result comprising: spherical harmonic coefficients of a plurality of illumination probes in the preset game scene;
[0008] updating the spherical harmonic coefficients of the first illumination probe according to the spherical harmonic coefficients of the first illumination probe on both sides of the first wall in the preset game scene and the spherical harmonic coefficients of the adjacent illumination probes of the first illumination probe, wherein the first wall is a wall in the preset game scene having a thickness greater than or equal to a preset thickness;
[0009] The updated spherical harmonic coefficients of the first lighting probe are stored, and the updated spherical harmonic coefficients of the first lighting probe are used to perform lighting rendering on a virtual object in the game scene that satisfies a preset position relationship with the first wall.
[0010] In a second aspect, an embodiment of the present application further provides a lighting rendering device, the device comprising:
[0011] An acquisition module, used to acquire a pre-baked result of a preset game scene, wherein the pre-baked result includes: spherical harmonic coefficients of a plurality of illumination probes in the preset game scene;
[0012] an updating module, configured to update the spherical harmonic coefficients of the first illumination probe according to the spherical harmonic coefficients of the first illumination probe on both sides of the first wall in the preset game scene and the spherical harmonic coefficients of the adjacent illumination probes of the first illumination probe, wherein the first wall is a wall in the preset game scene having a thickness greater than or equal to a preset thickness;
[0013] A storage module is used to store the updated spherical harmonic coefficients of the first lighting probe, and the updated spherical harmonic coefficients of the first lighting probe are used to perform lighting rendering on virtual objects in the game scene that satisfy a preset position relationship with the first wall.
[0014] In a third aspect, an embodiment of the present application further provides an electronic device, comprising: a processor, a storage medium and a bus, wherein the storage medium stores program instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium through the bus, and the processor executes the program instructions to perform the steps of the lighting rendering method as described in any one of the first aspects.
[0015] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the lighting rendering method as described in any one of the first aspects are executed.
[0016] The beneficial effects of this application are:
[0017] The present application provides a lighting rendering method, device, electronic device and storage medium. In an offline state, the spherical harmonic coefficients of the first lighting probe on both sides of the first wall pre-baked in a preset game scene and the spherical harmonic coefficients of the adjacent lighting probes of the first lighting probe are updated, so that in the process of real-time rendering, virtual objects near the first wall are illuminated and rendered according to the updated spherical harmonic coefficients of the first lighting probe. By modifying the pre-baked spherical harmonic coefficients, the present application does not bring additional consumption and memory package occupancy, has no requirements on the performance of the real-time rendering terminal device, and uses an automated spherical harmonic coefficient update process for the first wall to reduce manual workload and improve baking efficiency. The spherical harmonic coefficients of the adjacent lighting probes of the first lighting probe are used to update the spherical harmonic coefficients of the first lighting probe, accurately avoiding light leakage problems of the first wall from various perspectives, thereby ensuring the lighting rendering effect during real-time rendering. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0019] Figure 1 Schematic diagram of the lighting rendering method provided in the embodiment of the present application Figure 1 ;
[0020] Figure 2 A schematic diagram of a pre-baked illumination probe provided in an embodiment of the present application;
[0021] Figure 3 The updated illumination probe provided in the embodiment of the present application is shown in FIG. Figure 1 ;
[0022] Figure 4 Schematic diagram of the lighting rendering method provided in the embodiment of the present application Figure 2 ;
[0023] Figure 5 Schematic diagram of the lighting rendering method provided in the embodiment of the present application Figure 3 ;
[0024] Figure 6 Schematic diagram of the lighting rendering method provided in the embodiment of the present application Figure 4 ;
[0025] Figure 7 The updated illumination probe provided in the embodiment of the present application is shown in FIG. Figure 2 ;
[0026] Figure 8 Schematic diagram of the lighting rendering method provided in the embodiment of the present application Figure 5 ;
[0027] Fig. 9 A schematic diagram of the offset direction of the illumination probe provided in an embodiment of the present application;
[0028] Fig.10 A schematic diagram of a lighting probe for a second wall provided in an embodiment of the present application;
[0029] Fig.11 A schematic diagram of a virtual geometric body provided in an embodiment of the present application;
[0030] Fig.12 A schematic diagram of the structure of a lighting rendering device provided in an embodiment of the present application;
[0031] Fig.13 A schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0032] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in combination with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments.
[0033] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.
[0034] In addition, the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0035] It should be noted that, in the absence of conflict, the features in the embodiments of the present application may be combined with each other.
[0036] Light leakage refers to the phenomenon that blocked light passes through the obstruction and illuminates the blocked area. When light leakage occurs in the wall in the game scene, the lighting information recorded by the light probe behind the wall will be biased, resulting in errors in the lighting information rendered by real-time interpolation of virtual objects based on the lighting information recorded in the light probe.
[0037] To address the light leakage problem of virtual objects during real-time interpolation rendering, existing technical solutions include: Dynamic Diffuse Global Illumination (DDGI) rendering method, manual editing method, Signed Distance Field (SDF) method, etc.
[0038] Among them, DDGI stores the octahedral depth map of the light probe, recalculates the interpolation weight of each light probe in the real-time interpolation process, and interpolates and renders virtual objects according to the interpolation weights of different light probes during rendering. The performance, package size and memory requirements of this solution are all beyond the reach of mobile terminals.
[0039] Manual editing is to set different types of light probes inside and outside the wall, or place some geometric bodies in the game scene to distinguish between the inside and outside of the wall. During the real-time rendering process, if a light probe of a different type is encountered, no interpolation is performed. This solution requires a lot of artistic work, and requires distinguishing light probes one by one, or manually adding geometric bodies to divide the scene space, which is inefficient.
[0040] SDF is a method of detecting light probes by emitting physical rays from the light probes to all directions. The light probes are judged to be indoors or outdoors based on the proportion and distance of the rays hitting the wall. The collision distance is injected into the state probe as SDF information. During real-time rendering, the SDF information is used to distinguish whether the surrounding light probes need to be interpolated and the weight ratio. The accuracy of this solution depends on the distance between the light probes and the wall, as well as the interval between the light probes. If the accuracy is not matched, light leakage in the corners is likely to occur, and the real-time difference cannot completely eliminate the influence of unweighted light probes.
[0041] Based on the technical problems existing in the above-mentioned prior art, the present application intends to provide a lighting rendering method, device, electronic device and storage medium. In an offline state, the spherical harmonic coefficients of the first lighting probe on both sides of the first wall pre-baked in a preset game scene and the spherical harmonic coefficients of the adjacent lighting probes of the first lighting probe are updated, so that in the process of real-time rendering, the virtual objects near the first wall are illuminated and rendered according to the updated spherical harmonic coefficients of the first lighting probe. By modifying the pre-baked spherical harmonic coefficients, the present application will not bring additional consumption and memory package occupancy, and has no requirements on the performance of the real-time rendering terminal device. The automated spherical harmonic coefficient update process for the first wall reduces manual workload and improves baking efficiency. The spherical harmonic coefficients of the adjacent lighting probes of the first lighting probe are used to update the spherical harmonic coefficients of the first lighting probe, so as to accurately avoid light leakage problems of the first wall from various perspectives, thereby ensuring the lighting rendering effect during real-time rendering.
[0042] The specific implementation of the lighting rendering method, device, electronic device and storage medium provided by the present application is described below in conjunction with the embodiments.
[0043] Figure 1 Schematic diagram of the lighting rendering method provided in the embodiment of the present application Figure 1 ,like Figure 1 As shown, the method may include:
[0044] S101. Obtain a pre-baking result of a preset game scene, where the pre-baking result includes: spherical harmonic coefficients of multiple lighting probes in the preset game scene.
[0045] In this embodiment, the preset game scene is a virtual game scene designed and built by artists. After the preset game scene is built, it is necessary to perform lighting rendering on the preset game scene to make the lighting effect of the preset game scene more realistic.
[0046] In some embodiments, light baking can be performed in advance on a preset game scene in offline mode by generating a number of light probes in the preset game scene. A light probe is a light detector that can be in the shape of a sphere or other polygon. The light probe can capture the light information of the light source in the preset game scene when it passes through the game scene, and the captured light information is stored in the light probe. During the real-time rendering process when the game scene is running, the light information stored in the light probe around the virtual object can be obtained to render the lighting effect of the virtual object in the game scene.
[0047] The process of offline baking to obtain lighting information can be as follows: using ray tracing technology, after pre-calculating the light source in the game scene to bounce off the surface of the obstruction in the game scene, the color obtained by the rebound is recorded on the information carrier of the obstruction, and then each lighting probe in the preset game scene is used to emit rays to the surroundings, and the corresponding color is obtained from the information carrier of the obstruction in the ray. According to the angle of the emitted ray and the obtained color, a multi-order spherical harmonic function is generated by calculation encoding and stored in the lighting probe.
[0048] Among them, if the order of the spherical harmonic function is 2nd order, the spherical harmonic function has four spherical harmonic coefficients float4, and there are 3*4=12 spherical harmonic coefficients on the RGB channel; if the order of the spherical harmonic function is 3rd order, the spherical harmonic function has nine spherical harmonic coefficients float9, and there are 3*9=27 spherical harmonic coefficients on the RGB channel.
[0049] In the process of real-time rendering, the color of light on the surface of the virtual object can be calculated according to the angle between the virtual object and the lighting probe, and the corresponding spherical harmonic coefficients, so as to perform lighting rendering on the virtual object according to the color.
[0050] In some embodiments, during real-time rendering, the spherical harmonic coefficients of multiple lighting probes around the virtual object may be interpolated, and the color on the surface of the virtual object may be calculated based on the interpolation result.
[0051] S102. Update the spherical harmonic coefficients of the first illumination probe according to the spherical harmonic coefficients of the first illumination probe on both sides of the first wall in a preset game scene and the spherical harmonic coefficients of the adjacent illumination probes of the first illumination probe. The first wall is a wall in the preset game scene whose thickness is greater than or equal to a preset thickness.
[0052] The first wall is defined as a thick wall of a preset game scene. The thick wall of the preset game scene is composed of two layers of grids with a certain distance between the two layers of grids, that is, a wall with a thickness greater than or equal to a preset thickness.
[0053] During the pre-baking process, if the first wall does not leak light, the light source on one side of the first wall will not pass through the first wall to illuminate the space on the other side of the first wall, and the lighting information stored in the lighting probes distributed in the space on the other side of the first wall will not be affected by the light source on one side of the first wall.
[0054] However, when there is a light leakage problem in the first wall, the light source on one side of the first wall will pass through the first wall to illuminate the space on the other side of the first wall. The lighting information stored in the lighting probes distributed in the space on the other side of the first wall will be affected by the light source on one side of the first wall, resulting in errors in the existing lighting information. When the virtual object is interpolated and rendered based on the spherical harmonic coefficients of the lighting probes around it, misplaced colors will be rendered.
[0055] In this embodiment, in order to prevent light leakage from the first wall, which causes the lighting information stored in the lighting probes on both sides of the first wall to be affected by the light source on the opposite side of the first wall, after pre-baking the preset game scene, the lighting information stored in the lighting probes on both sides of the first wall needs to be corrected.
[0056] Specifically, for any first illumination probe on both sides of the first wall, determine the adjacent illumination probes of the first illumination probe, calculate the first target spherical harmonic coefficients according to the spherical harmonic coefficients of the first illumination probe and the adjacent illumination probes, and use the first target spherical harmonic coefficients as the updated spherical harmonic coefficients of the first illumination probe.
[0057] Each first illumination probe on both sides of the first wall is traversed in turn, and the spherical harmonic coefficients of each first illumination probe are updated. The spherical harmonic coefficients of the first illumination probe are updated by the spherical harmonic coefficients of the adjacent illumination probes, so that the illumination information stored in the first illumination probe is affected by the illumination information stored in the adjacent illumination probes. This can reduce the influence of the light source passing through the first wall on the illumination information stored in the first illumination probe, and solve the problem caused by light leakage of the first wall.
[0058] In some embodiments, the illumination probes within a preset range on both sides of the first wall are used as the first illumination probes.
[0059] S103. Storing the updated spherical harmonic coefficients of the first lighting probe, where the updated spherical harmonic coefficients of the first lighting probe are used to perform lighting rendering on a virtual object in the game scene that satisfies a preset position relationship with the first wall.
[0060] In an embodiment, the updated spherical harmonic coefficients of the first lighting probe are stored so that during the running of the game scene, for a virtual object that satisfies a preset position relationship with the first wall, the lighting probes around the virtual object are determined, interpolation calculations are performed based on the spherical harmonic coefficients of the lighting probes around the virtual object, the lighting parameters of the surface of the virtual object are determined, and the virtual object is illuminated and rendered based on the lighting parameters.
[0061] Among them, the virtual object that satisfies the preset position relationship with the first wall is a virtual object whose surrounding lighting probes include the first lighting probe. For the virtual object that does not satisfy the preset position relationship with the first wall, the lighting information stored in the surrounding lighting probes is still pre-baked information, and interpolation rendering can be directly performed during the real-time rendering process.
[0062] The lighting rendering method provided in the above embodiment, on the one hand, solves the light leakage problem of the wall by modifying the pre-baked spherical harmonic coefficients, which does not bring about additional consumption and memory package occupation, and has no requirements on the performance of the real-time rendering terminal device; on the other hand, the processing process of using automated spherical harmonic coefficient update for the first wall reduces manual workload and improves baking efficiency; in addition, the spherical harmonic coefficients of the adjacent lighting probes of the first lighting probe are used to update the spherical harmonic coefficients of the first lighting probe, so as to accurately avoid the light leakage problem of the first wall from various perspectives, thereby ensuring the lighting rendering effect during real-time rendering.
[0063] In a possible implementation, the pre-baking result further includes: colors of multiple lighting probes. Before the above S102 updates the spherical harmonic coefficients of the first lighting probe on both sides of the first wall in the preset game scene and the spherical harmonic coefficients of the adjacent lighting probes of the first lighting probe, the method may further include:
[0064] According to the colors of the plurality of light probes, the non-black light probes on both sides of the first wall are determined as first light probes, and the non-black light probes adjacent to the first light probe are determined as adjacent light probes.
[0065] In this embodiment, during the pre-baking process, the color of the light probe is determined. The color of the light probe can be calculated based on the indirect light color value collected from multiple rays emitted from the light probe. A black light probe indicates that no light is transmitted through the location of the light probe. The spherical harmonic coefficients of the black light probe are regarded as invalid spherical harmonic coefficients. Therefore, for the black light probe, there is no need to solve the influence of the light leakage problem, nor does it participate in solving the light leakage problem of other light probes.
[0066] For the light probes on both sides of the first wall, non-black light probes are selected as the first light probes according to the colors of the light probes, and non-black light probes around the first light probe are determined as the adjacent light probes of the first light probe. For example, the first light probe has 8 light probes around it in 2D space and 26 light probes around it in 3D space, and non-black light probes are selected from the 8 or 26 light probes as the adjacent light probes of the first light probe.
[0067] In a possible implementation, the above S102 updates the spherical harmonic coefficients of the first light probe according to the spherical harmonic coefficients of the first light probe on both sides of the first wall in the preset game scene and the spherical harmonic coefficients of the adjacent light probes of the first light probe, which may include:
[0068] According to the spherical harmonic coefficients of the adjacent lighting probes of the first lighting probe, the spherical harmonic coefficients of the first lighting probe are subjected to multiple mixed interpolations to obtain updated spherical harmonic coefficients of the first lighting probe.
[0069] In this embodiment, for multiple first illumination probes on both sides of the first wall, each first illumination probe is traversed in turn, the spherical harmonic coefficients of each first illumination probe and the spherical harmonic coefficients of the adjacent illumination probes of the first illumination probe are averaged to obtain the first target spherical harmonic coefficients, and the spherical harmonic function of the first illumination probe is updated according to the first target spherical harmonic coefficients.
[0070] The multiple first illumination probes on both sides of the first wall are traversed multiple times continuously, and multiple mean calculations are performed to reduce high-frequency stripes between the illumination information stored in the multiple first illumination probes.
[0071] For example, the mean calculation may be an arithmetic mean or a weighted mean, which is not limited in this embodiment.
[0072] Figure 2 A schematic diagram of a pre-baked illumination probe provided in an embodiment of the present application, Figure 3 The updated illumination probe provided in the embodiment of the present application is shown in FIG. Figure 1 ,like Figure 2 and Figure 3 As shown, for the first light probes on both sides of the first wall, i.e., outside the wall, the lighting information of the first light probes has changed after multiple mixed interpolations. In fact, the lighting information corresponding to the light source leaking from the first wall is filtered out from the lighting information pre-baked by the first light probes, thereby solving the light leakage problem of the first wall.
[0073] The lighting rendering method provided in the above embodiment can reduce the high-frequency stripes between the lighting information stored by multiple first lighting probes by performing multiple mixed interpolations on the spherical harmonic coefficients of the first lighting probe, while ensuring that the influence of the light leakage problem of the first wall on the lighting information stored in the first lighting probe is reduced, thereby ensuring the lighting rendering effect of the virtual object.
[0074] In one possible implementation, Figure 4 Schematic diagram of the lighting rendering method provided in the embodiment of the present application Figure 2 ,like Figure 4 As shown, the method may also include:
[0075] S201. Update the spherical harmonic coefficients of the second illumination probe inside the first wall according to the updated spherical harmonic coefficients of the first illumination probe.
[0076] Currently, when performing illumination rendering on a virtual object in combination with illumination information in a preset game scene, a plurality of illumination probes adjacent to the virtual object in the preset game scene are generally selected for interpolation calculation to obtain illumination information of the virtual object.
[0077] However, since the first wall has a certain thickness, light probes are also distributed in the area where the first wall is located, that is, inside the first wall. These light probes are in a state of being blocked by the first wall. When this interpolation calculation rendering method is used, if several light probes among the selected light probes are in a state of being blocked by the first wall, since the spherical harmonic coefficients of these light probes on the RGB channels are all 0, indicating that their lighting information is no lighting information, the lighting information of the virtual object obtained by interpolating these light probes will have errors, affecting the lighting rendering effect of the virtual object.
[0078] Based on this, this embodiment needs to update the spherical harmonic coefficients of the second illumination probe inside the first wall according to the spherical harmonic coefficients of the first illumination probes on both sides of the first wall.
[0079] Specifically, in the above S102, after the spherical harmonic coefficients of the first illumination probe are updated using the adjacent illumination probes of the first illumination probe, for the second illumination probe inside the first wall, the first illumination probes adjacent to the second illumination probes on both sides of the first wall are determined, and the second target spherical harmonic coefficients are calculated based on the updated spherical harmonic coefficients of the first illumination probe, and the second target spherical harmonic coefficients are used as the updated spherical harmonic coefficients of the second illumination probe.
[0080] Each second light probe inside the first wall is traversed in turn, and the spherical harmonic coefficients of each second light probe are updated to transmit the lighting information of the first light probes on both sides of the first wall to the second light probes inside the first wall. When the virtual object is interpolated and rendered, even if multiple adjacent light probes selected for the virtual object include the second light probe inside the first wall, there will be no error in the lighting information calculated for the virtual object due to the invalid lighting information stored in the second light probe, thereby ensuring the lighting rendering effect of the virtual object.
[0081] Generally speaking, when interpolating the outer surface of the first wall, i.e., the wall surface, the second lighting probe inside the first wall may be selected. Therefore, after the spherical harmonic coefficients of the second lighting probe are updated, the color of the outer surface of the first wall after lighting rendering can be guaranteed to be correct.
[0082] S202, storing the updated spherical harmonic coefficients of the second lighting probe, and the updated spherical harmonic coefficients of the first lighting probe and the updated spherical harmonic coefficients of the second lighting probe are used to perform lighting rendering on a virtual object in the game scene that satisfies a preset position relationship with the first wall.
[0083] In an embodiment, the updated spherical harmonic coefficients of the second lighting probe are stored so that during the running of the game scene, for a virtual object that satisfies a preset position relationship with the first wall, the lighting probes around the virtual object are determined, interpolation calculations are performed based on the spherical harmonic coefficients of the lighting probes around the virtual object, the lighting parameters of the surface of the virtual object are determined, and the virtual object is illuminated and rendered based on the lighting parameters.
[0084] Among them, the virtual object that satisfies the preset position relationship with the first wall is a virtual object whose surrounding lighting probes include the first lighting probe and / or the second lighting probe. For the virtual object that does not satisfy the preset position relationship with the first wall, the lighting information stored in the surrounding lighting probes is still pre-baked information, and interpolation rendering can be directly performed during the real-time rendering process.
[0085] It should be noted that although the lighting information of the second lighting probe inside the first wall has been updated to valid lighting information, this does not mean that there will be a visual effect of light passing through the first wall when rendering the scene. In fact, during the scene rendering process, the lighting probe inside the first wall will not be used to render the interior of the first wall. The first wall will only be directly rendered as a model of the corresponding shape.
[0086] In a possible implementation, before updating the spherical harmonic coefficients of the second illumination probe inside the first wall according to the updated spherical harmonic coefficients of the first illumination probe in S201, the method may further include:
[0087] According to the colors of the plurality of light probes, a black light probe inside the first wall is determined as a second light probe.
[0088] In this embodiment, for the non-black lighting probe inside the first wall, if the lighting probe is selected when performing interpolation calculation on the virtual object, its lighting information will not cause errors in the interpolation result of the virtual object. Therefore, there is no need to update the spherical harmonic coefficients of the non-black lighting probe inside the first wall.
[0089] For the light probes inside the first wall, black light probes are selected as second light probes according to the colors of the light probes, and non-black light probes on both sides of the first wall adjacent to the second light probes are determined as first light probes.
[0090] In one possible implementation, Figure 5Schematic diagram of the lighting rendering method provided in the embodiment of the present application Figure 3 ,like Figure 5 As shown, before updating the spherical harmonic coefficients of the second illumination probe inside the first wall according to the updated spherical harmonic coefficients of the first illumination probe in the above S201, the method may further include:
[0091] S301 , determining whether the illumination probe inside the first wall has adjacent illumination probes on both sides of the first wall.
[0092] S302: If the light probe inside the first wall has adjacent light probes on both sides of the first wall, determine that the light probe inside the first wall is a second light probe.
[0093] In this embodiment, the density or interval of the light probes set for the preset game scene can be customized. When the density of the light probes is set to be larger or the interval is smaller, the first wall may contain multiple rows or columns of light probes. In the process of interpolation calculation of the virtual object, the selected adjacent light probes can only involve at most one row or one column of light probes in the first wall that is separated from the virtual object by a wall. Therefore, only the spherical harmonic coefficients of the row or one column of light probes in the first wall that is separated from the virtual object by a wall need to be updated.
[0094] Specifically, it can be determined whether the light probe inside the first wall has adjacent light probes located on both sides of the first wall, that is, it can be determined whether the light probes adjacent to the light probes inside the first wall include light probes located on both sides of the first wall. If the light probe inside the first wall has adjacent light probes located on both sides of the first wall, it is determined that the light probe is the second light probe adjacent to the wall surface of the first wall and separated from the virtual object by a wall.
[0095] In one possible implementation, Figure 6 Schematic diagram of the lighting rendering method provided in the embodiment of the present application Figure 4 ,like Figure 6 As shown, the process of updating the spherical harmonic coefficients of the second illumination probe inside the first wall according to the updated spherical harmonic coefficients of the first illumination probe in S201 may include:
[0096] S401. Calculate new spherical harmonic coefficients according to the updated spherical harmonic coefficients of the first illumination probe adjacent to the second illumination probe using a preset calculation method.
[0097] S402. Update the spherical harmonic coefficients of the second illumination probe according to the new spherical harmonic coefficients.
[0098] In this embodiment, the preset calculation method can be mean calculation, which performs mean calculation on the updated spherical harmonic coefficients of the first illumination probe adjacent to the second illumination probe to obtain new spherical harmonic coefficients, i.e., the second spherical harmonic coefficients, and assigns the new spherical harmonic coefficients to the second illumination probe to update the spherical harmonic coefficients of the second illumination probe.
[0099] Figure 7 The updated illumination probe provided in the embodiment of the present application is shown in FIG. Figure 2 ,like Figure 3 and Figure 7 As shown, the color of the lighting probe inside the first wall adjacent to the first wall on both sides is consistent with the color of the lighting probes on the first wall adjacent to the first wall, which means that the internal and external lighting probes separated by a wall store the same lighting information. When the second lighting probe inside the first wall is selected during interpolation calculation of the virtual object, the second lighting probe can provide effective lighting information for the virtual object, thereby ensuring that the lighting rendering result of the virtual object is correct.
[0100] The lighting rendering method provided in the above embodiment uses the updated spherical harmonic coefficients of the first lighting probe on both sides of the first wall to update the spherical harmonic coefficients of the second lighting probe inside the first wall, so that in the real-time rendering process, the lighting information provided by the lighting probe used for interpolation calculation of the virtual object will not be an invalid value, thereby ensuring the rendering effect of the virtual object.
[0101] In one possible implementation, Figure 8 Schematic diagram of the lighting rendering method provided in the embodiment of the present application Figure 5 ,like Figure 8 As shown, the method may also include:
[0102] S501. During the process of editing the preset game scene, if light leakage occurs in the second wall, a virtual geometric body is placed in the normal direction of the second wall, where the second wall is a wall in the preset game scene whose thickness is less than the preset thickness.
[0103] The second wall is defined as a thin wall of a preset game scene, and the thin wall in the preset game scene is a wall composed of a layer of grids, that is, a wall with a thickness less than a preset thickness. Generally, a thin wall is a wall used to separate two closed spaces in a game scene.
[0104] During the pre-baking process, if the second wall does not leak light, the light source on one side of the second wall will not pass through the second wall to illuminate the space on the other side of the second wall, and the lighting information stored in the lighting probes distributed in the space on the other side of the second wall will not be affected by the light source on one side of the second wall.
[0105] However, when there is a light leakage problem in the second wall, the light source on one side of the second wall will pass through the second wall to illuminate the space on the other side of the second wall. The lighting information stored in the lighting probes distributed in the space on the other side of the second wall will be affected by the light source on one side of the second wall, resulting in errors in the existing lighting information. When the virtual object is interpolated and rendered based on the spherical harmonic coefficients of the lighting probes around it, misplaced colors will be rendered.
[0106] During the editing of the preset game scene, if the artist finds that there is light leakage in the normal of the second wall, that is, the color of the light source on the other side appears on the object on one side of the second wall, a virtual geometry can be generated for the second wall, and the second wall can be simulated as a thick wall through the virtual geometry to avoid interpolating the stored lighting information containing the lighting probe of the light source on the other side when interpolating the virtual objects on one side of the second wall.
[0107] Specifically, with the second wall as the center, a preset width is extended on both sides along the normal direction of the second wall to determine the placement position of the virtual geometric body, and the virtual geometric body Volume is placed at the placement position. The lighting probe covered by the virtual geometric body Volume does not participate in the lighting rendering of the virtual object. The virtual geometric body Volume can be, for example, a square, a rectangle, or a sphere, etc., which is not limited in this embodiment.
[0108] S502. Generate an offset map based on the placement position of the virtual geometric body and the distribution positions of multiple lighting probes. The offset map indicates the lighting probes located at the placement position of the virtual geometric body. The offset map is used to screen the lighting probes used for lighting rendering when rendering the virtual objects that meet the preset position relationship with the second wall in the game scene.
[0109] In this embodiment, in order to facilitate the determination of the placement of virtual geometric bodies during the interpolation rendering of virtual objects, thereby determining the lighting probes that do not participate in the lighting rendering of virtual objects, an offset map SepareteTexture for the lighting probes can be generated.
[0110] Specifically, an offset map is generated according to the placement of the virtual geometry and the distribution positions of multiple light probes. The offset map is used to indicate whether each light probe is located at the placement position of the virtual geometry, that is, whether each light probe is covered by the virtual geometry.
[0111] In some embodiments, an offset map may be generated that is the same size as the area covered by the virtual geometry, storing only the light probes that are covered by the virtual geometry.
[0112] When performing interpolation rendering of a virtual object, if the lighting probes participating in the interpolation rendering around the virtual object include the lighting probes indicated in the offset map, the lighting probes are deleted from the lighting probes participating in the interpolation rendering, and interpolation rendering is performed only based on the remaining lighting probes.
[0113] In some embodiments, each pixel value of the offset map stores an offset direction index of the corresponding light probe, and the offset direction of the light probe is determined according to the offset direction of the portion of the virtual geometric body corresponding to the light probe relative to the second wall.
[0114] For example, Fig. 9 A schematic diagram of the offset direction of the illumination probe provided in the embodiment of the present application, such as Fig. 9 As shown in the figure, a light probe has 8 preset offset directions in 2D space, and 26 offset directions in 3D space. The offset map stores the indexes 1 to 8. If the direction index is 0, it indicates that the light probe is not within the coverage of the virtual geometry.
[0115] Fig.10 A schematic diagram of the illumination probe of the second wall provided in the embodiment of the present application, such as Fig.10 As shown, the second wall is the wall that separates room 1 and room 2. Due to the light leakage problem of the second wall, the lighting probe adjacent to the second wall will store the lighting information of the light source in the opposite room. If the lighting probe adjacent to the second wall is interpolated during the interpolation rendering of the virtual object, wrong lighting information will be rendered.
[0116] Fig.11 A schematic diagram of a virtual geometric body provided in an embodiment of the present application, such as Fig.11 As shown, with the second wall as the center, the width of a light probe is extended on both sides along the normal direction of the second wall to determine the placement position of the virtual geometric body, and the virtual geometric body is placed at the placement position.
[0117] The offset direction of the light probes covered by virtual geometry located in room 1 is to the left, and the offset direction of the light probes covered by virtual geometry located in room 2 is to the right.
[0118] like Fig.11 As shown, the black dots on the second wall are the original interpolation sampling boundaries, that is, when interpolating and rendering the virtual objects on both sides of the second wall, the light probes adjacent to the second wall can be interpolated. For example, the virtual objects in room 1 can be interpolated to a row of light probes adjacent to the left side of the second wall at most, and the virtual objects in room 2 can be interpolated to a row of light probes adjacent to the right side of the second wall at most.
[0119] After placing the virtual geometry, the red dot is the target interpolation sampling boundary for Room 1 and Room 2. The light probes adjacent to the second wall inside the red dot do not participate in the interpolation rendering. For example, the virtual objects in Room 1 can be interpolated to the row of light probes adjacent to the left of the red dot at most, and the virtual objects in Room 2 can be interpolated to the row of light probes adjacent to the right of the red dot at most.
[0120] The lighting rendering method provided in the above embodiment inserts virtual geometric bodies into thin walls and generates offset maps, so that when interpolating and rendering virtual objects, it can avoid using lighting probes covered by virtual geometric bodies for interpolating and rendering, thereby ensuring the accuracy of the interpolation rendering results of virtual objects. And because this solution only targets thin walls with light leakage, its effective range is small and will not affect other parts of the scene with correct rendering effects, achieving a minimization effect and ensuring the accuracy of large-scale rendering effects in game scenes.
[0121] Based on the above method embodiment, the embodiment of the present application also provides a lighting rendering device. Fig.12 A schematic diagram of the structure of the lighting rendering device provided in the embodiment of the present application is shown in FIG. Fig.12 As shown, the apparatus may include:
[0122] The acquisition module 601 is used to acquire the pre-baking result of the preset game scene, where the pre-baking result includes: spherical harmonic coefficients of multiple illumination probes in the preset game scene;
[0123] An updating module 603 is used to update the spherical harmonic coefficients of the first illumination probe according to the spherical harmonic coefficients of the first illumination probe on both sides of the first wall in the preset game scene and the spherical harmonic coefficients of the adjacent illumination probes of the first illumination probe, wherein the first wall is a wall having a thickness greater than or equal to a preset thickness in the preset game scene;
[0124] The storage module 604 is used to store the updated spherical harmonic coefficients of the first lighting probe, and the updated spherical harmonic coefficients of the first lighting probe are used to perform lighting rendering on the virtual objects in the game scene that satisfy a preset position relationship with the first wall.
[0125] Optionally, the updating module 603 is further configured to update the spherical harmonic coefficients of the second illumination probe inside the first wall according to the updated spherical harmonic coefficients of the first illumination probe;
[0126] The storage module 604 is also used to store the updated spherical harmonic coefficients of the second lighting probe. The updated spherical harmonic coefficients of the first lighting probe and the updated spherical harmonic coefficients of the second lighting probe are used to perform lighting rendering on virtual objects in the game scene that satisfy a preset position relationship with the first wall.
[0127] Optionally, the pre-baking result further includes: colors of multiple light probes. The device may further include:
[0128] The screening module 602 is used to determine, based on the colors of the plurality of light probes, the non-black light probes on both sides of the first wall as first light probes, and the non-black light probes adjacent to the first light probe as adjacent light probes.
[0129] Optionally, the updating module 603 is specifically configured to perform multiple mixed interpolations on the spherical harmonic coefficients of the first illumination probe according to the spherical harmonic coefficients of the adjacent illumination probes of the first illumination probe, so as to obtain updated spherical harmonic coefficients of the first illumination probe.
[0130] Optionally, the screening module 602 is further configured to determine, based on the colors of the plurality of light probes, a black light probe inside the first wall as the second light probe.
[0131] Optionally, the screening module 602 is further used to determine whether the light probe inside the first wall has adjacent light probes on both sides of the first wall; if the light probe inside the first wall has adjacent light probes on both sides of the first wall, determine that the light probe inside the first wall is the second light probe.
[0132] Optionally, the updating module 603 is specifically configured to calculate new spherical harmonic coefficients using a preset calculation method according to the updated spherical harmonic coefficients of the first illumination probe adjacent to the second illumination probe; and update the spherical harmonic coefficients of the second illumination probe according to the new spherical harmonic coefficients.
[0133] Optionally, the device may further include:
[0134] A placement module is used to place a virtual geometric body in the normal direction of the second wall if light leakage occurs in the second wall during the editing of the preset game scene, and the second wall is a wall in the preset game scene whose thickness is less than the preset thickness;
[0135] A mapping module is used to generate an offset map according to the placement position of the virtual geometric body and the distribution positions of multiple lighting probes. The offset map indicates the lighting probes located at the placement position of the virtual geometric body. The offset map is used to screen the lighting probes used for lighting rendering when rendering the virtual objects that meet the preset position relationship with the second wall in the game scene.
[0136] The lighting rendering device provided by the above embodiment, on the one hand, solves the problem of wall light leakage by modifying the pre-baked spherical harmonic coefficients, does not bring about additional consumption and memory package occupation, and has no requirements on the performance of the real-time rendering terminal device; on the other hand, the processing process of using automated spherical harmonic coefficient update for the first wall reduces manual workload and improves baking efficiency; in addition, the spherical harmonic coefficients of the adjacent lighting probes of the first lighting probe are used to update the spherical harmonic coefficients of the first lighting probe, so as to accurately avoid the light leakage problem of the first wall from various perspectives, thereby ensuring the lighting rendering effect during real-time rendering.
[0137] The above-mentioned device is used to execute the method provided by the aforementioned embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.
[0138] The above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASICs), or one or more microprocessors, or one or more field programmable gate arrays (FPGAs). For another example, when a module is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
[0139] Fig.13 A schematic diagram of an electronic device provided for an embodiment of the present application, the electronic device 700 may include: a processor 701, a storage medium 702 and a bus, the storage medium 702 stores program instructions executable by the processor 701, when the electronic device 700 is running, the processor 701 communicates with the storage medium 702 via the bus, and the processor 701 executes the program instructions to execute the above method embodiment.
[0140] Specifically, the processor executes the steps of the above-mentioned illumination rendering method, which may include:
[0141] Obtain a pre-baked result of a preset game scene, the pre-baked result including: spherical harmonic coefficients of multiple lighting probes in the preset game scene; update the spherical harmonic coefficients of the first lighting probe according to the spherical harmonic coefficients of the first lighting probe on both sides of a first wall in the preset game scene and the spherical harmonic coefficients of adjacent lighting probes of the first lighting probe, wherein the first wall is a wall in the preset game scene having a thickness greater than or equal to a preset thickness; store the updated spherical harmonic coefficients of the first lighting probe, and the updated spherical harmonic coefficients of the first lighting probe are used for lighting rendering of a virtual object in the game scene that satisfies a preset position relationship with the first wall.
[0142] Optionally, the processor executes the steps of the above-mentioned illumination rendering method, and may further include:
[0143] According to the updated spherical harmonic coefficients of the first lighting probe, the spherical harmonic coefficients of the second lighting probe inside the first wall are updated; the updated spherical harmonic coefficients of the second lighting probe are stored, and the updated spherical harmonic coefficients of the first lighting probe and the updated spherical harmonic coefficients of the second lighting probe are used to perform lighting rendering on virtual objects in the game scene that satisfy a preset position relationship with the first wall.
[0144] Optionally, the pre-baked result further includes: colors of multiple lighting probes. Before the processor executes the above-mentioned updating of the spherical harmonic coefficients of the first lighting probe on both sides of the first wall in the preset game scene and the spherical harmonic coefficients of the adjacent lighting probes of the first lighting probe, the processor executes the steps of the above-mentioned lighting rendering method, which may also include:
[0145] According to the colors of the plurality of light probes, the non-black light probes on both sides of the first wall are determined as first light probes, and the non-black light probes adjacent to the first light probe are determined as adjacent light probes.
[0146] Optionally, the processor executing the step of updating the spherical harmonic coefficients of the first light probe according to the spherical harmonic coefficients of the first light probe on both sides of the first wall in the preset game scene and the spherical harmonic coefficients of the adjacent light probes of the first light probe may include:
[0147] According to the spherical harmonic coefficients of the adjacent lighting probes of the first lighting probe, the spherical harmonic coefficients of the first lighting probe are subjected to multiple mixed interpolations to obtain updated spherical harmonic coefficients of the first lighting probe.
[0148] Optionally, before the processor executes the above-mentioned updating of the spherical harmonic coefficients of the second lighting probe inside the first wall according to the updated spherical harmonic coefficients of the first lighting probe, the processor executes the above-mentioned lighting rendering method, which may further include:
[0149] According to the colors of the plurality of light probes, a black light probe inside the first wall is determined as a second light probe.
[0150] Optionally, before the processor executes the above-mentioned updating of the spherical harmonic coefficients of the second lighting probe inside the first wall according to the updated spherical harmonic coefficients of the first lighting probe, the processor executes the above-mentioned lighting rendering method, which may further include:
[0151] It is determined whether the light probe inside the first wall has adjacent light probes on both sides of the first wall; if the light probe inside the first wall has adjacent light probes on both sides of the first wall, it is determined that the light probe inside the first wall is the second light probe.
[0152] Optionally, the processor executing the step of updating the spherical harmonic coefficients of the second lighting probe inside the first wall according to the updated spherical harmonic coefficients of the first lighting probe may include:
[0153] New spherical harmonic coefficients are calculated using a preset calculation method according to the updated spherical harmonic coefficients of the first illumination probe adjacent to the second illumination probe; and the spherical harmonic coefficients of the second illumination probe are updated according to the new spherical harmonic coefficients.
[0154] Optionally, the processor executes the steps of the above-mentioned illumination rendering method, and may further include:
[0155] During the process of editing the preset game scene, if light leakage occurs in the second wall, a virtual geometric body is placed in the normal direction of the second wall, and the second wall is a wall in the preset game scene whose thickness is less than the preset thickness; an offset map is generated according to the placement position of the virtual geometric body and the distribution positions of multiple light probes, and the offset map indicates the light probe located at the placement position of the virtual geometric body. The offset map is used to screen the light probes used for lighting rendering when rendering the virtual objects in the game scene that satisfy the preset position relationship with the second wall.
[0156] The lighting rendering method executed by the processor of the above-mentioned embodiment, on the one hand, solves the light leakage problem of the wall by modifying the pre-baked spherical harmonic coefficients, which does not bring about additional consumption and memory package occupation, and has no requirements on the performance of the real-time rendering terminal device; on the other hand, the processing process of using automated spherical harmonic coefficient update for the first wall reduces manual workload and improves baking efficiency; in addition, the spherical harmonic coefficients of the adjacent lighting probes of the first lighting probe are used to update the spherical harmonic coefficients of the first lighting probe, so as to accurately avoid the light leakage problem of the first wall from various perspectives, thereby ensuring the lighting rendering effect during real-time rendering.
[0157] Optionally, the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the above method embodiment is executed.
[0158] Specifically, the processor executes the steps of the above-mentioned illumination rendering method, which may include:
[0159] Obtain a pre-baked result of a preset game scene, the pre-baked result including: spherical harmonic coefficients of multiple lighting probes in the preset game scene; update the spherical harmonic coefficients of the first lighting probe according to the spherical harmonic coefficients of the first lighting probe on both sides of a first wall in the preset game scene and the spherical harmonic coefficients of adjacent lighting probes of the first lighting probe, wherein the first wall is a wall in the preset game scene having a thickness greater than or equal to a preset thickness; store the updated spherical harmonic coefficients of the first lighting probe, and the updated spherical harmonic coefficients of the first lighting probe are used for lighting rendering of a virtual object in the game scene that satisfies a preset position relationship with the first wall.
[0160] Optionally, the processor executes the steps of the above-mentioned illumination rendering method, and may further include:
[0161] According to the updated spherical harmonic coefficients of the first lighting probe, the spherical harmonic coefficients of the second lighting probe inside the first wall are updated; the updated spherical harmonic coefficients of the second lighting probe are stored, and the updated spherical harmonic coefficients of the first lighting probe and the updated spherical harmonic coefficients of the second lighting probe are used to perform lighting rendering on virtual objects in the game scene that satisfy a preset position relationship with the first wall.
[0162] Optionally, the pre-baked result further includes: colors of multiple lighting probes. Before the processor executes the above-mentioned updating of the spherical harmonic coefficients of the first lighting probe on both sides of the first wall in the preset game scene and the spherical harmonic coefficients of the adjacent lighting probes of the first lighting probe, the processor executes the steps of the above-mentioned lighting rendering method, which may also include:
[0163] According to the colors of the plurality of light probes, the non-black light probes on both sides of the first wall are determined as first light probes, and the non-black light probes adjacent to the first light probe are determined as adjacent light probes.
[0164] Optionally, the processor executing the step of updating the spherical harmonic coefficients of the first light probe according to the spherical harmonic coefficients of the first light probe on both sides of the first wall in the preset game scene and the spherical harmonic coefficients of the adjacent light probes of the first light probe may include:
[0165] According to the spherical harmonic coefficients of the adjacent lighting probes of the first lighting probe, the spherical harmonic coefficients of the first lighting probe are subjected to multiple mixed interpolations to obtain updated spherical harmonic coefficients of the first lighting probe.
[0166] Optionally, before the processor executes the above-mentioned updating of the spherical harmonic coefficients of the second lighting probe inside the first wall according to the updated spherical harmonic coefficients of the first lighting probe, the processor executes the above-mentioned lighting rendering method, which may further include:
[0167] According to the colors of the plurality of light probes, a black light probe inside the first wall is determined as a second light probe.
[0168] Optionally, before the processor executes the above-mentioned updating of the spherical harmonic coefficients of the second lighting probe inside the first wall according to the updated spherical harmonic coefficients of the first lighting probe, the processor executes the above-mentioned lighting rendering method, which may further include:
[0169] It is determined whether the light probe inside the first wall has adjacent light probes on both sides of the first wall; if the light probe inside the first wall has adjacent light probes on both sides of the first wall, it is determined that the light probe inside the first wall is the second light probe.
[0170] Optionally, the processor executing the step of updating the spherical harmonic coefficients of the second lighting probe inside the first wall according to the updated spherical harmonic coefficients of the first lighting probe may include:
[0171] New spherical harmonic coefficients are calculated using a preset calculation method according to the updated spherical harmonic coefficients of the first illumination probe adjacent to the second illumination probe; and the spherical harmonic coefficients of the second illumination probe are updated according to the new spherical harmonic coefficients.
[0172] Optionally, the processor executes the steps of the above-mentioned illumination rendering method, and may further include:
[0173] During the process of editing the preset game scene, if light leakage occurs in the second wall, a virtual geometric body is placed in the normal direction of the second wall, and the second wall is a wall in the preset game scene whose thickness is less than the preset thickness; an offset map is generated according to the placement position of the virtual geometric body and the distribution positions of multiple light probes, and the offset map indicates the light probe located at the placement position of the virtual geometric body. The offset map is used to screen the light probes used for lighting rendering when rendering the virtual objects in the game scene that satisfy the preset position relationship with the second wall.
[0174] The lighting rendering method executed by the processor of the above-mentioned embodiment, on the one hand, solves the light leakage problem of the wall by modifying the pre-baked spherical harmonic coefficients, which does not bring about additional consumption and memory package occupation, and has no requirements on the performance of the real-time rendering terminal device; on the other hand, the processing process of using automated spherical harmonic coefficient update for the first wall reduces manual workload and improves baking efficiency; in addition, the spherical harmonic coefficients of the adjacent lighting probes of the first lighting probe are used to update the spherical harmonic coefficients of the first lighting probe, so as to accurately avoid the light leakage problem of the first wall from various perspectives, thereby ensuring the lighting rendering effect during real-time rendering.
[0175] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0176] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0177] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0178] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to perform some steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (English: Read-Only Memory, abbreviated: ROM), random access memory (English: Random Access Memory, abbreviated: RAM), disk or optical disk and other media that can store program codes.
[0179] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A lighting rendering method, characterized in that: The method comprises: Obtaining a pre-baking result of a preset game scene, the pre-baking result comprising: spherical harmonic coefficients of a plurality of illumination probes in the preset game scene; updating the spherical harmonic coefficients of the first illumination probe according to the spherical harmonic coefficients of the first illumination probe on both sides of the first wall in the preset game scene and the spherical harmonic coefficients of the adjacent illumination probes of the first illumination probe, wherein the first wall is a wall in the preset game scene having a thickness greater than or equal to a preset thickness; The updated spherical harmonic coefficients of the first lighting probe are stored, and the updated spherical harmonic coefficients of the first lighting probe are used to perform lighting rendering on a virtual object in the game scene that satisfies a preset position relationship with the first wall.
2. The method according to claim 1, characterized in that The method further comprises: updating the spherical harmonic coefficients of the second light probe inside the first wall according to the updated spherical harmonic coefficients of the first light probe; The updated spherical harmonic coefficients of the second lighting probe are stored, and the updated spherical harmonic coefficients of the first lighting probe and the updated spherical harmonic coefficients of the second lighting probe are used to perform lighting rendering on virtual objects in the game scene that satisfy a preset position relationship with the first wall.
3. The method according to claim 1, characterized in that The pre-baking result further includes: the colors of the multiple lighting probes, and before updating the spherical harmonic coefficients of the first lighting probe on both sides of the first wall in the preset game scene and the spherical harmonic coefficients of the adjacent lighting probes of the first lighting probe, the method further includes: According to the colors of the plurality of light probes, the non-black light probes on both sides of the first wall are determined as first light probes, and the non-black light probes adjacent to the first light probes are determined as adjacent light probes.
4. The method according to claim 1, characterized in that: The updating of the spherical harmonic coefficients of the first illumination probe according to the spherical harmonic coefficients of the first illumination probe at both sides of the first wall in the preset game scene and the spherical harmonic coefficients of the adjacent illumination probes of the first illumination probe includes: According to the spherical harmonic coefficients of the adjacent lighting probes of the first lighting probe, multiple mixed interpolations are performed on the spherical harmonic coefficients of the first lighting probe to obtain updated spherical harmonic coefficients of the first lighting probe.
5. The method according to claim 2, characterized in that: Before updating the spherical harmonic coefficients of the second illumination probe inside the first wall according to the updated spherical harmonic coefficients of the first illumination probe, the method further includes: According to the colors of the plurality of light probes, a black light probe inside the first wall is determined as the second light probe.
6. The method according to claim 2, characterized in that Before updating the spherical harmonic coefficients of the second illumination probe inside the first wall according to the updated spherical harmonic coefficients of the first illumination probe, the method further includes: Determine whether the light probe inside the first wall has adjacent light probes on both sides of the first wall; If the light probe inside the first wall has adjacent light probes on both sides of the first wall, the light probe inside the first wall is determined to be the second light probe.
7. The method according to claim 2, characterized in that The updating of the spherical harmonic coefficients of the second illumination probe inside the first wall according to the updated spherical harmonic coefficients of the first illumination probe includes: Calculating new spherical harmonic coefficients using a preset calculation method according to the updated spherical harmonic coefficients of the first illumination probe adjacent to the second illumination probe; The spherical harmonic coefficients of the second lighting probe are updated according to the new spherical harmonic coefficients.
8. The method according to claim 1, characterized in that The method further comprises: During the editing of the preset game scene, if light leakage occurs in the second wall, a virtual geometric body is placed in the normal direction of the second wall, where the second wall is a wall in the preset game scene whose thickness is less than the preset thickness; An offset map is generated according to the placement position of the virtual geometric body and the distribution positions of the multiple lighting probes, wherein the offset map indicates the lighting probes located at the placement position of the virtual geometric body, and the offset map is used to screen the lighting probes used for lighting rendering when rendering the virtual objects in the game scene that satisfy a preset positional relationship with the second wall.
9. A lighting rendering device, characterized in that: The device comprises: An acquisition module, used to acquire a pre-baked result of a preset game scene, wherein the pre-baked result includes: spherical harmonic coefficients of a plurality of illumination probes in the preset game scene; an updating module, configured to update the spherical harmonic coefficients of the first illumination probe according to the spherical harmonic coefficients of the first illumination probe on both sides of the first wall in the preset game scene and the spherical harmonic coefficients of the adjacent illumination probes of the first illumination probe, wherein the first wall is a wall in the preset game scene having a thickness greater than or equal to a preset thickness; A storage module is used to store the updated spherical harmonic coefficients of the first lighting probe, and the updated spherical harmonic coefficients of the first lighting probe are used to perform lighting rendering on virtual objects in the game scene that satisfy a preset position relationship with the first wall.
10. An electronic device, characterized in that: include: A processor, a storage medium and a bus, wherein the storage medium stores program instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the program instructions to perform the steps of the lighting rendering method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the lighting rendering method according to any one of claims 1 to 8 are executed.