Method and device for rendering illumination effect in game and electronic equipment

By separating and storing the visibility and material lighting information of voxels in the game scene, and generating game scenes with different resolutions, the problems of large memory overhead and slow light travel are solved, and more efficient lighting effects are achieved.

CN120346519APending Publication Date: 2025-07-22NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510314758.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-17
Publication Date
2025-07-22

AI Technical Summary

Technical Problem

In the existing game rendering technology, voxelized expression methods lead to large overhead of video memory, insufficient light travel accuracy and speed, affecting the lighting effect.

Method used

The visibility and material lighting information of voxels in the game scene are separated and stored with voxels of different resolutions, and the first game scene and the second game scene are generated. The point of light is determined through the first game scene, and the material lighting information is determined through the second game scene for lighting rendering.

Benefits of technology

While reducing video memory usage, it ensures the speed and accuracy of light travel, and improves the lighting effect of the game scene.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120346519A_ABST
    Figure CN120346519A_ABST
Patent Text Reader

Abstract

The invention provides a rendering method and device for an illumination effect in a game and electronic equipment. A first game scene composed of voxels of a first resolution ratio and a second game scene composed of voxels of a second resolution ratio are generated according to a game scene; synchronizing a light path in the target game scene to the first game scene in real time; determining a target voxel where the light path intersects with the first game scene; and determining illumination information and material information of the target voxel from the second game scene, and performing illumination rendering on the target game scene. According to the mode, the visibility and the material illumination information of the voxels in the game scene are separately stored in the form of the voxels with different resolutions to obtain the first game scene and the second game scene, the emission point of the light is determined through the first game scene, the material illumination information of the emission point is determined through the second game scene for illumination rendering, video memory occupation is reduced, and the efficiency is improved. The light advancing speed and precision are guaranteed, and the lighting effect of the game scene is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of game rendering, and in particular, to a method, apparatus, and electronic device for rendering lighting effects in a game. Background Art

[0002] In current game rendering, correct lighting calculations are usually required. Among them, real-time global lighting requires algorithms such as scene representation and ray marching. In related technologies, a voxelized representation of the scene is usually used. Each voxel needs to store a large amount of information, resulting in a large video memory overhead. In addition, for ray marching based on the voxelized representation of the scene, there are problems of low precision and accuracy or slow speed, which in turn affects the lighting effect of the game scene. Summary of the Invention

[0003] In view of this, the purpose of the present disclosure is to provide a method, apparatus, and electronic device for rendering lighting effects in a game. The visibility and material lighting information of voxels in the game scene are separately stored in voxels with different resolutions to obtain a first game scene and a second game scene. The shooting point of the light ray is determined through the first game scene, and the material lighting information of the set point is determined through the second game scene for lighting rendering. While reducing the video memory occupancy, it can also ensure the speed and precision of ray marching, thereby improving the lighting effect of the game scene.

[0004] In a first aspect, an embodiment of the present disclosure provides a method for rendering lighting effects in a game. The method includes: generating a first game scene and a second game scene according to the game scene of the target game; wherein, the first game scene is composed of voxels with a first resolution, and the second game scene is composed of voxels with a second resolution. The voxels with the first resolution are used to store the visibility information of voxels in the game scene, and the voxels with the second resolution are used to store the material information and lighting information of voxels in the game scene. The first resolution is greater than the second resolution; in response to the game running instruction of the target game, display the target game scene in the game scene in the graphical user interface, and synchronize the light ray path in the target game scene to the first game scene in real time; determine the target voxel where the light ray path intersects the first game scene; determine the lighting information and material information of the target voxel from the second game scene according to the voxel coordinates of the target voxel, and perform lighting rendering on the target game scene based on the lighting information and material information.

[0005] In a second aspect, an embodiment of the present disclosure provides a rendering device for lighting effects in a game. The device includes: a generation module configured to generate a first game scene and a second game scene according to the game scene of a target game; wherein, the first game scene is composed of voxels with a first resolution, and the second game scene is composed of voxels with a second resolution. The voxels with the first resolution are used to store the visibility information of the voxels in the game scene, and the voxels with the second resolution are used to store the material information and lighting information of the voxels in the game scene. The first resolution is greater than the second resolution; a synchronization module configured to, in response to a game running instruction of the target game, display the target game scene in the game scene on the graphical user interface and synchronize the light path in the target game scene to the first game scene in real time; a determination module configured to determine the target voxels where the light path intersects the first game scene; a rendering module configured to determine the lighting information and material information of the target voxels from the second game scene according to the voxel coordinates of the target voxels, and perform lighting rendering on the target game scene based on the lighting information and material information.

[0006] In a third aspect, an embodiment of the present disclosure provides an electronic device, including a processor and a memory. The memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the method for rendering lighting effects in a game according to any one of the first aspect.

[0007] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions cause the processor to implement the method for rendering lighting effects in a game according to any one of the first aspect.

[0008] The embodiments of the present disclosure bring the following beneficial effects:

[0009] The present disclosure provides a method, an apparatus, and an electronic device for rendering a lighting effect in a game. A first game scene and a second game scene are generated according to the game scene of a target game. The first game scene is composed of voxels with a first resolution, and the second game scene is composed of voxels with a second resolution. The voxels with the first resolution are used to store the visibility information of the voxels in the game scene, and the voxels with the second resolution are used to store the material information and lighting information of the voxels in the game scene. The first resolution is greater than the second resolution. In response to a game running instruction of the target game, the target game scene in the game scene is displayed on the graphical user interface, and the light path in the target game scene is synchronously updated to the first game scene in real time. The target voxels where the light path intersects the first game scene are determined. The lighting information and material information of the target voxels are determined from the second game scene according to the voxel coordinates of the target voxels, and the target game scene is rendered with lighting based on the lighting information and material information. In this way, the visibility of the voxels in the game scene and the material lighting information are separately stored in voxels with different resolutions to obtain the first game scene and the second game scene. The shooting points of the light are determined through the first game scene, and the material lighting information of the set points is determined through the second game scene for lighting rendering, which reduces the video memory occupancy while ensuring the speed and accuracy of the light propagation, thereby improving the lighting effect of the game scene.

[0010] Other features and advantages of the present disclosure will be described in the following specification, and some of them will become obvious from the specification or be understood by implementing the present disclosure. The objectives and other advantages of the present disclosure are achieved and obtained by the structures specifically pointed out in the specification, the claims, and the drawings.

[0011] To make the above objectives, features, and advantages of the present disclosure more obvious and understandable, the following provides preferred embodiments in conjunction with the accompanying drawings for detailed description as follows. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] To more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the prior art, the following briefly introduces the accompanying drawings required for the description of the specific embodiments or the prior art. Obviously, the following drawings are some embodiments of the present disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative efforts.

[0013] Figure 1 It is a flowchart of a method for rendering a lighting effect in a game provided by an embodiment of the present disclosure;

[0014] Figure 2 It is a schematic diagram of a first game scene provided by an embodiment of the present disclosure;

[0015] Figure 3A schematic diagram of a second game scene provided by an embodiment of the present disclosure;

[0016] Figure 4 A schematic diagram of a merged scene of a first game scene and a second game scene provided by an embodiment of the present disclosure;

[0017] Figure 5 Another schematic diagram of a first game scene provided by an embodiment of the present disclosure;

[0018] Figure 6 A schematic diagram of a first-level game scene provided by an embodiment of the present disclosure;

[0019] Figure 7 A schematic diagram of a second-level game scene provided by an embodiment of the present disclosure;

[0020] Figure 8 A schematic diagram of the propagation of light provided by an embodiment of the present disclosure;

[0021] Figure 9 Another schematic diagram of the propagation of light provided by an embodiment of the present disclosure;

[0022] Figure 10 Another schematic diagram of the propagation of light provided by an embodiment of the present disclosure;

[0023] Figure 11 A schematic diagram of the structure of a rendering device for the lighting effect in a game provided by an embodiment of the present disclosure;

[0024] Figure 12 A schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure. Detailed implementation manners

[0025] To make the objectives, technical solutions, and advantages of the embodiments of the present disclosure clearer, the technical solutions of the present disclosure will be clearly and completely described below with reference to the accompanying drawings. Apparently, the described embodiments are some, but not all, of the embodiments of the present disclosure. All other embodiments obtained by those skilled in the art based on the embodiments of the present disclosure without creative efforts shall fall within the protection scope of the present disclosure.

[0026] In current game rendering, correct lighting calculations are required. Lighting calculations are divided into direct light and indirect light (multiple bounce lighting) calculations. Among them, the calculation of indirect light is particularly complex and is divided into offline baked GI (Global Illumination) and real-time GI. Since real-time GI requires a large amount of calculation, it is difficult to apply to mobile phones. The calculation of real-time GI consists of three parts of algorithms: scene representation, Ray marching, and Gather Irradiance. Common scene representations include SDF Scene (the signed distance field expression of the SDF (Signed Distance Field) scene), Voxel Scene (the voxelized expression of the scene), etc. However, existing scene representations are difficult to balance video memory occupancy, scene accuracy, and ray marching performance. If real-time GI needs to be applied to mobile phones, an efficient scene representation is required that can ensure high scene accuracy, good ray marching performance, and fast reconstruction speed under limited video memory occupancy. A simplified and efficient scene data structure that supports ray marching can be applied not only to the calculation of GI but also to other advanced rendering effects such as reflection, refraction, and ambient occlusion.

[0027] In some related technologies, it is implemented through the SDF Scene method. The SDF Scene can only store position information. For the material information of the scene, other data structures need to be used for storage, such as mesh card, surfacecache, or voxel. The SDF of a three-dimensional scene is generally represented by a 3D Texture. Each texel stores the distance value from this point to the nearest surface of the surrounding scene, and the distance value is generally stored in float16. In the game, the SDF is generally stored in a clipmap centered on the player. Multiple levels of clipmaps cover a wider range and provide higher precision at close range.

[0028] This method has a large video memory overhead because each texel generally requires 16-bit data for storage. If the resolution of the clipmap is 256*256*256, then one level of clipmap requires 32MB of video memory. At the same time, the SDF only stores the position and shape information of the scene, and additional data structures are needed to store the material and lighting information of the scene. The construction speed of the SDF is slow. When the center of the clipmap moves (the player's position changes), or the positions of the objects within the range change, the entire area of the SDF needs to be reconstructed. And no matter what algorithm is used for the construction of the SDF, the overhead is large, and it is necessary to repeatedly traverse the texels again and again. Moreover, even if only local data changes, the change information needs to be flooded and transmitted to every texel globally.

[0029] In some other related technologies, it is implemented through the Voxel Scene method. Voxel Scene is a simplified way of voxel representation of a scene. The voxels of a three-dimensional scene are generally represented by 3D Texture. Each texel stores information such as whether there is an object occupying this point and the material information of the occupying object. In a game, the Voxel is generally stored in a clipmap centered on the player. The multi-level clipmap covers a farther range and provides higher precision at close range. There are generally two ways for the light propagation in VoxelScene, cone tracing and HDDA ray marching (Hierarchical digital differential analyzer ray marching). Although cone tracing is very fast, there are problems such as low trace accuracy, inaccuracy, and easy light leakage. HDDA ray marching has high precision and traverses all voxels in the ray direction in sequence, but it is slower.

[0030] This method has a large video memory overhead because each texel needs to store material information such as albedo (albedo map), normal (normal map), and emissive (emissive map). Assuming that albedo, normal, and emissive are each stored using 72 bits and the resolution of the clipmap is 512 * 256 * 512, then one level of the clipmap requires 576 MB of video memory. Therefore, for most voxel scenes, the resolution of the clipmap can only be 128 * 64 * 128 or lower. Cone Tracing is fast but has low precision, while HDDA ray marching has high precision but is slow.

[0031] Based on this, an embodiment of the present disclosure provides a method, device, and electronic device for rendering lighting effects in a game. This technology can be applied to devices such as mobile phones, laptops, tablets, and computers.

[0032] To facilitate the understanding of this embodiment, first, a method for rendering lighting effects in a game disclosed in an embodiment of the present disclosure will be introduced in detail. As Figure 1 shown, the method includes the following steps:

[0033] Step S102: Generate a first game scene and a second game scene according to the game scene of the target game. Among them, the first game scene is composed of voxels with a first resolution, and the second game scene is composed of voxels with a second resolution. The voxels with the first resolution are used to store the visibility information of the voxels in the game scene, and the voxels with the second resolution are used to store the material information and lighting information of the voxels in the game scene. The first resolution is greater than the second resolution.

[0034] The above game scene can be a large map scene, a large terrain scene, etc. in the target game; the above game scene can be a two-dimensional scene or a three-dimensional scene.

[0035] Since the visibility information of voxels is required for light propagation, a first game scene and a second game scene are generated according to the game scene of the target game. The first game scene is mainly used to represent the visibility of voxels, and the second game scene is mainly used to store lighting information and material information.

[0036] Taking the first resolution as 512*256*512 as an example and the second resolution as 128*64*128 as an example for illustration. 1 bit is used to save the visibility information of each voxel in the first game scene (1 indicates that the voxel is occupied by an object, and 0 indicates that the voxel is not occupied by an object). The first game scene only requires 8MB of video memory. The material information and lighting information are saved in the voxels of the second game scene. For example, if the material information and lighting require 72 bits for one voxel, then the second game scene requires 9MB of video memory.

[0037] Exemplarily, as Figure 2 the schematic diagram of the first game scene shown, as Figure 3 the schematic diagram of the second game scene shown, as Figure 4 the schematic diagram of the merged scene of the first game scene and the second game scene shown. Among them, the first resolution is 512*256*512, and the second resolution is 128*64*128. The game scene and resolution in the figure are only an example, and the actual game scene and resolution are not limited to the information shown in the figure.

[0038] Step S104: In response to the game running instruction of the target game, display the target game scene in the game scene in the graphical user interface, and synchronize the light path in the target game scene to the first game scene in real time.

[0039] Optionally, the target game scene is obtained by shooting the game scene with a first virtual camera, and the scene picture of the target game scene is displayed in the image user interface. The above light path includes the light emission starting point and the light emission direction (i.e., the light propagation direction).

[0040] Step S106: Determine the target voxels where the light path intersects the first game scene.

[0041] Optionally, in step 1, calculate the intersection position of the light path and the first game scene, and determine the intersecting voxels according to the intersection position;

[0042] In step 2, determine whether the intersecting voxels are visible. If so, determine the intersecting voxels as the target voxels; if not, execute step 3;

[0043] In step 3, calculate the step length of the light path progression, and continue to execute step 1 until the total step length of the light path progression is greater than the preset step length, and determine that there are no visible target voxels in the voxels where the light path intersects the first game scene.

[0044] Optionally, the first game scene is determined as multiple hierarchical game scenes. The voxels of the high-level game scene have a low resolution, and the voxels of the low-level game scene have a high resolution;

[0045] In step a, determine the intersecting voxels of the light path and the high-level game scene. If the intersecting voxels are visible, execute step b; if the intersecting voxels are not visible, execute step c.

[0046] In step b, determine the intersecting voxels of the light path and the game scenes of the next two levels of the high level until the game scene is the first game scene and the intersecting voxels are visible, and determine the intersecting voxels as the target voxels.

[0047] In step c, calculate the step length of the light path progression, and continue to execute step a until the total step length is greater than the preset step length, and determine that there are no visible target voxels in the voxels where the light path intersects the first game scene.

[0048] In step S108, determine the lighting information and material information of the target voxels from the second game scene according to the voxel coordinates of the target voxels, and perform lighting rendering on the target game scene based on the lighting information and material information.

[0049] By separating the storage of voxel visibility information and lighting and material information, the first voxel including the target voxel can be directly obtained from the second game scene according to the voxel coordinates of the target voxel in the first game scene, and then the lighting information and material information stored in the first voxel can be obtained, and the lighting information and material information of the first voxel are determined as the lighting information and material information of the target voxel, avoiding the judgment of the second game scene.

[0050] An embodiment of the present disclosure provides a method for rendering a lighting effect in a game, which generates a first game scene and a second game scene according to the game scene of the target game; wherein, the first game scene is composed of voxels with a first resolution, and the second game scene is composed of voxels with a second resolution. The voxels with the first resolution are used to store the visibility information of the voxels in the game scene, and the voxels with the second resolution are used to store the material information and lighting information of the voxels in the game scene. The first resolution is greater than the second resolution; in response to the game running instruction of the target game, the target game scene in the game scene is displayed on the graphical user interface, and the light path in the target game scene is synchronized to the first game scene in real time; determining the target voxels where the light path intersects the first game scene; determining the lighting information and material information of the target voxels from the second game scene according to the voxel coordinates of the target voxels, and performing lighting rendering on the target game scene based on the lighting information and material information. In this way, the visibility of the voxels in the game scene and the material lighting information are separately stored in voxels with different resolutions to obtain the first game scene and the second game scene. The shooting point of the light is determined through the first game scene, and the material lighting information of the set point is determined through the second game scene for lighting rendering, which reduces the video memory occupancy while ensuring the speed and accuracy of the light traveling, thereby improving the lighting effect of the game scene.

[0051] The above method further includes: determining at least one level of game scenes according to the first game scene; wherein, the resolution of the voxels in the game scene of the lowest level in the at least one level is less than the first resolution.

[0052] Optionally, the at least one level includes multiple levels, wherein the resolution of the voxels in the game scene of the higher level is less than the resolution of the voxels in the game scene of the lower level.

[0053] For example, according to the first game scene, a first-level game scene and a second-level game scene are determined. The first resolution of the voxels in the first game scene is 512*512*512, the resolution of the voxels in the first-level game scene is 128*128*128, and the resolution of the voxels in the second-level game scene is 32*32*32.

[0054] Taking the first game scene as a two-dimensional scene as an example, as Figure 5 shown in the schematic diagram of the first game scene, each small grid corresponds to a voxel; as Figure 6 shown in the schematic diagram of the first-level game scene, each voxel is composed of 4*4 small grids, as Figure 7 shown in the schematic diagram of the second-level game scene, each voxel is composed of 16*16 small grids. The voxels with diagonal shading in the figure indicate that the voxels are visible.

[0055] In the above method, by constructing a hierarchical structure for the first game scene, when performing ray marching calculations subsequently, the speed of ray marching can be increased, and at the same time, the accuracy of ray marching can be ensured. In addition, it can ensure that the clipmap in the game can be quickly constructed incrementally during scrolling updates.

[0056] For the step of determining the target voxel where the ray path intersects the first game scene, a possible implementation: Control the ray path to perform ray marching from a higher-level game scene to the first game scene, and determine the target voxel where the ray path intersects the first game scene.

[0057] Optionally, in step 1, determine the current intersection position of the ray path and the current game scene, and determine the current voxel corresponding to the current intersection position; determine whether the current voxel is visible. If yes, execute step 2 below. If no, execute step 3 below.

[0058] Optionally, in the initial state, use the highest-level game scene as the current game scene. The current intersection position of the ray path and the highest-level game scene can be directly determined based on the ray starting point and the ray direction of the ray, and the current voxel corresponding to the current intersection position can be determined.

[0059] Exemplarily, taking the game scene of at least one level including the second-level game scene and the first-level game scene and being a two-dimensional scene as an example, and taking the resolution of the highest-level game scene as 32*32 as an example for illustration, as Figure 8 shown in the schematic diagram of ray marching, the intersection position of the ray and the highest-level game scene is position a. Determine the corresponding current voxel according to position a. And determine whether the current voxel is visible according to the visibility information stored in the current voxel. As Figure 8 shown, the current voxel is a visible voxel.

[0060] When it is not the initial state (i.e., not in the first loop), for the step of determining the current intersection position of the ray path and the current game scene, a possible implementation: p new = p + t * dir; where p new is the current intersection position, p is the previously determined current intersection position, t is the marching step length of the ray path, and dir is the marching direction of the ray. In the initial state, p is the ray starting point.

[0061] For the step of determining the current voxel corresponding to the current intersection position, a possible implementation: curvoxelSize = n lev× baseVoxelSize; where curVoxelID is the voxel coordinate of the current voxel, p is the current intersection position, floor is the floor function, curvoxelSize is the voxel size of the current game scene, baseVoxelSize is the voxel size of the first game scene, and lev is the level value.

[0062] For the above step of determining whether the current voxel is visible, a possible implementation: Obtain the visibility information stored in the current voxel, and determine whether the current voxel is visible according to the visibility information.

[0063] Step 2, determine whether the current game scene is the first game scene; if so, determine the current voxel as the target voxel; if not, subtract 1 from the level number of the current game scene, and continue to execute Step 1;

[0064] If the current game scene is the game scene of the highest level, then determine the game scene of the next level below the highest level as the current game scene, and then determine the current intersection position of the light path with the game scene of the next level below the highest level, and determine the current voxel corresponding to the current intersection position. Exemplarily, as Figure 9 shown in the schematic diagram of the light ray traveling, specifically the schematic diagram of the intersection position where the light path intersects with the game scene of the first level, and the intersection position of the light ray with the game scene of the first level is position b. Determine the current voxel corresponding to position b. And determine whether the current voxel is visible according to the visibility information stored in the current voxel, as Figure 9 shown that the current voxel is a visible voxel.

[0065] If the current game scene is the game scene of the first level, then determine the first game scene as the current game scene, and then determine the current intersection position of the light path with the first game scene, and determine the current voxel corresponding to the current intersection position. Exemplarily, as Figure 10 shown in the schematic diagram of the light ray traveling, specifically the schematic diagram of the intersection position where the light path intersects with the first game scene, and the intersection position of the light ray with the first game scene is position c. Determine the current voxel corresponding to position c. And determine whether the current voxel is visible according to the visibility information stored in the current voxel, as Figure 10 shown that the current voxel is an invisible voxel, then continue to execute the following Step 3.

[0066] Step 3, calculate the travel step length of the light path in the current game scene, update the light path according to the travel step length, and continue to execute Step 1 until the total travel step length of the light path is greater than the preset threshold, and determine that there is no intersecting target voxel of the light path with the first game scene.

[0067] For the above step of calculating the travel step length of the light path in the current game scene, a possible implementation: t = min(tv,x , t v,y , t v,z ); t v = (p0 - p) / dir; p0 = (curVoxelID + floorOffset) × curVoxelSize; where t is the step length of the ray path in the current game scene, p is the current intersection position, dir is the traveling direction of the ray, curVoxelID is the voxel coordinate of the current voxel, curVoxelSize is the voxel size of the current game scene, and floorOffset represents the positive or negative of the component of the ray path on the specified axis. floorOffset = 0 indicates the negative of the component of the traveling direction on the specified axis, and floorOffset = 1 indicates the positive of the component of the traveling direction on the specified axis.

[0068] where t v,x = (x0 - p .x ) / dir .x , t v,y = (y0 - p .y ) / dir .y , t v,z = (z0 - p .z ) / dir .z ; p0 = (x0, y0, z0), p = (p .x , p .y , p .z ). The above - specified axes include the X - axis, Y - axis, and Z - axis.

[0069] After updating the ray path according to the step length, exemplarily, as Figure 10 shown, continue to determine the intersection position d, the voxel corresponding to the position d is invisible, continue to determine the intersection position e, the voxel corresponding to the position e is visible, and determine the voxel corresponding to the position e as the target voxel.

[0070] If the current voxel is always invisible, keep calculating the step length until the total step length of the ray path is greater than the preset threshold, and determine that there is no intersecting target voxel between the ray path and the first game scene.

[0071] The following embodiments mainly describe the implementation manner of the step of determining that there is no intersecting target voxel between the ray path and the first game scene when the total step length of the ray path is greater than the preset threshold in step 3 above:

[0072] Step 1, determine the current intersection position of the ray path and the current game scene, and determine the current voxel corresponding to the current intersection position; judge whether the current voxel is visible. If it is, execute step 2 below. If not, execute step 3 below;

[0073] Step 2, determine whether the current game scene is the first game scene; if so, determine the current voxel as the target voxel; if not, decrement the level number of the current game scene by one, and continue to execute Step 1;

[0074] Step 3, calculate the step length of the light path advancing in the current game scene, update the light path according to the step length, and continue to execute Step 1. If the total step length of the light path is greater than the preset threshold corresponding to the current game scene, determine the target level of the current game scene; if the target level is the highest level, determine that there is no intersecting target voxel between the light path and the first game scene;

[0075] Among the preset thresholds corresponding to the current game scene, the preset thresholds corresponding to different levels of the game scene are different. Among them, the preset threshold corresponding to the highest-level game scene is determined by the player in advance according to the game scene, and the preset threshold range corresponding to the non-highest-level game scene is determined by the voxel size of the game scene of the previous level of the game scene, such as the diagonal length of the voxel.

[0076] If the current game scene is the highest-level game scene, and the total step length of the light path is greater than the preset threshold corresponding to the highest-level game scene (i.e., the target preset threshold), determine that there is no intersecting target voxel between the light path and the first game scene.

[0077] Step 4, if the target level is not the highest level, increment the level number of the current game scene by one, and continue to execute Step 1 until the total step length of the light path is greater than the target preset threshold, and determine that there is no intersecting target voxel between the light path and the first game scene.

[0078] If the target level is not the highest level, it means that the light path shines on the voxels of the previous level again. At this time, it is necessary to increment the level number of the current game scene by one and continue to determine the next intersection position point of the light path. Until the light path passes through all the voxels and still no target voxel is found, determine that there is no intersecting target voxel between the light path and the first game scene.

[0079] The above method further includes: determining the preset threshold corresponding to the specified game scene except the highest level based on the resolution of the voxels in the game scene of the previous level of the specified game scene.

[0080] Optionally, the preset threshold corresponding to the highest-level game scene is the same as the target preset threshold; the preset threshold corresponding to the specified game scene except the highest level is determined based on the resolution of the voxels in the game scene of the previous level of the specified game scene.

[0081] After the step of determining the target voxels where the light path does not intersect with the first game scene, the above method further includes: determining the lighting information and material information of the current voxel based on a preset sky sphere and a lighting path.

[0082] If there are no intersecting target voxels, it is necessary to obtain the lighting information and material information at the lighting position from the lighting position of the lighting path in the preset sky sphere, and determine them as the lighting information and material information of the current voxel.

[0083] The above first resolution is a*b*c, and the resolution of the voxels of the game scenes at different levels is where lev is the level value of the game scene, n is a preset multiple, and a, b, and c respectively represent the number of voxels of the game scene in the X, Y, and Z axes of the three-dimensional space. The n (preset multiple) is set as needed, such as 2, 4, etc., and n is usually a multiple of 2. The level of the first game scene is 0.

[0084] In the above manner, by performing ray marching on game scenes at different levels, the warp divergence of the GPU can be greatly reduced. For game scenes at different levels, only the voxel sizes are different, and their algorithm processes are exactly the same, and the number of instructions is small, which improves the speed and accuracy of ray marching.

[0085] The method further includes: determining a target scene area based on the character position of the virtual character in the target game scene; wherein, the virtual character is always located at the center of the target scene area, and in the target scene area, the closer the scene area is to the virtual character, the larger the resolution of the voxels of the corresponding game scene.

[0086] Optionally, the above target scene area includes multiple levels of scene sub-areas, where the lowest-level scene sub-area is located around the virtual character, and in adjacent levels of scene sub-areas, the higher-level scene sub-area is located outside the lower-level scene sub-area. The resolution of the voxels of the game scene corresponding to the lower-level scene sub-area is greater than the resolution of the voxels of the game scene corresponding to the higher-level scene sub-area. The purpose is to increase the scene range of the displayed game scene, improve the visual effect of the game scene, and further improve the player's gaming experience.

[0087] The method further includes: updating the target scene area in response to the movement of the virtual character.

[0088] After the virtual character moves, it is necessary to determine a new target scene area in real time based on the character position of the virtual character.

[0089] The above method further includes: determining a first shooting range of a second virtual camera corresponding to a first game scene for the first game scene, and a first scene area located within the first shooting range; wherein, the first scene area includes at least one level of scene sub-areas, and the resolutions of voxels in the game scenes corresponding to different levels of scene sub-areas are different.

[0090] Wherein, the first scene area includes a first-level scene sub-area located at the shooting center. Among two adjacent-level scene sub-areas, the higher-level scene sub-area is located outside the lower-level scene sub-area.

[0091] The resolution of voxels in the game scene corresponding to the higher-level scene sub-area is less than the resolution of voxels in the game scene corresponding to the lower-level scene sub-area; wherein, the resolution of voxels in the game scene corresponding to the lowest-level scene sub-area is less than or equal to the first resolution.

[0092] The above method further includes: in response to the movement of the second virtual camera, determining the movement distance of the second virtual camera. If the movement distance is greater than a preset distance, determining a target movement distance of the second virtual camera according to the movement distance and the preset distance; controlling the second virtual camera to move the target movement distance, and determining a second shooting range of the second virtual camera for the first game scene after movement, and a second scene area located within the second shooting range; based on the first scene area and the second scene area, updating the resolution of voxels in the game scene corresponding to the second scene area.

[0093] The above preset distance is the distance corresponding to voxels of a target number of the first resolution;

[0094] The above step of determining the target movement distance of the first virtual camera according to the movement distance and the preset distance includes: calculating the ratio of the movement distance to the preset distance, and obtaining the integer part of the ratio; calculating the product of the integer and the preset distance to obtain the target movement distance.

[0095] The above step of updating the resolution of voxels in the game scene corresponding to the second scene area based on the first scene area and the second scene area includes: obtaining an old scene sub-area of a specified level in the first scene area, and a new scene sub-area of the specified level in the second scene area; determining an overlapping scene area between the old scene sub-area and the new scene sub-area, and determining a newly added scene sub-area in the new scene sub-area except the overlapping scene area; updating the resolution of voxels in the game scene corresponding to the newly added scene sub-area to a target resolution; wherein, the target resolution is the resolution corresponding to the level of the first scene sub-area. The above specified level is the lowest level.

[0096] The step of updating the resolution of the voxels in the game scene corresponding to the second scene area based on the first scene area and the second scene area further includes: obtaining scene sub-areas of other levels in the second scene area except the specified level; updating the resolution of the voxels in the game scene corresponding to the scene sub-areas of other levels to the resolution corresponding to the other levels.

[0097] The above-mentioned first scene area generally refers to Clipmap. Clipmap is generally centered on the camera. When the character moves, the camera bound to the character also moves. At this time, the center of the clipmap will move, that is, the whole clipmap will move with the camera. This is called rolling update.

[0098] Because the characteristic of Clipmap is that the resolution is very high near the center and lower the farther away from the center. Then in the game, it is hoped that the voxel accuracy of the scene near the protagonist is the highest, and the accuracy can be lower in the farther places. So the center of the Clipmap needs to move with the protagonist. In this way, the range of the game scene seen by the player can be increased.

[0099] In the above method, since the game scenes of different levels are pre-constructed, when the game scene is rolling updated, the incremental construction speed is fast enough.

[0100] Corresponding to the above method embodiments, the embodiments of the present disclosure provide a rendering device for the lighting effect in a game, as Figure 11 shown. The device includes:

[0101] A generation module 1101, configured to generate a first game scene and a second game scene according to the game scene of the target game; wherein, the first game scene is composed of voxels with a first resolution, the second game scene is composed of voxels with a second resolution, the voxels with the first resolution are used to store the visibility information of the voxels in the game scene, the voxels with the second resolution are used to store the material information and lighting information of the voxels in the game scene, and the first resolution is greater than the second resolution;

[0102] A synchronization module 1102, configured to respond to the game running instruction of the target game, display the target game scene in the game scene on the graphical user interface, and synchronize the light path in the target game scene to the first game scene in real time;

[0103] A determination module 1103, configured to determine the target voxels where the light path intersects the first game scene;

[0104] A rendering module 1104, configured to determine the lighting information and material information of a target voxel from a second game scene according to the voxel coordinates of the target voxel, and perform lighting rendering on the target game scene based on the lighting information and the material information.

[0105] An embodiment of the present disclosure provides a rendering device for lighting effects in a game, which generates a first game scene and a second game scene according to the game scene of a target game; wherein, the first game scene is composed of voxels with a first resolution, and the second game scene is composed of voxels with a second resolution. The voxels with the first resolution are used to store the visibility information of the voxels in the game scene, and the voxels with the second resolution are used to store the material information and lighting information of the voxels in the game scene. The first resolution is greater than the second resolution; in response to a game running instruction of the target game, the target game scene in the game scene is displayed on the graphical user interface, and the light path in the target game scene is synchronously transferred to the first game scene in real time; determining a target voxel where the light path intersects the first game scene; determining the lighting information and material information of the target voxel from the second game scene according to the voxel coordinates of the target voxel, and performing lighting rendering on the target game scene based on the lighting information and the material information. In this way, the visibility of the voxels in the game scene and the material lighting information are separately stored in voxels with different resolutions to obtain the first game scene and the second game scene. The shooting point of the light is determined through the first game scene, and the material lighting information of the set point is determined through the second game scene for lighting rendering, which reduces the video memory occupancy while ensuring the speed and accuracy of the light traveling, thereby improving the lighting effect of the game scene.

[0106] The above device further includes a hierarchical construction module, configured to: determine at least one level of game scenes according to the first game scene; wherein, the resolution of the voxels in the game scene of the lowest level in the at least one level is less than the first resolution.

[0107] The above at least one level includes multiple levels, wherein the resolution of the voxels in the game scene of the higher level is less than the resolution of the voxels in the game scene of the lower level.

[0108] The above determining module is further configured to: control the light path to travel from the game scene of the higher level to the first game scene, and determine the target voxel where the light path intersects the first game scene.

[0109] The above determination module is further configured to: Step 1, determine the current intersection position of the light path and the current game scene, and determine the current voxel corresponding to the current intersection position; determine whether the current voxel is visible, if so, execute the following Step 2, if not, execute the following Step 3; Step 2, determine whether the current game scene is the first game scene; if so, determine the current voxel as the target voxel; if not, subtract one from the level number of the current game scene, and continue to execute Step 1; Step 3, calculate the progress step length of the light path in the current game scene, update the light path according to the progress step length, and continue to execute Step 1 until the total progress step length of the light path is greater than the preset threshold, and determine that there is no intersecting target voxel between the light path and the first game scene.

[0110] The above determination module is further configured to: if the total progress step length of the light path is greater than the preset threshold corresponding to the current game scene, determine the target level of the current game scene; if the target level is the highest level, determine that there is no intersecting target voxel between the light path and the first game scene; if the target level is not the highest level, add one to the level number of the current game scene, and continue to execute Step 1 until the total progress step length of the light path is greater than the target preset threshold, and determine that there is no intersecting target voxel between the light path and the first game scene.

[0111] The preset threshold corresponding to the game scene of the above highest level is the same as the target preset threshold; the above device further includes: determining the preset threshold corresponding to the specified game scene except the highest level based on the resolution of the voxels in the specified game scene.

[0112] The above device further includes an information determination module, configured to: determine the lighting information and material information of the current voxel based on the preset sky sphere and lighting path.

[0113] The above first resolution is a*b*c, and the resolution of the voxels in the game scenes of different levels is where lev is the level value of the game scene, n is the preset multiple, and a, b, and c respectively represent the number of voxels of the game scene in the X, Y, and Z axes of the three-dimensional space.

[0114] The above determination module is further configured to: curvoxelSize = n lev ×baseVoxelSize; where curVoxelID is the voxel coordinate of the current voxel, p is the current intersection position, floor is the floor function, curvoxelSize is the voxel size of the current game scene, baseVoxelSize is the voxel size of the first game scene, and lev is the level value.

[0115] The above-mentioned determination module is further configured to: obtain the visibility information stored in the current voxel, and determine whether the current voxel is visible according to the visibility information.

[0116] The above-mentioned determination module is further configured to: t = min(t v,x , t v,y , t v,z ); t v = (p0 - p) / dir; p0 = (curVoxelID + floorOffset) × curvoxelSize; where t is the step length of the light ray path in the current game scene, p is the current intersection position, dir is the traveling direction of the light ray, curVoxelID is the voxel coordinate of the current voxel, curvoxelSize is the voxel size of the current game scene, and floorOffset represents the positive or negative of the component of the light ray path on the specified axis. floorOffset = 0 indicates the negative of the component of the traveling direction on the specified axis, and floorOffset = 1 indicates the positive of the component of the traveling direction on the specified axis.

[0117] The above-mentioned determination module is further configured to: p new = p + t * dir; where p new is the current intersection position, p is the previously determined current intersection position, t is the step length of the light ray path, and dir is the traveling direction of the light ray.

[0118] The above-mentioned device further includes a scene area determination module, configured to: determine a target scene area based on the character position of the virtual character in the target game scene; where the virtual character is always located at the center of the target scene area, and in the target scene area, the higher the resolution of the voxels of the game scene corresponding to the scene area closer to the virtual character.

[0119] The rendering device for the lighting effect in the game provided by the embodiments of the present disclosure has the same technical features as the rendering method for the lighting effect in the game provided by the above embodiments, so it can also solve the same technical problems and achieve the same technical effects.

[0120] This embodiment further provides an electronic device, including a processor and a memory. The memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the above-mentioned rendering method for the lighting effect in the game. This electronic device can be a server or a terminal device.

[0121] See Figure 12 As shown, this electronic device includes a processor 100 and a memory 101. The memory 101 stores machine-executable instructions that can be executed by the processor 100, and the processor 100 executes the machine-executable instructions to implement the above-mentioned rendering method for the lighting effect in the game.

[0122] Further, Figure 12 the electronic device shown further includes a bus 102 and a communication interface 103, and the processor 100, the communication interface 103, and the memory unit 101 are connected through the bus 102.

[0123] Among them, the memory unit 101 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk memory. The communication connection between this system network element and at least one other network element is implemented through at least one communication interface 103 (which may be wired or wireless), and the Internet, a wide area network, a local area network, a metropolitan area network, etc. may be used. The bus 102 may be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For the sake of convenience in representation, Figure 12 only a bidirectional arrow is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0124] The processor 100 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method may be completed by the integrated logic circuit of the hardware in the processor 100 or instructions in the form of software. The above-mentioned processor 100 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present disclosure. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in combination with the embodiments of the present disclosure may be directly embodied as being executed and completed by a hardware decoding processor, or executed and completed by a combination of hardware and software modules in the decoding processor. The software module may be located in a mature storage medium in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. This storage medium is located in the memory 101, and the processor 100 reads the information in the memory 101 and combines its hardware to complete the steps of the method in the foregoing embodiments.

[0125] The processor in the above electronic device can implement the following operations in the method for rendering the lighting effect in the above game by executing machine-executable instructions:

[0126] Generate a first game scene and a second game scene according to the game scene of the target game; wherein, the first game scene is composed of voxels with a first resolution, and the second game scene is composed of voxels with a second resolution. The voxels with the first resolution are used to store the visibility information of the voxels in the game scene, and the voxels with the second resolution are used to store the material information and lighting information of the voxels in the game scene. The first resolution is greater than the second resolution; in response to the game running instruction of the target game, display the target game scene in the game scene on the graphical user interface, and synchronize the light path in the target game scene to the first game scene in real time; determine the target voxels where the light path intersects the first game scene; determine the lighting information and material information of the target voxels from the second game scene according to the voxel coordinates of the target voxels, and perform lighting rendering on the target game scene based on the lighting information and material information. In this method, the visibility of the voxels in the game scene and the material lighting information are separately stored in voxels with different resolutions to obtain the first game scene and the second game scene. The shooting point of the light is determined through the first game scene, and the material lighting information of the shooting point is determined through the second game scene for lighting rendering. While reducing the video memory occupancy, it can also ensure the speed and accuracy of the light propagation, thereby improving the lighting effect of the game scene.

[0127] The above method further includes: determining at least one level of game scenes according to the first game scene; wherein, the resolution of the voxels in the game scene of the lowest level in the at least one level is less than the first resolution.

[0128] The above at least one level includes multiple levels, wherein, the resolution of the voxels in the game scene of the higher level is less than the resolution of the voxels in the game scene of the lower level.

[0129] The step of determining the target voxels where the light path intersects the first game scene includes: controlling the light path to travel from the game scene of the higher level to the first game scene, and determining the target voxels where the light path intersects the first game scene.

[0130] The step of determining the target voxel where the above-mentioned light path intersects the first game scene by traveling light from a high-level game scene to the first game scene includes: Step 1, determining the current intersection position of the light path and the current game scene, and determining the current voxel corresponding to the current intersection position; judging whether the current voxel is visible, if so, execute the following Step 2, if not, execute the following Step 3; Step 2, determining whether the current game scene is the first game scene; if so, determining the current voxel as the target voxel; if not, subtracting 1 from the level number of the current game scene, and continuing to execute Step 1; Step 3, calculating the travel step length of the light path in the current game scene, updating the light path according to the travel step length, and continuing to execute Step 1 until the total travel step length of the light path is greater than a preset threshold, and determining that there is no intersecting target voxel between the light path and the first game scene.

[0131] The step of determining that there is no intersecting target voxel between the light path and the first game scene when the total travel step length of the above-mentioned light path is greater than the preset threshold includes: if the total travel step length of the light path is greater than the preset threshold corresponding to the current game scene, determining the target level of the current game scene; if the target level is the highest level, determining that there is no intersecting target voxel between the light path and the first game scene; if the target level is not the highest level, adding 1 to the level number of the current game scene, and continuing to execute Step 1 until the total travel step length of the light path is greater than the target preset threshold, and determining that there is no intersecting target voxel between the light path and the first game scene.

[0132] The preset threshold corresponding to the game scene at the above-mentioned highest level is the same as the target preset threshold; the above method further includes: determining the preset threshold corresponding to the specified game scene other than the highest level based on the resolution of the voxels in the specified game scene.

[0133] After the step of determining that there is no intersecting target voxel between the light path and the first game scene, the method further includes: determining the lighting information and material information of the current voxel based on the preset sky sphere and lighting path.

[0134] The above-mentioned first resolution is a*b*c, and the resolution of the voxels in the game scenes at different levels is where lev is the level value of the game scene, n is a preset multiple, and a, b, and c respectively represent the number of voxels of the game scene in the X, Y, and Z axes of the three-dimensional space.

[0135] The step of determining the current voxel corresponding to the current intersection position includes: curvoxelSize = n lev× baseVoxelSize; where curVoxelID is the voxel coordinate of the current voxel, p is the current intersection position, floor is the floor function, curvoxelSize is the voxel size of the current game scene, baseVoxelSize is the voxel size of the first game scene, and lev is the level value.

[0136] The above step of determining whether the current voxel is visible includes: obtaining the visibility information stored in the current voxel, and determining whether the current voxel is visible according to the visibility information.

[0137] The above step of calculating the step length of the light ray path advancing in the current game scene includes: t = min(t v,x , t v,y , t v,z ); t v = (p0 - p) / dir; p0 = (curVoxelID + floorOffset) × curvoxelSize; where t is the step length of the light ray path advancing in the current game scene, p is the current intersection position, dir is the advancing direction of the light ray, curVoxelID is the voxel coordinate of the current voxel, curvoxelSize is the voxel size of the current game scene, floorOffset represents the positive or negative of the component of the light ray path on the specified axis, floorOffset = 0 represents the negative of the component of the advancing direction on the specified axis, and floorOffset = 1 represents the positive of the component of the advancing direction on the specified axis.

[0138] The above step of determining the current intersection position of the light ray path and the current game scene includes: p new = p + t * dir; where p new is the current intersection position, p is the previously determined current intersection position, t is the step length of the light ray path, and dir is the advancing direction of the light ray.

[0139] The above method further includes: determining a target scene area based on the character position of the virtual character in the target game scene; where the virtual character is always located at the center of the target scene area, and in the target scene area, the higher the resolution of the voxels of the game scene corresponding to the scene area closer to the virtual character.

[0140] This embodiment also provides a machine-readable storage medium, which stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions cause the processor to implement the above method for rendering the lighting effect in the game.

[0141] The machine-executable instructions stored in the above-mentioned machine-readable storage medium can, by executing the machine-executable instructions, implement the following operations in the method for rendering the lighting effect in the above-mentioned game:

[0142] Generate a first game scene and a second game scene according to the game scene of the target game; wherein, the first game scene is composed of voxels with a first resolution, the second game scene is composed of voxels with a second resolution, the voxels with the first resolution are used to store the visibility information of the voxels in the game scene, the voxels with the second resolution are used to store the material information and lighting information of the voxels in the game scene, and the first resolution is greater than the second resolution; in response to the game running instruction of the target game, display the target game scene in the game scene in the graphical user interface, and synchronize the light path in the target game scene to the first game scene in real time; determine the target voxels where the light path intersects the first game scene; determine the lighting information and material information of the target voxels from the second game scene according to the voxel coordinates of the target voxels, and perform lighting rendering on the target game scene based on the lighting information and material information. In this method, the visibility and material lighting information of the voxels in the game scene are separately stored in voxels with different resolutions to obtain the first game scene and the second game scene. The shooting points of the light are determined through the first game scene, and the material lighting information of the set points is determined through the second game scene for lighting rendering, which reduces the video memory occupancy while ensuring the speed and accuracy of the light traveling, thereby improving the lighting effect of the game scene.

[0143] The above method further includes: determining at least one level of game scenes according to the first game scene; wherein, the resolution of the voxels in the game scene of the lowest level in the at least one level is less than the first resolution.

[0144] The above at least one level includes multiple levels, wherein, the resolution of the voxels in the game scene of the higher level is less than the resolution of the voxels in the game scene of the lower level.

[0145] The step of determining the target voxels where the light path intersects the first game scene includes: controlling the light path to travel from the game scene of the higher level to the first game scene, and determining the target voxels where the light path intersects the first game scene.

[0146] The step of determining the target voxel where the above-mentioned light path intersects the first game scene by traveling light from a high-level game scene to the first game scene includes: Step 1, determining the current intersection position of the light path with the current game scene and determining the current voxel corresponding to the current intersection position; determining whether the current voxel is visible, if so, executing the following Step 2, if not, executing the following Step 3; Step 2, determining whether the current game scene is the first game scene; if so, determining the current voxel as the target voxel; if not, subtracting 1 from the level number of the current game scene and continuing to execute Step 1; Step 3, calculating the travel step length of the light path in the current game scene, updating the light path according to the travel step length, and continuing to execute Step 1 until the total travel step length of the light path is greater than a preset threshold, and determining that there is no intersecting target voxel between the light path and the first game scene.

[0147] The step of determining that there is no intersecting target voxel between the light path and the first game scene when the total travel step length of the above-mentioned light path is greater than the preset threshold includes: if the total travel step length of the light path is greater than the preset threshold corresponding to the current game scene, determining the target level of the current game scene; if the target level is the highest level, determining that there is no intersecting target voxel between the light path and the first game scene; if the target level is not the highest level, adding 1 to the level number of the current game scene and continuing to execute Step 1 until the total travel step length of the light path is greater than the target preset threshold, and determining that there is no intersecting target voxel between the light path and the first game scene.

[0148] The preset threshold corresponding to the game scene of the above-mentioned highest level is the same as the target preset threshold; the above method further includes: determining the preset threshold corresponding to the specified game scene other than the highest level based on the resolution of the voxels in the specified game scene.

[0149] After the step of determining that there is no intersecting target voxel between the light path and the first game scene, the method further includes: determining the lighting information and material information of the current voxel based on the preset sky sphere and lighting path.

[0150] The above-mentioned first resolution is a*b*c, and the resolution of the voxels in the game scenes of different levels is where lev is the level value of the game scene, n is the preset multiple, and a, b, and c respectively represent the number of voxels of the game scene in the X, Y, and Z axes of the three-dimensional space.

[0151] The step of determining the current voxel corresponding to the current intersection position includes: curvoxelSize = n lev×baseVoxelSize; where curVoxelID is the voxel coordinate of the current voxel, p is the current intersection position, floor is the floor function, curvoxelSize is the voxel size of the current game scene, baseVoxelSize is the voxel size of the first game scene, and lev is the level value.

[0152] The above steps for determining whether the current voxel is visible include: obtaining the visibility information stored in the current voxel, and determining whether the current voxel is visible according to the visibility information.

[0153] The above steps for calculating the step length of the light ray path advancing in the current game scene include: t = min(t v,x , t v,y , t v,z ); t v = (p0 - p) / dir; p0 = (curVoxelID + floorOffset) × curvoxelSize; where t is the step length of the light ray path advancing in the current game scene, p is the current intersection position, dir is the advancing direction of the light ray, curVoxelID is the voxel coordinate of the current voxel, curvoxelSize is the voxel size of the current game scene, floorOffset represents the positive or negative of the component of the light ray path on the specified axis, floorOffset = 0 represents the negative of the component of the advancing direction on the specified axis, and floorOffset = 1 represents the positive of the component of the advancing direction on the specified axis.

[0154] The above steps for determining the current intersection position of the light ray path and the current game scene include: p new = p + t * dir; where p new is the current intersection position, p is the previously determined current intersection position, t is the step length of the light ray path, and dir is the advancing direction of the light ray.

[0155] The above method further includes: determining a target scene area based on the character position of the virtual character in the target game scene; where the virtual character is always located at the center of the target scene area, and in the target scene area, the higher the resolution of the voxels of the game scene corresponding to the scene area closer to the virtual character.

[0156] The computer program product of the method, device, electronic device, and system for rendering the lighting effect in the game provided by the embodiments of the present disclosure includes a computer-readable storage medium storing program code, and the instructions included in the program code can be used to execute the method described in the foregoing method embodiments. For specific implementation, reference can be made to the method embodiments, which will not be elaborated here.

[0157] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the systems and devices described above can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.

[0158] In addition, in the description of the embodiments of the present disclosure, unless otherwise clearly defined and limited, the terms "install", "connect", and "couple" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium, and it can be the communication inside two elements. For those skilled in the art, the specific meanings of the above terms in the present disclosure can be understood according to specific situations.

[0159] If the above functions are implemented in the form of software function units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present disclosure, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present disclosure. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs that can store program codes.

[0160] In the description of the present disclosure, it should be noted that the orientation or positional relationship indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. is based on the orientation or positional relationship shown in the drawings. It is only for the convenience of describing the present disclosure and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be construed as a limitation to the present disclosure. In addition, the terms "first", "second", and "third" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance.

[0161] Finally, it should be noted that the above embodiments are only specific implementation manners of the present disclosure, used to illustrate the technical solutions of the present disclosure, rather than limiting it. The protection scope of the present disclosure is not limited thereto. Although the present disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art within the technical scope disclosed by the present disclosure can still modify the technical solutions recorded in the foregoing embodiments or can easily think of changes, or perform equivalent replacements on some of the technical features; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should all be covered within the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be subject to the protection scope of the claims.

Claims

1. A rendering method for lighting effects in a game, characterized in that The method includes: Generating a first game scene and a second game scene according to the game scene of the target game; wherein, the first game scene is composed of voxels with a first resolution, the second game scene is composed of voxels with a second resolution, the voxels with the first resolution are used to store the visibility information of the voxels in the game scene, the voxels with the second resolution are used to store the material information and lighting information of the voxels in the game scene, and the first resolution is greater than the second resolution; In response to the game running instruction of the target game, displaying the target game scene in the game scene on the graphical user interface, and synchronizing the light path in the target game scene to the first game scene in real time; Determining the target voxels where the light path intersects the first game scene; Determining the lighting information and material information of the target voxels from the second game scene according to the voxel coordinates of the target voxels, and performing lighting rendering on the target game scene based on the lighting information and the material information.

2. The method according to claim 1, wherein The method further includes: Determining at least one level of game scenes according to the first game scene; wherein, the resolution of the voxels in the game scene of the lowest level in the at least one level is less than the first resolution.

3. The method according to claim 2, wherein The at least one level includes multiple levels, wherein, the resolution of the voxels in the game scene of the higher level is less than the resolution of the voxels in the game scene of the lower level.

4. The method according to claim 3, wherein The step of determining the target voxels where the light path intersects the first game scene includes: Controlling the light path to travel from the game scene of the higher level to the first game scene, and determining the target voxels where the light path intersects the first game scene.

5. The method according to claim 3, characterized in that, The step of controlling the light path to travel from the game scene of the higher level to the first game scene and determining the target voxels where the light path intersects the first game scene includes: Step 1, determining the current intersection position of the light path and the current game scene, and determining the current voxel corresponding to the current intersection position; judging whether the current voxel is visible, if so, performing the following step 2, if not, performing the following step 3; Step 2, determining whether the current game scene is the first game scene; if so, determining the current voxel as the target voxel; if not, subtracting one from the level number of the current game scene, and continuing to execute step 1; Step 3, calculating the travel step length of the light path in the current game scene, updating the light path according to the travel step length, and continuing to execute step 1 until the total travel step length of the light path is greater than a preset threshold, and determining that there are no target voxels where the light path intersects the first game scene.

6. The method according to claim 5, wherein The step of determining that there are no target voxels where the light path intersects the first game scene when the total travel step length of the light path is greater than the preset threshold includes: If the total travel step length of the light path is greater than the preset threshold corresponding to the current game scene, determining the target level of the current game scene; if the target level is the highest level, determining that there are no target voxels where the light path intersects the first game scene. If the target level is not the highest level, increment the level number of the current game scene by one, and continue to execute step 1 until the total step length of the light ray path is greater than the target preset threshold, and determine that there is no target voxel intersecting the light ray path and the first game scene.

7. The method according to claim 6, characterized in that, The preset threshold corresponding to the game scene of the highest level is the same as the target preset threshold; the method further includes: Based on the resolution of the voxels in the game scene of the upper level of the specified game scene, determine the preset threshold corresponding to the specified game scene other than the highest level.

8. The method according to claim 5 or 6, characterized in that, After the step of determining that there is no target voxel intersecting the light ray path and the first game scene, the method further includes: Based on the preset sky sphere and the light path, determine the lighting information and material information of the current voxel.

9. The method according to claim 2, wherein The first resolution is a*b*c, and the resolution of the voxels of the game scenes at different levels is where lev is the level value of the game scene, n is a preset multiple, and a, b, and c respectively represent the number of voxels of the game scene in the X, Y, and Z axes of the three-dimensional space.

10. The method according to claim 5, wherein The step of determining the current voxel corresponding to the current intersection position includes: curvoxelSize = n lev × baseVoxelSize; Where curVoxelID is the voxel coordinate of the current voxel, p is the current intersection position, floor is the floor function, curvoxelSize is the voxel size of the current game scene, baseVoxelSize is the voxel size of the first game scene, and lev is the level value.

11. The method according to claim 5, characterized in that, The step of determining whether the current voxel is visible includes: Obtain the visibility information stored in the current voxel, and determine whether the current voxel is visible according to the visibility information.

12. The method according to claim 5, characterized in that, The step of calculating the step length of the light ray path in the current game scene includes: t = min(t v,x , t v,y , t v,z ); t v = (p0 - p) / dir; p0 = (curVoxelID + floorOffset) × curvoxelSize; Where t is the step length of the light ray path in the current game scene, p is the current intersection position, dir is the traveling direction of the light ray, curVoxelID is the voxel coordinate of the current voxel, currvoxelSize is the voxel size of the current game scene, floorOffset represents the positive or negative of the component of the light ray path on the specified axis, floorOffset = 0 represents the negative of the component of the traveling direction on the specified axis, and floorOffset = 1 represents the positive of the component of the traveling direction on the specified axis.

13. The method according to claim 5, characterized in that The step of determining the current intersection position of the light ray path and the current game scene includes: p new = p + t * dir; where p new is the current intersection position, p is the previously determined current intersection position, t is the step length of the ray path, and dir is the propagation direction of the ray.

14. The method according to claim 1, wherein The method further includes: Based on the character position of the virtual character in the target game scene, determine the target scene area; wherein, the virtual character is always located at the center of the area of the target scene area, and in the target scene area, the higher the resolution of the voxels of the game scene corresponding to the scene area closer to the virtual character.

15. A rendering device for lighting effects in a game, characterized in that, The device includes: A generation module for generating a first game scene and a second game scene according to the game scene of a target game; wherein, the first game scene is composed of voxels with a first resolution, the second game scene is composed of voxels with a second resolution, the voxels with the first resolution are used to store the visibility information of the voxels in the game scene, the voxels with the second resolution are used to store the material information and lighting information of the voxels in the game scene, and the first resolution is greater than the second resolution; A synchronization module for, in response to a game running instruction of the target game, displaying the target game scene in the game scene on a graphical user interface, and synchronizing the light path in the target game scene to the first game scene in real time; A determination module for determining a target voxel at which the light path intersects the first game scene; A rendering module for determining the lighting information and material information of the target voxel from the second game scene according to the voxel coordinates of the target voxel, and performing lighting rendering on the target game scene based on the lighting information and the material information.

16. An electronic device, characterized in that, It includes a processor and a memory, the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the method for rendering the lighting effect in the game according to any one of claims 1-14.

17. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer executable instructions, and when the computer executable instructions are called and executed by a processor, the computer executable instructions cause the processor to implement the method for rendering the lighting effect in the game according to any one of claims 1-14.