Methods, apparatus, media and equipment for generating river topography
By determining the river path in the 3D basic terrain and performing width expansion processing, the problem of inaccurate river morphology simulation in the existing technology is solved, more realistic river generation is achieved, and the user experience is improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-23
- Publication Date
- 2026-03-31
AI Technical Summary
Existing technologies struggle to accurately and reasonably simulate the shape of rivers when generating river terrain, resulting in generated rivers that do not match the real world and negatively impacting user experience.
By determining the starting and ending points of the 3D river, we can determine whether a river path exists in the 3D basic terrain, and then perform edge expansion processing based on the width of the river to generate the 3D river.
It improves the accuracy and realism of river terrain generation, enhances the matching degree between virtual images and the real world, and improves the user experience.
Smart Images

Figure CN115944913B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and more specifically, to a method, apparatus, medium, and device for generating river topography. Background Technology
[0002] Currently, gaming applications have become common applications in people's lives. Based on the terrain structure of the real world, diverse terrain designs can be generated in gaming applications, such as plains, islands, and rivers, so that users can have a more realistic experience in gaming applications.
[0003] Most related technologies employ two-dimensional pathfinding algorithms when generating river terrain, such as the A* algorithm to find paths between two points within a region. However, this process only considers path generation and neglects the river's inherent shape, making it difficult to achieve accurate and reasonable river generation. Summary of the Invention
[0004] This summary section is provided to briefly introduce the concepts, which will be described in detail in the detailed description section below. This summary section is not intended to identify key or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.
[0005] In a first aspect, this disclosure provides a method for generating river topography, the method comprising:
[0006] Determine the starting and ending points of a three-dimensional river;
[0007] Based on the location of the starting point and the location of the ending point, determine whether there is a river path in the three-dimensional basic terrain corresponding to the location of the starting point and the location of the ending point;
[0008] If the river path exists, the river path is extended according to the width corresponding to the three-dimensional river to generate the three-dimensional river in the three-dimensional basic terrain.
[0009] Secondly, this disclosure provides an apparatus for generating river topography, the apparatus comprising:
[0010] The first determining module is used to determine the location of the starting point and the location of the ending point of the three-dimensional river;
[0011] The second determining module is used to determine whether a river path corresponding to the location of the starting point and the location of the ending point exists in the three-dimensional basic terrain based on the location of the starting point and the location of the ending point.
[0012] An extension module is used to perform edge expansion processing on the river path according to the width corresponding to the three-dimensional river if the river path exists, so as to generate the three-dimensional river in the three-dimensional basic terrain.
[0013] Thirdly, this disclosure provides a computer-readable medium having a computer program stored thereon, which, when executed by a processing device, implements the steps of the method described in the first aspect.
[0014] Fourthly, this disclosure provides an electronic device, comprising:
[0015] A storage device on which computer programs are stored;
[0016] A processing device for executing the computer program in the storage device to implement the steps of the method described in the first aspect.
[0017] In the above technical solution, the starting and ending points of the 3D river are first determined. Then, it is determined whether a river path corresponding to the starting and ending points exists in the 3D base terrain. If the river path exists, it is expanded based on the width of the 3D river to generate the 3D river within the base terrain. Therefore, this technical solution allows for the generation of river terrain on a 3D base terrain, ensuring a high degree of fit between the generated 3D river and the base terrain, enabling river generation under any terrain and improving the accuracy and realism of the generated 3D river. Furthermore, by expanding the river path based on its width after determination, rivers of arbitrary width can be generated, further improving the matching degree between the generated river terrain and real-world rivers, enhancing the accuracy of image rendering, providing users with realistic virtual visuals, and improving the user experience.
[0018] Other features and advantages of this disclosure will be described in detail in the following detailed description section. Attached Figure Description
[0019] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale. In the drawings:
[0020] Figure 1 This is a flowchart of a method for generating river topography according to one embodiment of the present disclosure;
[0021] Figure 2This is a flowchart illustrating an exemplary implementation of determining whether a river path corresponding to the location of the starting point and the location of the ending point exists in a three-dimensional basic terrain according to an embodiment of the present disclosure;
[0022] Figure 3 This is a schematic diagram of a three-dimensional basic terrain in the horizontal direction according to one embodiment of the present disclosure;
[0023] Figure 4 This is a schematic diagram of an extended river between adjacent river sections L1 and L2, provided according to one embodiment of the present disclosure.
[0024] Figure 5 This is a schematic diagram of a river after the adjacent river sections L1 and L2 have been expanded and the turning area has been filled, according to one embodiment of the present disclosure.
[0025] Figure 6 This is a block diagram of a river topography generation apparatus according to one embodiment of the present disclosure;
[0026] Figure 7 A schematic diagram of the structure of an electronic device suitable for implementing embodiments of the present disclosure is shown. Detailed Implementation
[0027] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0028] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0029] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.
[0030] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.
[0031] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0032] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0033] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.
[0034] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the software or hardware, such as the electronic device, application, server, or storage medium performing the operations of this disclosed technical solution, based on the prompt message.
[0035] As an optional but non-limiting implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0036] It is understood that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of this disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of this disclosure.
[0037] Meanwhile, it is understood that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and related provisions.
[0038] Figure 1 The diagram shown is a flowchart of a method for generating river topography according to one embodiment of this disclosure. Figure 1 As shown, the method may include:
[0039] In step 11, the locations of the starting and ending points of the three-dimensional river are determined.
[0040] Users can select the starting and ending points of a river on the basic topographic map through the configuration page, and then obtain the locations of the selected starting and ending points after the configuration is completed. Alternatively, they can import automatically generated data from the system.
[0041] It should be noted that in this embodiment, the height of the starting point is greater than or equal to the height of the ending point to conform to the true characteristics of river flow. As an example, if the height of the starting point selected by the user is less than the height of the ending point, a prompt message can be displayed to the user, prompting them to reselect and obtain the starting and ending points of the 3D river. Similarly, in the scenarios imported by the system, the height of the starting point must also be greater than or equal to the height of the ending point; if this is not met, the user can reselect.
[0042] In step 12, based on the location of the starting point and the location of the ending point, it is determined whether there is a river path in the three-dimensional basic terrain corresponding to the location of the starting point and the location of the ending point.
[0043] In this embodiment of the disclosure, a three-dimensional river is generated from an existing topographic map. The three-dimensional base terrain can be terrain where rivers can appear in actual application scenarios, such as plains, mountain ranges, etc.
[0044] As an example, this step can determine whether there is a path that can flow from the starting point to the ending point in the current three-dimensional basic terrain based on the existence logic and flow logic of the river, so as to determine whether a river can be formed based on the starting point and the ending point.
[0045] In step 13, if a river path exists, the river path is extended according to the width corresponding to the three-dimensional river to generate the three-dimensional river in the three-dimensional basic terrain.
[0046] The width of the three-dimensional river can be preset, and this disclosure does not limit this. In this embodiment, the river path is formed by the path centerline of adjacent voxel points. However, in real-world scenarios, rivers usually have a certain width, rather than being just a single path as described in the background art. Therefore, in this embodiment, the width of the river can be further combined with the path centerline to expand to both sides to obtain a river with a certain width, which is more in line with the behavior of rivers in the real world.
[0047] Therefore, in the above technical solution, the starting and ending points of the 3D river are first determined, and then it is determined whether a river path corresponding to the starting and ending points exists in the 3D base terrain. If the river path exists, it is expanded according to the width of the 3D river to generate the 3D river in the 3D base terrain. Thus, through this technical solution, river terrain can be generated on the 3D base terrain, ensuring that the generated 3D river closely matches the 3D base terrain, enabling river generation under any terrain and improving the accuracy and realism of the generated 3D river. Furthermore, by expanding the river path based on its width after determining it, rivers of arbitrary width can be generated, further improving the matching degree between the generated river terrain and real-world rivers, enhancing the accuracy of image rendering, providing users with realistic virtual images, and improving the user experience.
[0048] In one possible embodiment, an exemplary implementation of determining whether a river path corresponding to the starting point and the ending point exists in the three-dimensional basic terrain based on the starting point and the ending point is as follows: Figure 2 As shown, this step may include:
[0049] In step 21, valid candidate points adjacent to the target point are determined, wherein the starting point is the initial value of the target point.
[0050] The process involves using the starting point as the initial point for path searching to determine if a river path exists. Valid candidate points are defined as voxel points in the 3D base terrain that are adjacent to the target point and can serve as river points.
[0051] In step 22, the current search cost is determined for each of the valid candidate points as path points in the river path.
[0052] For each valid candidate point, the current search cost corresponding to that valid candidate point as a path point in the river path can be determined by the following cost calculation formula. Let the target point be N and the valid candidate point be P, then the formula is as follows:
[0053] TotalCost(P)=RealCost(P)+GreedCost(P)
[0054] RealCost(P)=RealCost(N)+cost(N,P)
[0055] GreedCost(P)=cost(P,endPoint)
[0056] Where TotalCost(P) represents the total search cost corresponding to the valid candidate point P, i.e., the current search cost; RealCost(P) represents the true cost corresponding to the valid candidate point P; RealCost(N) represents the true cost corresponding to the target point N; cost(N,P) represents the cost from the target N to the valid candidate point P; and GreedCost(P) represents the greedy cost of the valid candidate point P, i.e., the cost from the valid candidate point P to the destination. For example, the cost between points p1 and p2 is defined as follows:
[0057] cost(p1,p2)=p2.x-p1.x+p2.y-p1.y+p2.z-p1.z
[0058] Where x, y, and z are used to represent coordinate values, that is, p2.x is used to represent the x-coordinate value of point p2.
[0059] In step 23, a new target point is determined based on the current search cost of the valid candidate points corresponding to the target point.
[0060] Repeat step 21, which involves determining the effective candidate points adjacent to the target point, until the search termination condition is met. The search termination condition is either that the new target point is the endpoint or that there are no candidate points in the candidate point list.
[0061] The current search cost of the valid candidate point represents the search cost of the river path generated when the target point flows to the valid candidate point in the river path. The next target point can be selected based on the search cost to continue the search for the river path.
[0062] In step 24, if the new target point is the endpoint, then the preceding nodes will be obtained sequentially from the endpoint until the obtained preceding node is the path corresponding to the starting point, and then the river path will be determined.
[0063] For example, if the endpoint is represented as endPoint, then we can obtain the predecessor node of the endpoint, such as Pn, and then obtain the predecessor node of node Pn-1, the predecessor node of node Pn-1, Pn-2, and so on until the predecessor node is the starting point startPoint. The corresponding path can be the path from the starting point startPoint to the endpoint endPoint.
[0064] Therefore, through the above technical solution, a path can be searched from the starting point to the destination. In the process of selecting target points on the path, the candidate point with the lowest target search cost in the updated candidate point list is taken as the new target point. This can ensure the minimum cost of the finally generated river path, that is, the shortest distance of the river path, and improve the matching degree between the determined river path and the real scene.
[0065] In one possible embodiment, the specific implementation of determining a new target point based on the current search cost of the valid candidate points corresponding to the target point can be as follows:
[0066] Based on the current search cost corresponding to the valid candidate point, the target search cost corresponding to the valid candidate point is determined, and the candidate point list and the selected point list are updated. The preceding node corresponding to the valid candidate point is determined. The target search cost is used to record the minimum search cost when the valid candidate point is used as the path point. The candidate point list initially includes the starting point.
[0067] The target search cost corresponding to a valid candidate point represents the cost already calculated for that valid candidate point. The candidate point list records valid candidate points whose search costs have been calculated but which have not yet been selected; correspondingly, the starting point can be directly added to the candidate point list in this step. The selected point list records the selected valid candidate points.
[0068] The candidate point with the lowest target search cost in the updated candidate point list is selected as the new target point, and the new target point is moved from the candidate point list to the selected point list.
[0069] As mentioned above, the target search cost is used to represent the estimated cost when selecting the candidate point as a point on the river path. Therefore, the candidate point with the smallest target search cost in the candidate point list can be used as the new target point to ensure the shortest path of the determined river path.
[0070] Furthermore, the new target point can be moved from the candidate point list to the selected point list, indicating that the new target point has been selected and preventing it from being selected again in the next judgment process. Then, the above process can be executed again based on the new target point to continue selecting new target points until a destination is included among the new target points, indicating that a river path from the starting point to the destination exists in the 3D basic terrain. If there are no candidate points in the candidate point list, meaning that no destination has been found after traversing all possible paths in the candidate point list, it can be considered that a river path from the starting point to the destination cannot be formed in the 3D basic terrain. In this case, a prompt can be output so that the user can re-specify the starting point and destination to generate the corresponding river path.
[0071] In one possible embodiment, the step of determining valid candidate points adjacent to the target point may include:
[0072] If the height of the target point is less than the height of the endpoint, it is determined that there are no valid candidate points for the target point.
[0073] In order to conform to the flow logic of rivers in real-world scenarios, i.e., rivers flow from high to low, when the height of the determined target point is less than the height of the destination, it can be assumed that the cost of continuing to search for a path from that target point is infinite. Therefore, it can be determined that there are no valid candidate points for that target point, and the search for a path should not continue with that target point.
[0074] If the height of the target point is greater than or equal to the height of the endpoint and the target point has four adjacent points in the horizontal direction, then if the target point has an adjacent point below it in the vertical direction but no adjacent point above it, the four adjacent points in the horizontal direction are considered as valid candidate points; if the target point has an adjacent point below it in the vertical direction and an adjacent waterfall point above it, then the four adjacent points in the horizontal direction are considered as valid candidate points.
[0075] When the height of the target point is greater than or equal to the height of the endpoint, it conforms to the flow logic of a river, meaning that a river path from the target point to the endpoint is feasible. Furthermore, the existence of a river requires the support of a riverbed. That is, if there are voxel points in the 3D base terrain, and the target point has four adjacent points in the horizontal direction, and if the target point has adjacent points below it in the vertical direction but no adjacent points above it, it indicates that the target point has complete riverbed support in the horizontal direction and is a voxel point on the surface corresponding to the 3D base terrain. This means that river generation can proceed from the target point to its adjacent points in the horizontal direction. In this case, the four adjacent points in the horizontal direction can be considered as valid candidate points.
[0076] As another example, if the height of the target point is greater than or equal to the height of the endpoint and the target point has four adjacent points in the horizontal direction, and if the target point has adjacent points below and adjacent waterfall points above in the vertical direction, it means that the target point has complete riverbed support in the horizontal direction, and it can be used as the corresponding waterfall endpoint of the adjacent waterfall point above. In this case, its four adjacent points in the horizontal direction can also be used as the valid candidate points to further determine new target points.
[0077] If the height of the target point is greater than or equal to the height of the endpoint and the target point has fewer than four adjacent points in the horizontal direction, then if the target point has an adjacent point below it in the vertical direction but no adjacent point above it, or if the target point has an adjacent point below it in the vertical direction and an adjacent waterfall point above it, then the adjacent point below it is taken as the valid candidate point and the adjacent point below it is marked as a waterfall point.
[0078] In this embodiment, if a target point has fewer than four adjacent points in the horizontal direction, it indicates that the target point does not have complete riverbed support in the horizontal direction. If the target point has adjacent points below it in the vertical direction but no adjacent points above it, it indicates that the target point is a voxel point on the surface of the three-dimensional basic terrain. In this case, the target point can be used as the starting point of the waterfall, i.e., the river path is searched downwards. In another example, if the target point has adjacent points below it in the vertical direction and adjacent waterfall points above it, it indicates that the river can continue to flow downwards and it can be used as a point in the waterfall. In this case, the adjacent points below it are used as valid candidate points and are marked as waterfall points to mark each voxel point in the waterfall.
[0079] Therefore, the above technical solution allows for the selection of effective candidate points based on the existence logic of rivers, namely, by forming river paths from voxel points in the 3D basic terrain, ensuring consistency between the generated river paths and those in the real scene. Furthermore, this solution can generate waterfall terrain based on the 3D basic terrain, improving the accuracy of 3D river generation. Compared with 2D pathfinding algorithms in related technologies, this further expands the applicability of the river generation method while ensuring the accuracy and effectiveness of river path searching in the 3D basic terrain.
[0080] In one possible embodiment, the step of determining the target search cost corresponding to the valid candidate point based on the current search cost corresponding to the valid candidate point, updating the candidate point list and the selected point list, and determining the preceding node corresponding to the valid candidate point can include:
[0081] If the valid candidate point is not in the candidate point list, then the valid candidate point is added to the candidate point list, the current search cost corresponding to the valid candidate point is determined as the target search cost corresponding to the valid candidate point, and the target point is used as the predecessor node of the valid candidate point.
[0082] As mentioned above, candidate points in the candidate point list are used to determine the next new target point. If a valid candidate point is not in the candidate point list, it means that the valid candidate point has not been traversed before. In this case, the valid candidate point can be directly added to the candidate point list, and the current search cost corresponding to the valid candidate point is determined as the target search cost corresponding to the valid candidate point, so as to determine whether the valid candidate point can be used as the next new target point based on the target search cost. Further, in this step, the target point is used as the predecessor node of the valid candidate point, that is, it means that the river can flow from the target point to the valid candidate point, so as to finally determine the river path and mark it. Figure 3 As shown, this is a schematic diagram of the three-dimensional basic terrain in the horizontal direction. In the example, A7 is the starting point, and A2, A6, A8, and A12 are valid candidate points. These four valid candidate points can be directly added to the candidate point list.
[0083] If the valid candidate point is in the candidate point list, and if it is determined that the current search cost corresponding to the valid candidate point is less than the target search cost of the valid candidate point, the target search cost of the valid candidate point is updated to the current search cost, and the target point is used as the predecessor node of the valid candidate point.
[0084] In this embodiment, a valid candidate point in the candidate point list indicates that the valid candidate point has been traversed previously. Continuing with the example above, if the target points determined in sequence are A7, A6, A11, and A16, then when the new target point is A16, the valid candidate points corresponding to A16 can be A11, A21, and A17. At this time, A11 is a point in the already selected point list, so A21 and A17 can be added to the candidate point list. Then, a new target point, such as A12, is determined from the candidate point list. The valid candidate points corresponding to A12 are then determined to be A7, A11, A17, and A13.
[0085] When determining the valid candidate point A16, A17 has already been traversed and added to the candidate point list. In this case, the search cost corresponding to A17 as a valid candidate point of A12 (the current search cost) can be compared with the search cost corresponding to A17 as a valid candidate point of A16 (the target search cost). If the current search cost is less than the target search cost, it means that the cost of forming a river path from A7 to A6, A11, A16 and then to A17 is greater than the cost of forming a river path from A7 to A12 and then to A17. At this time, the target search cost of the valid candidate point A17 can be updated to the current search cost, that is, updated to the current search cost calculated when A17 was a valid candidate point of A12, and A12 can be set as the predecessor node of A17.
[0086] If the valid candidate point is in the list of selected points, and it is determined that the current search cost corresponding to the valid candidate point is less than the target search cost of the valid candidate point, the valid candidate point is moved from the list of selected points to the list of candidate points, the target search cost of the valid candidate point is updated to the current search cost, and the target point is used as the predecessor node of the valid candidate point.
[0087] In this embodiment, the presence of a valid candidate point in the selected point list indicates that the valid candidate point has been previously traversed as the target point, meaning that the search cost for the valid candidate point has already been calculated. In this case, it is still necessary to compare whether the newly calculated current search cost is less than the already determined target search cost. The comparison method is the same as described above and will not be repeated here. Furthermore, the valid candidate point can be moved from the selected point list to the candidate point list, and the target search cost of the valid candidate point can be updated to the current search cost. The target point can be used as the predecessor node of the valid candidate point, so that the valid candidate point can be added back to the candidate point list after the target search cost is updated, so that it may be selected again after the target search cost decreases.
[0088] Therefore, through the above technical solution, each effective candidate point in the river path search process can be recorded through the candidate point list and the selected point list. The candidate point list and the selected point list can be updated by the current search cost of the newly determined effective candidate points in the river path search process, so as to ensure the accuracy and effectiveness of the next determined new target point, thereby ensuring the accuracy and rationality of the finally determined river path, so as to determine the shortest river path generated from the starting point to the end point and reduce the amount of data computation required by the algorithm.
[0089] In one possible embodiment, the method of performing edge expansion processing on the river path based on the width corresponding to the three-dimensional river to generate the three-dimensional river in the three-dimensional base terrain may include:
[0090] Determine the segment points on the river path, wherein the segment points include the starting point, the ending point, and the turning point on the river path, and the horizontal coordinate values of two points adjacent to the turning point in the river path are different.
[0091] Among them, such as Figure 3As shown, the determined river path is A7, A8, A9, A14, A19, A24, A25, where A7 is the starting point and A25 is the ending point. We can start traversing from A7 and determine the turning points on the river path in turn. For example, A7, A8, and A9 have the same coordinate value in the horizontal direction, while A8 and A14 have different coordinate values in the horizontal direction. Therefore, A9 is a turning point. Similarly, we can further determine A24 as a turning point.
[0092] Based on the segmentation points, the river sections corresponding to the river path are determined.
[0093] In this context, the river segment is defined as the section between any two points along the river path from the starting point to the end point. Thus, A7-A9 can form a river segment, A9-A24 can form a river segment, and A24-A25 can form a river segment.
[0094] For each of the aforementioned river segments, the river segment is expanded according to the width corresponding to the three-dimensional river.
[0095] The direction of the river plays a decisive role in its expansion. Therefore, the above technical solution allows for segmented expansion of the river path, enabling separate expansion for each specific river segment. This improves the matching degree between the river expansion and the river path, thereby enhancing the realism of the generated 3D river.
[0096] In one possible embodiment, the exemplary method of extending the river segment according to the width corresponding to the three-dimensional river may include:
[0097] Based on the width of the three-dimensional river, the expansion widths corresponding to both sides of the river section are determined, and an expansion area is generated based on the expansion widths.
[0098] If the river width N is odd, then the expansion width on both sides of the river path is consistent, i.e., (N-1) / 2. If the river width N is even, then one side of the expansion on either side of the river path will necessarily have a smaller expansion width than the other side by one unit. For example, the user can predefine the priority expansion edge, such as the right side along the river flow as the priority expansion edge, with a corresponding expansion width of N / 2, and the left side having a corresponding expansion width of N / 2-1. Furthermore, the expansion area can be obtained by expanding to both sides according to its corresponding expansion width based on the river path.
[0099] The extended region is vertically mapped to obtain candidate points corresponding to the extended region. Specifically, the extended region can be mapped from top to bottom to obtain surface voxels belonging to the extended region and corresponding to the three-dimensional basic terrain, which are then used as candidate points.
[0100] Based on each path point in the river segment, determine the effective candidate points in the region among the candidate points.
[0101] Each path point on the river path can be a voxel point of the river. Therefore, we can start from each path point and extend to both sides of the river path to determine whether the candidate points in the area can become the voxel points corresponding to the river, that is, to determine whether the candidate points in the area can satisfy the logic of the existence of the river.
[0102] As an example, an exemplary implementation of determining valid candidate points in the region based on each path point in the river segment may include:
[0103] For each of the aforementioned path points, the valid candidate points for the region are determined from the candidate points for the region in the following manner:
[0104] Determine the valid candidate points corresponding to the reference point, and set the valid candidate points as valid candidate points for the region, wherein the reference point is initially the path point.
[0105] The above process can be performed sequentially on each path point according to the corresponding river flow direction within the river segment. For example, for the first path point X1 in river segment L1, it is used as a reference point for judgment. Its corresponding expansion direction is the direction perpendicular to the river segment in the horizontal direction, that is, the left and right sides of the river flow direction. Unless otherwise specified, the right side is used to represent the right side based on the river flow direction, and the left side is used to represent the left side based on the river flow direction. The method for determining the effective candidate points corresponding to the reference point is the same as the method for determining the effective candidate points of the target point described above, and will not be repeated here. In this embodiment, any effective candidate point within the expansion area that can satisfy the logic of river existence can be directly used as a regional effective candidate point, that is, it is considered that it can be used to form a river.
[0106] If the valid candidate point is an adjacent point of the reference point in the extension direction, then the valid candidate point is determined as the new reference point, and the determination of the valid candidate point corresponding to the reference point is performed again until the new reference point does not belong to the regional candidate points. The extension direction is a direction perpendicular to the river section in the horizontal direction, and the regional valid candidate points include valid candidate points that belong to the regional candidate points.
[0107] As an example, we can prioritize judging to the right of the river flow direction, such as determining whether there is an adjacent valid candidate point to the right of the reference point. If the valid candidate point is an adjacent point to the right of the reference point, it can be used as the new reference point. Then, we can further determine the valid candidate points for this new reference point, thus realizing the judgment of valid candidate points traversing to the right from the path point. When the new reference point does not belong to the region's candidate points, it indicates that it has exceeded the boundary of the extended region, and at this point, the judgment of extending the path point to the right can be terminated. The method for determining the valid points of the region when the path point extends to the left is similar and will not be repeated here.
[0108] Furthermore, after performing the above extended judgment steps for each path point in the river path, the corresponding effective candidate points in the river segment can be determined, that is, the voxel points in the extended area of the river segment where the river can exist.
[0109] Therefore, by using the above technical solution, effective candidate points in the region corresponding to the expansion direction can be determined for each path point, ensuring that the expansion logic of the river satisfies the logic of the river's existence, ensuring the consistency between the river expansion and the three-dimensional basic terrain, and improving the accuracy of forming a three-dimensional river on the three-dimensional basic terrain.
[0110] Then, based on each path point in the river segment, the river point among the valid candidate points in the region can be determined, and the river path and the river point form an expanded three-dimensional river.
[0111] In this process, after identifying the effective candidate points within a river segment, i.e., the voxel points within the extended area corresponding to that river segment that can contain the river, it is further determined whether the effective candidate points in that area satisfy the river flow logic, so as to determine whether the effective candidate points in that area can become actual river points.
[0112] As an example, determining the river point among the valid candidate points in the region based on each path point in the river segment may include:
[0113] For each of the aforementioned path points, river points among the valid candidate points in the region are determined in the following manner:
[0114] Obtain valid candidate points in the region corresponding to the benchmark point, wherein the benchmark point is initially a path point. If the benchmark point is initially a path point on a river path, then the benchmark point must be a river point.
[0115] If at least one of the adjacent points in the horizontal direction or the upper adjacent points in the vertical direction of the effective candidate point in the region is a river point, the effective candidate point in the region is determined to be a river point, and the effective candidate point in the region in the extension direction of the reference point is determined as a new reference point. The process of obtaining the effective candidate point in the region corresponding to the reference point is repeated until each effective candidate point in the region has been traversed.
[0116] Based on the flow logic of rivers, in the horizontal direction, if a valid candidate point in a region is a river point at its horizontal neighbor, then the river can flow to the valid candidate point through its neighbor. In this case, the valid candidate point can be identified as a river point. In the vertical direction, waterfalls may form within the expanded region. The river blocks of the waterfall are arranged vertically and do not require riverbed support. If the upper neighbor of a valid candidate point in a region is a river point, the water flow in the waterfall can flow to the valid candidate point in that region. In this case, the valid candidate point in a region can be identified as a river point. In addition to the waterfall's starting point, valid candidate points in the region that are horizontally adjacent to the waterfall point can be used as the waterfall's endpoint to generate waterfalls along the river path, further conforming to the terrain structure of the real environment.
[0117] Furthermore, the valid candidate points in the region to the right of the reference point can be used as new reference points, and the above steps can be repeated until all valid candidate points in the region on the right have been traversed. Similarly, the valid candidate points in the region to the left of the reference point can be traversed and judged in the same way, which will not be elaborated here.
[0118] Accordingly, after performing the above process at each path point in the river segment, each valid candidate point in the extended area corresponding to the river segment can be judged to determine the river point in the extended area corresponding to the river segment, thereby forming the extended three-dimensional river.
[0119] Therefore, through the above technical solution, the voxel points in the extended area can be judged based on the river flow logic in the real scene, so as to determine the voxel points where there is a river and the river path can flow to. Based on the three-dimensional basic terrain, the river path is accurately extended, improving the realism and accuracy of the generated three-dimensional river, so as to provide users with a more realistic terrain picture and improve the user experience.
[0120] In one possible embodiment, an exemplary implementation of performing edge expansion processing on the river path based on the width corresponding to the three-dimensional river to generate the three-dimensional river in the three-dimensional base terrain may further include:
[0121] Determine the turning direction corresponding to the adjacent river section after expansion, and define the area that deviates from the turning direction and is formed by the outer extension line of the adjacent river section as the turning area.
[0122] like Figure 4 As shown, the river section flows from L1 to L2, so its turning direction can be determined to be a left turn. Therefore, the area formed by the outer extension of the adjacent river section, away from this turning direction, is considered the turning area. Specifically, the area formed by the right-side extension of the adjacent river section is the turning area. Figure 4 The area at point C.
[0123] Among them, Figure 4 In the middle, the extended area of the river section corresponding to L1 is Figure 4 As shown at point A, the extended region of the river area corresponding to L2 is... Figure 4 The river formed at point B is like... Figure 4 The regions corresponding to points A, B, and the path points are shown in the diagram.
[0124] Points within the triangular region formed by the turning point and the diagonal opposite to the turning point are identified as filling river points, and these filling river points are filled to obtain the three-dimensional river.
[0125] Furthermore, to ensure the smoothness of the river bend, river points can be filled in the bend area to create a smooth transition. Within the bend area, a triangular region is formed by the bend point and its opposite diagonal; that is, a triangular region with the bend point as the vertex and its opposite diagonal as the side. Further, points within this triangular region are designated as river points for filling, such as… Figure 5 The black-filled dots in region C are shown.
[0126] Therefore, by using the above technical solution, after expanding the river section, the turning area can be filled to make the turning point of the generated river smooth and achieve the effect of a smooth curve visually. It also makes the river turn as close as possible to the real-world river turn, thus improving the realism of the generated river.
[0127] This disclosure also provides an apparatus for generating river topography, such as Figure 6 As shown, the device 10 includes: a first determining module 100, used to determine the location of the starting point and the location of the ending point of the three-dimensional river; a second determining module 200, used to determine whether there is a river path corresponding to the location of the starting point and the location of the ending point in the three-dimensional basic terrain; and an expanding module 300, used to perform edge expanding processing on the river path according to the width corresponding to the three-dimensional river if the river path exists, so as to generate the three-dimensional river in the three-dimensional basic terrain.
[0128] Optionally, the second determining module includes: a first determining submodule, configured to determine valid candidate points adjacent to the target point, wherein the starting point is the initial value of the target point; a second determining submodule, configured to determine the current search cost corresponding to each of the valid candidate points as path points in the river path; a first processing submodule, configured to determine a new target point based on the current search cost of the valid candidate points corresponding to the target point, triggering the first determining submodule to determine valid candidate points adjacent to the target point until a search termination condition is met, wherein the search termination condition is that the new target point is the endpoint or there are no candidate points in the candidate point list; and a second determining submodule, configured to, if the new target point is the endpoint, sequentially obtain preceding nodes from the endpoint until the obtained preceding nodes are the path corresponding to the starting point, and determine it as the river path.
[0129] Optionally, the processing submodule further includes: an update submodule, configured to determine the target search cost corresponding to the valid candidate point based on the current search cost corresponding to the valid candidate point, update the candidate point list and the selected point list, and determine the preceding node corresponding to the valid candidate point, wherein the target search cost is used to record the minimum search cost when the valid candidate point is used as the path point, and the candidate point list initially includes the starting point; and a second processing submodule, configured to take the candidate point with the minimum target search cost in the updated candidate point list as the new target point, and move the new target point from the candidate point list to the selected point list.
[0130] Optionally, the update submodule includes: a third determining submodule, configured to add the valid candidate point to the candidate point list if the valid candidate point is not in the candidate point list, determine the current search cost corresponding to the valid candidate point as the target search cost corresponding to the valid candidate point, and use the target point as the predecessor node of the valid candidate point; a fourth determining submodule, configured to update the target search cost of the valid candidate point to the current search cost if the valid candidate point is in the candidate point list and the current search cost corresponding to the valid candidate point is less than the target search cost of the valid candidate point, and use the target point as the predecessor node of the valid candidate point; and a fifth determining submodule, configured to move the valid candidate point from the selected point list to the candidate point list if the valid candidate point is in the selected point list and the current search cost corresponding to the valid candidate point is less than the target search cost of the valid candidate point, update the target search cost of the valid candidate point to the current search cost, and use the target point as the predecessor node of the valid candidate point.
[0131] Optionally, the first determining submodule includes: a sixth determining submodule, configured to determine that the target point does not have a valid candidate point if the height of the target point is less than the height of the endpoint; a seventh determining submodule, configured to, when the height of the target point is greater than or equal to the height of the endpoint and the target point has four adjacent points in the horizontal direction, if the target point has an adjacent point below it in the vertical direction but no adjacent point above it, then the four adjacent points in the horizontal direction are taken as the valid candidate points; if the target point has an adjacent point below it in the vertical direction and an adjacent waterfall point above it, then the four adjacent points in the horizontal direction are taken as the valid candidate points; an eighth determining submodule, configured to, when the height of the target point is greater than or equal to the height of the endpoint and the target point has fewer than four adjacent points in the horizontal direction, if the target point has an adjacent point below it in the vertical direction but no adjacent point above it, or if the target point has an adjacent point below it in the vertical direction and an adjacent waterfall point above it, then the adjacent points below it are taken as the valid candidate points, and the adjacent points below it are marked as waterfall points.
[0132] Optionally, the extension module includes: a ninth determining submodule, used to determine segment points on the river path, wherein the segment points include the starting point, the ending point, and the turning point on the river path, and the coordinate values of two points adjacent to the turning point in the river path are different in the horizontal direction; a tenth determining submodule, used to determine the river segment corresponding to the river path based on the segment points; and an extension submodule, used to extend each river segment according to the width corresponding to the three-dimensional river.
[0133] Optionally, the expansion submodule includes: an eleventh determining submodule, used to determine the expansion width corresponding to both sides of the river segment according to the width corresponding to the three-dimensional river, and generate an expansion region according to the expansion width; a mapping submodule, used to map the expansion region vertically to obtain the region candidate points corresponding to the expansion region; a twelfth determining submodule, used to determine the effective region candidate points based on each path point in the river segment; and a thirteenth determining submodule, used to determine the river point among the effective region candidate points based on each path point in the river segment, wherein the river path and the river point form the expanded three-dimensional river.
[0134] Optionally, the twelfth determining submodule is further configured to: for each path point, determine the effective candidate points in the region among the region candidate points in the following manner: determine the effective candidate points corresponding to the reference point, and determine the effective candidate points as the effective candidate points in the region, wherein the reference point is initially the path point; if the effective candidate point is an adjacent point of the reference point in the extension direction, then determine the effective candidate point as a new reference point, and re-execute the determination of the effective candidate points corresponding to the reference point until the new reference point does not belong to the region candidate points, wherein the extension direction is a direction perpendicular to the river section in the horizontal direction, and the effective candidate points in the region include the effective candidate points that belong to the region candidate points.
[0135] Optionally, the thirteenth determining submodule is further configured to: for each of the path points, determine the river points among the valid candidate points in the region in the following manner: obtain the valid candidate points in the region corresponding to the reference point, wherein the reference point is initially the path point; if at least one of the adjacent points in the horizontal direction or the upper adjacent points in the vertical direction of the valid candidate point in the region is a river point, determine the valid candidate point as a river point, and determine the valid candidate points in the region in the extension direction of the reference point as new reference points, and re-execute the process of obtaining the valid candidate points in the region corresponding to the reference point until each of the valid candidate points in the region has been traversed.
[0136] Optionally, the expansion module further includes: a fourteenth determining submodule, used to determine the turning direction corresponding to the adjacent river section after expansion, and to take the area opposite to the turning direction and formed by the outer extension line of the adjacent river section as the turning area; and a filling submodule, used to determine the points in the triangle area formed by the turning point and the diagonal opposite to the turning point as filling river points, and to fill the filling river points to obtain the three-dimensional river.
[0137] The following is for reference. Figure 7 This diagram illustrates a structural schematic of an electronic device 600 suitable for implementing embodiments of the present disclosure. The terminal devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 7 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0138] like Figure 7As shown, electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 601, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 602 or a program loaded from storage device 608 into random access memory (RAM) 603. RAM 603 also stores various programs and data required for the operation of electronic device 600. Processing device 601, ROM 602, and RAM 603 are interconnected via bus 604. Input / output (I / O) interface 605 is also connected to bus 604.
[0139] Typically, the following devices can be connected to I / O interface 605: input devices 606 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 607 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 608 including, for example, magnetic tapes, hard disks, etc.; and communication devices 609. Communication device 609 allows electronic device 600 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 7 An electronic device 600 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0140] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by the processing device 601, it performs the functions defined in the methods of embodiments of this disclosure.
[0141] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0142] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.
[0143] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0144] The aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to: determine the location of the starting point and the location of the ending point of a three-dimensional river; determine, based on the location of the starting point and the location of the ending point, whether a river path corresponding to the location of the starting point and the location of the ending point exists in the three-dimensional base terrain; if the river path exists, perform edge expansion processing on the river path based on the width corresponding to the three-dimensional river to generate the three-dimensional river in the three-dimensional base terrain.
[0145] Computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof, including but not limited to object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0146] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0147] The modules described in the embodiments of this disclosure can be implemented in software or in hardware. The names of the modules are not necessarily limiting in certain circumstances; for example, the first determining module can also be described as "a module for determining the location of the starting point and the location of the ending point of a three-dimensional river".
[0148] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0149] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0150] According to one or more embodiments of this disclosure, Example 1 provides a method for generating river terrain, wherein the method includes: determining the location of the starting point and the location of the ending point of a three-dimensional river; determining whether a river path corresponding to the location of the starting point and the location of the ending point exists in the three-dimensional base terrain based on the location of the starting point and the location of the ending point; if the river path exists, performing edge expansion processing on the river path according to the width corresponding to the three-dimensional river to generate the three-dimensional river in the three-dimensional base terrain.
[0151] According to one or more embodiments of this disclosure, Example 2 provides the method of Example 1, wherein determining whether a river path corresponding to the starting point and the ending point exists in the three-dimensional basic terrain based on the starting point and the ending point includes: determining effective candidate points adjacent to the target point, wherein the starting point is the initial value of the target point; determining the current search cost corresponding to each of the effective candidate points as a path point in the river path; determining a new target point based on the current search cost of the effective candidate points corresponding to the target point, and re-executing the step of determining the effective candidate points adjacent to the target point until the search termination condition is reached, wherein the search termination condition is that the new target point is the ending point or there are no candidate points in the candidate point list; if the new target point is the ending point, then sequentially obtaining the preceding nodes from the ending point until the obtained preceding nodes are the path corresponding to the starting point, and determining them as the river path.
[0152] According to one or more embodiments of this disclosure, Example 3 provides the method of Example 2, wherein determining a new target point based on the current search cost of the valid candidate point corresponding to the target point includes: determining the target search cost corresponding to the valid candidate point based on the current search cost corresponding to the valid candidate point, updating the candidate point list and the selected point list, and determining the preceding node corresponding to the valid candidate point, wherein the target search cost is used to record the minimum search cost when the valid candidate point is used as the path point, and the candidate point list initially includes the starting point; taking the candidate point with the minimum target search cost in the updated candidate point list as the new target point, and moving the new target point from the candidate point list to the selected point list.
[0153] According to one or more embodiments of this disclosure, Example 4 provides the method of Example 3, wherein the step of determining the target search cost corresponding to the valid candidate point based on the current search cost corresponding to the valid candidate point, updating the candidate point list and the selected point list, and determining the predecessor node corresponding to the valid candidate point includes: if the valid candidate point is not in the candidate point list, then adding the valid candidate point to the candidate point list, determining the current search cost corresponding to the valid candidate point as the target search cost corresponding to the valid candidate point, and using the target point as the predecessor node of the valid candidate point; if the valid candidate point is in the candidate point list, If the current search cost corresponding to the valid candidate point is less than the target search cost of the valid candidate point, the target search cost of the valid candidate point is updated to the current search cost, and the target point is set as the predecessor node of the valid candidate point; if the valid candidate point is in the selected point list, if the current search cost corresponding to the valid candidate point is less than the target search cost of the valid candidate point, the valid candidate point is moved from the selected point list to the candidate point list, the target search cost of the valid candidate point is updated to the current search cost, and the target point is set as the predecessor node of the valid candidate point.
[0154] According to one or more embodiments of this disclosure, Example 5 provides the method of Example 3, wherein determining the effective candidate points adjacent to the target point includes: if the height of the target point is less than the height of the endpoint, determining that the target point has no effective candidate points; if the height of the target point is greater than or equal to the height of the endpoint and the target point has four adjacent points in the horizontal direction, and if the target point has an adjacent point below it in the vertical direction but no adjacent point above it, then the four adjacent points in the horizontal direction are taken as the effective candidate points; if the target point has an adjacent point below it in the vertical direction and an adjacent waterfall point above it, then the four adjacent points in the horizontal direction are taken as the effective candidate points; if the height of the target point is greater than or equal to the height of the endpoint and the target point has fewer than four adjacent points in the horizontal direction, and if the target point has an adjacent point below it in the vertical direction but no adjacent point above it, or if the target point has an adjacent point below it in the vertical direction and an adjacent waterfall point above it, then the adjacent point below it is taken as the effective candidate point, and the adjacent point below it is marked as a waterfall point.
[0155] According to one or more embodiments of this disclosure, Example 6 provides the method of Example 1, wherein the step of performing edge expansion processing on the river path according to the width corresponding to the three-dimensional river to generate the three-dimensional river in the three-dimensional base terrain includes: determining segment points on the river path, wherein the segment points include the starting point, the ending point, and the turning point on the river path, and the coordinate values of two points adjacent to the turning point in the river path are different in the horizontal direction; determining the river segment corresponding to the river path according to the segment points; and for each river segment, expanding the river segment according to the width corresponding to the three-dimensional river.
[0156] According to one or more embodiments of this disclosure, Example 7 provides the method of Example 6, wherein expanding the river segment according to the width corresponding to the three-dimensional river includes: determining the expansion width corresponding to both sides of the river segment according to the width corresponding to the three-dimensional river, and generating an expansion region according to the expansion width; mapping the expansion region vertically to obtain regional candidate points corresponding to the expansion region; determining regional effective candidate points among the regional candidate points based on each path point in the river segment; and determining river points among the regional effective candidate points based on each path point in the river segment, wherein the river path and the river points form the expanded three-dimensional river.
[0157] According to one or more embodiments of this disclosure, Example 8 provides the method of Example 7, wherein determining a valid candidate point in the regional candidate points based on each path point in the river segment includes: for each path point, determining a valid candidate point in the regional candidate points in the following manner: determining a valid candidate point corresponding to a reference point and determining the valid candidate point as a valid candidate point in the region, wherein the reference point is initially the path point; if the valid candidate point is an adjacent point of the reference point in the extension direction, then determining the valid candidate point as a new reference point, and re-performing the determination of the valid candidate point corresponding to the reference point until the new reference point does not belong to the regional candidate points, wherein the extension direction is a direction perpendicular to the river segment in the horizontal direction, and the valid candidate points in the region include valid candidate points belonging to the regional candidate points.
[0158] According to one or more embodiments of this disclosure, Example 9 provides the method of Example 7, wherein determining the river point among the valid candidate points of the region based on each path point in the river segment includes: for each path point, determining the river point among the valid candidate points of the region in the following manner: obtaining the valid candidate point of the region corresponding to a reference point, wherein the reference point is initially the path point; if at least one of the adjacent points in the horizontal direction or the upper adjacent points in the vertical direction of the valid candidate point of the region is a river point, determining the valid candidate point as a river point, and determining the valid candidate point of the region in the extension direction of the reference point as a new reference point, and re-executing the step of obtaining the valid candidate point of the region corresponding to the reference point, until each of the valid candidate points of the region has been traversed.
[0159] According to one or more embodiments of this disclosure, Example 10 provides the method of Example 6, wherein the step of performing edge expansion processing on the river path according to the width corresponding to the three-dimensional river to generate the three-dimensional river in the three-dimensional base terrain further includes: determining the turning direction corresponding to the adjacent river segments after expansion; taking the area opposite to the turning direction and formed by the outer extension line of the adjacent river segments as the turning area; determining the points in the triangle area formed by the turning point and the diagonal opposite to the turning point as filling river points, and filling the filling river points to obtain the three-dimensional river.
[0160] According to one or more embodiments of this disclosure, Example 11 provides a river terrain generation apparatus, the apparatus comprising: a first determining module, configured to determine the location of the starting point and the location of the ending point of a three-dimensional river; a second determining module, configured to determine whether a river path corresponding to the location of the starting point and the location of the ending point exists in the three-dimensional base terrain based on the location of the starting point and the location of the ending point; and an expanding module, configured to, if the river path exists, perform edge expanding processing on the river path according to the width corresponding to the three-dimensional river, so as to generate the three-dimensional river in the three-dimensional base terrain.
[0161] According to one or more embodiments of the present disclosure, Example 12 provides a computer-readable medium having a computer program stored thereon that, when executed by a processing device, implements the steps of the method described in any one of Examples 1-10.
[0162] According to one or more embodiments of this disclosure, Example 13 provides an electronic device including: a storage device having a computer program stored thereon; and a processing device for executing the computer program in the storage device to implement the steps of the method of any one of Examples 1-10.
[0163] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.
[0164] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.
[0165] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative forms of implementing the claims. Regarding the apparatus in the above embodiments, the specific manner in which the various modules perform their operations has been described in detail in the embodiments relating to the method, and will not be elaborated upon here.
Claims
1. A method of generating a river terrain, characterized by, The method comprises: determining a position of a starting point and a position of an ending point of a three-dimensional river; determining effective candidate points adjacent to a target point, wherein the starting point is an initial value of the target point; respectively determining a corresponding current search cost in a case that each of the effective candidate points is taken as a path point in a river path; determining a new target point according to the current search cost of the effective candidate point corresponding to the target point, re-executing the step of determining the effective candidate points adjacent to the target point until a search end condition is reached, the search end condition being that the new target point is the ending point or there is no candidate point in a candidate point list; if the new target point is the ending point, sequentially obtaining a predecessor node from the ending point until the obtained predecessor node is a path corresponding to the starting point, and determining the path as a river path, wherein the river path is a path searched from the starting point to the ending point; if the river path exists, performing edge expansion processing on the river path according to a width corresponding to the three-dimensional river to generate the three-dimensional river in the three-dimensional underlying terrain.
2. The method of claim 1, wherein, The determining of the new target point according to the current search cost of the effective candidate point corresponding to the target point comprises: determining a target search cost corresponding to the effective candidate point according to the current search cost of the effective candidate point, updating a candidate point list and a selected point list, and determining a predecessor node corresponding to the effective candidate point, wherein the target search cost is used for recording a minimum search cost when the effective candidate point is taken as the path point, and the candidate point list initially contains the starting point; taking a candidate point with a minimum target search cost in the updated candidate point list as a new target point, and moving the new target point from the candidate point list to the selected point list.
3. The method of claim 2, wherein, The determining of the target search cost corresponding to the effective candidate point according to the current search cost of the effective candidate point, the updating of the candidate point list and the selected point list, and the determining of the predecessor node corresponding to the effective candidate point comprise: if the effective candidate point is not in the candidate point list, adding the effective candidate point to the candidate point list, determining the current search cost of the effective candidate point as the target search cost corresponding to the effective candidate point, and taking the target point as the predecessor node of the effective candidate point; if the effective candidate point is in the candidate point list, in a case that the current search cost of the effective candidate point is determined to be less than the target search cost of the effective candidate point, updating the target search cost of the effective candidate point to the current search cost, and taking the target point as the predecessor node of the effective candidate point; if the effective candidate point is in the selected point list, in a case that the current search cost of the effective candidate point is determined to be less than the target search cost of the effective candidate point, moving the effective candidate point from the selected point list to the candidate point list, updating the target search cost of the effective candidate point to the current search cost, and taking the target point as the predecessor node of the effective candidate point.
4. The method of claim 2, wherein, The determining of the effective candidate point adjacent to the target point comprises: If the height of the target point is less than the height of the terminal point, it is determined that the target point has no effective candidate point; If the height of the target point is greater than or equal to the height of the terminal point and there are less than four adjacent points in the horizontal direction of the target point, if there is an adjacent point below the target point in the vertical direction and there is no adjacent point above the target point, or if there is an adjacent point below the target point in the vertical direction and there is an adjacent waterfall point above the target point, the adjacent point below the target point is determined as the effective candidate point, and the adjacent point below the target point is marked as a waterfall point. The edge expansion processing of the river path according to the width corresponding to the three-dimensional river comprises:
5. The method of claim 1, wherein, Determining segmented points on the river path, wherein the segmented points comprise the starting point, the terminal point and a turning point on the river path, and the coordinate values of two points adjacent to the turning point in the horizontal direction of the river path are different; According to the segmented points, determining a river section corresponding to the river path; For each river section, expanding the river section according to the width corresponding to the three-dimensional river. The expanding of the river section according to the width corresponding to the three-dimensional river comprises:
6. The method of claim 5, wherein, According to the width corresponding to the three-dimensional river, determining an expansion width corresponding to each side of the river section, and generating an expansion region according to the expansion width; Mapping the expansion region in the vertical direction to obtain a region candidate point corresponding to the expansion region; According to each path point in the river section, determining a region effective candidate point in the region candidate point based on the path point; According to each path point in the river section, determining a river point in the region effective candidate point based on the path point, and the river path and the river point form an expanded three-dimensional river. The determining of the region effective candidate point in the region candidate point based on the path point in the river section comprises:
7. The method of claim 6, wherein, For each path point, the region effective candidate point in the region candidate point is determined by the following method: Determining an effective candidate point corresponding to a reference point, and determining the effective candidate point as the region effective candidate point, wherein the reference point is initially the path point; If the effective candidate point is a neighboring point of the reference point in an expansion direction, the effective candidate point is determined as a new reference point, and the determination of the effective candidate point corresponding to the reference point is re-executed until the new reference point does not belong to the region candidate point, wherein the expansion direction is a direction perpendicular to the river section in a horizontal direction, and the region effective candidate point includes the effective candidate point belonging to the region candidate point.
8. The method of claim 6, wherein, The determination of the river point in the region effective candidate point based on the path point in each path point of the river section includes: For each path point, the river point in the region effective candidate point is determined by the following manner: Obtain the region effective candidate point corresponding to the reference point, wherein the reference point is initially the path point; If at least one of the neighboring point of the region effective candidate point in the horizontal direction or the neighboring point above in the vertical direction is a river point, the effective candidate point is determined as a river point, and the region effective candidate point of the reference point in the expansion direction is determined as a new reference point, and the obtaining of the region effective candidate point corresponding to the reference point is re-executed until each region effective candidate point is traversed.
9. The method of claim 5, wherein, The edge expansion processing of the river path according to the width corresponding to the three-dimensional river is further used to generate the three-dimensional river in the three-dimensional base terrain, and the edge expansion processing of the river path according to the width corresponding to the three-dimensional river includes: Determine the turning direction corresponding to the adjacent river section after expansion, and take the region formed by the outer extension line of the adjacent river section away from the turning direction as a turning region; Determine the points in the triangular region formed by the turning point and the opposite diagonal line of the turning point in the turning region as filling river points, and fill the filling river points to obtain the three-dimensional river.
10. A device for generating a river terrain, characterized by The device includes: A first determination module is configured to determine the position of a starting point and the position of an ending point of a three-dimensional river; A second determination module is configured to determine the effective candidate points adjacent to a target point, wherein the starting point is an initial value of the target point; determine the current search cost corresponding to each effective candidate point when the effective candidate point is taken as a path point in the river path; determine a new target point according to the current search cost of the effective candidate point corresponding to the target point, and re-execute the step of determining the effective candidate points adjacent to the target point until a search end condition is reached, the search end condition is that the new target point is the ending point or there is no candidate point in the candidate point list; if the new target point is the ending point, obtain the predecessor node from the ending point in sequence until the obtained predecessor node is the path corresponding to the starting point, and determine the path as a river path, wherein the river path is a path from the starting point to the ending point; An expansion module is configured to, if the river path exists, perform edge expansion processing of the river path according to the width corresponding to the three-dimensional river to generate the three-dimensional river in the three-dimensional base terrain.
11. A computer readable medium having stored thereon a computer program, characterized in that, The program is executed by a processing device to implement the steps of the method in any one of claims 1-9.
12. An electronic device, comprising: It includes: A storage device having a computer program stored thereon; processing means for executing the computer program in said storage means to implement the steps of the method according to any one of claims 1-9.
Citation Information
Patent Citations
Method and device for creating river model in 3D (three-dimensional) online game
CN103700139A
System and method for generating multi dimensional topographic feature data of channel
KR101655021B1