Terrain rendering method and device, electronic equipment and storage medium

By dividing the cubic space in the three-dimensional virtual environment and calculating the directional distance field value, the grid information of the multi-layer spatial structure is generated, and the GPU is used for parallel computing, which solves the problem of insufficient terrain rendering performance in the existing technology and realizes a variety of Terrain representation and efficient rendering performance.

CN118807199APending Publication Date: 2024-10-22NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410760489.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-12
Publication Date
2024-10-22

AI Technical Summary

Technical Problem

Existing terrain rendering methods rely on static grid information in three-dimensional virtual environments, resulting in a single terrain representation and insufficient CPU computing performance, which cannot meet the needs of complex terrain rendering, especially in open world games, resulting in low rendering performance.

Method used

By dividing the three-dimensional space of the virtual world into multiple cubic spaces, calculating the directional distance field value of each cubic space, generating grid information of a multi-layer spatial structure, and using the GPU to perform parallel operations, efficient rendering of the terrain is achieved.

Benefits of technology

It improves terrain rendering performance, can express various terrain effects, overcomes the problem of insufficient CPU performance when calculating grid information, supports efficient rendering of complex terrain and large world maps, and maintains high frame rates and low memory consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118807199A_ABST
    Figure CN118807199A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, and provides a terrain rendering method and device, electronic equipment and a storage medium. The method comprises the steps that a three-dimensional space of a virtual world is divided into a plurality of blocks, and each block comprises a plurality of cubic spaces; generating a three-dimensional directed distance field value table corresponding to each target block in the plurality of blocks through a first shader; wherein the target block is a corresponding block in the terrain area to be rendered; generating grid information corresponding to each target block based on the three-dimensional directed distance field value table corresponding to each target block through a second shader; and rendering based on the grid information corresponding to all the target blocks to obtain a terrain effect. According to the method, various terrain effects can be represented, parallel computation of a graphics processing unit (GPU) is realized, the problem that performance cannot meet requirements when grid information is calculated by adopting the CPU is solved, and the terrain rendering performance is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a terrain rendering method, device, electronic device and storage medium. Background Art

[0002] In games based on three-dimensional virtual environments, terrain rendering is required to achieve some terrain effects. In existing terrain rendering methods, different materials are often used to render pre-generated grid information representing the ups and downs of the terrain surface to ultimately display terrains of various landforms. Since the grid information directly represents height information and is a static grid, the terrain effect displayed is single, and there is a problem that the performance of using the CPU to calculate the grid information cannot meet the requirements, resulting in low terrain rendering performance. Summary of the invention

[0003] In view of this, the purpose of the present disclosure is to provide a terrain rendering method, device, electronic device and storage medium, which divides the three-dimensional space of the virtual world into multiple cubic spaces and calculates the signed distance field values ​​of each vertex of these cubic spaces, thereby generating grid information of a multi-layer spatial structure, which can express various terrain effects and realize parallel computing of a graphics processing unit (GPU), overcomes the problem that the performance cannot meet the requirements when using a CPU to calculate grid information, and greatly improves the rendering performance of the terrain.

[0004] In a first aspect, an embodiment of the present disclosure provides a terrain rendering method, the terrain rendering method comprising:

[0005] Dividing the three-dimensional space of the virtual world into a plurality of blocks, wherein each block includes a plurality of cubic spaces;

[0006] Generate a three-dimensional directed distance field value table corresponding to each target block in the plurality of blocks by using a first shader; wherein the target block is one of the corresponding blocks in the terrain area to be rendered;

[0007] Generate mesh information corresponding to each target block based on the three-dimensional directed distance field value table corresponding to each target block through a second shader;

[0008] Rendering is performed based on the grid information corresponding to all target blocks to obtain the terrain effect.

[0009] In a second aspect, an embodiment of the present disclosure provides a terrain rendering device, the terrain rendering device comprising:

[0010] A division module, used for dividing the three-dimensional space of the virtual world into a plurality of blocks, wherein each block includes a plurality of cubic spaces;

[0011] A first generating module, configured to generate a three-dimensional directed distance field value table corresponding to each target block in the plurality of blocks by using a first shader; wherein the target block is one of the corresponding blocks in the terrain area to be rendered;

[0012] A second generating module, configured to generate mesh information corresponding to each target block based on a three-dimensional directed distance field value table corresponding to each target block through a second shader;

[0013] The first rendering module is used to render based on the grid information corresponding to all target blocks to obtain a terrain effect.

[0014] In a third aspect, an embodiment of the present disclosure provides an electronic device, including a processor and a memory, wherein 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 terrain rendering method.

[0015] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above-mentioned terrain rendering method.

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

[0017] The terrain rendering method, device, electronic device and storage medium divide the three-dimensional space of the virtual world into multiple blocks, wherein each block includes multiple cubic spaces; a three-dimensional signed distance field value table corresponding to each target block in the multiple blocks is generated by a first shader; wherein the target block is one of the corresponding blocks in the terrain area to be rendered; a second shader is used to generate grid information corresponding to each target block based on the three-dimensional signed distance field value table corresponding to each target block; and the terrain effect is obtained by rendering based on the grid information corresponding to all target blocks. In this method, by dividing the three-dimensional space of the virtual world into multiple cubic spaces and calculating the signed distance field values ​​of each vertex of these cubic spaces, grid information of a multi-layer spatial structure is generated, which can express a variety of terrain effects, realize the parallel operation of the graphics processing unit (GPU), overcome the problem that the performance cannot meet the requirements when the CPU is used to calculate the grid information, and greatly improve the rendering performance of the terrain.

[0018] Other features and advantages of the present disclosure will be described in the following description, and partly become apparent from the description, or understood by practicing the present disclosure. The purpose and other advantages of the present disclosure are realized and obtained by the structures particularly pointed out in the description, claims and drawings.

[0019] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the specific embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.

[0021] Figure 1 A schematic diagram of an embodiment of a terrain rendering method provided by an embodiment of the present disclosure;

[0022] Figure 2 A schematic diagram of an embodiment of a target terrain effect provided by an embodiment of the present disclosure;

[0023] Figure 3 A schematic diagram of a terrain rendering device provided in an embodiment of the present disclosure;

[0024] Figure 4 A schematic diagram of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0025] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.

[0026] In games based on three-dimensional virtual environments, terrain rendering is required to achieve some terrain effects. In existing terrain rendering methods, mesh patches are often generated through height fields. Therefore, their performance effect is single and can only show the ups and downs of the terrain. When rendering complex multi-layer structure terrains such as caves or empty islands, it is necessary to pre-generate separate static mesh information representing the ups and downs of the terrain surface, and render the static mesh information multiple times through different materials to finally display various terrains. This technology limits the gameplay and scene effects. In addition, because it is a static mesh, the mesh information directly represents the height information, and because it is a static mesh, the terrain cannot be changed in real time through player interaction. The gameplay is relatively single and lacks freedom. Therefore, the terrain effect is single, and there is a problem that the performance cannot meet the requirements when the CPU is used to calculate the mesh information, resulting in low terrain rendering performance. With the popularity of open world gameplay, the memory and rendering time caused by the increase in map size have also increased dramatically. Maintaining a high frame rate and low memory consumption in the big world to improve the player's gaming experience is also an urgent problem to be solved.

[0027] Based on this, the embodiments of the present disclosure provide a terrain rendering method, device, electronic device and storage medium, which can be applied to terrain rendering scenarios in any application, such as terrain rendering in maps, especially terrain rendering scenarios in games.

[0028] In one embodiment of the present disclosure, the terrain rendering method can be run on a terminal device or a server. The terminal device can be a local terminal device. When the terrain rendering method is run on a server, the method can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and a client device.

[0029] For ease of understanding, the specific process of the embodiment of the present disclosure is described below. Figure 1 An embodiment of the terrain rendering method in the present disclosure includes the following steps:

[0030] Step 101, dividing the three-dimensional space of the virtual world into a plurality of blocks, wherein each block includes a plurality of cubic spaces;

[0031] The three-dimensional space of the above-mentioned virtual world can be understood as the three-dimensional space of a specific simulated environment, for example, the spatial area of ​​the game world in an open world game; the three-dimensional space of the above-mentioned virtual world can also be understood as the three-dimensional space of a simulated environment that requires terrain rendering (or contains terrain features), for example, the three-dimensional space of a simulated environment including terrain features such as mountains, rivers, and forests.

[0032] As an example but not limitation, the three-dimensional space of the virtual world is gridded on a two-dimensional plane according to a preset division size to obtain a plurality of divided areas, wherein the preset division size may be the size of each divided area (block), that is, the size of each block is the preset division size, for example, the size of each block is N*M; each of the plurality of divided areas is divided into a plurality of cubic spaces to obtain a plurality of divided areas; the plurality of divided areas are determined as a plurality of blocks, each block containing a plurality of cubic spaces, which may be understood as voxels.

[0033] Among them, each block can be regarded as a two-dimensional area, and the length and width of each block are both powers of 2, which can achieve memory alignment, improve access efficiency and reduce memory waste, and can improve computing efficiency.

[0034] Step 102, generating a three-dimensional directed distance field value table corresponding to each target block in a plurality of blocks by a first shader; wherein the target block is one of the corresponding blocks in the terrain area to be rendered;

[0035] The three-dimensional signed distance field value table corresponding to each target block includes the signed distance field value corresponding to each cube space vertex; the signed distance field value corresponding to each cube space vertex refers to the signed distance of each cube space vertex relative to a specified surface (the signed distance includes but is not limited to a distance value and direction information), and the specified surface may be the cube space itself, an implicit surface inside the block, or other surfaces outside the block, which are not limited here; the signed distance field value corresponding to each cube space vertex includes but is not limited to distance information and direction information, the distance information is used to indicate the distance value of each cube space vertex relative to the specified surface, and the direction information is used to indicate the direction information of the position of each cube space vertex relative to the cube space surface.

[0036] As an example but not limitation, multiple blocks are screened to obtain multiple target blocks, wherein the multiple blocks can be screened based on the size of the cubic space in the block to obtain the multiple target blocks; the signed distance field value corresponding to each cubic space in each target block is calculated by a first shader, wherein the signed distance field value includes a distance value and a direction of the distance field; the signed distance field value corresponding to each cubic space in each target block is saved in a preset data structure by the first shader to obtain a three-dimensional signed distance field value table corresponding to each target block.

[0037] Generating a three-dimensional directed distance field value table corresponding to each target block through the first shader is conducive to real-time generation and real-time adjustment of grid information of each target block, helps to generate grid information of multi-layer spatial structure, and helps to realize complex multi-layer structure terrain.

[0038] Step 103, generating mesh information corresponding to each target block based on the three-dimensional signed distance field value table corresponding to each target block through a second shader;

[0039] The grid information corresponding to each target block includes but is not limited to the position, size, shape, and any attributes or features related to the grid. The grid position is used to indicate the coordinates in the virtual world, and the grid content is used to indicate the list of game objects stored in the grid. The grid information corresponding to each target block is a multi-layer spatial structure, and each layer represents spatial information of different granularity.

[0040] As an example but not limitation, the mesh information corresponding to each target block is generated by the second shader based on the MarchingCube algorithm and the three-dimensional signed distance field value table corresponding to each target block.

[0041] As an example but not limitation, the isosurface and the corresponding position and direction of the isosurface are obtained from the three-dimensional signed distance field value table corresponding to each target block by the second shader, wherein the isosurface can be generally understood as the surface of an object, the isosurface is a curved surface connected by all points with the same specified signed distance field value, and the isosurface is a surface with specific attributes from the three-dimensional volume data, for example, a curved surface with a signed distance field SDF value of zero; at least one polygon is generated by the second shader based on the three-dimensional signed distance field value table corresponding to each target block, the isosurface and the corresponding position and direction of the isosurface; at least one polygon is smoothed, and the at least one smoothed polygon is converted into a standard mesh file format to obtain the mesh information corresponding to each target block. The mesh information generated according to the isosurface can be processed in parallel by the GPU, thereby improving the rendering efficiency of the super large world terrain generation.

[0042] In the big world gameplay, as the size of the terrain increases, the calculation of grid information will become a bottleneck. At the same time, the GPU is used to calculate all target block sections in parallel, overcoming the problem that the performance of using the CPU to calculate grid information cannot meet the demand, greatly improving the rendering performance.

[0043] Step 104, rendering is performed based on the grid information corresponding to all target blocks to obtain a terrain effect.

[0044] As an example but not limitation, after obtaining the mesh information corresponding to all target blocks, the mesh information is converted into the format required by the rendering engine to obtain the converted data, which includes but is not limited to vertex data, normal data and texture coordinates, and appropriate shading and material attributes are set for each mesh in the converted data, which can be processed based on the set mesh data by vertex shader and fragment shader to obtain rendered image data, that is, terrain effect. Among them, in the vertex shader, further processing can be performed based on the position and normal vector information of the vertices in the mesh information, for example, the lighting effect can be calculated based on the normal vector information, or some transformation operations can be performed on the vertices; or, in the fragment shader, the color, texture and other attributes are calculated, as well as other processing related to mesh display.

[0045] It should be noted that the entire terrain rendering process (i.e., the execution process of steps 101-104) is completely completed by GPU driver, which fully utilizes GPU parallelism to generate complex mesh information and has extremely high performance and effect performance.

[0046] The above method divides the three-dimensional space of the virtual world into multiple cubic spaces and calculates the signed distance field values ​​of each vertex of these cubic spaces, thereby generating grid information of a multi-layer spatial structure, which can express various terrain effects and realize the parallel computing of the graphics processing unit (GPU). It overcomes the problem that the performance of using the CPU to calculate the grid information cannot meet the requirements and greatly improves the rendering performance of the terrain.

[0047] In one implementation, the sizes of the cubic spaces in each block are the same, and the sizes of the cubic spaces between the blocks in the plurality of blocks are different.

[0048] By making the sizes of the cube spaces in the same block the same and the sizes of the cube spaces between different blocks different, it is possible to adapt a cube space of appropriate size to each block, thereby improving processing efficiency and processing performance, and achieving effective allocation and management of resources.

[0049] For example, block A includes cube space 1 and cube space 2, block B includes cube space 3, cube space 4 and each cube space 5, the size of cube space 1 is the same as the size of cube space 2, the size of cube space 3, cube space 4 and each cube space 5 is the same, but the size of cube space 1 is different from the size of cube space 3.

[0050] As an example but not a limitation, the three-dimensional space of the virtual world is divided into multiple blocks of the same size; the distance between each block and the field of view is determined; the cubic space division parameter corresponding to each block is determined according to the distance between each block and the field of view, wherein the cubic space division parameter can be the total number of divided cubic spaces and / or the size of each cubic space after division, and the cubic space division parameters between blocks are different; the corresponding blocks are divided into cubic spaces according to the cubic space division parameters corresponding to each block. The level of detail can be dynamically adjusted and the invisible parts can be effectively eliminated, thereby improving rendering efficiency.

[0051] As an example but not a limitation, when determining the distance between each block and the field of view position, the camera position (i.e., field of view position) and the position of each block can be obtained, wherein the camera position is represented by the position vector of the camera, and the position of each block is the center point position of each block; based on the camera position and the position of each block, the distance is calculated to obtain the distance between each block and the field of view position, wherein the calculation can be performed using the Euclidean distance formula. By determining the distance between each block and the field of view position based on the center point position of each block and the camera position, the accuracy and reliability of the distance between each block and the field of view position are improved.

[0052] In one implementation, the closer a block among the multiple blocks is to the field of view, the smaller the cubic space constituting the block is.

[0053] In order to further reduce the memory requirements for rendering and maintain a high level of visual effects, the cubic space division of the block section adopts a method that changes with the field of view distance, which reduces the memory by about 1 / 3 compared with the previous method.

[0054] By changing the size of the cube space in the block with the field of view distance, it is beneficial to dynamically adjust the size of the cube space using the Level of Detail (LOD) method, which can reduce the number of actual cubes that need to be rendered while reducing memory. While ensuring the picture quality, it can reduce the detail rendering of distant objects, thereby improving rendering performance.

[0055] As an example but not limitation, the three-dimensional space of the virtual world is divided into multiple blocks of the same size; the distance between each block and the field of view position is determined; the distance level of each block is determined based on the distance between each block and the field of view position, wherein the distance level may include but is not limited to far distance, medium distance and near distance; the division parameter corresponding to each block is determined based on the distance level of each block, wherein the cube space division parameter may be the total number of divided cube spaces and / or the size of each cube space after division, the size of each cube space in the block is the same, the cube space division parameters between different blocks are different, the closer the distance to the field of view position, the larger the total number of cube spaces in the cube space division parameter and the smaller the size of each cube space in the cube space division parameter; cube space division is performed on each block based on the division parameter corresponding to each block.

[0056] By determining the size of each cubic space in each block based on the distance between each block and the field of view, the level of detail can be dynamically adjusted and the invisible parts can be effectively culled, thereby improving rendering efficiency and rendering performance.

[0057] In one implementation, when a three-dimensional signed distance field value table corresponding to each target block in a plurality of blocks is generated by a first shader, the plurality of blocks may be screened to obtain a plurality of target blocks; wherein the target blocks are blocks within a field of view; and the first shader is used to calculate the signed distance field values ​​of all cube space vertices in each target block to obtain a three-dimensional signed distance field value table corresponding to each target block.

[0058] Among them, as an example but not limitation, when multiple blocks are screened to obtain multiple target blocks, the multiple blocks can be screened according to the spatial position information of the blocks to obtain multiple target blocks, wherein the spatial position information includes but is not limited to the coordinates and bounding boxes of the blocks, and the multiple target blocks are blocks within a specific position range that require terrain rendering.

[0059] As an example but not limitation, multiple blocks may be screened according to the attributes of the blocks to obtain multiple target blocks, wherein the attributes include but are not limited to size, shape, color, and material.

[0060] The signed distance field values ​​of all cube space vertices in each target block are calculated by the first shader, and a three-dimensional signed distance field value table is generated based on the signed distance field values ​​of all cube space vertices (the signed distance field values ​​of all cube space vertices can be stored in a pre-created data structure), so as to obtain a three-dimensional signed distance field value table corresponding to each target block.

[0061] It should be noted that the calculation of the signed distance field value of each cube space vertex in each target block by the first shader is performed when the system or application is just running (for example, the game is just running). During the running process, when no interaction with the terrain occurs, the calculation of the signed distance field value of each cube space vertex in each target block is not performed. That is, for example, for all target blocks (sections) in the visible area, if the game is just running or the player interacts with the terrain in the target block (section), the first shader is used in the GPU to calculate the signed distance field values ​​of all cube vertices of the target block (section), and a three-dimensional signed distance field value table unique to the target block (section) is generated.

[0062] By screening multiple blocks and generating the corresponding three-dimensional directed distance field value table, fast and efficient real-time terrain rendering can be achieved, complex multi-layer structure terrain effects can be achieved, and the rendering performance of the terrain is greatly improved.

[0063] In one implementation, when multiple blocks are screened to obtain multiple target blocks, a viewing cone can be constructed; wherein the viewing cone is a three-dimensional geometric body used to represent the field of view of a camera; blocks outside the field of view among multiple blocks are determined through the viewing cone; blocks outside the field of view among multiple blocks are eliminated to obtain multiple target blocks.

[0064] The target block is the block within the field of view, that is, the block within the visible area.

[0065] Among them, as an example but not limitation, when constructing a viewing cone, the position and direction of the camera, as well as the information of the near clipping plane and the far clipping plane of the viewing cone are determined; the projection matrix and the view matrix are constructed by perspective projection or orthogonal projection; according to the position, direction, near clipping plane and far clipping plane information of the camera, the vertex information of the viewing cone is calculated, and the vertex information includes the information of the four vertices of the near clipping plane and the four vertices of the far clipping plane; the viewing cone is constructed by the vertex information of the viewing cone, the projection matrix and the view matrix.

[0066] As an example but not limitation, when determining a block outside the field of view among multiple blocks through a viewing cone, calculate a bounding box or a bounding volume of each block among the multiple blocks; obtain a viewing cone bounding volume corresponding to the viewing cone based on the projection matrix and the view matrix of the viewing cone; perform an intersection test on the bounding box or the bounding volume of each block with the viewing cone bounding volume to obtain a test result; determine the block outside the field of view among the multiple blocks based on the test result, specifically, if the test result indicates intersection, the corresponding block is within the field of view, and if the test result indicates non-intersection, the corresponding block is outside the field of view.

[0067] By culling blocks outside the field of view through the frustum, unnecessary rendering calculations are reduced, which helps to improve the overall resource utilization efficiency, reduce memory, and improve rendering performance.

[0068] In one implementation, after the signed distance field values ​​of all cube space vertices in each target block are calculated by the first shader to obtain a three-dimensional signed distance field value table corresponding to each target block, the specific cube space corresponding to each target block is also obtained; wherein the specific cube space is a cube space adjacent to the target block; and shading calculation is performed on the specific cube space corresponding to each target block to obtain target shading information of each specific cube space.

[0069] The above-mentioned specific cubic space can be understood as one more cubic space calculated for each target block in the direction adjacent to other blocks, that is, one cubic space near the boundary of each target block and in the direction adjacent to other blocks. The specific cubic space corresponding to each target block is the cubic space outside the target block; it can be generally understood as: near the boundary of each target block (section), a certain overlapping area or additional calculation space is left between other adjacent target blocks (sections). The specific cubic space corresponding to each target block can be the specific cubic space in each direction of each target block. The specific cubic space corresponding to each target block does not participate in the generation of mesh information, but only calculates normals, colors and other information.

[0070] Wherein, as an example but not limitation, when obtaining the specific cubic space corresponding to each target block, the direction in which each target block is adjacent to other target blocks can be determined, wherein the adjacent direction can be the up, down, left, right, front, and back directions; for each target block (section), in the direction adjacent to other target blocks (section), the bounding box of each target block is expanded to include an additional cubic space to obtain the expanded bounding box of each target block; the position and attributes of the additional cubic space are calculated according to the expanded bounding box of each target block to obtain the specific cubic space corresponding to each target block.

[0071] By obtaining the target shading information of the specific cubic space corresponding to the target block, it is ensured that there is enough overlap during rendering to avoid cracks or disconnections, and to avoid cracks or gaps during rendering, so as to ensure that the scene can be seamlessly connected during rendering, and the seam rendering errors caused by missing data information on the edges of the target blocks can be effectively solved.

[0072] In one implementation, when rendering is performed based on the grid information corresponding to all target blocks to obtain the terrain effect, rendering may be performed based on the grid information corresponding to all target blocks and the target shading information of each specific cubic space to obtain the terrain effect.

[0073] The mesh information corresponding to all target blocks and the target shading information of each specific cube space are merged to obtain merged information; the merged information is passed to the rendering pipeline; and the rendering pipeline is used to render based on the merged information and preset parameters required for rendering to obtain a terrain effect.

[0074] By combining the target shading information of each specific cube space for rendering, the rendering effect is improved and discontinuities are avoided, thus optimizing the rendering results and improving the user experience.

[0075] In one implementation, after rendering based on the grid information corresponding to all target blocks to obtain the terrain effect, the terrain can also be changed in real time according to the interactive operation. Specifically, in response to the terrain editing instruction, the parameters of the target terrain effect are determined; based on the parameters of the target terrain effect, the updated grid information corresponding to the target effect block is determined; wherein the target effect block is the target block corresponding to the target terrain effect; the physical collision information of all grids corresponding to the target terrain effect is calculated; based on the updated grid information, physical collision information and material attributes in the parameters of the target terrain effect, the target terrain effect is rendered to obtain the target terrain effect.

[0076] Among them, as an example but not limitation, the terrain editing instruction is an operation instruction for the target terrain effect, and the terrain editing instruction may be a digging instruction or a mountain building instruction or an operation instruction corresponding to other terrain effects; the parameters of the target terrain effect include the block position of the target terrain effect (referring to the position of the target block where the target terrain effect is located), world coordinates, radius size and material properties required to be expressed.

[0077] As an example but not limitation, when a terrain editing instruction is received, the first shader receives parameters corresponding to the target terrain effect, and the first shader and the second shader obtain updated mesh information corresponding to the target effect block based on the parameters corresponding to the target terrain effect; determine the volume shape used to represent the collision according to the terrain features and terrain shape of the target terrain effect; decompose all meshes corresponding to the target terrain effect for collision detection to obtain decomposed mesh objects; perform collision detection on each decomposed mesh object based on a preset collision detection algorithm (for example, a mesh-based collision detection algorithm, a volume-based collision detection algorithm) to obtain physical collision information, wherein the physical collision information includes but is not limited to collision points, normals and collision depths; store the physical collision information in a preset data structure; render based on the updated mesh information, the stored physical collision information and the material properties in the parameters of the target terrain effect to obtain the target terrain effect, so as to display the terrain effect corresponding to the interactive operation in real time.

[0078] By way of example and not limitation, the target terrain effect may be Figure 2 As shown, Figure 2 Shown is the effect of digging a hole.

[0079] Through the interaction of players on the map, coordinates and parameters of target terrain effects (e.g., digging holes) are transmitted, and the grid information of the target block (Section) corresponding to the target terrain effect is updated in real time in the GPU, and physical collision information is generated to achieve the purpose of real-time target terrain effects (e.g., digging holes). Players can use interactive functions to dig holes, build mountains, or perform other terrain editing operations in real time during the game to change the terrain, allowing players to freely create unique maps in the game. At the same time, in order to meet the needs of large world or open world gameplay, it can support terrain rendering in super large maps, and maintain rendering effects and efficient rendering performance.

[0080] It should be noted that the entire rendering process of the target terrain effect can be completed entirely through GPU driver, making full use of GPU parallelism to generate complex mesh information, with extremely high performance and effect performance.

[0081] By updating the grid information of the target block of the target terrain effect in real time to achieve interactive terrain effects, the terrain can be changed in real time, with a high degree of freedom in creating terrain structures, while still maintaining a high frame rate and low memory consumption, thereby improving rendering performance and efficiency and enhancing the user's gaming experience.

[0082] In one implementation, when determining updated mesh information corresponding to a target effect block based on parameters of a target terrain effect, all target cube spaces in a target special effect block corresponding to the target terrain effect may be determined; wherein the target cube space is a cube space within the range of the target terrain effect; a first shader is used to update the three-dimensional signed distance field values ​​of all target cube spaces in a three-dimensional signed distance field value table of the target special effect block based on the parameters of the target terrain effect to obtain an updated three-dimensional signed distance field value table; a second shader is used to update mesh information of the target effect block based on the updated three-dimensional signed distance field value table to obtain updated mesh information.

[0083] Wherein, as an example but not limitation, a new three-dimensional signed distance field value of all target cube spaces is generated by a first shader based on the parameters of the target terrain effect, and the three-dimensional signed distance field values ​​of all target cube spaces in the three-dimensional signed distance field value table of the target special effect block are replaced with the new three-dimensional signed distance field values ​​of all target cube spaces to obtain an updated three-dimensional signed distance field value table; new grid information is generated by a second shader based on the three-dimensional signed distance field values ​​in the updated three-dimensional signed distance field value table, and the grid information of the target special effect block is replaced with the new grid information to obtain the updated grid information.

[0084] As an example but not limitation, when determining all target cube spaces in a target special effects block corresponding to a target terrain effect, the target terrain space can be determined based on parameters of the target terrain effect (e.g., shape, position, size, etc.); a collision detection is performed on the target terrain space and each cube space in the target special effects block to obtain a collision detection result for each cube space; all target cube spaces in the target special effects block are determined based on the collision detection results for each cube space; specifically, if the collision detection result indicates an intersection, the corresponding cube space is determined as the target cube space; if the collision detection result indicates a non-intersection, a detection analysis of the next cube space is performed.

[0085] By using GPU parallel processing during interaction to change the signed distance field value of the corresponding cube space to generate or update the grid information of the multi-layer space structure, real-time dynamic adjustment of terrain is achieved, which helps to improve the rendering efficiency of the target terrain effect and has extremely high performance and effect performance.

[0086] Corresponding to the above method embodiment, see Figure 3 A schematic diagram of a terrain rendering device is shown, the device comprising:

[0087] A division module 301 is used to divide the three-dimensional space of the virtual world into a plurality of blocks, wherein each block includes a plurality of cubic spaces;

[0088] A first generating module 302 is used to generate a three-dimensional directed distance field value table corresponding to each target block in a plurality of blocks through a first shader; wherein the target block is one of the corresponding blocks in the terrain area to be rendered;

[0089] A second generating module 303 is used to generate mesh information corresponding to each target block based on the three-dimensional directed distance field value table corresponding to each target block through a second shader;

[0090] The first rendering module 304 is used to perform rendering based on the grid information corresponding to all target blocks to obtain a terrain effect.

[0091] The above-mentioned device divides the three-dimensional space of the virtual world into multiple cubic spaces and calculates the signed distance field values ​​of each vertex of these cubic spaces, thereby generating grid information of a multi-layer spatial structure, which can express various terrain effects and realize parallel computing of the graphics processing unit (GPU), thereby overcoming the problem that the performance of using the CPU to calculate grid information cannot meet the requirements and greatly improving the rendering performance of the terrain.

[0092] Optionally, the first generating module 302 may also be used for:

[0093] Screening multiple blocks to obtain multiple target blocks; wherein the target blocks are blocks within the field of view;

[0094] The signed distance field values ​​of all cube space vertices in each target block are calculated by the first shader to obtain a three-dimensional signed distance field value table corresponding to each target block.

[0095] Optionally, the first generating module 302 may also be used for:

[0096] Constructing a viewing cone; wherein the viewing cone is a three-dimensional geometric body used to represent the field of view of the camera;

[0097] Determine the blocks outside the field of view among the multiple blocks through the viewing cone;

[0098] Blocks outside the field of view are eliminated from the multiple blocks to obtain multiple target blocks.

[0099] Optionally, the first generating module 302 may also be used for:

[0100] Obtaining a specific cubic space corresponding to each target block; wherein the specific cubic space is a cubic space adjacent to the target block;

[0101] The shading calculation is performed on the specific cubic space corresponding to each target block to obtain the target shading information of each specific cubic space.

[0102] Optionally, the first rendering module 304 may also be used for:

[0103] Rendering is performed based on the grid information corresponding to all target blocks and the target shading information of each specific cube space to obtain the terrain effect.

[0104] Optionally, the sizes of the cubic spaces in each block are the same, and the sizes of the cubic spaces between the blocks in the multiple blocks are different.

[0105] Optionally, the closer a block among the multiple blocks is to the field of view, the smaller the cubic space constituting the block is.

[0106] Optionally, the terrain rendering device further includes:

[0107] A determination module 305, for determining parameters of a target terrain effect in response to a terrain editing instruction;

[0108] An updating module 306, configured to determine updated grid information corresponding to a target effect block based on parameters of a target terrain effect; wherein the target effect block is a target block corresponding to the target terrain effect;

[0109] A calculation module 307 is used to calculate the physical collision information of all grids corresponding to the target terrain effect;

[0110] The second rendering module 308 is used to perform rendering based on the updated mesh information, physical collision information and material attributes in the parameters of the target terrain effect to obtain the target terrain effect.

[0111] Optionally, the update module 306 may also be used to:

[0112] Determine all target cubic spaces in the target special effect block corresponding to the target terrain effect; wherein the target cubic space is the cubic space within the range of the target terrain effect;

[0113] The three-dimensional signed distance field values ​​of all target cube spaces in the three-dimensional signed distance field value table of the target special effect block are updated by the first shader based on the parameters of the target terrain effect to obtain an updated three-dimensional signed distance field value table;

[0114] The mesh information of the target effect block is updated by the second shader based on the updated three-dimensional signed distance field value table to obtain updated mesh information.

[0115] This embodiment also provides an electronic device, including a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the terrain rendering method. The electronic device can be a server or a terminal device.

[0116] See also Figure 4 As shown, the electronic device includes a processor 400 and a memory 401 . The memory 401 stores machine executable instructions that can be executed by the processor 400 . The processor 400 executes the machine executable instructions to implement the above terrain rendering method.

[0117] Further, Figure 4 The electronic device shown further includes a bus 402 and a communication interface 403 , and the processor 400 , the communication interface 403 and the memory 401 are connected via the bus 402 .

[0118] The memory 401 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 403 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 402 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0119] The processor 400 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 400. The above processor 400 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can 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 gates or transistor logic devices, discrete hardware components. The disclosed methods, steps and logic block diagrams in the embodiments of the present disclosure can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present disclosure can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature 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. The storage medium is located in the memory 401, and the processor 400 reads the information in the memory 401 and completes the following steps in combination with its hardware:

[0120] Dividing the three-dimensional space of the virtual world into a plurality of blocks, wherein each block includes a plurality of cubic spaces;

[0121] Generate a three-dimensional directed distance field value table corresponding to each target block in the plurality of blocks through a first shader; wherein the target block is one of the corresponding blocks in the terrain area to be rendered;

[0122] Generate mesh information corresponding to each target block based on the three-dimensional directed distance field value table corresponding to each target block through a second shader;

[0123] Rendering is performed based on the grid information corresponding to all target blocks to obtain the terrain effect.

[0124] The step of generating a three-dimensional signed distance field value table corresponding to each target block in the plurality of blocks by using the first shader includes:

[0125] Screening multiple blocks to obtain multiple target blocks; wherein the target blocks are blocks within the field of view;

[0126] The signed distance field values ​​of all cube space vertices in each target block are calculated by the first shader to obtain a three-dimensional signed distance field value table corresponding to each target block.

[0127] The above step of screening multiple blocks to obtain multiple target blocks includes:

[0128] Constructing a viewing cone; wherein the viewing cone is a three-dimensional geometric body used to represent the field of view of the camera;

[0129] Determine the blocks outside the field of view among the multiple blocks through the viewing cone;

[0130] Blocks outside the field of view are eliminated from the multiple blocks to obtain multiple target blocks.

[0131] After the above step of calculating the signed distance field values ​​of all cube space vertices in each target block by the first shader to obtain a three-dimensional signed distance field value table corresponding to each target block, the following step is further included:

[0132] Obtaining a specific cubic space corresponding to each target block; wherein the specific cubic space is a cubic space adjacent to the target block;

[0133] The shading calculation is performed on the specific cubic space corresponding to each target block to obtain the target shading information of each specific cubic space.

[0134] The above step of rendering based on the grid information corresponding to all target blocks to obtain the terrain effect includes:

[0135] Rendering is performed based on the grid information corresponding to all target blocks and the target shading information of each specific cube space to obtain the terrain effect.

[0136] The sizes of the cubic spaces in each of the above blocks are the same, and the sizes of the cubic spaces between the blocks in the multiple blocks are different.

[0137] The closer a block is to the field of view among the above-mentioned multiple blocks, the smaller the cubic space constituting the block is.

[0138] After the above step of rendering based on the grid information corresponding to all target blocks to obtain the terrain effect, the following steps are further included:

[0139] In response to the terrain editing instruction, determining parameters of the target terrain effect;

[0140] Determining updated grid information corresponding to a target effect block based on parameters of the target terrain effect; wherein the target effect block is a target block corresponding to the target terrain effect;

[0141] Calculate the physical collision information of all meshes corresponding to the target terrain effect;

[0142] Rendering is performed based on the updated mesh information, physical collision information, and material attributes in the parameters of the target terrain effect to obtain the target terrain effect.

[0143] The step of determining updated grid information corresponding to the target effect block based on the parameters of the target terrain effect includes:

[0144] Determine all target cubic spaces in the target special effect block corresponding to the target terrain effect; wherein the target cubic space is the cubic space within the range of the target terrain effect;

[0145] The three-dimensional signed distance field values ​​of all target cube spaces in the three-dimensional signed distance field value table of the target special effect block are updated by the first shader based on the parameters of the target terrain effect to obtain an updated three-dimensional signed distance field value table;

[0146] The mesh information of the target effect block is updated by the second shader based on the updated three-dimensional signed distance field value table to obtain updated mesh information.

[0147] The above method steps divide the three-dimensional space of the virtual world into multiple cubic spaces and calculate the signed distance field values ​​of each vertex of these cubic spaces, thereby generating grid information of a multi-layer spatial structure, which can express various terrain effects and realize the parallel computing of the graphics processing unit (GPU), thereby overcoming the problem that the performance of using the CPU to calculate the grid information cannot meet the requirements and greatly improving the rendering performance of the terrain.

[0148] This embodiment further provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the following steps of the terrain rendering method:

[0149] Dividing the three-dimensional space of the virtual world into a plurality of blocks, wherein each block includes a plurality of cubic spaces;

[0150] Generate a three-dimensional directed distance field value table corresponding to each target block in the plurality of blocks through a first shader; wherein the target block is one of the corresponding blocks in the terrain area to be rendered;

[0151] Generate mesh information corresponding to each target block based on the three-dimensional directed distance field value table corresponding to each target block through a second shader;

[0152] Rendering is performed based on the grid information corresponding to all target blocks to obtain the terrain effect.

[0153] The step of generating a three-dimensional signed distance field value table corresponding to each target block in the plurality of blocks by using the first shader includes:

[0154] Screening multiple blocks to obtain multiple target blocks; wherein the target blocks are blocks within the field of view;

[0155] The signed distance field values ​​of all cube space vertices in each target block are calculated by the first shader to obtain a three-dimensional signed distance field value table corresponding to each target block.

[0156] The above step of screening multiple blocks to obtain multiple target blocks includes:

[0157] Constructing a viewing cone; wherein the viewing cone is a three-dimensional geometric body used to represent the field of view of the camera;

[0158] Determine the blocks outside the field of view among the multiple blocks through the viewing cone;

[0159] Blocks outside the field of view are eliminated from the multiple blocks to obtain multiple target blocks.

[0160] After the above step of calculating the signed distance field values ​​of all cube space vertices in each target block by the first shader to obtain a three-dimensional signed distance field value table corresponding to each target block, the following step is further included:

[0161] Obtaining a specific cubic space corresponding to each target block; wherein the specific cubic space is a cubic space adjacent to the target block;

[0162] The shading calculation is performed on the specific cubic space corresponding to each target block to obtain the target shading information of each specific cubic space.

[0163] The above step of rendering based on the grid information corresponding to all target blocks to obtain the terrain effect includes:

[0164] Rendering is performed based on the grid information corresponding to all target blocks and the target shading information of each specific cube space to obtain the terrain effect.

[0165] The sizes of the cubic spaces in each of the above blocks are the same, and the sizes of the cubic spaces between the blocks in the multiple blocks are different.

[0166] The closer a block is to the field of view among the above-mentioned multiple blocks, the smaller the cubic space constituting the block is.

[0167] After the above step of rendering based on the grid information corresponding to all target blocks to obtain the terrain effect, the following steps are further included:

[0168] In response to the terrain editing instruction, determining parameters of the target terrain effect;

[0169] Determining updated grid information corresponding to a target effect block based on parameters of the target terrain effect; wherein the target effect block is a target block corresponding to the target terrain effect;

[0170] Calculate the physical collision information of all meshes corresponding to the target terrain effect;

[0171] Rendering is performed based on the updated mesh information, physical collision information, and material attributes in the parameters of the target terrain effect to obtain the target terrain effect.

[0172] The step of determining updated grid information corresponding to the target effect block based on the parameters of the target terrain effect includes:

[0173] Determine all target cubic spaces in the target special effect block corresponding to the target terrain effect; wherein the target cubic space is the cubic space within the range of the target terrain effect;

[0174] The three-dimensional signed distance field values ​​of all target cube spaces in the three-dimensional signed distance field value table of the target special effect block are updated by the first shader based on the parameters of the target terrain effect to obtain an updated three-dimensional signed distance field value table;

[0175] The mesh information of the target effect block is updated by the second shader based on the updated three-dimensional signed distance field value table to obtain updated mesh information.

[0176] The above method steps divide the three-dimensional space of the virtual world into multiple cubic spaces and calculate the signed distance field values ​​of each vertex of these cubic spaces, thereby generating grid information of a multi-layer spatial structure, which can express various terrain effects and realize the parallel computing of the graphics processing unit (GPU), thereby overcoming the problem that the performance of using the CPU to calculate the grid information cannot meet the requirements and greatly improving the rendering performance of the terrain.

[0177] The computer program product of the terrain rendering method, device, electronic device and storage medium provided in the embodiments of the present disclosure includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the previous method embodiments. The specific implementation can be found in the method embodiments, which will not be repeated here.

[0178] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0179] In addition, in the description of the embodiments of the present disclosure, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" 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 a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For those skilled in the art, the specific meanings of the above terms in the present disclosure can be understood according to specific circumstances.

[0180] If the functions are implemented in the form of software functional 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, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0181] In the description of the present disclosure, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are 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 cannot be understood as a limitation of the present disclosure. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.

[0182] Finally, it should be noted that the above embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above embodiments, those skilled in the art should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; 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 be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.

Claims

1. A terrain rendering method, characterized in that: The method comprises: Dividing the three-dimensional space of the virtual world into a plurality of blocks, wherein each block includes a plurality of cubic spaces; Generate a three-dimensional directed distance field value table corresponding to each target block in the plurality of blocks by using a first shader; wherein the target block is one of the corresponding blocks in the terrain area to be rendered; Generate mesh information corresponding to each target block based on the three-dimensional directed distance field value table corresponding to each target block through a second shader; Rendering is performed based on the grid information corresponding to all target blocks to obtain the terrain effect.

2. The method according to claim 1, characterized in that The step of generating a three-dimensional directed distance field value table corresponding to each target block in the plurality of blocks by using a first shader comprises: Screening the multiple blocks to obtain multiple target blocks; wherein the target blocks are blocks within the field of view; The signed distance field values ​​of all cube space vertices in each target block are calculated by the first shader to obtain a three-dimensional signed distance field value table corresponding to each target block.

3. The method according to claim 2, characterized in that The step of screening the multiple blocks to obtain multiple target blocks includes: Constructing a viewing cone; wherein the viewing cone is a three-dimensional geometric body used to represent the field of view of the camera; Determine, by using the viewing cone, a block among the plurality of blocks that is outside the field of view; Blocks outside the field of view of the multiple blocks are eliminated to obtain multiple target blocks.

4. The method according to claim 2, characterized in that: After the step of calculating the signed distance field values ​​of all cube space vertices in each target block by the first shader to obtain a three-dimensional signed distance field value table corresponding to each target block, the method further includes: Acquire a specific cubic space corresponding to each target block; wherein the specific cubic space is a cubic space adjacent to the target block; The shading calculation is performed on the specific cubic space corresponding to each target block to obtain the target shading information of each specific cubic space.

5. The method according to claim 4, characterized in that The step of rendering based on the grid information corresponding to all target blocks to obtain the terrain effect includes: Rendering is performed based on the grid information corresponding to all target blocks and the target shading information of each specific cube space to obtain the terrain effect.

6. The method according to claim 1, characterized in that The sizes of the cubic spaces in each block are the same, and the sizes of the cubic spaces between the blocks in the plurality of blocks are different.

7. The method according to claim 1, characterized in that The closer a block among the multiple blocks is to the field of view, the smaller the cubic space constituting the block is.

8. The method according to any one of claims 1 to 7, characterized in that: After the step of rendering based on the grid information corresponding to all target blocks to obtain the terrain effect, the method further includes: In response to the terrain editing instruction, determining parameters of the target terrain effect; Determining updated grid information corresponding to a target effect block based on the parameters of the target terrain effect; wherein the target effect block is a target block corresponding to the target terrain effect; Calculating physical collision information of all meshes corresponding to the target terrain effect; Rendering is performed based on the updated grid information, the physical collision information and the material attributes in the parameters of the target terrain effect to obtain the target terrain effect.

9. The method according to claim 8, characterized in that The step of determining updated grid information corresponding to the target effect block based on the parameters of the target terrain effect comprises: Determine all target cubic spaces in the target special effect block corresponding to the target terrain effect; wherein the target cubic space is a cubic space within the range of the target terrain effect; The three-dimensional signed distance field values ​​of all target cube spaces in the three-dimensional signed distance field value table of the target special effect block are updated by the first shader based on the parameters of the target terrain effect to obtain an updated three-dimensional signed distance field value table; The mesh information of the target effect block is updated by the second shader based on the updated three-dimensional signed distance field value table to obtain updated mesh information.

10. A terrain rendering device, characterized in that: The terrain rendering device comprises: A division module, used for dividing the three-dimensional space of the virtual world into a plurality of blocks, wherein each block includes a plurality of cubic spaces; A first generating module, configured to generate a three-dimensional directed distance field value table corresponding to each target block in the plurality of blocks by using a first shader; wherein the target block is one of the corresponding blocks in the terrain area to be rendered; A second generating module, configured to generate mesh information corresponding to each target block based on a three-dimensional directed distance field value table corresponding to each target block through a second shader; The first rendering module is used to render based on the grid information corresponding to all target blocks to obtain a terrain effect.

11. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the terrain rendering method according to any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the terrain rendering method according to any one of claims 1 to 9.