CN115601486A - Virtual river generation method and device - Google Patents

Virtual river generation method and device Download PDF

Info

Publication number
CN115601486A
CN115601486A CN202211303707.0A CN202211303707A CN115601486A CN 115601486 A CN115601486 A CN 115601486A CN 202211303707 A CN202211303707 A CN 202211303707A CN 115601486 A CN115601486 A CN 115601486A
Authority
CN
China
Prior art keywords
virtual
node
curve
river
model
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211303707.0A
Other languages
Chinese (zh)
Inventor
张又文
汤志
杨唯
孟岩
万平
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhuhai Kingsoft Digital Network Technology Co Ltd
Original Assignee
Zhuhai Kingsoft Digital Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhuhai Kingsoft Digital Network Technology Co Ltd filed Critical Zhuhai Kingsoft Digital Network Technology Co Ltd
Priority to CN202211303707.0A priority Critical patent/CN115601486A/en
Publication of CN115601486A publication Critical patent/CN115601486A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T13/00Animation
    • G06T13/203D [Three Dimensional] animation
    • G06T13/603D [Three Dimensional] animation of natural phenomena, e.g. rain, snow, water or plants
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T17/00Three dimensional [3D] modelling, e.g. data description of 3D objects
    • G06T17/05Geographic models
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T17/00Three dimensional [3D] modelling, e.g. data description of 3D objects
    • G06T17/20Finite element generation, e.g. wire-frame surface description, tesselation

Landscapes

  • Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Geometry (AREA)
  • Software Systems (AREA)
  • Computer Graphics (AREA)
  • Remote Sensing (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The application provides a virtual river generation method and a device, wherein the virtual river generation method comprises the following steps: determining a first curve and a second curve, wherein virtual nodes contained in the first curve and the second curve are arranged according to a node arrangement sequence; drawing a node connection line between the virtual node of the first curve and the virtual node of the second curve according to the node arrangement sequence corresponding to the first curve to obtain a connection line model; traversing the virtual nodes of the second curve in the connection line model according to the node arrangement sequence corresponding to the second curve, and generating an initial virtual river containing a polygonal patch according to the traversal result; and determining node coordinates of virtual nodes in the initial virtual river, merging polygon patches contained in the initial virtual river according to the node coordinates, and generating a target virtual river according to a merging result.

Description

Virtual river generation method and device
Technical Field
The application relates to the technical field of computers, in particular to a virtual river generation method. The application also relates to a virtual river generation device, a virtual model generation method, a virtual model generation device, a terrain model generation method, a terrain model generation device, a computing device and a computer readable storage medium.
Background
With the development of internet technology, 3D technology is increasingly applied to the fields of game production, animation production, and the like. In order to create a relatively real environment, provide a richer game scene or animation scene, and add a river as a natural landscape in the process of making a game or animation, in the prior art, a preset river model is usually used to implement one-key generation, or a curve is used to generate a river, which has a single river generation mode, cannot implement a more complex river shape, has a lower generated river truth, and further cannot provide a more real visual effect for users, so a virtual river generation method is urgently needed to solve the above problems.
Disclosure of Invention
In view of this, the embodiment of the present application provides a virtual river generation method to solve the technical defects existing in the prior art. The embodiment of the application also provides a virtual river generation device, a virtual model generation method, a virtual model generation device, a terrain model generation method, a terrain model generation device, a computing device and a computer readable storage medium.
According to a first aspect of embodiments of the present application, there is provided a virtual river generation method, including:
determining a first curve and a second curve, wherein virtual nodes contained in the first curve and the second curve are arranged according to a node arrangement sequence;
according to the node arrangement sequence corresponding to the first curve, drawing a node connection line between the virtual node of the first curve and the virtual node of the second curve to obtain a connection line model;
traversing the virtual nodes of the second curve in the connection line model according to the node arrangement sequence corresponding to the second curve, and generating an initial virtual river containing a polygonal patch according to the traversal result;
and determining node coordinates of virtual nodes in the initial virtual river, merging polygon patches contained in the initial virtual river according to the node coordinates, and generating a target virtual river according to a merging result.
Optionally, the drawing a node connection line between the virtual node of the first curve and the virtual node of the second curve according to the node arrangement order corresponding to the first curve to obtain a connection line model includes:
determining an ith virtual node contained in the first curve based on the node arrangement order corresponding to the first curve, wherein i is a positive integer;
determining a connecting virtual node corresponding to the ith virtual node in the second curve, and drawing an ith node connecting line between the ith virtual node and the connecting virtual node;
judging whether a virtual node without node connection drawing exists in the first curve;
if yes, i is increased by 1, and the step of determining the ith virtual node contained in the first curve based on the node arrangement sequence corresponding to the first curve is executed;
if not, determining a connection line model based on the connection line result.
Optionally, the determining a connection virtual node corresponding to the ith virtual node in the second curve includes:
calculating the distance between the ith virtual node and each virtual node in the second curve, and selecting the virtual node with the shortest distance as a virtual node to be selected;
and under the condition that at least two virtual nodes to be selected exist, selecting the virtual node to be selected with the highest sequencing priority from the at least two virtual nodes to be selected as a connecting virtual node.
Optionally, the traversing the virtual nodes of the second curve in the connection line model according to the node arrangement order corresponding to the second curve, and generating an initial virtual river including a polygon patch according to a traversal result includes:
under the condition that the second curve comprises at least one unconnected virtual node, determining an unconnected node sequence corresponding to the unconnected virtual node according to a node arrangement sequence corresponding to the second curve;
determining a jth virtual node from the at least one unconnected virtual node according to the sequence of the unconnected nodes, wherein j is a positive integer;
determining a to-be-connected virtual node corresponding to the jth virtual node in the first curve, and drawing a jth node connecting line between the jth virtual node and the to-be-connected virtual node;
judging whether an unconnected virtual node without node connection line drawing exists in the at least one unconnected virtual node;
if yes, j is increased by 1, and the step of determining the jth virtual node in the at least one unconnected virtual node according to the sequence of the unconnected virtual nodes is executed;
and if not, generating an initial virtual river containing a polygon patch based on the drawing result, wherein the polygon patch is enclosed by a node connecting line, the first curve and the second curve.
Optionally, the merging the polygon patches included in the initial virtual river according to the node coordinates, and generating the target virtual river according to a merging result includes:
projecting the initial virtual river containing the polygonal patches, and combining the polygonal patches with overlapping relation in patch projection results to obtain a virtual combination model containing projection virtual nodes and coincident virtual nodes;
determining projection coordinates of the projection virtual nodes according to the node coordinates, and calculating coincidence coordinates of the coincidence virtual nodes according to the projection coordinates;
restoring a virtual merging model containing the projection virtual nodes and the coincidence virtual nodes according to the projection coordinates and the coincidence coordinates to obtain an intermediate virtual river;
and performing triangular surface division processing on the intermediate virtual river, and generating a target virtual river based on a processing result.
Optionally, the performing triangular surface division processing on the intermediate virtual river and generating a target virtual river based on a processing result includes:
performing triangular surface division processing on the middle virtual river to obtain a virtual divided river;
and performing model drawing based on a preset river depth and the divided patches of the virtually divided river, and determining a target virtually river corresponding to the virtually divided river according to a drawing result.
Optionally, after the step of merging polygon patches included in the initial virtual river according to the node coordinates and generating a target virtual river according to a merging result is executed, the method further includes:
obtaining a terrain model;
and carrying out fusion processing on the terrain model and the target virtual river, and determining a target terrain model according to a fusion result.
Optionally, the fusing the terrain model and the target virtual river, and determining the target terrain model according to a fusion result includes:
carrying out fusion processing on the terrain model and the target virtual river to obtain an initial terrain model;
determining a beach area associated with the target virtual river in the initial terrain model;
a beach model is created for the beach area of the initial terrain model, and a target terrain model including the beach model and the target virtual river is determined according to the creation result.
Optionally, the creating a beach model for the beach area in the initial terrain model and determining a target terrain model containing the beach model and the target virtual river according to the creating result includes:
creating a beach model for the beach area in the initial terrain model, and determining an intermediate terrain model according to the creation result, wherein the intermediate terrain model comprises the beach model and the target virtual river;
determining a river boundary region associated with the target virtual river in the intermediate terrain model;
and drawing a terrain feature point in the river boundary area, creating a terrain feature model according to the terrain feature point, and determining a target terrain model according to a creation result, wherein the target terrain model comprises the terrain feature model, the beach model and the target virtual river.
Optionally, the determining the first curve and the second curve includes:
creating a first group of virtual nodes and a second group of virtual nodes;
and drawing a first curve according to the node arrangement sequence corresponding to the first group of virtual nodes, and drawing a second curve according to the node arrangement sequence corresponding to the second group of virtual nodes.
According to a second aspect of embodiments of the present application, there is provided a virtual river generating apparatus including:
the determining module is configured to determine a first curve and a second curve, wherein virtual nodes contained in the first curve and the second curve are arranged according to a node arrangement sequence;
the drawing module is configured to draw a node connection line between the virtual node of the first curve and the virtual node of the second curve according to the node arrangement sequence corresponding to the first curve to obtain a connection line model;
the traversing module is configured to traverse the virtual nodes of the second curve in the connection line model according to the node arrangement sequence corresponding to the second curve, and generate an initial virtual river containing a polygonal patch according to a traversal result;
and the generating module is configured to determine node coordinates of virtual nodes in the initial virtual river, merge polygon patches contained in the initial virtual river according to the node coordinates, and generate a target virtual river according to a merging result.
According to a third aspect of embodiments of the present application, there is provided a virtual model generation method, including:
determining a first curve and a second curve, wherein virtual nodes contained in the first curve and the second curve are arranged according to a node arrangement sequence;
drawing a node connection line between the virtual node of the first curve and the virtual node of the second curve according to the node arrangement sequence corresponding to the first curve to obtain a connection line model;
traversing the virtual nodes of the second curve in the connection line model according to the node arrangement sequence corresponding to the second curve, and generating an initial virtual model containing a polygonal patch according to a traversal result;
and determining node coordinates of virtual nodes in the initial virtual model, merging polygon patches contained in the initial virtual model according to the node coordinates, and generating a target virtual model according to a merging result.
According to a fourth aspect of embodiments of the present application, there is provided a virtual model generation apparatus including:
the curve determining module is configured to determine a first curve and a second curve, wherein virtual nodes contained in the first curve and the second curve are arranged according to a node arrangement sequence;
a connecting line drawing module configured to draw a node connecting line between the virtual node of the first curve and the virtual node of the second curve according to the node arrangement order corresponding to the first curve, so as to obtain a connecting line model;
the node traversing module is configured to traverse virtual nodes of a second curve in the connecting line model according to the node arrangement sequence corresponding to the second curve, and generate an initial virtual model containing a polygon patch according to a traversing result;
and the model generation module is configured to determine node coordinates of virtual nodes in the initial virtual model, merge polygon patches contained in the initial virtual model according to the node coordinates, and generate a target virtual model according to a merging result.
According to a fifth aspect of embodiments of the present application, there is provided a terrain model generation method, including:
determining a first curve and a second curve in response to a model generation instruction submitted for a terrain model, wherein virtual nodes contained in the first curve and the second curve are arranged according to a node arrangement order;
according to the node arrangement sequence corresponding to the first curve, drawing a node connection line between the virtual node of the first curve and the virtual node of the second curve to obtain a connection line model;
traversing the virtual nodes of the second curve in the connection line model according to the node arrangement sequence corresponding to the second curve, and generating an initial virtual river containing a polygonal patch according to the traversal result;
and generating a target virtual river based on the initial virtual river containing the polygonal patch, and performing fusion processing according to the terrain model and the target virtual river to obtain a target terrain model.
According to a sixth aspect of the embodiments of the present application, there is provided a terrain model generating apparatus including:
the instruction response module is configured to respond to a model generation instruction submitted aiming at a terrain model to determine a first curve and a second curve, wherein virtual nodes contained in the first curve and the second curve are arranged according to a node arrangement sequence;
a node connecting line module configured to draw a node connecting line between the virtual node of the first curve and the virtual node of the second curve according to the node arrangement order corresponding to the first curve, so as to obtain a connecting line model;
the node processing module is configured to traverse the virtual nodes of the second curve in the connection line model according to the node arrangement sequence corresponding to the second curve, and generate an initial virtual river containing a polygonal patch according to a traversal result;
and the terrain generating module is configured to generate a target virtual river based on the initial virtual river containing the polygonal patch, and perform fusion processing according to the terrain model and the target virtual river to obtain a target terrain model.
According to a seventh aspect of embodiments herein, there is provided a computing device comprising:
a memory and a processor;
the memory is for storing computer-executable instructions that when executed by the processor implement the steps of the method.
According to an eighth aspect of embodiments herein, there is provided a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, perform the steps of the method.
According to a ninth aspect of embodiments herein, there is provided a chip storing a computer program which, when executed by the chip, implements the steps of the method.
According to the virtual river generation method provided by the application, a first curve and a second curve are determined, wherein virtual nodes contained in the first curve and the second curve are arranged according to a node arrangement sequence; drawing a node connection line between the virtual node of the first curve and the virtual node of the second curve according to the node arrangement sequence corresponding to the first curve to obtain a connection line model; traversing the virtual nodes of the second curve in the connection line model according to the node arrangement sequence corresponding to the second curve, and generating an initial virtual river containing a polygonal patch according to the traversal result; and determining node coordinates of virtual nodes in the initial virtual river, merging polygon patches contained in the initial virtual river according to the node coordinates, and generating a target virtual river according to a merging result.
The virtual nodes contained in the first curve and the second curve are arranged according to the node arrangement sequence, and node connecting lines are drawn between the virtual nodes on the first curve and the virtual nodes on the second curve, so that an initial virtual river containing a polygonal patch can be obtained, a user-defined complex river shape is realized, and the variety of river generation is improved. And generating a target virtual river according to the node coordinates of the virtual nodes in the initial virtual river, so as to enhance the truth of the river and improve the visual experience of a user.
Drawings
Fig. 1 is a schematic structural diagram of a virtual river generation method according to an embodiment of the present application;
fig. 2 is a flowchart of a virtual river generation method according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a virtual river generation process provided by an embodiment of the present application;
FIG. 4 is a process flow diagram of a virtual river generation method applied to river terrain generation according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a virtual river generating device according to an embodiment of the present application;
FIG. 6 is a flowchart of a method for generating a virtual model according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of a virtual model generation apparatus according to an embodiment of the present application;
FIG. 8 is a flow chart of a terrain model generation method provided by an embodiment of the present application;
FIG. 9 is a schematic structural diagram of a terrain model generation apparatus according to an embodiment of the present application;
fig. 10 is a block diagram of a computing device according to an embodiment of the present application.
Detailed Description
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present application. This application is capable of implementation in many different ways than those herein set forth and of similar import by those skilled in the art without departing from the spirit of this application and is therefore not limited to the specific implementations disclosed below.
The terminology used in the one or more embodiments of the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of the present application. As used in one or more embodiments of the present application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used in one or more embodiments of the present application refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It will be understood that, although the terms first, second, etc. may be used herein in one or more embodiments of the present application to describe various information, these information should not be limited by these terms. These terms are only used to distinguish one type of information from another. For example, a first aspect may be termed a second aspect, and, similarly, a second aspect may be termed a first aspect, without departing from the scope of one or more embodiments of the present application.
In the present application, a virtual river generation method is provided. The present application also relates to a virtual river generating apparatus, a virtual model generating method, a virtual model generating apparatus, a terrain model generating method, a terrain model generating apparatus, a computing device, and a computer-readable storage medium, which are described in detail one by one in the following embodiments.
Referring to the structural schematic diagram of the virtual river generation method shown in fig. 1, the outline of the river is drawn by drawing the first curve and the second curve, the flow direction of the river can be determined according to the drawing direction of the curves, and the flow direction of the river can also be customized according to actual requirements. Virtual nodes contained in the first curve and the second curve are arranged according to the node arrangement sequence; the flow direction of the river can be determined according to the arrangement sequence of the virtual nodes. Traversing the virtual nodes on the first curve according to the node arrangement sequence corresponding to the first curve, determining the virtual nodes corresponding to the virtual nodes on the first curve at the virtual nodes on the second curve, and connecting the virtual nodes on the first curve to the virtual nodes responding to the second curve, namely drawing node connection lines between the virtual nodes on the first curve and the virtual nodes on the second curve, wherein the node connection lines are drawn while ensuring that no intersection exists between the node connection lines. After the virtual nodes on the first curve are all drawn with the node connecting line, the connecting line model shown in fig. 1 is obtained. And traversing the virtual nodes which are not drawn with the node connection lines on the second curve in the connection model, determining the virtual nodes corresponding to the virtual nodes which are not drawn with the node connection lines on the second curve on the first curve, and drawing the node connection lines to obtain the initial virtual river shown in the figure 1. And then merging polygon patches in the initial virtual river, and performing coordinate restoration on the merged virtual river according to the node coordinates of the virtual nodes to generate a target virtual river. The self-definition of the virtual river shape is realized, the three-dimensional virtual rivers with different shapes can be flexibly generated, and the visual experience is further improved.
Fig. 2 shows a flowchart of a virtual river generation method according to an embodiment of the present application, which specifically includes the following steps:
step S202: determining a first curve and a second curve, wherein virtual nodes contained in the first curve and the second curve are arranged according to a node arrangement sequence.
Specifically, the first curve and the second curve respectively refer to two curves for generating a virtual river, and each curve includes virtual nodes arranged according to a node arrangement order. In the process of generating the first curve and the second curve, the virtual nodes may be sequentially determined, and the virtual nodes are sequentially connected to form the curve. After the first curve and the second curve are generated, the positions of the virtual nodes on the first curve and/or the second curve can be adjusted according to requirements, and further the shapes of the first curve and the second curve can be adjusted; the node arrangement order refers to the arrangement order of virtual nodes contained in the curve, and any end point of the curve can be used as a starting point to further determine the node arrangement order corresponding to the curve.
Based on this, under the virtual river drawing scene, the first curve and the second curve are determined as the two sides of the river. The first curve and the second curve can adopt the same drawing method, namely, a first virtual node and a second virtual node are determined, a connecting line is drawn between the first virtual node and the second virtual node, a third virtual node is determined, a connecting line is drawn between the second virtual node and the third virtual node, and then the virtual nodes on the curves are arranged in sequence.
In practical application, when the first curve and the second curve are drawn, a group of virtual nodes with a node arrangement order can be determined, and the virtual nodes are sequentially connected according to the node arrangement order to obtain the drawn curve. The curve shape can be adjusted by adjusting the position of the virtual node.
Further, considering that the first curve and the second curve with the set curve shapes cannot be used for flexibly adjusting the shape of the river and cannot generate a river curve with a specified shape, considering the convenience of curve drawing, the first curve and the second curve can be created in a point drawing and line connecting mode, namely a group of virtual nodes is created, and the curve is drawn according to the node arrangement sequence, which is specifically realized as follows:
creating a first group of virtual nodes and a second group of virtual nodes; and drawing a first curve according to the node arrangement sequence corresponding to the first group of virtual nodes, and drawing a second curve according to the node arrangement sequence corresponding to the second group of virtual nodes.
Specifically, the first group of virtual nodes and the second group of virtual nodes are both a group of nodes used for generating a curve, each group of virtual nodes corresponds to a node arrangement sequence, that is, each virtual node included in each group of virtual nodes corresponds to a unique identifier, and identifiers of the same group of virtual nodes have a sequence relationship and are used for representing the arrangement sequence in the group of virtual nodes, and then the virtual nodes are sequentially connected based on the node arrangement sequence corresponding to the group of virtual nodes, so that the curve is drawn.
Based on the method, virtual nodes are sequentially created according to the node creation sequence, and a first group of virtual nodes and a second group of virtual nodes are obtained. And sequentially connecting the nodes according to the node arrangement sequence corresponding to the first group of virtual nodes to draw a first curve, and sequentially connecting the nodes according to the node arrangement sequence corresponding to the second group of virtual nodes to draw a second curve.
In addition, when the first curve and the second curve are drawn, the first curve can be drawn while virtual nodes are created, namely, a first virtual node used for drawing the first curve is created, a second virtual node is created according to the creation position of the first virtual node, a node connecting line is drawn between the first virtual node and the second virtual node, an unfinished first curve is obtained, a third virtual node is created according to the creation position of the second virtual node, a node connecting line is drawn between the second virtual node and the third virtual node, and the like.
For example, when the first curve and the second curve are drawn, the drawing of the curves may be completed by drawing nodes in order and sequentially connecting the nodes according to the node order. The generation of the curve may be implemented by any three-dimensional computer graphics software. For example, houdini software is used, a plurality of virtual nodes are input in a node creating mode, and then the virtual nodes are sequentially connected according to the arrangement sequence of the virtual nodes to generate two contour curves of the river. The shape of the river can be set according to actual requirements, for example, two rivers are intersected to form a river in the flowing process.
In summary, the first curve is drawn according to the node arrangement order, so that the customization of the virtual node position and the arrangement order can be realized when the virtual node is created, and the flexibility of drawing the first curve is improved.
Step S204: and drawing a node connection line between the virtual node of the first curve and the virtual node of the second curve according to the node arrangement sequence corresponding to the first curve to obtain a connection line model.
Specifically, after the first curve and the second curve are determined, because the virtual nodes included in the first curve and the second curve are arranged according to the node arrangement order, a node connection line can be drawn between the virtual node of the first curve and the virtual node of the second curve according to the node arrangement order corresponding to the first curve, where the node connection line refers to a line drawn between the virtual node on the first curve and the virtual node on the second curve, so that the virtual nodes on the first curve are all connected with the virtual node on the second curve, and the connection line model including at least one polygon is obtained.
Based on the method, after the first curve and the second curve are determined, according to the node arrangement sequence corresponding to the first curve, node connecting lines are drawn between the virtual nodes of the first curve and the virtual nodes of the second curve in sequence according to the node connection rule, and a connecting line model is obtained. Wherein, the node connection rule may include: and drawing node connecting lines according to the distance between the virtual nodes on the first curve and the virtual nodes on the second curve, wherein the node connecting lines cannot be intersected, and each virtual node corresponds to at least one node connecting line and the like. In the obtained connection line model, each virtual node included in the first curve corresponds to one node connection line.
In practical application, when node connection lines are drawn between virtual nodes of a first curve and virtual nodes of a second curve, in order to avoid missing the virtual nodes on the first curve, the virtual nodes can be sequentially traversed according to the node arrangement sequence corresponding to the first curve, the first virtual nodes on the first curve are determined, the virtual nodes corresponding to the first virtual nodes are determined on the second curve, node connection lines are drawn until the virtual nodes at the tail position on the first curve are traversed, and the node connection lines are drawn, so that a connection line model can be obtained.
Further, after the first curve and the second curve are determined, considering that the first curve exists and the second curve contains a large number of virtual nodes, the problem of low river trueness is caused when a river is directly generated according to the first curve and the second curve, so that a connection model can be obtained by drawing a node connection line between the virtual nodes on the first curve and the virtual nodes on the second curve, and the specific implementation is as follows:
determining an ith virtual node contained in the first curve based on the node arrangement sequence corresponding to the first curve, wherein i is a positive integer; determining a connecting virtual node corresponding to the ith virtual node in the second curve, and drawing an ith node connecting line between the ith virtual node and the connecting virtual node; judging whether a virtual node which is not drawn with a node connecting line exists in the first curve; if yes, i is increased by 1, and the step of determining the ith virtual node contained in the first curve based on the node arrangement sequence corresponding to the first curve is executed; if not, determining a connection line model based on the connection line result.
Specifically, connecting virtual nodes refers to virtual nodes that can be connected to the ith virtual node on the first curve determined on the second curve when a node connection line is drawn between the virtual node on the first curve and the virtual node on the second curve, where the ith virtual node may be a virtual node at any endpoint position on the first curve or a virtual node at any position on the first curve.
Based on the node arrangement sequence corresponding to the first curve, the 1 st virtual node contained in the first curve is determined, the connecting virtual node corresponding to the 1 st virtual node contained in the first curve is determined in the second curve, and the 1 st node connecting line is drawn between the 1 st virtual node and the connecting virtual node. After the 1 st node connecting line is drawn, judging whether a virtual node which is not drawn in the node connecting line exists in the first curve, if the virtual node which is not drawn in the node connecting line exists in the first curve, selecting a 2 nd virtual node on the first curve according to the node arrangement sequence, determining a connecting virtual node which corresponds to the 2 nd virtual node contained in the first curve in the second curve, and drawing the 2 nd node connecting line between the 2 nd virtual node and the connecting virtual node. And if the virtual node which is not drawn with the node connection line does not exist in the first curve, determining a connection line model based on the connection line result.
According to the above example, after two river contour curves are drawn, any one of the curves is determined to be a first curve, virtual nodes included in the first curve are traversed, virtual nodes connected with the virtual nodes on the first curve are determined on a second curve, and a node connecting line is drawn between the two virtual nodes. Determining any end point on the first curve as a traversal starting point, determining a virtual node corresponding to the traversal starting point on the second curve, and drawing a node connection line between the traversal starting point and the virtual node; and determining a second node corresponding to the traversal starting point according to the arrangement sequence of the virtual nodes on the first curve, determining a virtual node corresponding to the second node on the second curve, drawing a node connecting line between the second node and the virtual node, and so on until the virtual nodes on the first curve finish the drawing of the node connecting line, thereby obtaining a connection model after the initial traversal.
In summary, based on the node arrangement order corresponding to the first curve, the virtual node on the second curve corresponding to each virtual node on the first curve is sequentially determined, and then the node connecting line between the first curve and the second curve is drawn, so that the virtual river is generated based on the obtained connecting line model in the following process.
Further, when determining a virtual node that can be connected to a virtual node in the first curve in the second curve, considering that the number of virtual nodes included in the second curve may be large, in order to ensure that a virtual node on the first curve is connected to a virtual node on the second curve without crossing a node connection line, the virtual node may be determined according to a distance between the virtual nodes, which is specifically implemented as follows:
calculating the distance between the ith virtual node and each virtual node in the second curve, and selecting the virtual node with the shortest distance as a virtual node to be selected; and under the condition that at least two virtual nodes to be selected exist, selecting the virtual node to be selected with the highest sequencing priority from the at least two virtual nodes to be selected as the connecting virtual node.
Specifically, the virtual node with the shortest distance is a node with the shortest distance between the ith virtual node on the first curve and the second curve, and the shortest distance is determined according to the calculation result by calculating the distance between the ith virtual node and each virtual node on the second curve, so that the virtual node on the second curve corresponding to the shortest distance is determined as the virtual node to be selected. The priority of the ranking can be determined according to the node ranking order of the virtual nodes, and the priority of the virtual nodes which are ranked more ahead is higher.
Based on the above, calculating the distance between the ith virtual node and each virtual node in the second curve, and selecting the virtual node with the minimum distance as the virtual node to be selected which can be connected with the ith virtual node according to the distance; when at least two virtual nodes to be selected exist, one virtual node in the at least two virtual nodes to be selected is selected as a connection virtual node according to the node arrangement order, that is, the virtual node to be selected with the highest ranking priority is selected as the connection virtual node in the at least two virtual nodes to be selected.
Along the above example, when node connection between a virtual node on a first curve and a virtual node on a second curve is drawn, a 1 st virtual node on the first curve is determined, the distance between the 1 st virtual node and each virtual node on the second curve is calculated, in the case where 5 virtual nodes exist on the first curve and the second curve, the distance between the 1 st virtual node on the first curve and the a virtual node on the second curve is 0.5, the distance between the b virtual node is 0.5, the distance between the c virtual node is 1.5, the distance between the d virtual node is 1.9, the distance between the e virtual node is 2.1, the a virtual node and the b virtual node having the shortest distances are determined, and the a virtual node is determined as a virtual node corresponding to the 1 st virtual node on the first curve because the order of the a virtual nodes is earlier.
In summary, when at least two virtual nodes to be selected exist, the virtual node to be selected with the highest ranking priority is selected as the connecting virtual node, so that the virtual nodes on the first curve and the second curve can be connected and drawn one to one, so as to generate a virtual river subsequently.
Step S206: traversing the virtual nodes of the second curve in the connecting line model according to the node arrangement sequence corresponding to the second curve, and generating an initial virtual river containing a polygonal patch according to a traversal result.
Specifically, after a connection line model is obtained, traversing is performed on the virtual nodes of the second curve in the connection line model according to the node arrangement order corresponding to the second curve, and an initial virtual river containing a polygonal patch is generated, wherein the polygonal patch is a polygonal surface formed by the node connection line, the first curve and the second curve after the node connection line is drawn between the virtual nodes on the first curve and the virtual nodes on the second curve; the initial virtual river refers to a river model obtained after all virtual nodes contained in the first curve and the second curve are drawn by node connecting lines.
Based on the above, after the connection model is obtained, the virtual nodes of the second curve in the connection model are traversed according to the node arrangement sequence corresponding to the second curve, the virtual nodes of the second curve in the connection model are determined, the virtual nodes of the second curve, which are not drawn with the node connection, are determined, the virtual nodes corresponding to the virtual nodes of the second curve, which are not drawn with the node connection, are determined in the virtual nodes included in the first curve, and the node connection is further drawn, so that all the virtual nodes included in the second curve correspond to at least one node connection.
Further, after the connection line model is obtained, it is considered that all the virtual nodes on the first curve complete the drawing of the node connection line, but the virtual nodes on the second curve that do not draw the node connection line may still exist, and therefore it is also necessary to determine the virtual nodes on the second curve that do not draw the node connection line, and further complete the drawing of the node connection line, which is specifically implemented as follows:
under the condition that the second curve comprises at least one unconnected virtual node, determining an unconnected node sequence corresponding to the unconnected virtual node according to a node arrangement sequence corresponding to the second curve; determining a jth virtual node from the at least one unconnected virtual node according to the sequence of the unconnected nodes, wherein j is a positive integer; determining a to-be-connected virtual node corresponding to the jth virtual node in the first curve, and drawing a jth node connecting line between the jth virtual node and the to-be-connected virtual node; judging whether an unconnected virtual node without node connection drawing exists in the at least one unconnected virtual node; if yes, j is increased by 1, and the step of determining the jth virtual node in the at least one unconnected virtual node according to the sequence of the unconnected virtual nodes is executed; and if not, generating an initial virtual river containing a polygon patch based on the drawing result, wherein the polygon patch is surrounded by a node connecting line, the first curve and the second curve.
Specifically, the unconnected virtual nodes refer to virtual nodes to which node connection lines are not drawn on the second curve; the unconnected node sequence refers to the arrangement sequence of the unconnected virtual nodes on the second curve, which is determined according to the arrangement sequence of the nodes corresponding to the second curve; the virtual node to be connected refers to a virtual node on the first curve, which can be connected with the jth virtual node on the second curve.
Based on the virtual nodes which are not connected are determined in the sub second curves, and when the second curves contain at least one virtual node which is not connected, the order of the nodes which are not connected and correspond to the virtual nodes is determined according to the order of the nodes which correspond to the second curves; determining a 1 st virtual node in at least one unconnected virtual node according to the sequence of the unconnected virtual nodes, determining a to-be-connected virtual node corresponding to the 1 st virtual node in a first curve, and drawing a 1 st node connecting line between the 1 st virtual node and the to-be-connected virtual node; judging whether an unconnected virtual node without node connection drawing exists in at least one unconnected virtual node; if unconnected virtual nodes of unconnected virtual nodes do not draw node connection lines exist, determining a 2 nd virtual node from the unconnected virtual nodes according to the unconnected node sequence, determining a virtual node to be connected corresponding to the 2 nd virtual node on a first curve, and drawing node connection lines between the 2 nd virtual node and the virtual node to be connected, if unconnected virtual nodes of the unconnected virtual nodes do not exist, generating an initial virtual river containing a polygonal patch based on a drawing result, wherein in the initial virtual river, the polygonal patch is defined by the node connection lines, the first curve and a second curve, and the polygonal patch can be a triangular patch or a quadrilateral patch.
According to the above example, after traversing the virtual nodes on the first curve and drawing the node connecting lines to obtain the connecting line model, because the virtual nodes on the first curve are already connected with the virtual nodes on the second curve, under the condition that the virtual nodes on the second curve all draw the node connecting lines, the node connecting line drawing aiming at the first curve and the second curve is completed; and finding out the virtual nodes which are not drawn with the node connecting lines on the second curve under the condition that the virtual nodes which are not drawn with the node connecting lines exist on the second curve. And re-determining the sequence of the virtual nodes without node connection lines according to the arrangement sequence of the virtual nodes on the second curve, traversing the virtual nodes, determining the virtual nodes which can correspond to the virtual nodes without node connection lines on the first curve, and drawing the node connection lines, so that the virtual nodes on the first curve and the second curve are both drawn with the node connection lines, and obtaining an initial virtual river which comprises a plurality of polygonal patches surrounded by the node connection lines, the first curve and the second curve. In practical application, the generation operation of the patch can be realized through a function provided by three-dimensional computer graphics software.
In summary, the unconnected virtual nodes included in the second curve are connected with the virtual nodes on the first curve to draw node connection lines, so that all the virtual nodes on the second curve are drawn with node connection lines, and a virtual river is generated based on the initial virtual river.
Step S208: and determining node coordinates of virtual nodes in the initial virtual river, merging polygon patches contained in the initial virtual river according to the node coordinates, and generating a target virtual river according to a merging result.
Specifically, after the virtual nodes of the second curve in the connection line model are traversed according to the node arrangement sequence corresponding to the second curve, and an initial virtual river containing a polygon patch is generated according to a traversal result, the polygon patches contained in the initial virtual river are merged according to node coordinates of the virtual nodes in the initial virtual river, so as to generate a target virtual river, wherein the node coordinates refer to coordinates corresponding to the initial virtual river in a coordinate system, the coordinate system includes but is not limited to a plane coordinate system and a space coordinate system, and correspondingly, the node coordinates may also be coordinates of multiple dimensions such as two-dimensional coordinates or three-dimensional coordinates; the merging result is a virtual river including polygonal patches obtained by merging the polygonal patches included in the initial virtual river, and the target virtual river is a river model obtained by merging the polygonal patches included in the initial virtual river.
Based on the above, after an initial virtual river containing polygonal patches is generated based on the first curve and the second curve, the node coordinates of each virtual node in the initial virtual river are determined, at least two polygonal patches contained in the initial virtual river are merged according to the node coordinates of each virtual node, a merged virtual river containing at least one polygonal patch is obtained, and then a target virtual river is generated according to the node coordinates of the virtual nodes in the virtual river.
Further, when the polygon patches included in the initial virtual river are merged, considering that the virtual river is a spatial model, after the polygon patches are merged, the virtual nodes may overlap, and in order to restore the three-dimensional virtual river, it is further necessary to restore each virtual node, which is specifically implemented as follows:
projecting the initial virtual river containing the polygonal patches, and combining the polygonal patches with overlapping relation in patch projection results to obtain a virtual combination model containing projection virtual nodes and coincident virtual nodes; determining projection coordinates of the projection virtual nodes according to the node coordinates, and calculating coincidence coordinates of the coincidence virtual nodes according to the projection coordinates; restoring a virtual merging model containing the projection virtual nodes and the coincidence virtual nodes according to the projection coordinates and the coincidence coordinates to obtain an intermediate virtual river; and performing triangular surface division processing on the intermediate virtual river, and generating a target virtual river based on a processing result.
Specifically, the step of projecting the initial virtual river means that the initial virtual river is placed in a space coordinate system, the initial virtual river is projected to a coordinate system plane formed by an x axis and a y axis, and an obtained virtual river projection diagram can be regarded as a top view of the initial virtual river; the projection virtual node is a node corresponding to a virtual node in the initial virtual river after the initial virtual river is projected to a coordinate system plane formed by an x axis and a y axis; the coincident virtual nodes are virtual nodes with overlapped projection positions after the projection is finished; the virtual merging model is a river model obtained by projecting an initial virtual river and merging polygonal patches which are overlapped after projection. The projection coordinates refer to the node coordinates of the projection virtual nodes determined on the basis of the node coordinates of the virtual nodes in the initial virtual river, and the coincidence coordinates refer to the node coordinates of the coincidence virtual nodes calculated according to the node coordinates of the projection virtual nodes; the middle virtual river is a virtual river obtained by reducing the projected virtual nodes and the polygonal patches; the triangular surface division processing is a rewiring operation performed on the intermediate virtual river, and generates a wired virtual river by dividing a polygonal patch included in the intermediate virtual river into a plurality of triangular surfaces.
Based on the method, the initial virtual river containing the polygonal patches is projected to obtain projected virtual nodes and the projected polygonal patches, and the polygonal patches with the overlapping relation in the patch projection results are merged to obtain a virtual merging model containing the projected virtual nodes and the overlapped virtual nodes. Determining overlapped virtual nodes after projection, determining projection coordinates of the projection virtual nodes according to the node coordinates, and calculating the overlapped coordinates of the overlapped virtual nodes according to the projection coordinates. And restoring the virtual merging model containing the projection virtual nodes and the coincidence virtual nodes according to the projection coordinates and the coincidence coordinates to obtain an intermediate virtual river of node restoration and patch restoration. And carrying out triangular surface division processing on the polygonal patches in the middle virtual river to obtain a target virtual river consisting of a plurality of triangular surfaces.
Following the above example, after the generation operation of the patch is realized by the function provided by the three-dimensional computer graphics software, and the initial virtual river including the polygon patch is obtained, the three-dimensional coordinates of each virtual node in the initial virtual river are recorded, each virtual node is projected to the plane formed by the x-axis and the y-axis in the three-dimensional coordinate system, and boolean operations are performed to merge the overlapped polygon planes. The condition that part of virtual nodes are overlapped can occur after projection, the three-dimensional coordinates of the overlapped virtual nodes can be determined according to the three-dimensional coordinates of the adjacent points, and the initial virtual river is restored according to the determined three-dimensional coordinates to obtain the restored virtual river. It should be noted that, when determining the three-dimensional coordinates of the overlapped virtual nodes, the functions provided by the three-dimensional computer graphics software may also be used for implementation. And rewiring the polygon patches contained in the restored virtual river, dividing the polygon patches into a plurality of triangular faces, wherein the side length of each triangular face can be determined according to actual requirements, and the generated triangular face is similar to an equilateral triangle.
In summary, the initial virtual river is subjected to projection processing, and the projected virtual nodes and the polygonal patches are subjected to reduction processing to obtain the target virtual river, so that a terrain model including the river is generated based on the target virtual river, and the diversity of the terrain is further improved.
Further, after the triangular surface division processing is performed on the middle virtual river, the obtained virtual river is only a river surface and cannot reflect river depths of different river areas, so that the river depth can be preset, and further, model drawing is performed according to the river depth, and the method is specifically realized as follows:
performing triangular surface division processing on the middle virtual river to obtain a virtual divided river; and performing model drawing based on the preset river depth and the divided patches of the virtually divided river, and determining a target virtually river corresponding to the virtually divided river according to a drawing result.
Specifically, the virtual division of the river refers to a virtual river obtained by performing triangular surface division on an intermediate virtual river, performing region division on a polygonal plane corresponding to the intermediate virtual river again, and dividing the intermediate virtual river into virtual rivers formed by splicing triangular patches; the river depth refers to preset river depth parameters, and different river depths can be set for different areas of the virtual river, so that the virtual river is more real; the target virtual river refers to a virtual river generated based on river depth and divided patches, wherein in the process of model drawing, each divided patch can be drawn respectively, and the model drawing is performed based on the river depth corresponding to each divided patch.
Based on the method, triangular surface division processing is carried out on the middle virtual river based on the combined polygonal patches corresponding to the middle virtual river to obtain a virtual divided river comprising a plurality of divided patches, model drawing is carried out based on preset river depth and the divided patches of the virtual divided river, and a target virtual river corresponding to the virtual divided river is drawn according to the river depth corresponding to each divided patch.
According to the above example, the polygon facets included in the restored virtual river are rewired, and after the polygon facets are divided into a plurality of triangular surfaces, virtual rivers with different river depths are generated according to the preset river depth and the triangular surfaces obtained through division, so that the cross section of the virtual rivers is approximate to a trapezoid. The downward extrusion of the patches of the virtual river to present a concave shape can be realized through three-dimensional computer graphics software, so that the river has depth, and the truth of the river is enhanced.
In conclusion, the model is drawn based on the preset river depth and the division patches for virtually dividing the river, so that the reality degree of the drawn target virtual river is improved, and the visual effect is enhanced.
Further, after the target virtual river is drawn, considering that the terrain model only including the terrain features such as vegetation, roads, cliff walls and the like is too single, in order to improve the richness of the terrain model, the target virtual river and the terrain model can be fused, and the method is specifically implemented as follows:
acquiring a terrain model; and performing fusion processing on the terrain model and the target virtual river, and determining a target terrain model according to a fusion result.
Specifically, the terrain model refers to a model for generating a game terrain in a game scene or an animation terrain in an animation scene, and the terrain model includes, but is not limited to, a natural environment model such as a mountain land model, and an urban model; the fusion processing is to fuse the target virtual river into a terrain model, and further generate a terrain including a river landscape.
Based on the method, a pre-drawn terrain model is obtained, and the terrain model and the target virtual river are subjected to fusion processing. Selecting a river region for placing the target virtual river in the terrain model, adding the target virtual river to the river region in the terrain model, obtaining a fusion result, and determining the target terrain model according to the fusion result.
In the above example, the terrain model shown in fig. 3 (a) is obtained, and the virtual river is fused with the terrain model to add the river model to the terrain model, so as to obtain the terrain model shown in fig. 3 (b). In order to ensure that the fusion degree of the virtual river and the terrain model in the fused terrain model is higher, the fused terrain model can be subjected to smoothing treatment, so that the visual effect is enhanced.
In conclusion, the target terrain model is obtained by fusing the terrain model and the target virtual river, so that the combination of the virtual river and the terrain model is realized, the virtual river landscape is added into the terrain model, the richness of the terrain model is improved, and the visual experience of a user is improved.
Further, when the terrain model and the target virtual river are subjected to fusion processing, the river effect is single only by adding the target virtual river into the terrain model, so that a river bank area flushed by river water can be determined in the terrain model after the fusion processing is performed, and then a river beach model is generated, which is specifically realized as follows:
carrying out fusion processing on the terrain model and the target virtual river to obtain an initial terrain model; determining a beach area associated with the target virtual river in the initial terrain model; a beach model is created for the beach area of the initial terrain model, and a target terrain model including the beach model and the target virtual river is determined according to the creation result.
Specifically, the initial terrain model is a terrain model containing a virtual river obtained by fusing a terrain model and a target virtual river; the river shoal area is an area determined in a terrain model according to the river shape of a target virtual river, in an actual river, when the river flows through a curve, surface water flow tends to a concave bank to wash the concave bank, and the water flow can carry silt to accumulate on the convex bank to form a river shoal; the river beach model refers to a model created in a river beach area, which indicates that the area is frequently washed by river water to form a flat river beach.
Based on this, after the terrain model and the target virtual river are fused to obtain the initial terrain model, considering that in an actual river environment, due to the impact effect of river water on a river bank, the water flow is turbulent, and a river beach is easily formed at a bent part of a river channel, so that a river beach area associated with the target virtual river can be determined in the initial terrain model according to drawing experience. And creating a flat or sloping river beach model aiming at the river beach area of the initial terrain model, and further generating a target terrain model comprising the river beach model and the target virtual river.
Following the above example, the beach area corresponding to the river is determined in the terrain model containing the virtual river. The normal lines of the virtual nodes in the two curves of the virtual river are set to be along the curve direction, if the normal line direction of a certain point is excessively deviated from the normal lines of the adjacent points, namely the curve of the river is regarded as a curve, a plurality of adjacent virtual nodes of the virtual nodes at the curve are extracted, the group of connected virtual nodes usually form an arc, the group of virtual nodes are connected end to form a river beach mesh, and the river bank can be leveled by mapping the river beach mesh to form a river bank effect as shown in (c) in fig. 3.
In summary, a river beach area associated with the target virtual river is determined in the initial terrain model, and a river beach model is created in the terrain model for the river beach area, so that the abundance of landforms in the terrain model is improved.
Furthermore, considering that only the colors and the terrains of the terrain models obtained by generating terrains such as rivers, beaches and the like in the terrain models are too single, and the environments such as real vegetation cannot be simulated, the models such as vegetation, stones and the like can be generated in the terrain models according to actual terrain scenes, and the method is specifically realized as follows:
creating a beach model for the beach area in the initial terrain model, and determining an intermediate terrain model according to the creation result, wherein the intermediate terrain model comprises the beach model and the target virtual river; determining a river boundary region associated with the target virtual river in the intermediate terrain model; and drawing a terrain feature point in the river boundary area, creating a terrain feature model according to the terrain feature point, and determining a target terrain model according to a creation result, wherein the target terrain model comprises the terrain feature model, the beach model and the target virtual river.
Specifically, the river boundary region may be an expanded region obtained by expanding the river region to the periphery of the river, the river boundary region is a region surrounding the river and having a certain width, and the partial region may be regarded as a river beach; the topographic feature points can be nodes obtained by random sampling in a river boundary region; correspondingly, the terrain feature model is a model drawn at the terrain feature point and used for simulating vegetation such as grass, flowers, trees and the like and objects such as stones and the like at the river bank.
Based on this, after creating a beach model for the beach area in the initial terrain model and determining an intermediate terrain model including the beach model and the target virtual river according to the creation result, in the intermediate terrain model, the river boundary area associated with the target virtual river is divided by the outer area of the river. And randomly drawing terrain feature points in the river boundary region, creating a terrain feature model at the terrain feature points according to the terrain feature points, and generating a target terrain model comprising a terrain feature model, a river beach model and a target virtual river, so that the terrain features in the target terrain model are richer.
According to the above example, after the river beach is added to the terrain model, the range information of the river is determined in the terrain model, the river Mask with a wider coverage area can be obtained after the river area is expanded, the expanded river Mask is subtracted from the initial river Mask, a Mask surrounding the river can be obtained, and the expanded river Mask can be regarded as the river beach. The spreading operation is carried out in the river beach, random fixed points further form point clouds, and vegetation can be generated based on the point clouds. And then randomly selecting a plurality of virtual nodes from the virtual nodes of the river, and generating a serging stone model at the selected virtual nodes to form vegetation and serging stone effects as shown in (d) in fig. 3, so that the terrain model is richer.
In summary, in the virtual river generation method provided by the present application, a first curve and a second curve are determined, where virtual nodes included in the first curve and the second curve are arranged according to a node arrangement order; drawing a node connection line between the virtual node of the first curve and the virtual node of the second curve according to the node arrangement sequence corresponding to the first curve to obtain a connection line model; traversing the virtual nodes of the second curve in the connecting line model according to the node arrangement sequence corresponding to the second curve, and generating an initial virtual river containing a polygonal patch according to a traversal result; and determining node coordinates of virtual nodes in the initial virtual river, merging polygon patches contained in the initial virtual river according to the node coordinates, and generating a target virtual river according to a merging result.
The virtual nodes contained in the first curve and the second curve are arranged according to the node arrangement sequence, and node connection lines are drawn between the virtual nodes on the first curve and the virtual nodes on the second curve, so that an initial virtual river containing a polygonal patch can be obtained, a user-defined complex river shape is realized, and the variety of river generation is improved. And generating a target virtual river according to the node coordinates of the virtual nodes in the initial virtual river, so that the truth of the river is enhanced, and the visual experience of a user is improved.
The virtual river generation method provided by the present application is further described below with reference to fig. 4 by taking the application of the virtual river generation method to river terrain generation as an example. Fig. 4 shows a processing flow chart of a virtual river generation method applied to river terrain generation according to an embodiment of the present application, which specifically includes the following steps:
step S402: and drawing a first curve and a second curve, wherein virtual nodes contained in the first curve and the second curve are arranged according to the node arrangement sequence.
Under the virtual river generation scene, a first curve and a second curve are drawn as two edges of a river. And drawing two curves corresponding to the node arrangement sequence in a mode of inputting a plurality of virtual nodes.
Step S404: and determining an ith virtual node contained in the first curve based on the node arrangement sequence corresponding to the first curve, wherein i is a positive integer.
After two river contour curves are drawn, any one curve is determined to be a first curve, and virtual nodes contained in the first curve are traversed.
Step S406: and calculating the distance between the ith virtual node and each virtual node in the second curve, and selecting the virtual node with the shortest distance as the virtual node to be selected.
Step S408: and under the condition that at least two virtual nodes to be selected exist, selecting the virtual node to be selected with the highest sequencing priority from the at least two virtual nodes to be selected as the connecting virtual node.
Step S410: and drawing an ith node connecting line between the ith virtual node and the connecting virtual node.
And determining virtual nodes connected with the virtual nodes on the first curve on the second curve, and drawing a node connecting line between the two virtual nodes.
Step S412: judging whether a virtual node without node connection drawing exists in the first curve, if so, executing step S414; if not, go to step S416.
Step S414: i is incremented by 1 and step S404 is performed.
Step S416: a wiring model is determined based on the wiring result.
Determining any end point on the first curve as a traversal starting point, determining a virtual node corresponding to the traversal starting point on the second curve, and drawing a node connection line between the traversal starting point and the virtual node; and determining a second node corresponding to the traversal starting point according to the arrangement sequence of the virtual nodes on the first curve, determining a virtual node corresponding to the second node on the second curve, drawing a node connecting line between the second node and the virtual node, and so on until the virtual nodes on the first curve finish the drawing of the node connecting line, thereby obtaining a connection model after the initial traversal.
Step S418: and under the condition that the second curve contains at least one unconnected virtual node, determining an unconnected node sequence corresponding to the unconnected virtual node according to the node arrangement sequence corresponding to the second curve.
After traversing the virtual nodes on the first curve and drawing node connecting lines to obtain a connecting line model, under the condition that the virtual nodes on the second curve are all drawn with the node connecting lines, the node connecting line drawing aiming at the first curve and the second curve is completed because the virtual nodes on the first curve are already connected with the virtual nodes on the second curve; and finding out the virtual nodes which are not drawn with the node connecting lines on the second curve under the condition that the virtual nodes which are not drawn with the node connecting lines exist on the second curve. And re-determining the order of the virtual nodes which are not connected with the drawn nodes according to the arrangement order of the virtual nodes on the second curve.
Step S420: and determining a j-th virtual node in at least one unconnected virtual node according to the sequence of the unconnected virtual nodes, wherein j is a positive integer.
Step S422: and determining a to-be-connected virtual node corresponding to the jth virtual node in the first curve, and drawing a jth node connecting line between the jth virtual node and the to-be-connected virtual node.
And traversing the unconnected virtual nodes, determining virtual nodes corresponding to the virtual nodes which can be connected with the unconnected nodes on the first curve, and drawing node connection lines.
Step S424: judging whether an unconnected virtual node without node connection drawing exists in the at least one unconnected virtual node, if yes, executing step S420; if not, go to step S426.
Step S426: and generating an initial virtual river containing a polygon patch based on the drawing result, wherein the polygon patch is enclosed by the node connecting line, the first curve and the second curve.
And drawing node connecting lines on virtual nodes on the first curve and the second curve to obtain an initial virtual river, wherein the initial virtual river comprises a plurality of polygonal patches surrounded by the node connecting lines, the first curve and the second curve. In practical application, the generation operation of the patch can be realized through a function provided by three-dimensional computer graphics software.
Step S428: and projecting the initial virtual river containing the polygonal patches, and combining the polygonal patches with overlapping relation in the patch projection result to obtain a virtual combination model containing projection virtual nodes and coincident virtual nodes.
After the generation operation of a patch is realized through a function provided by three-dimensional computer graphics software, an initial virtual river containing a polygonal patch is obtained, the node coordinates of each virtual node in the initial virtual river are recorded, each virtual node is projected to a plane formed by an x axis and a y axis in a node coordinate system, and Boolean operation is carried out to combine overlapped polygonal planes.
Step S430: and determining projection coordinates of the projection virtual nodes according to the node coordinates, and calculating coincidence coordinates of the coincidence virtual nodes according to the projection coordinates.
Step S432: and restoring the virtual merging model containing the projection virtual nodes and the coincidence virtual nodes according to the projection coordinates and the coincidence coordinates to obtain the middle virtual river.
The condition that partial virtual nodes are overlapped can occur after projection, the node coordinates of the overlapped virtual nodes can be determined according to the node coordinates of the adjacent points, the initial virtual river is restored according to the determined node coordinates, and the restored virtual river is obtained.
Step S434: the intermediate virtual river is subjected to triangular face division processing, and a target virtual river is generated based on the processing result.
When determining the node coordinates of the coincident virtual nodes, the function provided by the three-dimensional computer graphic software can be adopted for realization. And rewiring the polygon patches contained in the restored virtual river, dividing the polygon patches into a plurality of triangular faces, wherein the side length of each triangular face can be determined according to actual requirements, and the generated triangular face is similar to an equilateral triangle. The downward extrusion of the patches of the virtual river to present a concave shape can be realized through three-dimensional computer graphics software, so that the river has depth, and the truth of the river is enhanced.
Step S436: and carrying out fusion processing on the terrain model and the target virtual river to obtain an initial terrain model.
The terrain model is obtained, the virtual river and the terrain model are subjected to fusion processing, the river model is added into the terrain model, so that the fusion degree of the virtual river and the terrain model in the fused terrain model is higher, the fused terrain model can be subjected to smoothing processing, and the visual effect is further enhanced.
Step S438: a beach area associated with the target virtual river is determined in the initial terrain model.
Step S440: and creating a river beach model aiming at the river beach area in the initial terrain model, and determining an intermediate terrain model according to the creation result, wherein the intermediate terrain model comprises the river beach model and the target virtual river.
And determining a river beach area corresponding to the river in the terrain model containing the virtual river. The method comprises the steps of setting the normal lines of virtual nodes in two curves of a virtual river to be along the curve direction, if the normal line direction of a certain point is excessively deviated from the normal lines of adjacent points, regarding the normal line direction as a river bent part, extracting a plurality of adjacent virtual nodes of the virtual nodes at the bent part, enabling the connected virtual nodes to form an arc shape generally, enabling the group of virtual nodes to be connected end to form a river beach mesh, and using the river beach mesh for mapping to beat the river convex bank to form a river beach effect.
Step S442: a river boundary region associated with the target virtual river is determined in the intermediate terrain model.
Step S444: and drawing terrain feature points in the river boundary area, creating a terrain feature model according to the terrain feature points, and determining a target terrain model according to a creating result, wherein the target terrain model comprises the terrain feature model, a river beach model and a target virtual river.
After the river beach is added into the terrain model, the range information of the river is determined in the terrain model, a river Mask with a wider coverage area can be obtained after the river area is expanded, then the expanded river Mask is subtracted from the initial river Mask, a Mask surrounding the river can be obtained, and the Mask can be regarded as the river beach. The spreading operation is carried out in the river beach, random fixed points further form point clouds, and vegetation can be generated based on the point clouds. And then randomly selecting a plurality of virtual nodes from the virtual nodes of the river, and generating a serging stone model at the selected virtual nodes to form vegetation and serging stone effects as shown in (d) in fig. 3, so that the terrain model is richer.
In summary, in the virtual river generation method provided by the present application, a first curve and a second curve are determined, where virtual nodes included in the first curve and the second curve are arranged according to a node arrangement order; drawing a node connection line between the virtual node of the first curve and the virtual node of the second curve according to the node arrangement sequence corresponding to the first curve to obtain a connection line model; traversing the virtual nodes of the second curve in the connecting line model according to the node arrangement sequence corresponding to the second curve, and generating an initial virtual river containing a polygonal patch according to a traversal result; and determining node coordinates of virtual nodes in the initial virtual river, merging polygon patches contained in the initial virtual river according to the node coordinates, and generating a target virtual river according to a merging result.
The virtual nodes contained in the first curve and the second curve are arranged according to the node arrangement sequence, and node connecting lines are drawn between the virtual nodes on the first curve and the virtual nodes on the second curve, so that an initial virtual river containing a polygonal patch can be obtained, a user-defined complex river shape is realized, and the variety of river generation is improved. And generating a target virtual river according to the node coordinates of the virtual nodes in the initial virtual river, so that the truth of the river is enhanced, and the visual experience of a user is improved.
Corresponding to the above method embodiment, the present application further provides an embodiment of a virtual river generating device, and fig. 5 shows a schematic structural diagram of the virtual river generating device provided in the embodiment of the present application. As shown in fig. 5, the apparatus includes:
a determining module 502 configured to determine a first curve and a second curve, wherein virtual nodes included in the first curve and the second curve are arranged according to a node arrangement order;
a drawing module 504, configured to draw a node connection line between the virtual node of the first curve and the virtual node of the second curve according to the node arrangement order corresponding to the first curve, so as to obtain a connection line model;
a traversal module 506 configured to traverse the virtual nodes of the second curve in the connection line model according to the node arrangement order corresponding to the second curve, and generate an initial virtual river including a polygon facet according to a traversal result;
a generating module 508 configured to determine node coordinates of virtual nodes in the initial virtual river, merge polygon patches included in the initial virtual river according to the node coordinates, and generate a target virtual river according to a merging result.
In an optional embodiment, the rendering module 504 is further configured to:
determining an ith virtual node contained in the first curve based on the node arrangement sequence corresponding to the first curve, wherein i is a positive integer; determining a connecting virtual node corresponding to the ith virtual node in the second curve, and drawing an ith node connecting line between the ith virtual node and the connecting virtual node; judging whether a virtual node which is not drawn with a node connecting line exists in the first curve; if yes, i is increased by 1, and the step of determining the ith virtual node contained in the first curve based on the node arrangement sequence corresponding to the first curve is executed; if not, determining a connection model based on the connection result.
In an optional embodiment, the rendering module 504 is further configured to:
calculating the distance between the ith virtual node and each virtual node in the second curve, and selecting the virtual node with the shortest distance as a virtual node to be selected; and under the condition that at least two virtual nodes to be selected exist, selecting the virtual node to be selected with the highest sequencing priority from the at least two virtual nodes to be selected as a connecting virtual node.
In an optional embodiment, the traversal module 506 is further configured to:
under the condition that the second curve comprises at least one unconnected virtual node, determining an unconnected node sequence corresponding to the unconnected virtual node according to a node arrangement sequence corresponding to the second curve; determining a jth virtual node from the at least one unconnected virtual node according to the sequence of the unconnected nodes, wherein j is a positive integer; determining a to-be-connected virtual node corresponding to the jth virtual node in the first curve, and drawing a jth node connecting line between the jth virtual node and the to-be-connected virtual node; judging whether an unconnected virtual node without node connection line drawing exists in the at least one unconnected virtual node; if yes, j is increased by 1, and the step of determining the j-th virtual node in the at least one unconnected virtual node according to the sequence of the unconnected nodes is executed; and if not, generating an initial virtual river containing a polygon patch based on the drawing result, wherein the polygon patch is enclosed by a node connecting line, the first curve and the second curve.
In an optional embodiment, the generating module 508 is further configured to:
projecting the initial virtual river containing the polygonal patches, and combining the polygonal patches with overlapping relation in patch projection results to obtain a virtual combination model containing projection virtual nodes and coincident virtual nodes; determining projection coordinates of the projection virtual nodes according to the node coordinates, and calculating coincidence coordinates of the coincidence virtual nodes according to the projection coordinates; restoring a virtual merging model containing the projection virtual nodes and the coincidence virtual nodes according to the projection coordinates and the coincidence coordinates to obtain a middle virtual river; and performing triangular surface division processing on the middle virtual river, and generating a target virtual river based on a processing result.
In an optional embodiment, the generating module 508 is further configured to:
performing triangular surface division processing on the middle virtual river to obtain a virtual divided river; and performing model drawing based on a preset river depth and the divided patches of the virtually divided river, and determining a target virtually river corresponding to the virtually divided river according to a drawing result.
In an optional embodiment, the generating module 508 is further configured to:
obtaining a terrain model; and carrying out fusion processing on the terrain model and the target virtual river, and determining a target terrain model according to a fusion result.
In an optional embodiment, the generating module 508 is further configured to:
carrying out fusion processing on the terrain model and the target virtual river to obtain an initial terrain model; determining a beach area associated with the target virtual river in the initial terrain model; a beach model is created for the beach area of the initial terrain model, and a target terrain model including the beach model and the target virtual river is determined according to the creation result.
In an optional embodiment, the generating module 508 is further configured to:
creating a beach model for the beach area in the initial terrain model, and determining an intermediate terrain model according to the creation result, wherein the intermediate terrain model comprises the beach model and the target virtual river; determining a river boundary region associated with the target virtual river in the intermediate terrain model; drawing terrain feature points in the river boundary area, creating a terrain feature model according to the terrain feature points, and determining a target terrain model according to a creation result, wherein the target terrain model comprises the terrain feature model, the beach model and the target virtual river.
In an optional embodiment, the determining module 502 is further configured to:
creating a first set of virtual nodes and a second set of virtual nodes; and drawing a first curve according to the node arrangement sequence corresponding to the first group of virtual nodes, and drawing a second curve according to the node arrangement sequence corresponding to the second group of virtual nodes.
In summary, the virtual river generating device provided by the application determines a first curve and a second curve, wherein virtual nodes included in the first curve and the second curve are arranged according to a node arrangement sequence; drawing a node connection line between the virtual node of the first curve and the virtual node of the second curve according to the node arrangement sequence corresponding to the first curve to obtain a connection line model; traversing the virtual nodes of the second curve in the connecting line model according to the node arrangement sequence corresponding to the second curve, and generating an initial virtual river containing a polygonal patch according to a traversal result; and determining node coordinates of virtual nodes in the initial virtual river, merging polygon patches contained in the initial virtual river according to the node coordinates, and generating a target virtual river according to a merging result.
The virtual nodes contained in the first curve and the second curve are arranged according to the node arrangement sequence, and node connection lines are drawn between the virtual nodes on the first curve and the virtual nodes on the second curve, so that an initial virtual river containing a polygonal patch can be obtained, a user-defined complex river shape is realized, and the variety of river generation is improved. And generating a target virtual river according to the node coordinates of the virtual nodes in the initial virtual river, so as to enhance the truth of the river and improve the visual experience of a user.
The above is a schematic scheme of a virtual river generating apparatus of the present embodiment. It should be noted that the technical solution of the virtual river generation apparatus and the technical solution of the virtual river generation method belong to the same concept, and for details that are not described in detail in the technical solution of the virtual river generation apparatus, reference may be made to the description of the technical solution of the virtual river generation method. In addition, the components in the device embodiment should be understood as functional modules that are necessary to implement the steps of the program flow or the steps of the method, and the functional modules are not limited to actual functional division or separation. The device claims defined by such a set of functional modules are to be understood as a functional module framework for implementing the solution mainly by means of a computer program as described in the specification, and not as a physical device for implementing the solution mainly by means of hardware.
Fig. 6 shows a flowchart of a virtual model generation method provided in an embodiment of the present application, which specifically includes the following steps:
step S602: determining a first curve and a second curve, wherein virtual nodes contained in the first curve and the second curve are arranged according to a node arrangement sequence.
Step S604: and drawing a node connection line between the virtual node of the first curve and the virtual node of the second curve according to the node arrangement sequence corresponding to the first curve to obtain a connection line model.
Step S606: traversing the virtual nodes of the second curve in the connection line model according to the node arrangement sequence corresponding to the second curve, and generating an initial virtual model containing a polygon patch according to the traversal result.
Step S608: and determining node coordinates of virtual nodes in the initial virtual model, merging polygon patches contained in the initial virtual model according to the node coordinates, and generating a target virtual model according to a merging result.
In summary, the virtual nodes included in the first curve and the second curve are arranged according to the node arrangement order, and node connecting lines are drawn between the virtual nodes on the first curve and the virtual nodes on the second curve, so that an initial virtual model including a polygonal patch can be obtained, a user-defined complex model shape is realized, and the variety of model generation is improved. And generating a target virtual model according to the node coordinates of the virtual nodes in the initial virtual model, so that the reality degree of the model is enhanced, the visual experience of a user is improved, and the model can be a river model, a road model and the like.
Corresponding to the above method embodiment, the present application further provides an embodiment of a virtual model generation apparatus, and fig. 7 shows a schematic structural diagram of a virtual model generation apparatus provided in an embodiment of the present application. As shown in fig. 7, the apparatus includes:
a curve determining module 702 configured to determine a first curve and a second curve, wherein virtual nodes included in the first curve and the second curve are arranged according to a node arrangement order;
a connecting line drawing module 704, configured to draw a node connecting line between the virtual node of the first curve and the virtual node of the second curve according to the node arrangement order corresponding to the first curve, so as to obtain a connecting line model;
a node traversing module 706 configured to traverse virtual nodes of the second curve in the connection line model according to the node arrangement order corresponding to the second curve, and generate an initial virtual model including a polygon patch according to a traversal result;
the model generating module 708 is configured to determine node coordinates of virtual nodes in the initial virtual model, merge polygon patches included in the initial virtual model according to the node coordinates, and generate a target virtual model according to a merging result.
In summary, in the above, the virtual nodes included in the first curve and the second curve are all arranged according to the node arrangement order, and node connection lines are drawn between the virtual nodes on the first curve and the virtual nodes on the second curve, so that an initial virtual model including a polygonal patch can be obtained, a user-defined complex model shape is realized, and the diversity of model generation is improved. And generating a target virtual model according to the node coordinates of the virtual nodes in the initial virtual model, so that the reality degree of the model is enhanced, and the visual experience of a user is improved.
The above is a schematic scheme of a virtual model generation apparatus of the present embodiment. It should be noted that the technical solution of the virtual model generation apparatus and the technical solution of the virtual model generation method belong to the same concept, and details that are not described in detail in the technical solution of the virtual model generation apparatus can be referred to the description of the technical solution of the virtual model generation method. In addition, the components in the device embodiment should be understood as functional modules that are necessary to implement the steps of the program flow or the steps of the method, and the functional modules are not limited to actual functional division or separation. The device claims defined by such a set of functional modules are to be understood as a functional module framework for implementing the solution mainly by means of a computer program as described in the specification, and not as a physical device for implementing the solution mainly by means of hardware.
Fig. 8 is a flowchart illustrating a terrain model generation method provided in an embodiment of the present application, which specifically includes the following steps:
step S802: determining a first curve and a second curve in response to a model generation instruction submitted for a terrain model, wherein virtual nodes contained in the first curve and the second curve are arranged according to a node arrangement order.
Step S804: and drawing a node connection line between the virtual node of the first curve and the virtual node of the second curve according to the node arrangement sequence corresponding to the first curve to obtain a connection line model.
Step S806: traversing the virtual nodes of the second curve in the connection line model according to the node arrangement sequence corresponding to the second curve, and generating an initial virtual river containing a polygonal patch according to the traversal result.
Step S808: and generating a target virtual river based on the initial virtual river containing the polygonal patch, and performing fusion processing according to the terrain model and the target virtual river to obtain a target terrain model.
In conclusion, the virtual nodes contained in the first curve and the second curve are arranged according to the node arrangement sequence, and node connecting lines are drawn between the virtual nodes on the first curve and the virtual nodes on the second curve, so that the initial virtual river containing the polygonal patch can be obtained, the customized complicated river shape is realized, and the variety of river generation is improved. And generating a target virtual river according to the node coordinates of the virtual nodes in the initial virtual river, further enhancing the truth of the river, and fusing the target virtual river and the terrain model, thereby improving the abundance of terrain features and improving the visual experience of a user.
Corresponding to the above method embodiment, the present application further provides an embodiment of a terrain model generation apparatus, and fig. 9 shows a schematic structural diagram of a terrain model generation apparatus provided in an embodiment of the present application. As shown in fig. 9, the apparatus includes:
an instruction response module 902 configured to determine a first curve and a second curve in response to a model generation instruction submitted for a terrain model, wherein virtual nodes included in the first curve and the second curve are arranged in a node arrangement order;
a node connecting line module 904, configured to draw a node connecting line between the virtual node of the first curve and the virtual node of the second curve according to the node arrangement order corresponding to the first curve, so as to obtain a connecting line model;
the node processing module 906 is configured to traverse the virtual nodes of the second curve in the connection line model according to the node arrangement order corresponding to the second curve, and generate an initial virtual river including a polygon patch according to a traversal result;
a terrain generating module 908 configured to generate a target virtual river based on an initial virtual river including a polygon patch, and perform fusion processing according to the terrain model and the target virtual river to obtain a target terrain model.
In conclusion, the virtual nodes contained in the first curve and the second curve are arranged according to the node arrangement sequence, and node connecting lines are drawn between the virtual nodes on the first curve and the virtual nodes on the second curve, so that the initial virtual river containing the polygonal patch can be obtained, the customized complicated river shape is realized, and the variety of river generation is improved. And generating a target virtual river according to the node coordinates of the virtual nodes in the initial virtual river, further enhancing the truth of the river, fusing the target virtual river and the terrain model, improving the richness of the terrain features and improving the visual experience of a user.
The above is a schematic configuration of a terrain model generating apparatus of the present embodiment. It should be noted that the technical solution of the terrain model generation apparatus is the same as that of the above-mentioned terrain model generation method, and details of the technical solution of the terrain model generation apparatus, which are not described in detail, can be referred to the description of the technical solution of the above-mentioned terrain model generation method. Further, the components in the device embodiment should be understood as functional blocks that must be created to implement the steps of the program flow or the steps of the method, and each functional block is not actually divided or separately defined. The device claims defined by such a set of functional modules are to be understood as a functional module framework for implementing the solution mainly by means of a computer program as described in the specification, and not as a physical device for implementing the solution mainly by means of hardware.
Fig. 10 shows a block diagram of a computing device 1000 according to an embodiment of the present application. The components of the computing device 1000 include, but are not limited to, memory 1010 and a processor 1020. The processor 1020 is coupled to the memory 1010 via a bus 1030, and the database 1050 is used to store data.
Computing device 1000 also includes access device 1040, access device 1040 enabling computing device 1000 to communicate via one or more networks 1060. Examples of such networks include the Public Switched Telephone Network (PSTN), a Local Area Network (LAN), a Wide Area Network (WAN), a Personal Area Network (PAN), or a combination of communication networks such as the internet. Access device 1040 may include one or more of any type of network interface, e.g., a Network Interface Card (NIC), wired or wireless, such as an IEEE802.11 Wireless Local Area Network (WLAN) wireless interface, a worldwide interoperability for microwave access (Wi-MAX) interface, an ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a bluetooth interface, a Near Field Communication (NFC) interface, and so forth.
In one embodiment of the present application, the above components of the computing device 1000 and other components not shown in fig. 10 may also be connected to each other, for example, through a bus. It should be understood that the block diagram of the computing device illustrated in FIG. 10 is for purposes of example only and is not intended to limit the scope of the present application. Other components may be added or replaced as desired by those skilled in the art.
Computing device 1000 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., tablet computer, personal digital assistant, laptop computer, notebook computer, netbook, etc.), mobile phone (e.g., smartphone), wearable computing device (e.g., smartwatch, smart glasses, etc.), or other type of mobile device, or a stationary computing device such as a desktop computer or PC. Computing device 1000 may also be a mobile or stationary server.
Wherein the processor 1020 is configured to execute the computer-executable instructions of the method.
The foregoing is a schematic diagram of a computing device of the present embodiment. It should be noted that the technical solution of the computing device and the technical solution of the method belong to the same concept, and details that are not described in detail in the technical solution of the computing device can be referred to the description of the technical solution of the method.
An embodiment of the present application also provides a computer readable storage medium storing computer instructions, which when executed by a processor, are used for the above method.
The above is an illustrative scheme of a computer-readable storage medium of the present embodiment. It should be noted that the technical solution of the storage medium and the technical solution of the above method belong to the same concept, and details that are not described in detail in the technical solution of the storage medium can be referred to the description of the technical solution of the above method.
An embodiment of the present application further provides a chip, which stores a computer program, and when the computer program is executed by the chip, the steps of the method are implemented.
The foregoing description of specific embodiments of the present application has been presented. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The computer instructions comprise computer program code which may be in the form of source code, object code, an executable file or some intermediate form, or the like. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, read-Only Memory (ROM), random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer-readable medium may contain suitable additions or subtractions depending on the requirements of legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer-readable media may not include electrical carrier signals or telecommunication signals in accordance with legislation and patent practice.
It should be noted that, for the sake of simplicity, the above-mentioned method embodiments are described as a series of acts or combinations, but those skilled in the art should understand that the present application is not limited by the described order of acts, as some steps may be performed in other orders or simultaneously according to the present application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required in this application.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to the related descriptions of other embodiments.
The preferred embodiments of the present application disclosed above are intended only to aid in the explanation of the application. Alternative embodiments are not exhaustive and do not limit the invention to the precise embodiments described. Obviously, many modifications and variations are possible in light of the above teaching. The embodiments were chosen and described in order to best explain the principles of the application and its practical applications, to thereby enable others skilled in the art to best understand and utilize the application. The application is limited only by the claims and their full scope and equivalents.

Claims (14)

1. A virtual river generation method, comprising:
determining a first curve and a second curve, wherein virtual nodes contained in the first curve and the second curve are arranged according to a node arrangement sequence;
drawing a node connection line between the virtual node of the first curve and the virtual node of the second curve according to the node arrangement sequence corresponding to the first curve to obtain a connection line model;
traversing the virtual nodes of the second curve in the connection line model according to the node arrangement sequence corresponding to the second curve, and generating an initial virtual river containing a polygonal patch according to the traversal result;
and determining node coordinates of virtual nodes in the initial virtual river, merging polygon patches contained in the initial virtual river according to the node coordinates, and generating a target virtual river according to a merging result.
2. The method according to claim 1, wherein the step of drawing a node connection line between the virtual node of the first curve and the virtual node of the second curve according to the node arrangement order corresponding to the first curve to obtain a connection line model comprises:
determining an ith virtual node contained in the first curve based on the node arrangement sequence corresponding to the first curve, wherein i is a positive integer;
determining a connecting virtual node corresponding to the ith virtual node in the second curve, and drawing an ith node connecting line between the ith virtual node and the connecting virtual node;
judging whether a virtual node which is not drawn with a node connecting line exists in the first curve;
if yes, i is increased by 1, and the step of determining the ith virtual node contained in the first curve based on the node arrangement sequence corresponding to the first curve is executed;
if not, determining a connection line model based on the connection line result.
3. The method of claim 2, wherein the determining a connecting virtual node corresponding to the ith virtual node in the second curve comprises:
calculating the distance between the ith virtual node and each virtual node in the second curve, and selecting the virtual node with the shortest distance as a virtual node to be selected;
and under the condition that at least two virtual nodes to be selected exist, selecting the virtual node to be selected with the highest sequencing priority from the at least two virtual nodes to be selected as a connecting virtual node.
4. The method of claim 1, wherein traversing the virtual nodes of the second curve in the connection model according to the node arrangement order corresponding to the second curve, and generating an initial virtual river including a polygon patch according to a traversal result comprises:
under the condition that the second curve comprises at least one unconnected virtual node, determining an unconnected node sequence corresponding to the unconnected virtual node according to a node arrangement sequence corresponding to the second curve;
determining a jth virtual node from the at least one unconnected virtual node according to the sequence of the unconnected nodes, wherein j is a positive integer;
determining a to-be-connected virtual node corresponding to the jth virtual node in the first curve, and drawing a jth node connecting line between the jth virtual node and the to-be-connected virtual node;
judging whether an unconnected virtual node without node connection line drawing exists in the at least one unconnected virtual node;
if yes, j is increased by 1, and the step of determining the j-th virtual node in the at least one unconnected virtual node according to the sequence of the unconnected nodes is executed;
and if not, generating an initial virtual river containing a polygon patch based on the drawing result, wherein the polygon patch is surrounded by a node connecting line, the first curve and the second curve.
5. The method according to claim 1, wherein the merging polygon patches included in the initial virtual river according to the node coordinates, and generating a target virtual river according to a merging result comprises:
projecting the initial virtual river containing the polygonal patches, and combining the polygonal patches with overlapping relation in patch projection results to obtain a virtual combination model containing projection virtual nodes and coincident virtual nodes;
determining projection coordinates of the projection virtual nodes according to the node coordinates, and calculating coincidence coordinates of the coincidence virtual nodes according to the projection coordinates;
restoring a virtual merging model containing the projection virtual nodes and the coincidence virtual nodes according to the projection coordinates and the coincidence coordinates to obtain a middle virtual river;
and performing triangular surface division processing on the intermediate virtual river, and generating a target virtual river based on a processing result.
6. The method according to claim 5, wherein the performing the triangular division processing on the intermediate virtual river and generating the target virtual river based on the processing result comprises:
performing triangular surface division processing on the middle virtual river to obtain a virtual divided river;
and performing model drawing based on the preset river depth and the divided patches of the virtually divided river, and determining a target virtually river corresponding to the virtually divided river according to a drawing result.
7. The method according to claim 1, wherein after the step of merging polygon patches included in the initial virtual river according to the node coordinates and generating a target virtual river according to a merging result is executed, the method further comprises:
obtaining a terrain model;
and carrying out fusion processing on the terrain model and the target virtual river, and determining a target terrain model according to a fusion result.
8. The method according to claim 7, wherein the fusing the terrain model and the target virtual river to determine a target terrain model according to a fusion result comprises:
carrying out fusion processing on the terrain model and the target virtual river to obtain an initial terrain model;
determining a beach area associated with the target virtual river in the initial terrain model;
a beach model is created for the beach area of the initial terrain model, and a target terrain model including the beach model and the target virtual river is determined according to the creation result.
9. The method of claim 8, wherein creating a beach model for the beach area in the initial terrain model and determining a target terrain model containing the beach model and the target virtual river according to the creation comprises:
creating a beach model for the beach area in the initial terrain model, and determining an intermediate terrain model according to the creation result, wherein the intermediate terrain model comprises the beach model and the target virtual river;
determining a river boundary region associated with the target virtual river in the intermediate terrain model;
and drawing a terrain feature point in the river boundary area, creating a terrain feature model according to the terrain feature point, and determining a target terrain model according to a creation result, wherein the target terrain model comprises the terrain feature model, the beach model and the target virtual river.
10. The method of claim 1, wherein determining the first curve and the second curve comprises:
creating a first group of virtual nodes and a second group of virtual nodes;
and drawing a first curve according to the node arrangement sequence corresponding to the first group of virtual nodes, and drawing a second curve according to the node arrangement sequence corresponding to the second group of virtual nodes.
11. A method for generating a virtual model, comprising:
determining a first curve and a second curve, wherein virtual nodes contained in the first curve and the second curve are arranged according to a node arrangement sequence;
drawing a node connection line between the virtual node of the first curve and the virtual node of the second curve according to the node arrangement sequence corresponding to the first curve to obtain a connection line model;
traversing the virtual nodes of the second curve in the connection line model according to the node arrangement sequence corresponding to the second curve, and generating an initial virtual model containing a polygonal patch according to a traversal result;
and determining node coordinates of virtual nodes in the initial virtual model, merging polygon patches contained in the initial virtual model according to the node coordinates, and generating a target virtual model according to a merging result.
12. A terrain model generation method, comprising:
determining a first curve and a second curve in response to a model generation instruction submitted for a terrain model, wherein virtual nodes contained in the first curve and the second curve are arranged according to a node arrangement order;
according to the node arrangement sequence corresponding to the first curve, drawing a node connection line between the virtual node of the first curve and the virtual node of the second curve to obtain a connection line model;
traversing the virtual nodes of the second curve in the connection line model according to the node arrangement sequence corresponding to the second curve, and generating an initial virtual river containing a polygonal patch according to the traversal result;
and generating a target virtual river based on the initial virtual river containing the polygonal patch, and performing fusion processing according to the terrain model and the target virtual river to obtain a target terrain model.
13. A computing device, comprising:
a memory and a processor;
the memory is for storing computer-executable instructions, and the processor is for executing the computer-executable instructions to perform the steps of the method of any one of claims 1 to 10 or 11 or 12.
14. A computer readable storage medium storing computer instructions, which when executed by a processor, perform the steps of the method of any one of claims 1 to 10 or 11 or 12.
CN202211303707.0A 2022-10-24 2022-10-24 Virtual river generation method and device Pending CN115601486A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211303707.0A CN115601486A (en) 2022-10-24 2022-10-24 Virtual river generation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211303707.0A CN115601486A (en) 2022-10-24 2022-10-24 Virtual river generation method and device

Publications (1)

Publication Number Publication Date
CN115601486A true CN115601486A (en) 2023-01-13

Family

ID=84848632

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211303707.0A Pending CN115601486A (en) 2022-10-24 2022-10-24 Virtual river generation method and device

Country Status (1)

Country Link
CN (1) CN115601486A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117312608A (en) * 2023-08-14 2023-12-29 河海大学 Depth-first search-based river network node degeneracy method

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117312608A (en) * 2023-08-14 2023-12-29 河海大学 Depth-first search-based river network node degeneracy method

Similar Documents

Publication Publication Date Title
US9330476B2 (en) Generating a modified image with additional content provided for a region thereof
CN107358649B (en) Processing method and device of terrain file
Tierny et al. Interactive quadrangulation with Reeb atlases and connectivity textures
CN101930623A (en) Three-dimensional road modeling method and device
CN110163942A (en) A kind of image processing method and device
CN108537886B (en) High quality grid dividing and optimization method in a kind of cutting of virtual operation
CN115311434B (en) Tree three-dimensional reconstruction method and device based on oblique photography and laser data fusion
CN110404261A (en) The construction method and device of virtual networks in game
CN101950435A (en) Navigation-based method for generating interactive non-blocking three-dimensional topographic map
CN115601486A (en) Virtual river generation method and device
CN111127649B (en) Method and device for constructing three-dimensional block model and server
Benes et al. Urban brush: Intuitive and controllable urban layout editing
Hirono et al. Constrained optimization for disoccluding geographic landmarks in 3D urban maps
CN113744401A (en) Terrain splicing method and device, electronic equipment and storage medium
Williams et al. A time-line approach for the generation of simulated settlements
WO2023160487A1 (en) Topographic-region splicing method and apparatus, and computer device and storage medium
CN109102565B (en) Method for automatically generating virtual terrain
Li et al. A fast fusion method for multi-videos with three-dimensional GIS scenes
CN102460515B (en) Utilize the additional content provided for image-region to generate modified image
CN115193034A (en) Rendering method and device for water flow area in virtual scene and computer equipment
JP7360510B2 (en) High-precision map crosswalk generation method, device, and electronic equipment
CN116152446B (en) Geological model subdivision method, device, terminal and medium based on UE4
CN113134230A (en) Virtual object clustering method and device, storage medium and electronic device
KR100848304B1 (en) Apparatus for nurbs surface rendering of sculpting deformation effect using the multi-resolution curved surface trimming
CN110223385A (en) A kind of 3 D model construction method and device of the road canal network comprising joint

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination