Method and apparatus for generating virtual terrain
By cyclically raising the termination point in the virtual terrain grid to search for extension points, extended virtual terrain is generated, solving the problem of the uniformity of river generation in existing technologies, realizing the generation of virtual terrain with diverse forms, and improving visual realism.
Patent Information
- Application Number
- CN202411878489.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2044-12-19
AI Technical Summary
In existing technologies, the methods for generating rivers are limited and it is difficult to cross complex terrains, resulting in visual effects that are not realistic and natural enough, and it is impossible to generate continuous and diverse virtual terrains in one go.
In the target terrain grid, determine the starting point and the ending point, cyclically raise the ending point at a preset raising interval, search for extension points, generate the initial virtual terrain, and generate extended virtual terrain based on the ending point, extension points and stopping conditions.
It improves the accuracy and search efficiency of extended points, generates more diverse virtual terrains, avoids overly simplistic target virtual terrains, and achieves a more vivid and natural visual effect.
Smart Images

Figure CN119722971B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present specification relate to the technical field of computer technology, and in particular, to a virtual terrain generation method and device. BACKGROUND
[0002] In the development of a virtual world, the design and layout of natural landscapes are very important. The drawing of a virtual terrain greatly affects the visual effect of the virtual world and determines whether the virtual world looks real and natural.
[0003] Taking a virtual terrain including a river as an example, as an important part of natural terrain, the generation of a river in a virtual world can enrich the natural landscape of the virtual world and bring users a realistic visual experience. However, at present, a river is usually generated based on a line connecting a starting point and an ending point on a world terrain. This generation method often forms a single river that is difficult to cross complex terrain, thereby making it difficult to generate a coherent and diverse river in one go, resulting in a visual effect that is difficult to meet expectations. Therefore, a better virtual terrain generation method is urgently needed. SUMMARY
[0004] In view of this, the embodiments of the present specification provide a virtual terrain generation method. One or more embodiments of the present specification also relate to a virtual terrain generation device, a computing device, a computer-readable storage medium, and a computer program product to solve the technical defects in the prior art.
[0005] According to a first aspect of the embodiments of the present specification, a virtual terrain generation method is provided, including:
[0006] determining a first starting point and a first ending point in a target terrain grid;
[0007] based on a preset lifting interval, cyclically lifting the first ending point to search for at least one first extension point in the target terrain grid;
[0008] in the case of reaching a target stop condition, generating an initial virtual terrain based on the first starting point and the first ending point, and generating an extended virtual terrain based on the first ending point, the first extension point, and the target stop condition, to obtain a target virtual terrain.
[0009] According to a second aspect of the embodiments of the present specification, a virtual terrain generation device is provided, including:
[0010] a determination module configured to determine a first starting point and a first ending point in a target terrain grid;
[0011] The search module is configured to search at least one first extension point in the target terrain grid by cyclically lifting the first termination point based on a preset lifting interval.
[0012] The generation module is configured to generate an initial virtual terrain based on the first start point and the first termination point, and generate an extended virtual terrain based on the first termination point, the first extension point, and the target stop condition, to obtain the target virtual terrain, in a case where the target stop condition is reached.
[0013] According to a third aspect of an embodiment of the present specification, a computing device is provided, comprising:
[0014] a memory and a processor;
[0015] The memory is configured to store computer executable instructions, and the processor is configured to execute the computer executable instructions, which, when executed by the processor, implement the steps of the virtual terrain generation method.
[0016] According to a fourth aspect of an embodiment of the present specification, a computer readable storage medium is provided, which stores computer executable instructions, which, when executed by a processor, implement the steps of the virtual terrain generation method.
[0017] According to a fifth aspect of an embodiment of the present specification, a computer program product is provided, comprising computer programs / instructions, which, when executed by a processor, implement the steps of the virtual terrain generation method.
[0018] One embodiment of the present specification realizes determining a first start point and a first termination point in a target terrain grid, searching at least one first extension point in the target terrain grid by cyclically lifting the first termination point based on a preset lifting interval, generating an initial virtual terrain based on the first start point and the first termination point in a case where a target stop condition is reached, and generating an extended virtual terrain based on the first termination point, the first extension point, and the target stop condition to obtain a target virtual terrain.
[0019] In this way, by searching at least one first extension point in the target terrain grid by cyclically lifting the first termination point based on a preset lifting interval, the first extension point that can be used to generate an extended virtual terrain can be searched starting from the first termination point, and the accuracy and search efficiency of the first extension point are improved. By generating an extended virtual terrain based on the first termination point, the first extension point, and the target stop condition, an extended virtual terrain can be further generated based on the initial virtual terrain, so that a target virtual terrain with 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 lively and natural visual effect. BRIEF DESCRIPTION OF DRAWINGS
[0020] Figure 1 is a flowchart of a method for generating a virtual terrain according to an embodiment of the present specification;
[0021] Figure 2 is a schematic diagram of a processing procedure of a method for generating a virtual terrain according to an embodiment of the present specification;
[0022] Figure 3 is a structural schematic diagram of a device for generating a virtual terrain according to an embodiment of the present specification;
[0023] Figure 4 is a structural block diagram of a computing device according to an embodiment of the present specification. DETAILED DESCRIPTION
[0024] In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present specification. However, the present specification can be practiced without the specific details, which are not described in the present specification, and it is understood that the scope of the present specification is not limited to the details of the description. It will further be recognized that the aspects of the present specification can be practiced with modifications other than those described in the present specification, and in contexts other than those described in the present specification, without departing from the scope and spirit of the aspects of the present specification.
[0025] The terminology used in one or more embodiments of the present specification is for the purpose of describing particular embodiments only and is not intended to be limiting of one or more embodiments of the present specification. As used in one or more embodiments of the present specification and the accompanying claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and / or "comprising," when used in one or more embodiments of the present specification, specify the presence of stated features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0026] It is to be understood that the singular forms "a," "an," and "the" include plural referents unless the context clearly dictates otherwise. It is to be further understood that the terms "comprises," "comprising," "includes," "including," "has," "having" and the like, when used in one or more embodiments of the present specification, specify the presence of stated features, integers, steps, operations, elements, and / or components but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. It is to be understood that the terms "and / or," "and," and "or" as used herein, refer to a functionally independent
[0027] In addition, it should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in one or more embodiments of the present specification are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation portal for user to choose authorization or rejection.
[0028] Firstly, the terms involved in one or more embodiments of the present specification are explained.
[0029] Valley point: refers to the lowest elevation position of a river in the flowing process. In the present specification, the valley point can be understood as the end point of a river channel in the terrain grid.
[0030] Distributary point: at the distributary point, the river can separate two or more independent waterways from the main river channel. Each newly formed waterway can be called a tributary, a branch or a branch river.
[0031] Terrain notch: refers to a closed low-lying area on the ground surface, which has the characteristics of higher on the four sides and lower in the middle. The terrain notch can form a relatively closed space.
[0032] Terrain grid: is a three-dimensional geometric structure used to represent the ground or surface in a game world. It is usually composed of a large number of polygons (such as triangles), which together form a continuous surface to simulate the terrain features in the real world, such as mountains, rivers, plains, etc. The terrain grid is the basis for creating and rendering a large world environment.
[0033] Breadth-First Search (BFS): is an algorithm for traversing or searching a graph structure. Starting from a starting node, first visit all the neighbor nodes directly connected to the node, then visit the unvisited neighbor nodes of these neighbor nodes in turn, and so on, until all reachable nodes are visited.
[0034] Virtual large world often contains a variety of virtual terrains. For virtual terrains that can flow on the surface, such as rivers, magma, etc., the common generation algorithm is to determine a starting point and an ending point in the large world terrain, and generate a virtual terrain based on the connection between the two points. The virtual terrain generated in this way often has a single form and cannot cross terrain notches and distributaries, is easy to break flow, and thus cannot generate virtual terrains with diversified forms in one go, resulting in a less realistic visual effect.
[0035] Based on this, the embodiment of the present specification provides a virtual terrain generation method, determines a first starting point and a first ending point in a target terrain grid; based on a preset lifting interval, cyclically lifting the first ending point, searching for at least one first extension point in the target terrain grid; in the case of reaching a target stop condition, generating an initial virtual terrain based on the first starting point and the first ending point, and generating an extended virtual terrain based on the first ending point, the first extension point and the target stop condition, to obtain a target virtual terrain.
[0036] In this way, by cyclically lifting the first ending point based on the preset lifting interval, searching for at least one first extension point in the target terrain grid, the first extension point that can be used to generate the extended virtual terrain can be searched from the first ending point, and the accuracy and search efficiency of the first extension point are improved; by generating the extended virtual terrain based on the first ending point, the first extension point and the target stop condition, the extended virtual terrain can be further generated on the basis of the initial virtual terrain, so that the target virtual terrain with 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, achieving a more lively and natural visual effect.
[0037] In the present specification, a virtual terrain generation method is provided, and the present specification also relates to a virtual terrain generation device, a computing device, a computer readable storage medium, and a computer program product, which are described one by one in the following embodiments.
[0038] Referring to Figure 1 , Figure 1 A flowchart of a virtual terrain generation method according to an embodiment of the present specification is shown, which specifically includes the following steps.
[0039] Step 102: determining a first starting point and a first ending point in a target terrain grid.
[0040] In practical applications, the first starting point and the first ending point can be determined based on the target terrain grid.
[0041] Specifically, the target terrain grid can be understood as a terrain grid corresponding to a target virtual world. The target virtual world can be understood as a virtual world that currently needs to generate a virtual terrain. The virtual world can be understood as a broad and coherent virtual environment constructed in a virtual scene, in which a user (such as a player) can freely explore and interact (including interacting with the scene or interacting with other players).
[0042] Exemplarily, the virtual large world design in game development not only includes creating a large map, but also includes a complex ecosystem, a dynamic weather system, rich NPC behaviors, diverse topography, etc., so as to provide an immersive game experience for players.
[0043] Specifically, the target terrain mesh can be understood as a three-dimensional geometric structure for representing the surface of the target virtual large world. The target terrain mesh can be composed of a large number of polygons (such as triangles), which collectively form a continuous surface. Each point in the target terrain mesh can have a corresponding surface height.
[0044] Optionally, the surface height of each point in the target terrain mesh can be obtained according to the height map of the target virtual large world.
[0045] Specifically, the first starting point can be understood as the starting point of the initial virtual terrain. The first terminal point can be understood as the terminal point of the initial virtual terrain, and can also be understood as the valley point. The first starting point and the first terminal point are points on the target terrain mesh.
[0046] Specifically, the virtual terrain can be understood as a terrain where the surface can flow, such as a river, magma, etc. For ease of illustration, the following description will use the virtual terrain as a river to further explain each embodiment.
[0047] Further, the initial virtual terrain can be understood as an initial form of virtual terrain. Exemplarily, it can be the main channel of the river. The extended virtual terrain can be understood as an extended form of virtual terrain extended on the basis of the initial form of virtual terrain. Exemplarily, it can be a lake or a pool formed at the valley point of the river, or a tributary formed at the branch point of the river.
[0048] Optionally, the first starting point can be determined according to the requirements in actual application, and is often a point with a higher position in the terrain mesh.
[0049] Optionally, the first terminal point can be determined based on the first starting point, and specifically can include:
[0050] Starting from the first starting point, the adjacent point is searched in the direction of gradient descent of the target terrain mesh, and the last searched point is determined as the first terminal point.
[0051] Specifically, the direction of gradient descent can be understood as the direction with the fastest height drop.
[0052] In actual applications, the first starting point can be taken as a starting point, and adjacent point positions can be searched in a direction of fastest height drop in the target terrain grid; the searched adjacent point positions can be determined as way point positions of the main river channel, and adjacent point positions of the way point positions can be searched in a direction of gradient drop; until no terrain grid with a drop is found around, a last point position is searched, and the last point position is the first terminal point.
[0053] It should be noted that the main river channel of the river can be generated based on the first starting point, the way point positions, and the first terminal point, that is, an initial virtual terrain.
[0054] In step 104, the first terminal point is cyclically lifted based on a preset lifting interval, and at least one first extension point is searched in the target terrain grid.
[0055] Specifically, the preset lifting interval can be understood as a lifting distance in the vertical direction, which is used to realize layer-by-layer lifting of the horizontal plane in each cycle.
[0056] Optionally, the preset lifting interval can be set in advance according to the needs in actual applications, for example, can be a unit height in the target terrain grid.
[0057] Specifically, the first extension point can be understood as a point position for generating an extended virtual terrain, which is a point position on the target terrain grid.
[0058] Optionally, the first extension point can be searched based on the lifted target point.
[0059] In one or more optional embodiments of the present specification, the process of searching the first extension point can include a process of cyclically lifting vertically and diffusing horizontally: starting from the first terminal point, lifting upward by a preset lifting interval each time, diffusing horizontally in the horizontal plane obtained by lifting, and searching for the first extension point; after completing the search in the current horizontal plane, continue to lift upward by the preset lifting interval, continue to diffuse horizontally in the horizontal plane obtained by lifting, and search for the first extension point; and so on, until a preset stop condition is reached.
[0060] According to one or more optional embodiments of the present specification, based on the preset lifting interval, the first terminal point is cyclically lifted, and at least one first extension point is searched in the target terrain grid, which can include the following steps:
[0061] The first terminal point is lifted by a preset lifting interval to obtain a target point;
[0062] In the horizontal plane where the target point is located, adjacent point positions are cyclically searched in a preset direction from the target point to obtain an initial extension point and an initial boundary point, wherein the initial boundary point is used to form a closed terrain region.
[0063] Lifting the target point by a preset lifting interval, and determining the lifted point as the target point;
[0064] In the horizontal plane where the target point is located, based on the initial boundary point, searching for adjacent points in a direction towards the outside of the closed terrain region, and obtaining a first extended point.
[0065] Specifically, the target point can be the first termination point initially, and after each lifting, the lifted point can be updated as the target point. The preset direction can be determined according to the requirements in actual application, which is not limited in the present specification. For example, it can be forward, backward, left, or right.
[0066] It should be noted that in the horizontal plane where the target point is located, the current point height of each point searched is unchanged, and is the height of the current horizontal plane.
[0067] Specifically, the initial extended point can be understood as the extended point searched after lifting the first termination point by a preset lifting interval. The extended point can also be understood as a diffusion point, which is a point obtained by diffusion from the target point.
[0068] Specifically, the initial boundary point can be understood as the boundary point searched after lifting the first termination point by a preset lifting interval. The boundary point can be understood as a point located on or below the ground surface.
[0069] Optionally, in the case of lifting the first termination point by a preset lifting interval to obtain the target point, the preset search algorithm can be used to search for each to-be-diffused point in the horizontal plane where the target point is located, starting from the target point and outwardly diffusing.
[0070] Specifically, the preset search algorithm is used to search for the to-be-diffused point in the current horizontal plane, which can be a breadth-first search algorithm, a depth-first search algorithm, or other search algorithms. The specific algorithm can be determined according to the requirements in actual application.
[0071] Further, for each to-be-diffused point, the to-be-diffused point can be determined to be an extended point or a boundary point according to the current point height and the terrain height.
[0072] Specifically, the to-be-diffused point can also be understood as the current point searched by the preset search algorithm.
[0073] Optionally, the ground surface height difference can be obtained by subtracting the current point height from the terrain height; and based on the ground surface height difference, the current point searched is determined to be an extended point or a boundary point.
[0074] Specifically, the ground height difference refers to a difference between the current point height and a terrain height of the current point. When the ground height difference is positive, it indicates that the current point is an extension point. When the ground height difference is zero or negative, it indicates that the current point is a boundary point. When the ground height difference is zero, it indicates that the current point is located on the ground. When the ground height difference is negative, it indicates that the current point is located below the ground.
[0075] In actual applications, for each searched point, corresponding marking processing can be performed. When the diffusion process of the current horizontal plane ends without triggering the preset stop condition, an initial extension point and an initial boundary point can be obtained. The initial extension point can form a closed terrain region.
[0076] Specifically, the preset stop condition can include encountering a terrain edge during the diffusion process, or a volume of the current formed terrain region being greater than a preset maximum volume.
[0077] Further, on the basis of obtaining the initial extension point and the initial boundary point, the target point can be continuously lifted to obtain a lifted target point, so that the diffusion process can be continued from the initial boundary point outward in the current horizontal plane in which the lifted target point is located, to search for a new extension point and obtain a first extension point.
[0078] According to one or more optional embodiments of the present specification, in order to detect whether the 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, a maximum volume, an initial volume, an initial surface area, and an initial depth can be preset.
[0079] During the process of lifting the target point and searching for the extension point, the current volume, the current surface area, and the current depth can be continuously updated based on the initial volume, the initial surface area, and the initial depth, and it is detected whether the current volume is greater than the maximum volume.
[0080] If yes, the preset stop condition is triggered; if no, the preset stop condition is not triggered.
[0081] In an optional embodiment of the present specification, each time the target point is lifted, the height (H) can be updated to the current height plus a preset lifting interval, and the current volume can be updated based on the current surface area and the preset lifting interval.
[0082] Illustratively, if the preset lifting interval is one unit height Uy, H = H + Uy, and the volume V = V + S * Uy is updated.
[0083] In an optional embodiment of the present disclosure, in 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.
[0084] For example, if an extension point pi is searched, and the terrain height difference is Hpi, the surface area S is updated to S+Ux*Uz, and the volume V is updated to V+Hpi*Uy*Ux*Uz.
[0085] By applying the present embodiment, the first extension point for forming the closed region can be searched in the horizontal plane of the target point by starting from the first termination point and constantly raising the target point based on the preset raising interval, so that the extended virtual terrain can be further generated based on the initial virtual terrain according to the first extension point, and the target virtual terrain with diversified shapes can be generated at one time, achieving better virtual terrain generation effect.
[0086] According to one or more optional embodiments of the present disclosure, the first extension point can be obtained by the following steps in the horizontal plane of the target point based on the initial boundary point and searching adjacent points in the direction towards the outside of the closed terrain region:
[0087] In the horizontal plane of the target point, the initial boundary point is searched in the direction towards the outside of the closed terrain region;
[0088] For the searched current point, 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, wherein the type includes the extension type and the boundary type;
[0089] In the case that the point of the boundary type can form a new closed terrain region, the initial extension point is determined as the first extension point;
[0090] 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 and determining the raised point as the target point is returned.
[0091] Specifically, the current point can be understood as a to-be-diffused point searched in the horizontal diffusion process. The type of the current point can include the extension type and the boundary type. The current point can be the initial boundary point or a point not marked in the current horizontal plane. The terrain height can be understood as the height of the current point in the target terrain grid.
[0092] In actual application, the initial boundary point is marked as the point of the boundary type in the layer before being raised, and the horizontal diffusion is performed from the initial boundary point.
[0093] Optionally, the updated ground height difference of the initial boundary point position can be calculated based on a difference between the current point position height of the initial boundary point position and the terrain height of the initial boundary point position. In the case that the ground height difference is positive, the initial boundary point position is updated to the initial extension point position.
[0094] The current point position height of the initial boundary point position can be understood as the height of the initial boundary point position on the current horizontal plane; the terrain height of the initial boundary point position can be understood as the height of the initial boundary point position on the target terrain grid, or the height on the height map.
[0095] Further, in the direction outward from the current horizontal plane, a neighboring point position of the initial extension point position is searched to obtain a new point position to be diffused; and the ground height difference of the point position to be diffused is calculated based on a difference between the current point position height of the point position to be diffused and the terrain height. In the case that the ground height difference is positive, the point position to be diffused is marked as the initial extension point position. By analogy, the search in the direction is stopped until a boundary point position or a point position that has been marked is searched.
[0096] Optionally, in the case that the initial extension point position can form a new closed terrain region, the initial extension point position can be determined as the first extension point position, that is, based on the first extension point position, the closed terrain region can be obtained.
[0097] Further, the point position of the boundary type searched in the current horizontal plane can be updated to the initial boundary point position, and the step of lifting the target point position by the preset lifting interval to determine the lifted point position as the target point position is returned to be executed. In this way, the target point position can be lifted layer by layer, and all point positions that can be used to form the terrain groove in the terrain grid can be searched.
[0098] By applying the embodiment, by searching the neighboring point positions in the direction outward from the closed terrain region based on the initial boundary point position in the horizontal plane where the target point position is located, and determining the type of the current point position based on the current point position height and the terrain height of the current point position, and determining the point position of the extension type as the initial extension point position, in the subsequent lifting process, the boundary point position searched previously can be continuously diffused outward, and in the case that a new closed region can be formed, the horizontal plane can be continuously lifted, so that each point position that can be used to form the closed terrain region can be searched, and the generation efficiency of the extended virtual terrain is improved.
[0099] Step 106: In the case that the target stop condition is reached, an initial virtual terrain is generated based on the first starting point position and the first terminal point position, and an extended virtual terrain is generated based on the first terminal point position, the first extension point position and the target stop condition to obtain a target virtual terrain.
[0100] In actual application, in the case that the cyclic lifting and horizontal diffusion process reaches the target stop condition, the initial virtual terrain can be generated based on the first start point and the first end point, and the extended virtual terrain can be generated based on the first end point, the first extension point and the target stop condition, so as to obtain the target virtual terrain.
[0101] Specifically, the target stop condition can be understood as one of the preset stop conditions, and the preset stop condition can be understood as a condition for stopping the execution of the cyclic lifting and horizontal diffusion process.
[0102] Optionally, the preset stop condition can include encountering a terrain edge in the diffusion process, or the volume of the terrain region formed based on the first extension point exceeding a preset maximum volume in the lifting or diffusion process.
[0103] Specifically, the terrain edge can be understood as a point located at the outermost circle of the target terrain grid.
[0104] Specifically, the virtual terrain can be understood as a terrain in which the surface can flow, such as a river, magma, etc. The initial virtual terrain can be understood as an initial form of virtual terrain. For example, it can be the main river channel of a river. The extended virtual terrain can be understood as a virtual terrain different from the initial form of virtual terrain, which is extended or formed on the basis of the initial form of 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 branch point of a river.
[0105] It should be noted that the initial virtual terrain and the extended virtual terrain are connected in the entire virtual terrain of the big world and do not flow off. The initial virtual terrain and the extended virtual terrain form the target virtual terrain as a whole.
[0106] According to one or more optional embodiments of the present specification, generating the initial virtual terrain based on the first start point and the first end point can include the following steps:
[0107] determining each path point between the first start point and the first end point;
[0108] generating the initial virtual terrain based on the first start point, each path point and the first end point.
[0109] Optionally, each path point is obtained by cyclically searching adjacent points from the first start point along the direction of gradient descent in the target terrain grid.
[0110] In actual application, in the case that the target virtual terrain is a river, the initial virtual terrain can be understood as the main river channel of the river.
[0111] According to one or more optional embodiments of the present specification, generating the extended virtual terrain based on the first termination point, the first extension point, and the target stop condition can include the following steps:
[0112] Determining the target first extension point from the first extension point;
[0113] Generating the extended virtual terrain based on the first termination point and the target first extension point according to the target stop condition.
[0114] Optionally, determining the target first extension point from the first extension point can include:
[0115] Eliminating the first extension point searched at the current level from the first extension point to obtain the target first extension point.
[0116] Specifically, the target first extension point can be understood as the first extension point searched based on other layer levels before being lifted to the current level.
[0117] In actual application, if the target stop condition is reached, that is, the terrain edge is searched or the current volume is greater than the preset maximum volume, it is necessary to retreat to the closed area formed by the previous level to form the extended virtual terrain. Therefore, if the terrain edge is searched during the horizontal diffusion process or the current volume is greater than the preset maximum volume during the horizontal diffusion process, it is necessary to eliminate the first extension point searched at the layer to generate the extended virtual terrain based on other first extension points.
[0118] Optionally, determining the target first extension point from the first extension point can also include:
[0119] Determining the first extension point as the target first extension point.
[0120] In actual application, if it is detected during the lifting process that the volume after lifting is greater than the preset maximum volume, horizontal diffusion can not be performed, and the previous level is retreated to generate the extended virtual terrain based on all the searched first extension points.
[0121] By generating the extended virtual terrain based on the first termination point and the target first extension point according to the target stop condition, the application of the present embodiment can generate different styles of extended virtual terrain based on different target stop conditions, thereby increasing the diversity of the target virtual terrain.
[0122] In one optional embodiment of the present specification, the target stop condition includes searching the terrain edge; generating the extended virtual terrain based on the first termination point and the target first extension point according to the target stop condition can include the following steps:
[0123] In the case of searching the terrain edge, the first extended virtual terrain is generated based on the first termination point and the target first extension point.
[0124] Specifically, the terrain edge can be understood as a point located at the outermost circle of the target terrain grid.
[0125] In practical applications, the target virtual terrain can include a variety of different styles or forms. For example, in the case of a river, the target virtual terrain can include at least one of the main river channel, lake, pool, tributary, etc.
[0126] The first extended virtual terrain can be understood as one of the styles of the target virtual terrain, which can be a lake.
[0127] By generating the first extended virtual terrain based on the first termination point and the target first extension point in the case of searching the terrain edge, the target virtual terrain containing the main river channel and the lake can be generated in the case of encountering the terrain edge, so that the virtual terrain containing two styles can be generated at one time, and the diversity of virtual terrain generation is improved.
[0128] In another alternative embodiment of the present specification, the target stop condition includes that the current terrain area volume exceeds the preset terrain area volume; and based on the first termination point and the target first extension point, the extended virtual terrain is generated according to the target stop condition, which can include the following steps:
[0129] Based on the first termination point and the target first extension point, the target terrain area is formed;
[0130] The first boundary point of the target terrain area is determined, and the extended virtual terrain is generated based on whether the first boundary point meets the preset search condition.
[0131] Specifically, the current terrain area volume can be understood as the currently recorded volume value, i.e. V. The preset terrain area volume can be understood as the maximum volume preset, i.e. Vmax.
[0132] 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, i.e. a boundary point of the pool area.
[0133] In practical applications, in the case of forming the target terrain area, all boundary points of the target terrain area can be checked to check whether there is a neighbor terrain grid with a height drop outside the target terrain area.
[0134] Specifically, the preset search condition can include that the first boundary point has a neighbor terrain grid with a height drop outside the target terrain area.
[0135] In actual applications, if the first boundary point position exists, the first boundary point position meets the preset search condition, and the first boundary point position is added to the pre-branch point list; if not, the first boundary point position is excluded.
[0136] By determining the first boundary point position of the target terrain region and generating the extended virtual terrain based on whether the first boundary point position meets the preset search condition, the application can further search for whether a branch point exists in the river based on the formation of the pool region, so as to generate different forms of rivers based on whether a branch point exists, and realize the search for the branch point and the generation of diversified rivers.
[0137] In an optional embodiment of the present specification, generating the extended virtual terrain based on whether the first boundary point position meets the preset search condition can include the following steps:
[0138] If there is at least one first boundary point position meeting the preset search condition, a target first boundary point position is determined from the at least one first boundary point position;
[0139] The target first boundary point position is determined as the branch point position corresponding to the target terrain region;
[0140] Based on the target terrain region and the branch point position, a second extended virtual terrain is generated.
[0141] Specifically, the second extended virtual terrain can include a pool and at least one tributary.
[0142] Optionally, if there is at least one first boundary point position meeting the preset search condition, a target first boundary point position is determined from the at least one first boundary point position, which can include:
[0143] The first boundary point position meeting the preset search condition is added to the pre-branch point list;
[0144] The first boundary point position with the lowest height is selected from the pre-branch point list to determine as the target first boundary point position.
[0145] In actual applications, the target first boundary point position can include one or more. If there are multiple first boundary point positions with the lowest height, the target first boundary point position includes multiple first boundary point positions.
[0146] Optionally, determining the target first boundary point position as the branch point position corresponding to the target terrain region can include:
[0147] The target first boundary point position is marked as the branch point position corresponding to the target terrain region.
[0148] In actual applications, in the case where the target first boundary point position is multiple, the branch point position can include multiple.
[0149] Further, in the case that one or more branch points are determined, the water pool can be generated based on the target terrain region, and the branch stream can be generated based on the branch points.
[0150] Optionally, generating the second extended virtual terrain based on the target terrain region and the branch points can include:
[0151] generating the water pool based on the target terrain region, and adjusting a height of the water pool to a height of the branch points;
[0152] taking each branch point as a second starting point, and generating a branch stream based on the second starting point.
[0153] It should be noted that the branch stream can be a new river, and the branch points can be taken as new first starting points. The execution process of steps 102-106 can be repeated to further generate the main river and the extended form. In the subsequent generation of the river, the points that have formed water areas need to be excluded.
[0154] In actual applications, by adjusting the height of the water pool to the height of the branch points, the water pool and the branch stream can be more fitted to the terrain, and a more natural terrain transition effect can be formed without causing a break in the flow.
[0155] By determining the target first boundary point from the at least one first boundary point, determining the target first boundary point as a branch point corresponding to the target terrain region, and generating the second extended virtual terrain based on the target terrain region and the branch point, the position of the branch point can be automatically determined, and a new river can be generated based on the branch point. By generating the water pool based on the target terrain region and adjusting the height of the water pool to the height of the branch point, the water pool can be more fitted to the terrain, a more natural terrain transition effect can be obtained, a terrain groove can be crossed and branch, and a break in the flow can be avoided, so that a more coherent and diversified target virtual terrain can be generated at one time.
[0156] 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 can include the following steps:
[0157] In the case that the first boundary point does not meet the preset search condition, generating a first extended virtual terrain based on the target terrain region.
[0158] Specifically, the first boundary point does not meet the preset search condition, which means that each boundary point of the target terrain region does not exist a neighbor terrain grid with a height drop outside the target terrain region, that is, the preset branch point list is empty.
[0159] In actual applications, in the case that the branch point cannot be searched, a lake can be generated based on the target terrain region.
[0160] By applying this embodiment, the first extended virtual terrain is generated based on the target terrain region in the case that the first boundary point does not meet the preset search condition, the lake can be generated based on the target terrain region in the case that there is no branch point, and the diversity of the target virtual terrain is improved.
[0161] One embodiment of the present specification provides a virtual terrain generation method, 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, searches for at least one first extension point in the target terrain grid; in the case that a target stop condition is reached, 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 stop condition, to obtain a target virtual terrain.
[0162] In this way, by cyclically lifting the first ending point based on the preset lifting interval, at least one first extension point is searched in the target terrain grid, the first extension point that can be used to generate the extended virtual terrain is searched starting from the first ending point, and the accuracy and search efficiency of the first extension point are improved; by generating the extended virtual terrain based on the first ending point, the first extension point and the target stop condition, the extended virtual terrain can be further generated on the basis of the initial virtual terrain, so that the target virtual terrain with more diverse forms can be obtained based on the initial virtual terrain and the extended virtual terrain, the target virtual terrain is not too single, and a more lifelike visual effect is achieved.
[0163] The following describes the virtual terrain generation method provided by the present specification with reference to the accompanying drawings. Figure 2 The virtual terrain generation method provided by the present specification is further described by taking the application of the virtual terrain generation method in river generation as an example. Wherein, Figure 2 A processing process schematic diagram of a virtual terrain generation method provided by one embodiment of the present specification is shown.
[0164] The starting point a of the river is determined, and the maximum pool volume Vmax is determined.
[0165] The starting point a is moved along the direction of the terrain grid gradient descent to obtain a river passing point, and based on the river passing point, the next river passing point is obtained by moving along the direction of the terrain grid gradient descent, and the process is repeated until the terrain grid with no descent around is searched to obtain the pool point p0.
[0166] Starting from the pool point p0, the pool / lake / branch point generation process is entered, and the river is generated by the water surface lifting spread algorithm.
[0167] The pool / lake / branch point generation procedure based on the water surface lifting spreading algorithm comprises:
[0168] V is the pool volume, S is the pool surface area, H is the pool depth, and a cell size of the terrain grid is (Ux, Uy, Uz), wherein y is the vertical direction.
[0169] Specifically, U represents a unit length. In the terrain grid, the specific value of a unit length can be determined according to the requirements in actual application.
[0170] Starting from the pool point p0, a unit height Uy is lifted to obtain p1 = p0 + (0, Uy, 0), and the initial H = Uy, V = Uy*Ux*Uz, and S = Ux*Uz are recorded.
[0171] Starting from the position of p1, a search algorithm is used to spread in a preset direction in the horizontal plane in which p1 is located.
[0172] Specifically, the preset direction can include forward, backward, left, and right, and can be set according to the requirements in actual application. The search algorithm can include a breadth-first search algorithm, a depth-first search algorithm, and other search algorithms, and the breadth-first search algorithm is preferred.
[0173] In the horizontal plane in which p1 is located, for each point to be spread, the ground surface height difference is calculated, and based on the ground surface height difference, it is determined whether the point to be spread is a spreading point or a boundary point.
[0174] Specifically, the ground surface height difference = height of the point to be spread - height of the corresponding position terrain.
[0175] The height of the point to be spread is the height of the point to be spread in the current horizontal plane, and the height of the corresponding position terrain is the height value of the point to be spread on the terrain grid, which can also be understood as the height value of the point to be spread on the height map.
[0176] If the ground surface height difference is zero or negative, the point to be spread is located on or below the ground surface, and the point is marked as a boundary point.
[0177] If the ground surface height difference is positive, the point is marked as a spreading point, and V = V + Hpi*Uy*Ux*Uz, S = S + Ux*Uz are updated. Hpi is the ground surface height difference of the spreading point pi.
[0178] As shown in the example of FIG. 2, in the horizontal plane in which p1 is located, the ground surface height difference of point pi is positive, and point pi is a spreading point. Figure 2
[0179] Continue to spread step by step outward until a boundary point or a point that has been marked is encountered, and then stop spreading in that direction.
[0180] Exemplarily, as shown in the following figure, in the horizontal plane where p1 locates, diffuse to the left, search to point pm, the ground height difference of point pm is 0, then point pm locates on the ground, is a boundary point, stop diffusing to the left direction; diffuse to the right, search to point pn, the ground height difference of point pn is 0, then point pn also locates on the ground, is a boundary point, stop diffusing to the right direction. Figure 2
[0181] If no preset stopping condition is met before the diffusion process ends, the diffusion result will form a closed boundary point.
[0182] Specifically, the preset stopping condition includes encountering the terrain edge, or V>Vmax.
[0183] Further, continue to lift the horizontal plane by one unit height Uy, and update the height H=H+Uy, and update the volume V=V+S*Uy.
[0184] Check all boundary points, recalculate the new ground height difference of the boundary points, if the new ground height difference meets the diffusion point requirement, modify the boundary point to the diffusion point, and continue to diffuse outward.
[0185] Exemplarily, as shown in the following figure, pm and pn are initially boundary points, after lifting the height by 2Uy, the new ground height difference is positive, which meets the diffusion point requirement, then modify it to the diffusion point, and continue to diffuse outward based on pm and pn in the horizontal plane where p2 locates. Assume that starting from pn, diffuse to the right and encounter point pj, since the calculated ground height difference of point pj is negative, it means that point pj is below the current ground, point pj is a boundary point. Figure 2
[0186] Continue to repeat the above water surface lifting and diffusion process until the preset stopping condition is triggered.
[0187] In the case that the triggered preset stopping condition is encountering the terrain edge, then back to the closed area formed by the last horizontal plane, form a lake based on the closed area, and no new diversion point, generate termination.
[0188] In the case that the triggered preset stopping condition is V>Vmax during the diffusion process, then stop diffusion, and back to the closed area formed by the last horizontal plane, take the closed area as the water pool L, and then detect whether there is a diversion point.
[0189] Detect whether each boundary point of the water pool L has a neighbor terrain grid with height drop outside the water pool L;
[0190] If yes, determine the boundary point as a pre-diversion point, and add it to the pre-diversion point list;
[0191] If no, exclude the boundary point.
[0192] After the detection ends, if the pre-diversion point list is empty, there is no diversion point, and the algorithm ends, taking the water pool L as a lake.
[0193] If the pre-diversion point list is not empty, the point B with the lowest height is selected from the pre-diversion point list as a diversion point.
[0194] It should be noted that there can be one or more points with the lowest height, and if there are multiple points, the multiple points with the same height are all marked as diversion points.
[0195] Further, in the case where one or more diversion points are determined, the height of the water pool L is adjusted to the height of the diversion point to fit the terrain.
[0196] Each diversion point B is taken as a starting point of a new river, and the river is continued to be generated.
[0197] 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 the river based on the diversion point B and the subsequent generation of the water pool, the area where the water pool has been formed needs to be excluded. The area where the water pool has been formed can be regarded as the edge of the terrain.
[0198] By applying the embodiment, the water surface lifting and spreading algorithm can be performed from the valley point position of the river to find the water pool and the diversion point, and the tributaries and lakes are iteratively generated, so that the river generation can cross the terrain groove and diversion, thereby the coherent multi-branch river and lake can be generated at one time, the diversity of the river generation is improved, and a more natural and realistic visual effect is obtained. Moreover, the time complexity of performing the water surface lifting and spreading algorithm is in the order of O (N) (N is the number of terrain meshes), which has high performance, thereby having the ability of real-time generation, and the diversified river can be efficiently generated.
[0199] Corresponding to the method embodiments described above, the present specification also provides a virtual terrain generation device embodiment, Figure 3 a structural schematic diagram of a virtual terrain generation device provided by an embodiment of the present specification is shown. As Figure 3 shown, the device comprises:
[0200] The determination module 302 is configured to determine a first starting point and a first ending point in the target terrain mesh.
[0201] The search module 304 is configured to search at least one first extension point in the target terrain mesh by cyclically lifting the first ending point based on a preset lifting interval.
[0202] The generating module 306 is configured to, in the case where the target stop condition is reached, generate an initial virtual terrain based on the first start point and the first end point, and generate an extended virtual terrain based on the first end point, the first extension point, and the target stop condition, to obtain a target virtual terrain.
[0203] Optionally, the searching module 304 is further configured to:
[0204] Lift the target point by a preset lifting interval to obtain a target point;
[0205] In a horizontal plane where the target point is located, start from the target point, search for adjacent points in a preset direction to obtain an initial extension point and an initial boundary point, wherein the initial boundary point is used to form a closed terrain area.
[0206] Lift the target point by a preset lifting interval to determine the lifted point as the target point;
[0207] In the horizontal plane where the target point is located, based on the initial boundary point, search for adjacent points in a direction towards the outside of the closed terrain area to obtain the first extension point.
[0208] Optionally, the searching module 304 is further configured to:
[0209] In the horizontal plane where the target point is located, based on the initial boundary point, search for adjacent points in a direction towards the outside of the closed terrain area;
[0210] For the searched current point, determine the type of the current point based on the current point height and the terrain height 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;
[0211] In the case where the point of the boundary type can form a new closed terrain area, determine the initial extension point as the first extension point;
[0212] Update the initial boundary point based on the point of the boundary type, and return to execute the step of lifting the target point by a preset lifting interval to determine the lifted point as the target point.
[0213] Optionally, the generating module 306 is further configured to:
[0214] From the first extension point, determine a target first extension point;
[0215] According to the target stop condition, generate an extended virtual terrain based on the first end point and the target first extension point.
[0216] Optionally, the target stop condition comprises searching a terrain edge; the generating module 306 is further configured to:
[0217] In the case of searching a terrain edge, generating a first extended virtual terrain based on the first termination point position and the target first extension point position.
[0218] Optionally, the target stop condition comprises that a current terrain region volume exceeds a preset terrain region volume; the generating module 306 is further configured to:
[0219] Forming a target terrain region based on the first termination point position and the target first extension point position;
[0220] Determining a first boundary point position of the target terrain region, and generating an extended virtual terrain based on whether the first boundary point position meets a preset search condition.
[0221] Optionally, the generating module 306 is further configured to:
[0222] If there is at least one first boundary point position meeting the preset search condition, determining a target first boundary point position from the at least one first boundary point position;
[0223] Determining the target first boundary point position as a diversion point position corresponding to the target terrain region;
[0224] Generating a second extended virtual terrain based on the target terrain region and the diversion point position.
[0225] Optionally, the generating module 306 is further configured to:
[0226] In the case that the first boundary point position does not meet the preset search condition, generating a first extended virtual terrain based on the target terrain region.
[0227] By cyclically lifting the first termination point position based on a preset lifting interval to search for at least one first extension point position in the target terrain grid, the embodiment can search for the first extension point position that can be used to generate the extended virtual terrain from the first termination point position, and improve the accuracy and search efficiency of the first extension point position. By generating the extended virtual terrain based on the first termination point position, the first extension point position and the target stop condition, the embodiment can further generate the extended virtual terrain on the basis of the initial virtual terrain, so as to obtain the target virtual terrain with more diversified shapes based on the initial virtual terrain and the extended virtual terrain, avoid the target virtual terrain being too single, and achieve a more lifelike visual effect.
[0228] The above is a schematic scheme of the virtual terrain generation device of the embodiment. It should be noted that the technical scheme of the virtual terrain generation device is the same as the technical scheme of the virtual terrain generation method described above, and the details of the technical scheme of the virtual terrain generation device that are not described in detail can be seen from the description of the technical scheme of the virtual terrain generation method.
[0229] Figure 4 A structural 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 through a bus 430, and a database 450 is used to save data.
[0230] The computing device 400 also includes an access device 440, which 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 can include one or more of any type of network interface (e.g., a network interface card (NIC)), wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a Worldwide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC).
[0231] In one embodiment of the present specification, the above-mentioned components of the computing device 400 and other components not shown in the Figure 4 may be connected to each other, for example, through a bus. It should be understood that Figure 4 The structural block diagram of the computing device shown is only for the purpose of example, and is not a limitation on the scope of the present specification. Those skilled in the art can add or replace other components as needed.
[0232] The computing device 400 can 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 smartphone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other type of mobile device, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 400 can also be a mobile or stationary server.
[0233] The processor 420 is configured to execute computer-executable instructions to perform the steps of the method for generating a virtual terrain.
[0234] The above is a schematic solution of the computing device of the embodiment. It should be noted that the technical solution of the computing device belongs to the same concept as the technical solution of the method for generating a virtual terrain, and the details of the technical solution of the computing device that are not described in detail can be referred to the description of the technical solution of the method for generating a virtual terrain.
[0235] 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 method for generating a virtual terrain.
[0236] The above is a schematic solution of the computer-readable storage medium of the embodiment. It should be noted that the technical solution of the storage medium belongs to the same concept as the technical solution of the method for generating a virtual terrain, and the details of the technical solution of the storage medium that are not described in detail can be referred to the description of the technical solution of the method for generating a virtual terrain.
[0237] An embodiment of the present specification further provides a computer program product comprising computer programs / instructions, which, when executed by a processor, implement the steps of the method for generating a virtual terrain.
[0238] The above is a schematic solution of the computer program product of the embodiment. It should be noted that the technical solution of the computer program product belongs to the same concept as the technical solution of the method for generating a virtual terrain, and the details of the technical solution of the computer program product that are not described in detail can be referred to the description of the technical solution of the method for generating a virtual terrain.
[0239] The above-described embodiments of the application have several aspects, no single one of which is solely responsible for the application's desirable attributes. Without limiting the scope of the application as expressed by the claims which follow, some further embodiments make these aspects even more useful. Other embodiments can result in less desirable attributes.
[0240] The computer readable medium can include any entity or apparatus capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier signal, telecommunication signal, software distribution medium, etc. It should be noted that the computer readable medium can include appropriate contents according to the requirements of patent practice, for example, according to the patent practice in some regions, the computer readable medium does not include electrical carrier signals and telecommunication signals.
[0241] It should be noted that for the foregoing method embodiments, the purposes of brief description are to express them as a combination of a series of acts, but those skilled in the art should know that the embodiments of the present specification are not limited by the order of the described acts, because according to the embodiments of the present specification, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification are all preferred embodiments, and the acts and modules involved are not necessarily all the embodiments of the present specification.
[0242] In the above embodiments, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments.
[0243] The preferred embodiments of the present specification disclosed above are only used to help explain the present specification. The alternative embodiments do not describe all the details and limit the application to the specific embodiments described. Obviously, according to the content of the embodiments of the present specification, many modifications and changes can be made. The present specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of the present specification, so that those skilled in the art can well understand and use the present specification. The present specification is limited by the claims and their entire scope and equivalents.
Claims
1. A method of generating a virtual terrain, characterized by, The method comprises the following steps: determining a first starting point and a first ending point in a target terrain grid; lifting the first ending point by a preset lifting 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 in a preset direction to obtain an initial extension point and an initial boundary point, wherein the initial boundary point is used to form a closed terrain area; lifting the target point by a preset lifting interval to determine the lifted point as the target point; in the horizontal plane where the target point is located, based on the initial boundary point, cyclically searching for adjacent points in a direction towards the outside of the closed terrain area to obtain a first extension point; in the case of reaching a target stop condition, generating an initial virtual terrain based on the first starting point and the first ending point, and generating an extended virtual terrain based on the first ending point, the first extension point and the target stop condition to obtain a target virtual terrain, wherein the target stop condition includes searching to the terrain edge or the current terrain area volume exceeding the preset terrain area volume.
2. The method of claim 1, wherein, The step of cyclically searching for adjacent points in a direction towards the outside of the closed terrain area based on the initial boundary point in the horizontal plane where the target point is located to obtain a first extension point comprises: cyclically searching for adjacent points in a direction towards the outside of the closed terrain area based on the initial boundary point in the horizontal plane where the target point is located; for the searched current point, determining the type of the current point based on the current point height and the terrain height of the current point, and determining 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 that the point of the boundary type can form a new closed terrain area, determining the initial extension point as the first extension point; updating the initial boundary point based on the point of the boundary type, and returning to execute the step of lifting the target point by a preset lifting interval to determine the lifted point as the target point.
3. The method of claim 1, wherein, The step of generating an extended virtual terrain based on the first ending point, the first extension point and the target stop condition comprises: determining a target first extension point from the first extension point; generating an extended virtual terrain based on the first ending point and the target first extension point according to the target stop condition.
4. The method of claim 3, wherein, The target stop condition includes searching to the terrain edge; The step of generating an extended virtual terrain based on the first ending point and the target first extension point according to the target stop condition comprises: in the case of searching to the terrain edge, generating a first extended virtual terrain based on the first ending point and the target first extension point.
5. The method of claim 3, wherein, The target stop condition includes the current terrain area volume exceeding the preset terrain area volume; The step of generating an extended virtual terrain based on the first ending point and the target first extension point according to the target stop condition comprises: forming a target terrain area based on the first ending point and the target first extension point; determining a first boundary point of the target terrain region, and generating an extended virtual terrain based on whether the first boundary point meets a preset search condition.
6. The method of claim 5, wherein, The generating of the extended virtual terrain based on whether the first boundary point meets the preset search condition comprises: if there is at least one first boundary point meeting 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 a shunt point corresponding to the target terrain region; generating a second extended virtual terrain based on the target terrain region and the shunt point.
7. The method of claim 5, wherein, The generating of the extended virtual terrain based on whether the first boundary point meets the preset search condition comprises: if the first boundary point does not meet the preset search condition, generating a first extended virtual terrain based on the target terrain region.
8. An apparatus for generating a virtual terrain, characterized by comprise: a determining module configured to determine a first start point and a first end point in a target terrain grid; a searching module configured to lift the first end point by a preset lifting interval to obtain a target point, and search for adjacent points in a preset direction from the target point to obtain an initial extended point and an initial boundary point in a horizontal plane where the target point is located, wherein the initial boundary point is used to form a closed terrain region, and the target point is lifted by the preset lifting interval to determine a lifted point as the target point, and search for adjacent points in a direction away from the closed terrain region based on the initial boundary point to obtain a first extended point in the horizontal plane where the target point is located; a generating module configured to generate an initial virtual terrain based on the first start point and the first end point if a target stop condition is reached, and generate an extended virtual terrain based on the first end point, the first extended point and the target stop condition to obtain a target virtual terrain, wherein the target stop condition comprises searching for a terrain edge or a current terrain region volume exceeding a preset terrain region volume.
9. A computing device, comprising: comprise: a memory and a processor; the memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions, which realize the steps of the virtual terrain generation method according to any one of claims 1-7 when executed by the processor.
10. A computer-readable storage medium, characterized in that, which stores computer programs / instructions, which realize the steps of the virtual terrain generation method according to any one of claims 1-7 when executed by the processor.
11. A computer program product, characterised in that, comprise computer programs / instructions, which realize the steps of the virtual terrain generation method according to any one of claims 1-7 when executed by the processor.
Citation Information
Patent Citations
Virtual landform generation method and device, computer equipment and storage medium
CN115518376A
Map generation method and apparatus
WO2023232055A1