Virtual terrain generation method and system, electronic device and storage medium

By generating square in-situ models with different levels of detail on the inner surface and using seamless integration technology, the problem of high performance consumption in virtual terrain generation on mobile devices has been solved, achieving efficient terrain generation on mobile devices.

CN122347650APending Publication Date: 2026-07-07珠海剑心互动娱乐有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610346499.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-03-20
Publication Date
2026-07-07

AI Technical Summary

Technical Problem

When running virtual terrain generation on mobile devices, existing technologies consume too much performance, making it difficult to freely create terrain under the limitations of memory and CPU/GPU performance.

Method used

The system generates square in-situ models with different levels of detail on the inner surface. The central processing unit generates terrain height maps, target surface texture arrays, and void models. The graphics processing unit performs seamless model integration and texture rendering, reducing memory copy communication between the GPU and CPU and avoiding the use of AlphaTest technology.

Benefits of technology

By reducing the communication performance and memory consumption between the GPU and CPU, the performance consumption of virtual terrain generation is reduced, making it suitable for mobile devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122347650A_ABST
    Figure CN122347650A_ABST
Patent Text Reader

Abstract

The application discloses a virtual terrain landscape generation method and system, an electronic device and a storage medium, and relates to the technical field of computers. The method comprises the following steps: generating original block models with different inner surface detail levels; each original block model is square in shape, and the number of surfaces of the outermost layer is the same; the number of surfaces of the inner surfaces of the original block models with different inner surface detail levels is different; a central processing unit generates a terrain height map, a target ground map array, a target normal map array, a ground control map and a void model; a graphics processing unit performs seamless connection on the original block models with different inner surface detail levels according to the terrain height map to obtain a terrain model; a ground map is rendered according to the ground control map, the target ground map array and the target normal map array to obtain a ground map model; and the ground map model, the terrain model and the void model are combined to obtain a target virtual terrain landscape. The performance consumption can be reduced in the process of generating the virtual terrain landscape.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method and system for generating virtual terrain features, electronic devices, and storage media. Background Technology

[0002] In 3D open-world games, players can freely create terrain and landforms in their homes to enrich the game's freedom and simulate realistic home creation. However, due to memory limitations and the performance limitations of CPUs (Central Processing Units) and GPUs (Graphics Processing Units) on mobile devices, it is difficult to freely create terrain and landforms when running games on mobile devices. Currently, there are two methods for generating virtual terrain and landforms: the first is using virtual texture mapping technology, and the second is traditional terrain rendering methods. When using virtual texture mapping technology, two virtual textures are required: a surface virtual texture and a normal virtual texture. These need to be dynamically generated in the GPU. If operations are needed on the surface and normal virtual textures, a new virtual texture needs to be regenerated in the GPU after each operation, thus consuming a significant amount of performance. Furthermore, using virtual textures requires allocating a large amount of memory for performance gains, which can lead to insufficient memory on low-end devices. Traditional terrain rendering methods treat four terrain textures as a single DrawCall. A DrawCall is an operation where the CPU calls either the glDrawElements (a primitive rendering function in OpenGL) or DrawIndexedPrimitive (a vertex drawing method in DirectX) to instruct the GPU to render. When virtual homes contain diverse terrain types, this traditional rendering method results in a large number of DrawCalls and significant performance overhead. Furthermore, when digging holes to place elements in the dungeon, AlphaTest (transparency testing) is used, which is very resource-intensive on mobile devices. Calculating the Level of Detail (LOD) model of the terrain requires complex formulas to obtain the LOD model data for the current plot, leading to substantial performance consumption. Therefore, reducing performance overhead during virtual terrain generation is a pressing technical problem. Summary of the Invention

[0003] This application aims to address at least one of the technical problems existing in the prior art. To this end, this application proposes a virtual terrain generation method and system, electronic device, and storage medium that can reduce performance consumption during the virtual terrain generation process.

[0004] In a first aspect, embodiments of this application provide a virtual terrain generation method, applied to a virtual terrain generation system, the system comprising: a central processing unit and a graphics processing unit; the method comprising: Generate original plot models with different levels of inner surface detail; wherein each of the original plot models is square and the number of faces in the outermost layer is the same; the richness of the number of faces in the inner surfaces of the original plot models with different levels of inner surface detail is different; The central processing unit generates a terrain height map, a target surface texture array, a target normal texture array, a surface control map, and a void model; The graphics processor performs seamless model integration processing based on the terrain height map and the original plot models with different levels of inner surface detail to obtain a terrain model; The graphics processor performs texture rendering processing based on the surface control map, the target surface texture array, and the target normal texture array to obtain a surface texture model; The graphics processor performs model combination processing based on the surface texture model, the terrain model, and the void model to obtain the target virtual terrain.

[0005] Secondly, embodiments of this application provide a virtual terrain generation system, including: a central processing unit and a graphics processing unit; the central processing unit and the graphics processing unit cooperate to implement the virtual terrain generation method as described in any one of the embodiments of the first aspect.

[0006] Thirdly, an electronic device according to an embodiment of this application includes at least one processor and a memory for communicatively connecting to the at least one processor; the memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enable the at least one processor to perform a virtual terrain generation method as described in any of the embodiments of the first aspect.

[0007] Fourthly, according to an embodiment of this application, a computer-readable storage medium stores computer-executable instructions for causing a computer to perform the virtual terrain generation method as described in any of the embodiments of the first aspect.

[0008] This application embodiment includes: a virtual terrain generation system comprising a central processing unit (CPU) and a graphics processing unit (GPU); in the process of generating virtual terrain using the virtual terrain generation system, firstly, original landmass models with different levels of inner surface detail are generated; wherein, each of the original landmass models is square, and the number of faces in the outermost layer is the same; the richness of the number of faces in the inner surfaces of the original landmass models with different levels of inner surface detail varies; secondly, the CPU generates a terrain height map, a target surface texture array, a target normal texture array, a surface control map, and a void model; the terrain height map, the target surface texture array, the target normal texture array, and the surface control map are all freely created in the CPU, unaffected by the performance of continuous memory copy communication between the GPU and CPU, and also reducing the communication performance consumption between the GPU and CPU; The use of AlphaTest technology to generate a void model reduces memory consumption. Next, the graphics processor seamlessly integrates the terrain height map and the original landmass models with different levels of inner surface detail to obtain a terrain model. By seamlessly integrating original landmass models with different levels of inner surface detail, a higher level of inner surface detail is used in visually important areas, while a lower level is used in non-visually important areas, thus reducing performance consumption. Then, the graphics processor performs texture rendering based on the surface control map, the target surface texture array, and the target normal texture array to obtain a surface texture model. Finally, the graphics processor combines the surface texture model, the terrain model, and the void model to obtain the target virtual terrain. In other words, this application can reduce performance consumption during the virtual terrain generation process. Attached Figure Description

[0009] Figure 1 This is a schematic diagram of the system architecture of a virtual terrain generation system provided in one embodiment of this application; Figure 2 This is a flowchart illustrating a virtual terrain generation method provided in one embodiment of this application; Figure 3 This is a schematic diagram of the original site model provided in one embodiment of this application; Figure 4 This is a schematic diagram of the original site model provided in another embodiment of this application; Figure 5 This is a schematic diagram illustrating the seamless connection of three original plot models with different levels of inner surface detail, provided in one embodiment of this application. Figure 6 This is a schematic diagram of a shape map provided in one embodiment of this application; Figure 7 This is a schematic diagram of the initial model to be processed used in the leakage processing provided in one embodiment of this application; Figure 8 This is a schematic diagram of a leak-through process provided in one embodiment of this application; Figure 9 This application provides a schematic diagram of information transmission in a virtual terrain generation system according to one embodiment. Figure 10 This is a schematic diagram of the hardware structure of an electronic device provided in one embodiment of this application. Detailed Implementation

[0010] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments.

[0011] It should be noted that although a logical order is shown in the flowcharts in this application, in some cases, the steps shown or described may be performed in a different order than that shown in the flowcharts. In the description of this application, "several" means one or more, and "more" means two or more. The terms "first" and "second" are used only to distinguish technical features and should not be construed as indicating or implying relative importance, or implicitly indicating the number of technical features indicated, or implicitly indicating the order in which the technical features are indicated.

[0012] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.

[0013] First, let me explain some of the terms used in this application: AlphaTest technology, often translated as "transparency test" or "Alpha test," is a simple and efficient technique used during rendering to determine whether to discard (not draw) a pixel based on its alpha channel value (i.e., transparency value).

[0014] CPU: Central Processing Unit.

[0015] GPU: Graphics Processing Unit.

[0016] LOD stands for Level of Detail, a core technology used in computer graphics, especially in real-time rendering (such as games, simulations, and 3D GIS), to optimize performance and manage resources.

[0017] This application provides a method, system, electronic device, and computer-readable storage medium for generating virtual terrain and landforms, relating to the field of computer technology. The method includes generating original landform models with different levels of inner surface detail; each original landform model is square and has the same number of faces on its outermost layer; the richness of face detail on the inner surfaces of the original landform models with different levels of inner surface detail varies; the central processing unit generates a terrain height map, a target surface texture array, a target normal texture array, a surface control map, and a void model; the graphics processing unit seamlessly connects the terrain height map and the original landform models with different levels of inner surface detail to obtain a terrain model; texture rendering is performed based on the surface control map, the target surface texture array, and the target normal texture array to obtain a surface texture model; and the surface texture model, terrain model, and void model are combined to obtain the target virtual terrain and landforms. This method can reduce performance consumption during the virtual terrain and landform generation process.

[0018] The embodiments of this application will be further described below with reference to the accompanying drawings.

[0019] like Figure 1 As shown, the virtual terrain generation system 100 provided in this application embodiment includes: a central processing unit 110, a graphics processing unit 120, a memory unit 130, a video memory unit 140, and an interactive display unit 150; the memory unit 130 is electrically connected to the central processing unit 110, and the video memory unit 140 is electrically connected to the graphics processing unit 120. The interactive display unit 150 is electrically connected to both the central processing unit 110 and the graphics processing unit 120.

[0020] The central processing unit 110 is used to: generate original block models with different levels of detail on the inner surface, generate terrain height maps, target surface texture arrays, target normal texture arrays, surface control maps, and void models.

[0021] The graphics processor 120 is used for: seamlessly connecting models based on terrain height maps and original block models with different levels of detail to obtain a terrain model; performing texture rendering based on surface control maps, target surface texture arrays, and target normal texture arrays to obtain a surface texture model; and combining the surface texture model, terrain model, and void model to obtain the target virtual terrain.

[0022] Memory unit 130 is used to store data such as the original plot model, generated terrain height map, target surface texture array, target normal texture array, and surface control map.

[0023] The video memory unit 140 is used to back up and store data such as generated terrain height maps, target surface texture arrays, target normal texture arrays, and surface control maps.

[0024] The interactive display unit 150 is used to: provide an operation interface for the user to input a series of operation commands through the operation interface, and to display the final created target virtual terrain.

[0025] The memory unit 130 and the central processing unit 110 work together to implement the virtual terrain generation method provided in this application embodiment, which can reduce performance consumption during the virtual terrain generation process.

[0026] Those skilled in the art will understand that the system structure shown in the figures does not constitute a limitation on the embodiments of this application, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0027] The system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0028] It will be understood by those skilled in the art that the system architecture and application scenarios described in the embodiments of this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided in the embodiments of this application. It is known by those skilled in the art that with the evolution of system architecture and the emergence of new application scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.

[0029] Based on the above system structure, various embodiments of the virtual terrain generation method of this application are proposed below.

[0030] like Figure 2 As shown, this virtual terrain generation method can be applied to, for example... Figure 1 The virtual terrain generation system shown includes a central processing unit and a graphics processing unit; the virtual terrain generation method may include, but is not limited to, steps S100 to S500.

[0031] Step S100: Generate original plot models with different levels of inner surface detail; wherein, each original plot model is square and the number of faces in the outermost layer is the same; the richness of the number of faces in the inner surfaces of original plot models with different levels of inner surface detail is different.

[0032] In this step, the original site model is a pre-generated, offline model with varying levels of detail. Because original site models with different levels of inner detail share the same shape (all squares) and the same number of faces in their outermost layer, this ensures that when multiple original site models with different levels of inner detail are at different heights and at different levels, they can automatically merge and achieve seamless connection. Thus, the terrain of each block can be seamlessly connected without requiring highly complex calculations at different or equal distances.

[0033] Specifically, in the embodiments of this application, the two original plot models with different levels of inner surface detail are respectively as follows: Figure 3 and Figure 4 As shown, it can be seen Figure 3 and Figure 4 The outermost layer of the two original plot models has the same number of faces, but the richness of face detail on the inner layers differs. It should be noted that, as... Figure 3 and Figure 4 The original site model shown is only an example; there are other original site models with different levels of internal detail, which are not listed here.

[0034] Step S200: The central processing unit generates a terrain height map, a target surface texture array, a target normal texture array, a surface control map, and a void model.

[0035] It should be noted that in this step, the terrain height map, target surface texture array, target normal map array, and surface control map are all created freely in the central processing unit, which is not affected by the performance of continuous memory copy communication between the GPU and CPU, and also reduces the performance consumption of communication between the GPU and CPU.

[0036] According to some embodiments of this application, step S200 is further described. Step S200: The central processing unit generates a terrain height map, a target surface texture array, a target normal texture array, a surface control map, and a void model, including but not limited to steps S210 to S240.

[0037] Step S210: In response to the first brush command input by the user, perform height map generation processing to obtain a terrain height map.

[0038] Specifically, according to some embodiments of this application, the height map generation process includes, but is not limited to, steps S211 to S213.

[0039] Step S211: Generate shape map data in response to the first brush command.

[0040] Step S212: Read the shape texture data into memory, convert the RGB format shape texture data to grayscale, and obtain a grayscale image.

[0041] Step S213: Generate different elevation differences based on different gray values ​​to form a terrain elevation map.

[0042] Specifically, in step S211, the first brush instruction is generated by the user performing a brush operation on the operation interface provided by the interactive display unit. The specific operation is: brushing the terrain height. The specific brush operation is: using a shape image or a regular image to freely control the shape of the terrain's undulations. Existing brush-related algorithms are used to generate shape texture data, and this application does not impose specific limitations on this.

[0043] Specifically, in step S212, the shape texture data is in RGB format. Specifically, the shape texture is as follows: Figure 6 As shown.

[0044] Steps S211 to S213 involve reading the RGB format shape map data into memory, converting it into a grayscale image containing different grayscale values, and finally generating a terrain height map in step S213. This allows the graphics processor to process the terrain based on the height map to obtain a terrain model.

[0045] Step S220: In response to the array operation command input by the user, perform operations on the array object to be processed to obtain the target array object; wherein, the array object to be processed includes the current surface texture array and the current normal texture array; the target array object includes: the target surface texture array and the target normal texture array.

[0046] Specifically, the current surface map array includes multiple first index values, with different first index values ​​used to indicate different surface maps; the current normal map array includes multiple second index values, with different second index values ​​used to indicate different surface normals.

[0047] According to some embodiments of this application, step S220 is further described. Step S220: In response to the array operation instruction input by the user, the array object to be processed is operated to obtain the target array object, including but not limited to steps S221 to S223.

[0048] Step S221: Receive array operation instructions, which include a first operation instruction and / or a second operation instruction; both the first and second operation instructions include at least one of the following: replacement operation, deletion operation, and addition operation.

[0049] In this step, the user inputs array operation instructions through the interactive display unit. The array operation instructions may include only the first operation instruction, thereby processing only the current surface texture array; or, the array operation instructions may include only the second operation instruction, thereby processing only the current normal texture array; or, they may include both the first and second operation instructions, processing both the current surface texture array and the current normal texture array.

[0050] Step S222: According to the first operation instruction, perform the first operation processing on the first index value of the current surface texture array to obtain the target surface texture array.

[0051] In this step, when processing the current terrain texture array, only the first index value is processed. This avoids the performance impact of continuous memory copy communication between the GPU and CPU, and also reduces the performance consumption of communication between the GPU and CPU. Specifically, deleting a first index value means deleting the terrain texture corresponding to that first index value; modifying a first index value means subsequently calling the terrain texture corresponding to the modified first index value.

[0052] Step S223: According to the second operation instruction, perform the second operation processing on the second index value of the current normal map array to obtain the target normal map array.

[0053] In this step, when processing the current normal map array, only the second index value is processed. This avoids the performance impact of continuous memory copy communication between the GPU and CPU, and also reduces the performance consumption of communication between the GPU and CPU. Specifically, deleting a second index value means deleting the normal map corresponding to that second index value; modifying a second index value means subsequently calling the normal map corresponding to the modified second index value.

[0054] Step S230: In response to the second brush command input by the user, perform control map generation processing to obtain a surface control map.

[0055] Specifically, the second brush instruction is generated after the user performs a brush operation on the operation interface provided by the interactive display unit. The specific operation is to brush the terrain surface style. The specific brush operation is to freely control the shape of the terrain's undulations using a shape image or a regular image. Existing brush-related algorithms are used to generate shape texture data, and this application does not impose specific limitations on this.

[0056] Specifically, the control map generation process includes, but is not limited to, the following steps: first, reading RGB format shape map data into memory; then, converting the shape map data into a grayscale image, which includes different grayscale values; and finally, generating different transition values ​​for the surface control map using these different grayscale values ​​to form the surface control map. Specifically, the shape map... Figure 6 As shown.

[0057] Step S240: In response to the user's input of a voiding command, voiding is performed on the initial model to be processed to obtain a voided model; wherein, the initial model is determined from the original plot model with different inner surface detail levels.

[0058] Specifically, the empty instruction is generated by the user after performing an operation on the interface provided by the interactive display unit.

[0059] According to some embodiments of this application, step S240 is further described. Step S240: the initial model to be processed is subjected to a void processing to obtain a void model, including but not limited to steps S241 to S243.

[0060] Step S241: Determine the initial model to be processed from the original plot models with different levels of inner surface detail.

[0061] Step S242: Determine the deletion range in the initial model to be processed based on the target void shape.

[0062] Step S243: Delete the mesh within the deletion range of the initial model to be processed to obtain the leaky model.

[0063] Through steps S241 to S243, when freely creating terrain to embed into a dungeon or underground model, the initial model to be processed is determined from the original block models with different levels of internal detail. Figure 7 As shown, the initial model to be processed is a LOD model, and the details of the face count of its outermost layer are similar to those of the model. Figure 3 and Figure 4 The original site model shown is the same. Before the void is created, different underground models correspond to different shapes. Therefore, it is necessary to determine the target void shape based on the required underground model. Then, based on the target void shape, the deletion range is determined in the initial model to be processed. Finally, the meshes within the deletion range are deleted to obtain the result as shown. Figure 8 The leak model shown is illustrated. AlphaTest technology was not used in this process, thus reducing performance overhead to some extent.

[0064] It is understandable that different underground structures are required when creating terrain, resulting in different target void shapes. This application does not impose any restrictions on the specific shape of the target void.

[0065] After completing step S200, the central processing unit transmits the terrain height map, target surface texture array, target normal texture array, surface control map, and void model to the graphics processor, so that the graphics processor can perform subsequent steps S300 to S500.

[0066] Step S300: The graphics processor performs seamless model integration based on the terrain height map and the original block models with different levels of detail on the inner surface to obtain the terrain model.

[0067] Understandably, the purpose of the terrain elevation map is to generate a terrain model together with the original plot model.

[0068] According to some embodiments of this application, step S300 is further described. Step S300: The graphics processor performs seamless model connection processing based on the terrain height map and the original block model with different inner surface detail levels to obtain the terrain model, including but not limited to steps S310 to S330.

[0069] Step S310: On the terrain elevation map, divide different target area ranges according to the preset reference position and preset distance value.

[0070] In this step, the area is divided based on a preset reference position. For example, the bottom left corner of a virtual map is used as the preset reference position, and the area is divided by a preset distance value. For instance, the preset distance value is 60m. Therefore, 60m x 60m is the first-level target area range, 60m to 120m is the second-level target area range, and 120m to 180m is the third-level target area range.

[0071] Step S320: Determine the level of detail of the original plot model used in each target area based on the distance between the target area and the preset reference position; wherein, the smaller the distance, the higher the level of detail and the higher the face detail richness of the original plot model used in the corresponding target area; the larger the distance, the lower the level of detail and the lower the face detail richness of the original plot model used in the corresponding target area.

[0072] Specifically, the distance between the target area and the preset reference position refers to the maximum distance between the boundary of the target area and the preset reference position.

[0073] It is understandable that users have visually focused areas when viewing a 3D virtual scene. Therefore, this application uses in-game models with higher detail levels and richer polygon counts in these visually focused areas to ensure a good immersive visual experience for users. Simultaneously, in-game models with lower detail levels and less rich polygon counts are used in non-visually focused areas to reduce performance overhead. In other words, visually, the closer the in-game model is to the user, the higher its detail level and richer its polygon count; conversely, the farther away the in-game model is from the user, the lower its detail level and richer its polygon count.

[0074] Step S330: Lay out original plot models in each target area and seamlessly connect the original plot models to obtain a terrain model.

[0075] In this step, seamless integration was achieved between original site models at different levels, based on the fact that all original site models are square and the outermost layer has the same number of faces and detail. For example, three original site models with different levels of inner face detail are seamlessly integrated as follows: Figure 5 As shown.

[0076] It should be noted that, depending on the actual scenario construction requirements, terrain models can be constructed using different numbers of original plot models with different levels of internal detail, based on different preset reference positions and preset distance values. This application does not impose specific restrictions on this.

[0077] Step S400: The graphics processor performs texture rendering based on the surface control map, the target surface texture array, and the target normal texture array to obtain the surface texture model.

[0078] Specifically, step S400 is equivalent to pixel shading. Understandably, the surface map, normal map, and surface control map are used to blend together to form a surface style, such as a surface with grass, snow, and rocks, thereby creating a surface that blends grass, snow, and rocks together through the surface map, normal map, and surface control map.

[0079] Understandably, a surface control map is a texture map used to control surface mapping. It contains various information, such as height, normals, and lighting data, to guide the sampling and rendering process of the texture map.

[0080] It's important to note that the terrain control map in a GPU is an array. Specifically, in multi-terrain terrain, each pixel can have a maximum of four terrain styles; any subsequent styles are almost ineffective after blending. Therefore, based on this characteristic, a single terrain control map can be used to control the blending transitions between multiple terrain styles. Each pixel in the terrain control map has four channels (R, G, B, A) with a unique ID corresponding to the terrain. The pixel's terrain layer ID in the terrain control map is stored as a texture map. This allows for the generation of a very large number of terrain styles. Because the four channels of each pixel in the terrain control map may have discontinuous terrain layers, resulting in boundary breaks, for example, discontinuous terrain layer IDs in adjacent R channels 10, 12 and A channels 5, 6 can cause breakage in the sampling of the texture sampling control map.

[0081] By differentiating a single-layer surface control map into multiple surface control maps, boundary faulting is addressed to merge multiple surfaces into a normal surface. The surface layer IDs of each pixel's four channels are traversed, checking if there are adjacent surface layer IDs in the four channels of surrounding pixels within X-axis (-2 to 2) and Y-axis (-2 to 2). If adjacent IDs exist, this pixel becomes the control map for this layer; otherwise, an additional control map is created. After differentiating the control map, surrounding pixels need to be reset to the same surface ID to achieve normal texture sampling. For multi-surface terrain, the surface texture, surface normal, and control map are all texture arrays, allowing for diverse terrain representation with a single DrawCall. This multi-surface technique of differentiating a single-layer control map into multiple control maps can also perfectly convert traditional multi-DrawCall terrain data into the new multi-surface model. The conversion method involves synthesizing all surface layer IDs corresponding to one control map for every four surfaces, directly converting them into the surface layer ID of the corresponding control map pixel as a texture. It can save artists a lot of work and eliminate the need to relearn new techniques.

[0082] Step S500: The graphics processor performs model combination processing based on the surface texture model, terrain model, and void model to obtain the target virtual terrain.

[0083] According to some embodiments of this application, the virtual terrain generation system further includes: a memory unit and a video memory unit; the memory unit is electrically connected to the central processing unit, and the video memory unit is electrically connected to the graphics processor; The virtual terrain generation method also includes, but is not limited to, the following steps S600 and S700.

[0084] Step S600: After generating the terrain height map, target surface texture array, target normal texture array, and surface control map, store the original data of the terrain height map, target surface texture array, target normal texture array, and surface control map in the memory unit, and copy the backup data of the terrain height map, target surface texture array, target normal texture array, and surface control map to the video memory unit at the last time in each frame; Step S700: After obtaining the target virtual terrain, end the virtual terrain generation process, delete the original data in the memory unit, and retain the backup data in the video memory unit.

[0085] It's important to note that after generating a terrain height map the same size as the entire scene, a backup of the terrain height map is created. These two identical copies are stored in memory and video memory, respectively. Specifically, the backup data of the terrain height map is copied to video memory at the end of each frame. This allows for the creation of terrain elevation and shape freely within the CPU, unaffected by the performance impact of continuous memory copy communication between the GPU and CPU. It should be noted that both the ground map and the normal map are contiguous texture arrays, and both memory units and video memory units store the same data. When modifying, deleting, or adding ground maps and normal maps, only the index values ​​of the corresponding arrays are operated on. After the operation is complete, the relevant data of the ground map and normal map only need to be copied to video memory at the last time of each frame; thus, it is not affected by the performance of continuous memory copy communication between the GPU and the CPU.

[0086] In addition, once the player stops creating terrain, the terrain height map, surface texture, and normal map in the memory unit are automatically turned off and deleted, and the freed-up memory space is used to retain only the backup data in the video memory unit.

[0087] Through steps S100 to S500, in the process of generating virtual terrain using the virtual terrain generation system, firstly, original block models with different levels of inner surface detail are generated; each original block model is square-shaped, and the number of faces in the outermost layer is the same; the richness of the number of faces on the inner surfaces of the original block models with different levels of inner surface detail varies; secondly, the central processing unit (CPU) generates a terrain height map, a target surface texture array, a target normal texture array, a surface control map, and a void model; the terrain height map, the target surface texture array, the target normal texture array, and the surface control map are all freely created in the CPU, unaffected by the performance of continuous memory copy communication between the GPU and CPU, thus reducing the performance consumption of communication between the GPU and CPU; preventing... The AlphaTest technique is used to generate a void model, reducing memory consumption. Next, the graphics processor (GPU) seamlessly integrates the terrain height map and original block models with different levels of inner surface detail to obtain the terrain model. By seamlessly integrating original block models with different levels of inner surface detail, a high level of inner surface detail is used in visually important areas, while a low level is used in non-visually important areas, thus reducing performance consumption. Then, the GPU performs texture rendering based on the surface control map, the target surface texture array, and the target normal texture array to obtain the surface texture model. Finally, the GPU combines the surface texture model, the terrain model, and the void model to obtain the target virtual terrain. Therefore, this application can reduce performance consumption during the virtual terrain generation process.

[0088] For example, combined with Figure 9 This is a schematic diagram illustrating the information transmission in the virtual terrain generation system provided in the embodiments of this application.

[0089] On the user side, the following operations are performed: refresh terrain height; add, replace, and delete terrain surfaces; refresh terrain surface styles; and place dungeons and underground models into the terrain. Correspondingly, the central processing unit (CPU) performs the appropriate processing to generate a terrain height map, a target surface texture array, a target normal texture array, a surface control map, and a void model. The graphics processing unit (GPU) performs relevant processing based on the input terrain height map, target surface texture array, target normal texture array, surface control map, and void model to generate the target virtual terrain. Finally, the target virtual terrain is displayed on the interactive display unit. It is understandable that due to the memory limitations and CPU and GPU performance limitations of mobile devices, it was previously difficult to freely create terrain models and landforms during game runtime. This application reduces performance consumption during virtual terrain generation, thus making it suitable for mobile devices.

[0090] like Figure 10 As shown, the present invention also provides an electronic device, comprising: The processor 1001 can be implemented using a general-purpose central processing unit, microprocessor, application-specific integrated circuit, or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application. The memory 1002 can be implemented as a read-only memory, static storage device, dynamic storage device, or random access memory. The memory 1002 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program code is stored in the memory 1002 and is called and executed by the processor 1001 to execute the virtual terrain generation method of the embodiments of this application. Input / output interface 1003 is used to implement information input and output; The communication interface 1004 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.). Bus 1005 transmits information between various components of the device (e.g., processor 1001, memory 1002, input / output interface 1003, and communication interface 1004); The processor 1001, memory 1002, input / output interface 1003 and communication interface 1004 are connected to each other within the device via bus 1005.

[0091] This application embodiment also provides a storage medium, which is a computer-readable storage medium, storing a computer program that, when executed by a processor, implements the above-described virtual terrain generation method.

[0092] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof. The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separate, and may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0093] It will be understood by those skilled in the art that all or some of the steps and systems in the methods disclosed above can be implemented as software, firmware, hardware, and suitable combinations thereof. Some or all of the physical components can be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software can be distributed on a computer-readable medium, which can include computer storage media (or non-transitory media) and communication media (or transient media). As is known to those skilled in the art, the term computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, as is known to those skilled in the art, communication media typically include computer-readable instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.

[0094] The above provides a detailed description of the preferred embodiments of this application. However, this application is not limited to the above-described embodiments. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of this application. All such equivalent modifications or substitutions are included within the scope defined by this application.

Claims

1. A method for generating virtual terrain features, characterized in that, A virtual terrain generation system is applied, the system comprising: a central processing unit and a graphics processing unit; the method comprising: Generate original plot models with different levels of inner surface detail; wherein each of the original plot models is square and the number of faces in the outermost layer is the same; the richness of the number of faces in the inner surfaces of the original plot models with different levels of inner surface detail is different; The central processing unit generates a terrain height map, a target surface texture array, a target normal texture array, a surface control map, and a void model; The graphics processor performs seamless model integration processing based on the terrain height map and the original plot models with different levels of inner surface detail to obtain a terrain model; The graphics processor performs texture rendering processing based on the surface control map, the target surface texture array, and the target normal texture array to obtain a surface texture model; The graphics processor performs model combination processing based on the surface texture model, the terrain model, and the void model to obtain the target virtual terrain.

2. The virtual terrain generation method according to claim 1, characterized in that, The graphics processor performs seamless model integration based on the terrain elevation map and the original plot models with different levels of inner surface detail to obtain a terrain model, including: In the terrain elevation map, different target areas are divided according to preset reference positions and preset distance values; The level of detail of the original plot model used in each target area is determined based on the distance between the target area and the preset reference position; wherein, the smaller the distance, the higher the level of detail and the higher the polygon detail richness of the original plot model used in the target area; the larger the distance, the lower the level of detail and the lower the polygon detail richness of the original plot model used in the target area. The original land parcel models are laid out in each of the target areas, and the original land parcel models are seamlessly connected to obtain the terrain model.

3. The virtual terrain generation method according to claim 1, characterized in that, The central processing unit generates a terrain height map, a target surface texture array, a target normal texture array, a surface control map, and a void model, including: The terrain height map is generated in response to the first brush command input by the user. In response to user-inputted array manipulation commands, the array object to be processed is manipulated to obtain a target array object; wherein, the array object to be processed includes the current surface texture array and the current normal texture array; the target array object includes: the target surface texture array and the target normal texture array; The control map is generated in response to the second brush command input by the user. In response to a user-inputted voiding command, a voiding process is performed on the initial model to be processed to obtain the voided model; wherein, the initial model is determined from the original plot models with different levels of inner surface detail.

4. The virtual terrain generation method according to claim 3, characterized in that, The height map generation process includes: Generate shape texture data in response to the first brush command; The shape texture data is read into memory, and the RGB format shape texture data is converted to grayscale to obtain a grayscale image; Different elevation differences are generated based on the different gray values ​​in the grayscale values ​​to form the terrain elevation map.

5. The virtual terrain generation method according to claim 3, characterized in that, The current surface texture array includes multiple first index values, and different first index values ​​are used to indicate different surface textures; the current normal texture array includes multiple second index values, and different second index values ​​are used to indicate different surface normals. The process of responding to a user-input array manipulation command to operate on the array object to be processed to obtain a target array object includes: The array operation instruction is received, which includes a first operation instruction and / or a second operation instruction; both the first operation instruction and the second operation instruction include at least one of the following: a replacement operation, a deletion operation, and an addition operation. According to the first operation instruction, the first index value of the current surface texture array is processed by a first operation to obtain the target surface texture array; According to the second operation instruction, the second index value of the current normal map array is processed by a second operation to obtain the target normal map array.

6. The virtual terrain generation method according to claim 3, characterized in that, The process of performing void processing on the initial model to be processed to obtain the void model includes: The initial model to be processed is determined from the original plot models with different levels of inner detail; The deletion range is determined in the initial model to be processed based on the shape of the target void. The meshes within the deletion range in the initial model to be processed are deleted to obtain the leaky model.

7. The virtual terrain generation method according to claim 1, characterized in that, The virtual terrain generation system further includes: a memory unit and a video memory unit; the memory unit is electrically connected to the central processing unit, and the video memory unit is electrically connected to the graphics processor; The method further includes: After generating the terrain height map, the target surface texture array, the target normal texture array, and the surface control map, the original data of the terrain height map, the target surface texture array, the target normal texture array, and the surface control map are stored in the memory unit, and at the end of each frame, the backup data of the terrain height map, the target surface texture array, the target normal texture array, and the surface control map are copied to the video memory unit. After obtaining the target virtual terrain, the virtual terrain generation process ends, the original data in the memory unit is deleted, and the backup data in the video memory unit is retained.

8. A virtual terrain generation system, characterized in that, include: A central processing unit and a graphics processing unit; the central processing unit and the graphics processing unit cooperate to implement the virtual terrain generation method as described in any one of claims 1 to 7.

9. An electronic device, characterized in that, It includes at least one processor and a memory for communicatively connecting to the at least one processor; the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the virtual terrain generation method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions for causing a computer to perform the virtual terrain generation method as described in any one of claims 1 to 7.