Virtual terrain generation method and device
By searching for extension points in the virtual terrain grid and generating extended virtual terrain, the problems of singularity and inconsistency in the generation of virtual rivers in the prior art are solved, and a more vivid and natural visual effect is achieved.
Patent Information
- Application Number
- CN202411878489.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2044-12-19
AI Technical Summary
The prior art is difficult to generate coherent and diverse virtual rivers, resulting in the visual effect not being realistic and natural enough.
By determining the starting point and the end point in the target terrain grid, cycling the lifting end point based on the preset lift interval, searching for the extension point, and generating initial and extended virtual terrain when the target stop condition is reached, a target virtual terrain with rich shape is obtained.
It improves the morphological diversity and coherence of virtual rivers and enhances the authenticity and nature of visual effects.
Smart Images

Figure CN119722971A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present specification relate to the field of computer technology, and more particularly to a method and device for generating a virtual terrain. Background Art
[0002] In the process of developing a virtual world, the design and layout of the natural landscape are very important. Among them, the drawing of virtual terrain will greatly affect the visual effect of the virtual world and determine whether the virtual world looks real and natural.
[0003] Taking virtual terrain including rivers as an example, rivers are an important part of natural terrain. Generating rivers in the virtual world can enrich the natural landscape of the virtual world and bring realistic visual experience to users. However, at present, rivers are usually generated based on the connection between the starting point and the end point on the terrain of the big world. The rivers generated in this way are often single and difficult to cross complex terrain, making it difficult to generate coherent and diverse rivers at one time, resulting in visual effects that are difficult to meet expectations. Therefore, a better method for generating virtual terrain is urgently needed. Summary of the invention In view of this, an embodiment of this specification provides a method for generating a virtual terrain. One or more embodiments of this specification also relate to a virtual terrain generating device, a computing device, a computer-readable storage medium and a computer program product to solve the technical defects existing in the prior art.
[0004] According to a first aspect of an embodiment of this specification, a method for generating a virtual terrain is provided, comprising: Determine a first starting point and a first ending point in the target terrain grid; Based on a preset lifting interval, cyclically lifting the first end point, searching for at least one first extension point in the target terrain grid; When the target stop condition is reached, an initial virtual terrain is generated based on the first starting point and the first ending point, and an extended virtual terrain is generated based on the first ending point, the first extension point and the target stop condition to obtain the target virtual terrain.
[0005] According to a second aspect of an embodiment of this specification, there is provided a device for generating a virtual terrain, comprising: A determination module is configured to determine a first starting point and a first ending point in a target terrain grid; A search module is configured to cyclically elevate the first end point based on a preset elevation interval and search for at least one first extension point in the target terrain grid; The generation module is configured to generate an initial virtual terrain based on a first starting point and a first ending point when a target stop condition is reached, and to generate an extended virtual terrain based on the first ending point, a first extension point and the target stop condition to obtain a target virtual terrain.
[0006] According to a third aspect of an embodiment of this specification, a computing device is provided, including: Memory and processor; The memory is used to store computer executable instructions, and the processor is used to execute the computer executable instructions. When the computer executable instructions are executed by the processor, the steps of the above-mentioned method for generating virtual terrain are implemented.
[0007] According to a fourth aspect of the embodiments of this specification, a computer-readable storage medium is provided, which stores computer-executable instructions, and when the instructions are executed by a processor, the steps of the above-mentioned method for generating virtual terrain are implemented.
[0008] According to a fifth aspect of the embodiments of this specification, a computer program product is provided, comprising a computer program / instruction, which implements the steps of the above-mentioned method for generating virtual terrain when executed by a processor.
[0009] An embodiment of the present specification implements determining a first starting point and a first ending point in a target terrain grid; cyclically raising the first ending point based on a preset raising interval, and searching for at least one first extension point in the target terrain grid; generating an initial virtual terrain based on the first starting point and the first ending point when a target stopping condition is met, and generating an extended virtual terrain based on the first ending point, the first extension point, and the target stopping condition to obtain a target virtual terrain.
[0010] In this way, by cyclically raising the first end point based on a preset raising interval and searching for at least one first extension point in the target terrain grid, it is possible to search for the first extension point that can be used to generate an extended virtual terrain starting from the first end point, and improve the accuracy and search efficiency of the first extension point; by generating an extended virtual terrain based on the first end point, the first extension point and the target stop condition, it is possible to further generate an extended virtual terrain on the basis of generating the initial virtual terrain, so that it is possible to obtain a target virtual terrain with richer and more diverse forms based on the initial virtual terrain and the extended virtual terrain, avoid the target virtual terrain being too single, and achieve a more vivid and natural visual effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1 is a flow chart of a method for generating a virtual terrain provided by an embodiment of this specification; Figure 2It is a schematic diagram of a processing process of a method for generating a virtual terrain provided by an embodiment of this specification; Figure 3 It is a structural schematic diagram of a virtual terrain generation device provided by an embodiment of this specification; Figure 4 It is a structural block diagram of a computing device provided by an embodiment of this specification. DETAILED DESCRIPTION
[0012] Many specific details are described in the following description to facilitate a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of this specification, so this specification is not limited to the specific implementation disclosed below.
[0013] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.
[0014] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of this specification, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0015] In addition, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of this specification are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0016] First, the terms involved in one or more embodiments of this specification are explained.
[0017] Valley point: refers to the lowest altitude position that a river passes through during its flow. In this specification, a valley point can be understood as the end point of a river in the terrain grid.
[0018] Divergence: A point at which a river can split from the main channel into two or more separate channels. Each newly formed channel may be called a tributary, branch, or distributary river.
[0019] Topographic groove: refers to a closed low-lying area on the ground surface, which is higher on the sides and lower in the middle. Topographic grooves can form a relatively closed space.
[0020] Terrain mesh: A three-dimensional geometric structure used to represent the ground or surface in the game world. It is usually composed of a large number of polygons (such as triangles), which together form a continuous surface to simulate terrain features in the real world, such as mountains, rivers, plains, etc. Terrain mesh is the basis for creating and rendering large world environments.
[0021] Breadth-First Search (BFS): It is an algorithm used to traverse or search a graph structure. Starting from a starting node, first visit all the neighboring nodes directly connected to the node, and then visit the unvisited neighboring nodes of these neighboring nodes in turn, and so on, until all reachable nodes have been visited.
[0022] Virtual worlds often contain a wide variety of virtual terrains. For virtual terrains with flowing surfaces, such as rivers and magma, common generation algorithms often determine a starting point and an end point in the large world terrain, and generate virtual terrain based on the line between the two points. Virtual terrains generated in this way are often monotonous and cannot cross terrain grooves and diversions. They are prone to interruption, making it impossible to generate virtual terrains with diverse forms in a coherent manner at one time, resulting in unrealistic and unnatural visual effects.
[0023] Based on this, an embodiment of the present specification provides a method for generating a virtual terrain, which determines a first starting point and a first ending point in a target terrain grid; based on a preset lifting interval, cyclically lifts the first ending point, and searches for at least one first extension point in the target terrain grid; when a target stopping condition is met, generates an initial virtual terrain based on the first starting point and the first ending point, and generates an extended virtual terrain based on the first ending point, the first extension point, and the target stopping condition, to obtain a target virtual terrain.
[0024] In this way, by cyclically raising the first end point based on a preset raising interval and searching for at least one first extension point in the target terrain grid, it is possible to search for the first extension point that can be used to generate an extended virtual terrain starting from the first end point, and improve the accuracy and search efficiency of the first extension point; by generating an extended virtual terrain based on the first end point, the first extension point and the target stop condition, it is possible to further generate an extended virtual terrain on the basis of generating the initial virtual terrain, so that a target virtual terrain with richer and more diverse forms can be obtained based on the initial virtual terrain and the extended virtual terrain, avoiding the target virtual terrain being too single and avoiding the target virtual terrain being incoherent, thereby achieving a more vivid and natural visual effect.
[0025] In this specification, a method for generating a virtual terrain is provided. This specification also relates to a device for generating a virtual terrain, a computing device, a computer-readable storage medium, and a computer program product, which are described in detail one by one in the following embodiments.
[0026] See also Figure 1 , Figure 1 A flowchart of a method for generating a virtual terrain according to an embodiment of the present specification is shown, which specifically includes the following steps.
[0027] Step 102: Determine a first starting point and a first ending point in the target terrain grid.
[0028] In practical applications, the first starting point and the first ending point may be determined based on the target terrain grid.
[0029] Specifically, the target terrain grid can be understood as the terrain grid corresponding to the target virtual world. The target virtual world can be understood as the virtual world for which the virtual terrain needs to be generated. The virtual world can be understood as a vast and coherent virtual environment constructed in a virtual scene, in which users (such as players) can freely explore and interact (including interacting with the scene or interacting with other players).
[0030] For example, the design of a virtual world in game development not only includes creating a large map, but also includes a complex ecosystem, a dynamic weather system, rich NPC behaviors, diverse terrain, etc., so as to provide players with an immersive gaming experience.
[0031] Specifically, the target terrain grid can be understood as a three-dimensional geometric structure used to represent the surface of the target virtual world. The target terrain grid can be composed of a large number of polygons (such as triangles), which together form a continuous surface. Each point in the target terrain grid can have a corresponding surface height.
[0032] Optionally, the surface height of each point in the target terrain grid can be obtained according to a height map of the target virtual world.
[0033] Specifically, the first starting point can be understood as the starting point of the initial virtual terrain. The first ending point can be understood as the end point of the initial virtual terrain, or as a valley point. The first starting point and the first ending point are points on the target terrain grid.
[0034] Specifically, the virtual terrain can be understood as terrain on which flow can occur, such as rivers, magma, etc. For the sake of illustration, the following description will use the virtual terrain as a river to further explain various embodiments.
[0035] Further, the initial virtual terrain can be understood as the virtual terrain in its initial form. For example, it can be the main river channel of a river. The extended virtual terrain can be understood as the virtual terrain in its extended form extended from the initial virtual terrain. For example, it can be a lake or a pool formed at the valley point of a river, or a tributary formed at the diversion point of a river.
[0036] Optionally, the first starting point may be determined according to requirements in actual applications, and is often a point at a higher position in the terrain grid.
[0037] Optionally, the first end point may be determined based on the first start point, which may specifically include: Starting from the first starting point, adjacent points are searched cyclically along the direction of the target terrain grid gradient descent, and the last point searched is determined as the first ending point.
[0038] Specifically, the direction of gradient descent can be understood as the direction in which the height decreases fastest.
[0039] In practical applications, we can start from the first starting point and search for adjacent points in sequence along the direction of the fastest altitude drop in the target terrain grid; determine the searched adjacent points as the path points of the main river channel, and further search for adjacent points of the path points along the direction of gradient descent; until the terrain grid with no descent on all sides is searched, the last point is obtained, and this point is the first end point.
[0040] It should be noted that, based on the first starting point, each path point and the first ending point, the main river channel of the river, ie, the initial virtual terrain, can be generated.
[0041] Step 104: Based on a preset lifting interval, cyclically lift the first end point and search for at least one first extension point in the target terrain grid.
[0042] Specifically, the preset lifting interval can be understood as the lifting distance in the vertical direction, which is used to achieve the gradual upward lifting of the horizontal plane during each cycle.
[0043] Optionally, the preset lifting interval may be pre-set according to requirements in actual applications, for example, it may be a unit height in the target terrain grid.
[0044] Specifically, the first extension point can be understood as a point used to generate the extended virtual terrain, and is a point on the target terrain grid.
[0045] Optionally, the first extension point may be searched based on the lifted target point.
[0046] In one or more optional embodiments of the present specification, the process of searching for the first extension point may include a process of cyclically performing vertical lifting and horizontal diffusion: starting from the first end point, lifting upward by a preset lifting interval each time, and performing horizontal diffusion in the horizontal plane obtained by the lifting to search for the first extension point; after completing the search in the current horizontal plane, continuing to lift upward by a preset lifting interval, and continuing to perform horizontal diffusion in the horizontal plane after the lifting to search for the first extension point; and so on, until the preset stop condition is reached.
[0047] According to one or more optional embodiments of the present specification, based on a preset lifting interval, cyclically lifting the first end point and searching for at least one first extension point in the target terrain grid may include the following steps: The first end point is raised by a preset raising interval to obtain the target point; In the horizontal plane where the target point is located, starting from the target point, cyclically searching for adjacent points along a preset direction to obtain initial extension points and initial boundary points, wherein the initial boundary points are used to form a closed terrain area; The target point is lifted by a preset lifting interval, and the point after the lifting is determined as the target point; In the horizontal plane where the target point is located, based on the initial boundary point, a cyclic search for adjacent points is performed in a direction outside the closed terrain area to obtain a first extended point.
[0048] Specifically, the target point may be the first end point at the beginning, and after each lift, the lifted point may be updated as the target point. The preset direction may be determined according to the needs of the actual application, and this specification does not make any limitation on this. For example, it may be forward, backward, left, and right.
[0049] It should be noted that, in the horizontal plane where the target point is located, the current point height of each searched point remains unchanged, and is the height of the current horizontal plane.
[0050] Specifically, the initial extension point can be understood as the extension point that is searched after the first end point is raised by a preset lifting interval. The extension point can also be understood as a diffusion point, which is a point obtained by spreading outward from the target point.
[0051] Specifically, the initial boundary point can be understood as a boundary point that is searched after the first end point is raised by a preset raising interval. The boundary point can be understood as a point located on the surface or below the surface.
[0052] Optionally, when the first end point is raised by a preset lifting interval to obtain the target point, it is possible to start from the target point and diffuse outward, using a preset search algorithm to search for each point to be diffused within the horizontal plane where the target point is located.
[0053] Specifically, the preset search algorithm is used to search for the points to be diffused in the current horizontal plane, for example, it may be a breadth-first search algorithm, or it may be a depth-first search algorithm or other search algorithms, which may be specifically determined according to the requirements in actual applications.
[0054] Furthermore, for each point to be diffused, it can be determined whether the point to be diffused is an extension point or a boundary point according to the current point height and the terrain height.
[0055] Specifically, the point to be diffused can also be understood as the current point searched through a preset search algorithm.
[0056] Optionally, the height of the current point and the height of the terrain may be subtracted to obtain the surface height difference; based on the surface height difference, it is determined whether the current point searched is an extension point or a boundary point.
[0057] Specifically, the surface height difference refers to the difference between the height of the current point and the height of the terrain at the current point. When the surface height difference is a positive value, it indicates that the current point is an extension point; when the surface height difference is zero or a negative value, it indicates that the current point is a boundary point. Among them, the surface height difference is zero, indicating that the current point is on the surface; the surface height difference is a negative value, indicating that the current point is below the surface.
[0058] In practical applications, corresponding marking processing can be performed for each searched point. When the diffusion process of the current horizontal plane ends and the preset stop condition is not triggered, the initial extension point and the initial boundary point can be obtained. Among them, the initial extension point can form a closed terrain area.
[0059] Specifically, the preset stop condition may include encountering a terrain edge during the diffusion process, or the volume of the currently formed terrain area is greater than a preset maximum volume.
[0060] Furthermore, based on the initial extension point and the initial boundary point, the target point can be further raised to obtain the raised target point, so that within the current horizontal plane where the raised target point is located, starting from the initial boundary point, the new extension point can be searched for to obtain the first extension point.
[0061] According to one or more optional embodiments of the present specification, in order to detect whether a preset stop condition is triggered during the process of lifting the target point and searching for the extension point, and to stop in time when the preset stop condition is triggered, the maximum volume, initial volume, initial surface area and initial depth can be preset.
[0062] In the process of lifting the target point and searching for the extended point, the current volume, current surface area and current depth can be continuously updated based on the initial volume, initial surface area and initial depth, and it can be detected whether the current volume is greater than the maximum volume.
[0063] If it is greater than, the preset stop condition is triggered; if it is not greater than, the preset stop condition is not triggered.
[0064] In an optional embodiment of the present specification, each time the target point is lifted, the height (H) may be updated to be the current height plus a preset lifting interval, and the current volume may be updated based on the current surface area and the preset lifting interval.
[0065] Exemplarily, if the preset lifting interval is a unit height Uy, then H=H+Uy; and the volume V=V+S*Uy is updated.
[0066] In an optional embodiment of the present specification, during the diffusion process, each time an extension point is searched, the surface area can be updated based on the cell size of the terrain grid, and the current volume can be updated based on the terrain height difference and the cell size.
[0067] Exemplarily, if the extension point pi is searched and the terrain height difference is Hpi, the surface area S=S+Ux*Uz is updated; and the volume V=V+Hpi*Uy*Ux*Uz is updated.
[0068] By applying this embodiment, starting from the first end point, the target point is continuously raised based on a preset lifting interval, so that the first extension point for forming a closed area can be searched in the horizontal plane where the target point is located, so that based on the first extension point, an extended virtual terrain can be further generated on the basis of the initial virtual terrain, so that target virtual terrains with diverse forms can be generated at one time, achieving a better virtual terrain generation effect.
[0069] According to one or more optional embodiments of the present specification, in the horizontal plane where the target point is located, based on the initial boundary point, cyclically searching for adjacent points in a direction outside the closed terrain area to obtain a first extended point may include the following steps: In the horizontal plane where the target point is located, based on the initial boundary point, the adjacent points are cyclically searched in the direction outside the closed terrain area; For the current point searched, based on the current point height and the terrain height of the current point, the type of the current point is determined, and the point of the extension type is determined as the initial extension point, wherein the type includes the extension type and the boundary type; In the case where the point of the boundary type can form a new closed terrain area, determining the initial extension point as the first extension point; The initial boundary point is updated based on the point of the boundary type, and the step of raising the target point by a preset raising interval is returned to be executed, and the raised point is determined as the target point.
[0070] Specifically, the current point can be understood as the point to be diffused that is searched during the horizontal diffusion process. The type of the current point can include an extension type and a boundary type. The current point can be an initial boundary point or an unmarked point in the current horizontal plane. The terrain height can be understood as the height of the current point in the target terrain grid.
[0071] In practical applications, in the horizontal diffusion process, the diffusion starts from the initial boundary point and spreads outward. The initial boundary point is a point marked as a boundary type in a layer before lifting.
[0072] Optionally, the updated ground height difference of the initial boundary point can be calculated based on the difference between the current point height of the initial boundary point and the terrain height of the initial boundary point. When the ground height difference is a positive value, the initial boundary point is updated to the initial extension point.
[0073] Among them, the current point height of the initial boundary point can be understood as the height of the initial boundary point on the current horizontal plane; the terrain height of the initial boundary point can be understood as the height of the initial boundary point on the target terrain grid, and can also be understood as the height on the height map.
[0074] Furthermore, in the outward direction of the current horizontal plane, the adjacent points of the initial extension point are searched to obtain a new point to be diffused; based on the difference between the current point height of the point to be diffused and the terrain height, the surface height difference of the point to be diffused is calculated. When the surface height difference is a positive value, the point to be diffused is marked as the initial extension point. And so on, until the boundary point or the marked point is found, the search in this direction is stopped.
[0075] Optionally, when the searched initial extension point can form a new closed terrain area, the initial extension point can be determined as the first extension point, that is, based on the first extension point, a closed terrain area can be obtained.
[0076] Furthermore, the point of the boundary type found in the current horizontal plane can be updated as the initial boundary point, and the step of raising the target point by the preset raising interval and determining the raised point as the target point can be returned. In this way, the target point can be raised layer by layer in a loop to search for all points in the terrain grid that can be used to form a terrain groove.
[0077] By applying this embodiment, adjacent points are cyclically searched in the direction outside the closed terrain area based on the initial boundary points in the horizontal plane where the target point is located; the type of the current point is determined based on the current point height and the terrain height of the current point, and the point of the extension type is determined as the initial extension point. In the subsequent lifting process, it can continue to diffuse outward along the previously searched boundary points, and when a new closed area can be formed, the horizontal plane can be continuously lifted, so as to search for various points that can be used to form a closed terrain area, thereby improving the generation efficiency of the extended virtual terrain.
[0078] Step 106: When the target stop condition is reached, an initial virtual terrain is generated based on the first starting point and the first ending point, and an extended virtual terrain is generated based on the first ending point, the first extension point and the target stop condition to obtain the target virtual terrain.
[0079] In practical applications, when the process of cyclic lifting and horizontal diffusion reaches the target stopping condition, an initial virtual terrain can be generated based on the first starting point and the first ending point, and an extended virtual terrain can be generated based on the first ending point, the first extension point and the target stopping condition, thereby obtaining the target virtual terrain.
[0080] Specifically, the target stop condition can be understood as one of the preset stop conditions, and the preset stop condition can be understood as the condition for stopping the execution of the cyclic lifting and horizontal diffusion process.
[0081] Optionally, the preset stop condition may include encountering a terrain edge during the diffusion process, or may include that during the lifting or diffusion process, the volume of the terrain area formed based on the first extension point exceeds a preset maximum volume.
[0082] Specifically, the terrain edge can be understood as a point located at the outermost circle of the target terrain grid.
[0083] Specifically, virtual terrain can be understood as terrain on which flow can occur on the surface, such as rivers, magma, etc. The initial virtual terrain can be understood as the virtual terrain in its initial form. For example, it can be the main river channel of a river. The extended virtual terrain can be understood as a virtual terrain that is extended or extended on the basis of the initial form of the virtual terrain and is different from the initial form of the virtual terrain. For example, it can be a lake or pool formed at the valley point of a river, or a tributary formed at the diversion point of a river.
[0084] It should be noted that the initial virtual terrain and the extended virtual terrain are connected in the virtual terrain of the entire big world, and there will be no interruption. The initial virtual terrain and the extended virtual terrain, as a whole, together form the target virtual terrain.
[0085] According to one or more optional embodiments of the present specification, generating an initial virtual terrain based on a first starting point and a first ending point may include the following steps: Determine each path point between the first starting point and the first ending point; An initial virtual terrain is generated based on the first starting point, each path point and the first ending point.
[0086] Optionally, each path point is obtained by cyclically searching for adjacent points along a gradient descending direction in the target terrain grid starting from the first starting point.
[0087] In practical applications, when the target virtual terrain is a river, the initial virtual terrain can be understood as the main channel of the river.
[0088] According to one or more optional embodiments of the present specification, generating an extended virtual terrain based on the first termination point, the first extension point and the target stop condition may include the following steps: Determining a target first extension point from the first extension points; According to the target stop condition, an extended virtual terrain is generated based on the first termination point and the target first extension point.
[0089] Optionally, determining a target first extension point from the first extension points may include: From the first extension points, the first extension points searched on the current horizontal plane are eliminated to obtain the target first extension point.
[0090] Specifically, the target first extension point may be understood as the first extension point searched based on other horizontal planes before being lifted to the current horizontal plane.
[0091] In actual applications, if the target stop condition is reached, that is, the edge of the terrain is searched, or the current volume is larger than the preset maximum volume, it is necessary to retreat to the closed area formed by the previous horizontal plane to form an extended virtual terrain. Therefore, if the edge of the terrain is searched during the horizontal diffusion process, or the current volume is larger than the preset maximum volume during the horizontal diffusion process, it is necessary to eliminate the first extension point searched in this layer and generate an extended virtual terrain based on other first extension points.
[0092] Optionally, determining a target first extension point from the first extension points may also include: The first extension point is determined as the target first extension point.
[0093] In actual applications, if during the lifting process it is detected that the lifted volume is larger than the preset maximum volume, horizontal diffusion may not be performed and the system may fall back to the previous horizontal plane to generate an extended virtual terrain based on all the first extension points searched.
[0094] By applying this embodiment, an extended virtual terrain is generated based on the first termination point and the target first extension point according to the target stopping condition. Different styles of extended virtual terrain can be generated based on different target stopping conditions, thereby increasing the diversity of the target virtual terrain.
[0095] In an optional embodiment of the present specification, the target stop condition includes searching for a terrain edge; according to the target stop condition, generating an extended virtual terrain based on the first termination point and the target first extension point may include the following steps: When the edge of the terrain is found, a first extended virtual terrain is generated based on the first termination point and the target first extension point.
[0096] Specifically, the terrain edge can be understood as a point located at the outermost circle of the target terrain grid.
[0097] In practical applications, the target virtual terrain may include a variety of different styles or forms. For example, when the target virtual terrain is a river, the target virtual terrain may include at least one of different styles such as a main river channel, a lake, a pool, and a tributary.
[0098] The first extended virtual terrain can be understood as one style of the target virtual terrain, and specifically can be a lake.
[0099] By applying this embodiment, when the edge of the terrain is searched, a first extended virtual terrain is generated based on the first end point and the target first extension point. When the edge of the terrain is encountered, a target virtual terrain including a main river channel and a lake can be generated. Thus, a virtual terrain including two styles can be generated at one time, thereby improving the diversity of virtual terrain generation.
[0100] In another optional embodiment of the present specification, the target stop condition includes that the current terrain area volume exceeds the preset terrain area volume; according to the target stop condition, based on the first end point and the target first extension point, generating the extended virtual terrain may include the following steps: Based on the first termination point and the target first extension point, a target terrain area is formed; A first boundary point of the target terrain area is determined, and based on whether the first boundary point meets a preset search condition, an extended virtual terrain is generated.
[0101] Specifically, the current terrain area volume can be understood as the currently recorded volume value, that is, V. The preset terrain area volume can be understood as the preset maximum volume, that is, Vmax.
[0102] Specifically, the target terrain area can be understood as a pool area. The first boundary point can be understood as a boundary point of the target terrain area, that is, a boundary point of the pool area.
[0103] In practical applications, when a target terrain region is formed, all boundary points of the target terrain region may be checked to see whether each boundary point has neighboring terrain grids with decreasing height outside the target terrain region.
[0104] Specifically, the preset search conditions may include: the first boundary point is located outside the target terrain area, and there are neighboring terrain grids with decreasing heights.
[0105] In actual applications, if the first boundary point exists, the first boundary point meets the preset search condition, and the first boundary point is added to the pre-dividing point list; if the first boundary point does not exist, the first boundary point is excluded.
[0106] By applying this embodiment, by determining the first boundary point of the target terrain area and generating an extended virtual terrain based on whether the first boundary point meets the preset search conditions, it is possible to further search for whether there is a diversion point in the river on the basis of forming a pool area, thereby being able to generate rivers of different forms based on whether there is a diversion point, thereby realizing the search for diversion points and the generation of diversified rivers.
[0107] In an optional embodiment of the present specification, generating an extended virtual terrain based on whether the first boundary point meets a preset search condition may include the following steps: If there is at least one first boundary point that meets the preset search condition, determining a target first boundary point from the at least one first boundary point; Determine the first boundary point of the target as the diversion point corresponding to the target terrain area; A second extended virtual terrain is generated based on the target terrain area and the diversion point.
[0108] Specifically, the second extended virtual terrain may include a pool and at least one tributary.
[0109] Optionally, if there is at least one first boundary point that meets the preset search condition, determining the target first boundary point from the at least one first boundary point may include: Add the first boundary point that meets the preset search condition to the pre-diversion point list; The first boundary point with the lowest height is selected from the pre-divergence point list and determined as the target first boundary point.
[0110] In practical applications, the target first boundary point may include one or more. If there are multiple first boundary points with the lowest height, then the target first boundary point includes multiple.
[0111] Optionally, determining the target first boundary point as a diversion point corresponding to the target terrain area may include: The first boundary point of the target is marked as the diversion point corresponding to the target terrain area.
[0112] In practical applications, when there are multiple target first boundary points, the diversion points may include multiple ones.
[0113] Furthermore, when one or more diversion points are determined, a pool may be generated based on the target terrain area, and a tributary may be generated based on the diversion points.
[0114] Optionally, generating the second extended virtual terrain based on the target terrain area and the diversion point may include: Generate a pool based on the target terrain area and adjust the height of the pool to the height of the diversion point; Each branch point is used as a second starting point, and a tributary is generated based on the second starting point.
[0115] It should be noted that the tributary can be used as a new river, starting from the diversion point, taking the diversion point as the new first starting point, repeating the execution process of the above steps 102 to 106, and further generating the main river channel and extended form. In addition, in the subsequent process of generating rivers, it is necessary to exclude the points that have formed water areas.
[0116] In practical applications, by adjusting the height of the pool to the height of the diversion point, the pool and tributaries can be made to fit the terrain more closely, forming a more natural terrain transition effect without causing interruptions.
[0117] By applying this embodiment, a target first boundary point is determined from at least one first boundary point; the target first boundary point is determined as a diversion point corresponding to the target terrain area; a second extended virtual terrain is generated based on the target terrain area and the diversion point, and the position of the diversion point can be automatically determined, thereby generating a new river based on the diversion point; by generating a pool based on the target terrain area and adjusting the height of the pool to the height of the diversion point, the pool can be made to fit the terrain more closely, a more natural terrain transition effect can be obtained, and the crossing of terrain grooves and diversions can be achieved without interruption of flow, thereby generating a more coherent and diverse target virtual terrain at one time.
[0118] In another optional embodiment of the present specification, generating the extended virtual terrain based on whether the first boundary point meets the preset search condition may include the following steps: When the first boundary point does not meet the preset search condition, a first extended virtual terrain is generated based on the target terrain area.
[0119] Specifically, the first boundary point does not meet the preset search condition, which means that each boundary point of the target terrain area is outside the target terrain area and has no neighboring terrain grids with decreasing height, that is, the preset diversion point list is empty.
[0120] In practical applications, when the diversion point cannot be found, a lake can be generated based on the target terrain area.
[0121] By applying this embodiment, a first extended virtual terrain is generated based on the target terrain area when the first boundary point does not meet the preset search conditions. A lake can be generated based on the target terrain area when there is no diversion point, thereby improving the diversity of the target virtual terrain.
[0122] An embodiment of the present specification provides a method for generating a virtual terrain, which includes determining a first starting point and a first ending point in a target terrain grid; cyclically raising the first ending point based on a preset raising interval, and searching for at least one first extension point in the target terrain grid; generating an initial virtual terrain based on the first starting point and the first ending point when a target stopping condition is met, and generating an extended virtual terrain based on the first ending point, the first extension point, and the target stopping condition to obtain a target virtual terrain.
[0123] In this way, by cyclically raising the first end point based on a preset raising interval and searching for at least one first extension point in the target terrain grid, it is possible to search for the first extension point that can be used to generate an extended virtual terrain starting from the first end point, and improve the accuracy and search efficiency of the first extension point; by generating an extended virtual terrain based on the first end point, the first extension point and the target stop condition, it is possible to further generate an extended virtual terrain on the basis of generating the initial virtual terrain, so that it is possible to obtain a target virtual terrain with richer and more diverse forms based on the initial virtual terrain and the extended virtual terrain, avoid the target virtual terrain being too single, and achieve a more vivid and natural visual effect.
[0124] The following combination Figure 2 Taking the application of the virtual terrain generation method provided in this specification in river generation as an example, the virtual terrain generation method is further described. Figure 2 A schematic diagram of the processing process of a method for generating a virtual terrain provided by an embodiment of the present specification is shown.
[0125] Determine the starting point a of the river and determine the maximum pool volume Vmax.
[0126] Move from the starting point a in the direction of the descending terrain grid gradient to obtain the river path point, and based on the river path point, move in the direction of the descending terrain grid gradient to obtain the next river path point, and so on, until the search is done to find a terrain grid with no descending terrain around it, and obtain the pool point p0.
[0127] Starting from the pool point p0, enter the pool / lake / diversion point generation process, and generate a river through the water surface lifting and spreading algorithm.
[0128] The process of generating pools / lakes / diversion points based on the water surface uplift and spread algorithm includes: Let V be the volume of the pool, S be the surface area of the pool, H be the depth of the pool, and the size of a cell of the terrain grid be (Ux, Uy, Uz), where y is the vertical direction.
[0129] Specifically, U represents a unit length. In the terrain grid, the specific value of a unit length can be determined according to the needs of actual applications.
[0130] Starting from the pool point p0, raise it one unit height Uy to obtain p1 = p0 + (0,Uy,0), and record the initial H=Uy, V=Uy*Ux*Uz, S=Ux*Uz.
[0131] Starting from the position of p1, a search algorithm is used to diffuse along the preset direction within the horizontal plane where p1 is located.
[0132] Specifically, the preset direction may include forward, backward, left, and right, which may be set according to the requirements of the actual application. The search algorithm may include a breadth-first search algorithm, a depth-first search algorithm, and other search algorithms, and the breadth-first search algorithm is preferred here.
[0133] In the horizontal plane where p1 is located, for each point to be diffused, the ground height difference is calculated, and based on the ground height difference, it is determined whether the point to be diffused is a diffusion point or a boundary point.
[0134] Specifically, the surface height difference = the height of the point to be diffused - the height of the terrain at the corresponding position.
[0135] Among them, the height of the point to be diffused is the height of the point to be diffused in the current horizontal plane, and the height of the terrain at the corresponding position is the height value of the point to be diffused on the terrain grid, which can also be understood as the height value of the point to be diffused on the height map.
[0136] If the surface height difference is zero or negative, the point to be diffused is on or below the surface, and the point is marked as a boundary point; If the ground height difference is positive, mark the point as a diffusion point and update V=V+Hpi*Uy*Ux*Uz, S=S+Ux*Uz. Where Hpi is the ground height difference of diffusion point pi.
[0137] For example, Figure 2 As shown, in the horizontal plane where p1 is located, the surface height difference of point pi is positive, then point pi is a diffusion point.
[0138] Continue to gradually diffuse outward until you encounter a boundary point or a marked point, then stop diffusing in that direction.
[0139] For example, Figure 2 As shown, in the horizontal plane where p1 is located, it diffuses to the left and searches for point pm. The surface height difference of point pm is 0, so point pm is located on the surface and is a boundary point, and it stops diffusing to the left; it diffuses to the right and searches for point pn. The surface height difference of point pn is 0, so point pn is also located on the surface and is a boundary point, and it stops diffusing to the right.
[0140] If the preset stop condition is not met before the diffusion process ends, the diffusion result will form a closed boundary point.
[0141] Specifically, the preset stop condition includes encountering a terrain edge, or V>Vmax.
[0142] Furthermore, the horizontal plane is continuously raised by a unit height Uy, and the height H=H+Uy and the volume V=V+S*Uy are updated.
[0143] Check all boundary points and recalculate the new surface height difference of the boundary points. If the new surface height difference meets the diffusion point requirements, modify the boundary point to a diffusion point and continue to diffuse outward.
[0144] For example, Figure 2 As shown, pm and pn are initially boundary points. After being raised by 2Uy, the new surface height difference is positive, which meets the requirements of diffusion points. They are then modified to diffusion points, and based on pm and pn, they continue to diffuse outward in the horizontal plane where p2 is located. Assuming that starting from pn, diffusion to the right encounters point pj, since the calculated surface height difference of point pj is negative, it means that point pj is below the current surface and point pj is a boundary point.
[0145] The above process of water surface rising and spreading is repeated continuously until the preset stop condition is triggered.
[0146] When the preset stop condition is triggered by encountering the edge of the terrain, it will retreat to the closed area formed by the previous horizontal plane, form a lake based on the closed area, and there will be no new diversion points, and the generation will be terminated.
[0147] When the preset stop condition is triggered during the diffusion process, if V>Vmax, the diffusion is stopped and retreats to the closed area formed by the previous horizontal plane. The closed area is used as the pool L, and then it is detected whether there is a diversion point.
[0148] Check each boundary point of the pool L to see if there is a neighboring terrain grid with a decreasing height outside the pool L; If it exists, the boundary point is determined as a pre-dividing point and added to the pre-dividing point list; If it does not exist, the boundary point is excluded.
[0149] After the detection, if the list of pre-diversion points is empty, there is no diversion point, the algorithm ends, and the pool L is treated as a lake.
[0150] If the pre-divergence point list is not empty, point B with the lowest height is selected from the pre-divergence point list as the divergence point.
[0151] It should be noted that there may be one or more points with the lowest height. If there are multiple points, all of the multiple points with the same height are marked as diversion points.
[0152] Furthermore, when one or more diversion points are determined, the height of the pool L is adjusted to the height of the diversion point to fit the terrain.
[0153] Take each diversion point B as the starting point of a new river and continue to generate rivers.
[0154] It should be noted that the main river channel generated based on the diversion point B can be understood as a tributary of the target river. In the process of generating rivers based on the diversion point B and the subsequent generation of pools, the area where the pool has been formed needs to be excluded. The area where the pool has been formed can be regarded as the edge of the terrain.
[0155] By applying this embodiment, a water surface lifting and spreading algorithm can be executed from the valley point of the river to find pools and diversion points, and iteratively generate tributaries and lakes, so that the river generation can cross the terrain grooves and diversions, so that coherent multi-branch rivers and lakes can be generated at one time, improving the diversity of river generation and obtaining a more natural and realistic visual effect. In addition, the time complexity of executing the water surface lifting and spreading algorithm is at the O(N) level (N is the number of terrain grids), with high performance, so that it has the ability to generate in real time and can efficiently generate diversified rivers.
[0156] Corresponding to the above method embodiment, this specification also provides an embodiment of a device for generating a virtual terrain. Figure 3 FIG. 1 is a schematic diagram showing a structure of a virtual terrain generating device provided by an embodiment of the present specification. Figure 3 As shown, the device comprises: The determination module 302 is configured to determine a first starting point and a first ending point in the target terrain grid.
[0157] The search module 304 is configured to cyclically elevate the first end point based on a preset elevation interval, and search for at least one first extension point in the target terrain grid.
[0158] Generation module 306: is configured to generate an initial virtual terrain based on a first starting point and a first ending point when a target stop condition is reached, and to generate an extended virtual terrain based on a first ending point, a first extension point and the target stop condition to obtain a target virtual terrain.
[0159] Optionally, the search module 304 is further configured to: The first end point is raised by a preset raising interval to obtain the target point; In the horizontal plane where the target point is located, starting from the target point, cyclically searching for adjacent points along a preset direction to obtain initial extension points and initial boundary points, wherein the initial boundary points are used to form a closed terrain area; The target point is lifted by a preset lifting interval, and the point after the lifting is determined as the target point; In the horizontal plane where the target point is located, based on the initial boundary point, a cyclic search for adjacent points is performed in a direction outside the closed terrain area to obtain a first extended point.
[0160] Optionally, the search module 304 is further configured to: In the horizontal plane where the target point is located, based on the initial boundary point, the adjacent points are cyclically searched in the direction outside the closed terrain area; For the current point searched, based on the current point height and the terrain height of the current point, the type of the current point is determined, and the point of the extension type is determined as the initial extension point, wherein the type includes the extension type and the boundary type; In the case where a point of the boundary type can form a new closed terrain area, determining the initial extension point as the first extension point; The initial boundary point is updated based on the point of the boundary type, and the step of raising the target point by a preset raising interval is returned to be executed, and the raised point is determined as the target point.
[0161] Optionally, the generating module 306 is further configured to: Determining a target first extension point from the first extension points; According to the target stop condition, an extended virtual terrain is generated based on the first termination point and the target first extension point.
[0162] Optionally, the target stop condition includes searching for a terrain edge; the generating module 306 is further configured to: When the edge of the terrain is found, a first extended virtual terrain is generated based on the first termination point and the target first extension point.
[0163] Optionally, the target stop condition includes that the current terrain area volume exceeds the preset terrain area volume; the generating module 306 is further configured to: Based on the first termination point and the target first extension point, a target terrain area is formed; A first boundary point of the target terrain area is determined, and based on whether the first boundary point meets a preset search condition, an extended virtual terrain is generated.
[0164] Optionally, the generating module 306 is further configured to: If there is at least one first boundary point that meets the preset search condition, determining a target first boundary point from the at least one first boundary point; Determine the first boundary point of the target as the diversion point corresponding to the target terrain area; A second extended virtual terrain is generated based on the target terrain area and the diversion point.
[0165] Optionally, the generating module 306 is further configured to: When the first boundary point does not meet the preset search condition, a first extended virtual terrain is generated based on the target terrain area.
[0166] By applying this embodiment, by cyclically raising the first end point based on a preset raising interval and searching for at least one first extension point in the target terrain grid, it is possible to search for the first extension point that can be used to generate an extended virtual terrain starting from the first end point, and improve the accuracy and search efficiency of the first extension point; by generating an extended virtual terrain based on the first end point, the first extension point and the target stop condition, it is possible to further generate an extended virtual terrain on the basis of generating the initial virtual terrain, so that a target virtual terrain with richer and more diverse forms can be obtained based on the initial virtual terrain and the extended virtual terrain, avoiding the target virtual terrain being too single and achieving a more vivid and natural visual effect.
[0167] The above is a schematic scheme of a virtual terrain generation device of this embodiment. It should be noted that the technical scheme of the virtual terrain generation device and the technical scheme of the virtual terrain generation method described above belong to the same concept, and the details of the technical scheme of the virtual terrain generation device that are not described in detail can all be referred to the description of the technical scheme of the virtual terrain generation method described above.
[0168] Figure 4 The block diagram of a computing device 400 according to one embodiment of the present specification is shown. The components of the computing device 400 include but are not limited to a memory 410 and a processor 420. The processor 420 is connected to the memory 410 via a bus 430, and the database 450 is used to store data.
[0169] The computing device 400 also includes an access device 440 that enables the computing device 400 to communicate via one or more networks 460. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 440 may include one or more of any type of network interface (e.g., a network interface card (NIC)) that is wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a world-wide interoperability for microwave access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, and a near field communication (NFC).
[0170] In one embodiment of the present specification, the above components of the computing device 400 and Figure 4 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 4 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.
[0171] The computing device 400 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 400 may also be a mobile or stationary server.
[0172] The processor 420 is used to execute the following computer executable instructions, which, when executed by the processor, implement the steps of the above-mentioned method for generating virtual terrain.
[0173] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the above-mentioned method for generating virtual terrain are of the same concept, and the details not described in detail in the technical scheme of the computing device can be found in the description of the technical scheme of the above-mentioned method for generating virtual terrain.
[0174] An embodiment of the present specification further provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the steps of the above-mentioned method for generating virtual terrain.
[0175] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the above-mentioned method for generating virtual terrain are of the same concept, and the details not described in detail in the technical scheme of the storage medium can be referred to the description of the technical scheme of the above-mentioned method for generating virtual terrain.
[0176] An embodiment of the present specification further provides a computer program product, including a computer program / instruction, which implements the steps of the above-mentioned method for generating virtual terrain when executed by a processor.
[0177] The above is a schematic scheme of a computer program product of this embodiment. It should be noted that the technical scheme of the computer program product and the technical scheme of the above-mentioned method for generating virtual terrain are of the same concept, and the details not described in detail in the technical scheme of the computer program product can be referred to the description of the technical scheme of the above-mentioned method for generating virtual terrain.
[0178] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0179] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0180] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of this specification are not limited by the order of the actions described, because according to the embodiments of this specification, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of this specification.
[0181] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0182] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The optional embodiments do not describe all the details in detail, nor do they limit the invention to only the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the embodiments of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of this specification, so that technicians in the relevant technical field can well understand and use this specification. This specification is only limited by the claims and their full scope and equivalents.
Claims
1. A method for generating a virtual terrain, characterized in that: include: Determine a first starting point and a first ending point in the target terrain grid; Based on a preset lifting interval, cyclically lifting the first end point, and searching for at least one first extension point in the target terrain grid; When the target stop condition is met, an initial virtual terrain is generated based on the first starting point and the first ending point, and an extended virtual terrain is generated based on the first ending point, the first extension point and the target stop condition to obtain a target virtual terrain.
2. The method according to claim 1, characterized in that The step of cyclically raising the first end point based on a preset raising interval and searching for at least one first extension point in the target terrain grid comprises: Raising the first end point by a preset raising interval to obtain a target point; In the horizontal plane where the target point is located, starting from the target point, cyclically searching for adjacent points along a preset direction to obtain initial extension points and initial boundary points, wherein the initial boundary points are used to form a closed terrain area; The target point is raised by a preset raising interval, and the raised point is determined to be the target point; In the horizontal plane where the target point is located, based on the initial boundary point, a cyclic search for adjacent points is performed in a direction outside the closed terrain area to obtain a first extended point.
3. The method according to claim 2, characterized in that The step of cyclically searching for adjacent points in a direction outside the closed terrain area based on the initial boundary point in the horizontal plane where the target point is located to obtain a first extended point includes: In the horizontal plane where the target point is located, based on the initial boundary point, cyclically searching for adjacent points in a direction outside the closed terrain area; For the searched current point, based on the height of the current point and the terrain height of the current point, determine the type of the current point, and determine the point of the extension type as the initial extension point, wherein the type includes the extension type and the boundary type; In the case where the point of the boundary type can form a new closed terrain area, determining the initial extension point as the first extension point; The initial boundary point is updated based on the point of the boundary type, and the step of returning to execute raising the target point by a preset raising interval and determining the raised point as the target point is performed.
4. The method according to claim 1, characterized in that: The step of generating the extended virtual terrain based on the first termination point, the first extension point and the target stop condition comprises: Determining a target first extension point from among the first extension points; According to the target stop condition, an extended virtual terrain is generated based on the first termination point and the target first extension point.
5. The method according to claim 4, characterized in that The target stopping condition includes searching for the edge of the terrain; The step of generating an extended virtual terrain according to the target stop condition and based on the first termination point and the target first extension point includes: When the edge of the terrain is found, a first extended virtual terrain is generated based on the first termination point and the target first extension point.
6. The method according to claim 4, characterized in that The target stop condition includes that the current terrain area volume exceeds the preset terrain area volume; The step of generating an extended virtual terrain according to the target stop condition and based on the first termination point and the target first extension point includes: Based on the first termination point and the target first extension point, forming a target terrain area; A first boundary point of the target terrain area is determined, and an extended virtual terrain is generated based on whether the first boundary point meets a preset search condition.
7. The method according to claim 6, characterized in that The step of generating the extended virtual terrain according to whether the at least one adjacent point meets a preset search condition comprises: If there is at least one first boundary point that meets the preset search condition, determining a target first boundary point from the at least one first boundary point; Determining the target first boundary point as the diversion point corresponding to the target terrain area; A second extended virtual terrain is generated based on the target terrain area and the diversion point.
8. The method according to claim 6, characterized in that The step of generating the extended virtual terrain according to whether the at least one adjacent point meets a preset search condition comprises: When the first boundary point does not meet the preset search condition, a first extended virtual terrain is generated based on the target terrain area.
9. A device for generating virtual terrain, characterized in that: include: A determination module is configured to determine a first starting point and a first ending point in a target terrain grid; A search module is configured to cyclically elevate the first end point based on a preset elevation interval, and search for at least one first extension point in the target terrain grid; The generation module is configured to generate an initial virtual terrain based on the first starting point and the first ending point when the target stopping condition is met, and to generate an extended virtual terrain based on the first ending point, the first extension point and the target stopping condition to obtain a target virtual terrain.
10. A computing device, characterized in that include: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer programs / instructions are executed by the processor, the steps of the method for generating virtual terrain according to any one of claims 1 to 8 are implemented.
11. A computer-readable storage medium, characterized in that: It stores a computer program / instruction, which, when executed by a processor, implements the steps of the method for generating a virtual terrain as described in any one of claims 1 to 8.
12. A computer program product, characterized in that The method comprises a computer program / instruction, which, when executed by a processor, implements the steps of the method for generating a virtual terrain as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Stratum entity automatic modeling method based on virtual terrain surface
CN114399605A
Virtual landform generation method and device, computer equipment and storage medium
CN115518376A
Map generation method and apparatus
WO2023232055A1