Search

CN-121997794-A - River flow velocity processing method and device, electronic equipment and storage medium

CN121997794ACN 121997794 ACN121997794 ACN 121997794ACN-121997794-A

Abstract

The present disclosure relates to the field of multimedia technologies, and in particular, to a river flow rate processing method, a device, an electronic device, and a storage medium, where the method includes generating an initial river water surface model according to a preset river curve; the method comprises the steps of projecting an initial river water surface model to a terrain surface, obtaining a terrain area covered by the initial river water surface model in the terrain surface, converting the terrain area into grids to obtain an updated river water surface model, determining the river width and the river depth of each vertex on the updated river water surface model, determining the river gradient of each vertex on the updated river water surface model, determining the actual water flow speed of each vertex based on the river width, the river depth and the river gradient of each vertex, and determining the actual water flow speed information of each vertex based on the normalized direction vector and the actual water flow speed of each vertex. The method and the device can improve river generation efficiency, reduce consumption of computing resources, and conduct rendering in real time.

Inventors

  • JIANG HAIYANG
  • QIU JINGHUI

Assignees

  • 广州弹指宇宙科技有限公司

Dates

Publication Date
20260508
Application Date
20251209

Claims (13)

  1. 1. A river flow rate treatment method, the method comprising: generating an initial river water surface model according to the preset river curve; Projecting the initial river water surface model to a terrain surface; Acquiring a terrain area covered by the initial river water surface model in the terrain surface, and converting the terrain area into a grid to obtain an updated river water surface model; determining the river width and the river depth of each vertex on the updated river surface model, and determining the river gradient of each vertex on the updated river surface model; determining an actual water flow velocity of each vertex based on the river width of each vertex, the river depth of each vertex, and the river slope of each vertex; The actual water flow velocity information for each vertex is determined based on the normalized direction vector for each vertex and the actual water flow velocity magnitude for each vertex.
  2. 2. The river flow rate processing method of claim 1, wherein the predetermined river curve comprises a predetermined river width parameter, and the generating an initial river surface model according to the predetermined river curve comprises: Generating a cross section curve according to the preset river width parameter at the starting point of the preset river curve or the world coordinate origin; sampling the preset river curve to obtain a preset number of sampling points; Determining the tangential direction of each sampling point; Copying the cross section curves on each sampling point, and adjusting the direction of the cross section curves at each sampling point according to the tangential direction of each sampling point so that the direction of the cross section curves at each sampling point is consistent with the tangential direction of each sampling point; And connecting the cross section curves on each sampling point to obtain the initial river water surface model.
  3. 3. The river flow rate processing method of claim 2, wherein prior to the generating an initial river surface model from the preset river curve, the method further comprises: Determining gradient data of points on the preset river curve; after the initial river water surface model is generated according to the preset river curve, the method further comprises the following steps: Determining an initial vertex positioned in an overlapping area under the condition that the initial vertex in the initial river water surface model has the overlapping area in the vertical direction; Determining a height difference between initial vertices located in the overlapping region; And merging the height difference values according to the height difference values and gradient data of the initial vertexes in the overlapped area to obtain a smoothed initial river water surface model, wherein the smoothed initial river water surface model is used for being projected to the terrain surface.
  4. 4. The river flow rate treatment method of claim 1, wherein the determining the river width and river depth of each vertex on the updated river water surface model comprises: acquiring attribute information of each vertex on the updated river water surface model from the initial river water surface model; and determining the river width and the river depth of each vertex on the updated river water surface model based on the attribute information of each vertex on the updated river water surface model.
  5. 5. The river flow rate processing method according to claim 4, wherein the obtaining attribute information of each vertex on the updated river surface model from the initial river surface model comprises: determining the point at which the vertex in the updated river water surface model and the initial vertex in the initial river water surface model intersect in the vertical direction to obtain a target vertex; and determining the attribute information of the target vertex on the initial river water surface model as the attribute information of the target vertex on the updated river water surface model.
  6. 6. The river flow rate processing method of claim 4, wherein the attribute information comprises a normalized direction vector, and wherein the determining the river width and river depth for each vertex on the updated river surface model based on the attribute information for each vertex on the updated river surface model comprises: Emitting rays downwards at the position of each vertex along the vertical direction to detect a terrain collision point, so as to obtain the river depth of the updated river water surface model at each vertex; Taking the vertical direction of the normalized direction vector of each vertex as a reference, respectively transmitting a ray to two sides to obtain the intersection point between the rays respectively transmitted by the two sides and the surface of the obstacle; And determining the river width of each vertex according to the distance between the intersection points of the reference and the two sides respectively.
  7. 7. The river flow rate treatment method of claim 1, further comprising: Extracting an intersecting contour line of an intersecting region between the updated river water surface model and an obstacle, and determining a tangential direction of a vertex on the intersecting contour line based on a surface normal of the obstacle; Determining a vertex on the updated river water surface model adjacent to a vertex on the intersecting contour line; Determining an included angle between the tangential direction of the vertexes on the intersecting contour lines and the normalized direction vector of the adjacent vertexes; and under the condition that the included angle is larger than a preset angle, reversing the tangential direction of the vertexes on the intersecting contour lines to obtain an updated river water surface model with the corrected water flow direction, wherein the updated river water surface model with the corrected water flow direction is used for determining the river width, the river depth and the river gradient.
  8. 8. The river flow rate treatment method according to claim 7, wherein the determining a tangential direction of the vertex on the intersecting contour line based on the surface normal of the obstacle comprises: The method comprises the steps of obtaining obstacle coordinate information and obstacle identification information, wherein the obstacle coordinate information is coordinate information of candidate points on the obstacle, the distance between the candidate points and vertexes on the intersecting contour line of the candidate points is smaller than a preset distance threshold value, and the obstacle identification information is identification information of the surface of the candidate points on the obstacle; And based on the obstacle coordinate information and the obstacle identification information, sampling the surface normal of the surface where the candidate point is located, and endowing the sampled data to the vertexes on the intersecting contour lines to obtain the tangential directions of the vertexes on the intersecting contour lines.
  9. 9. The river flow rate treatment method of any one of claims 1-8, wherein the determining a river slope of each vertex on the updated river surface model comprises: Determining the height difference between each vertex and a preset reference vertex, and determining the horizontal distance between each vertex and the preset reference vertex, wherein the preset reference vertex and each vertex are in a preset area range; And obtaining the river gradient of each vertex based on the height difference and the horizontal distance.
  10. 10. The river flow rate treatment method according to any one of claims 1 to 8, wherein the determining the actual water flow rate magnitude for each vertex based on the river width for each vertex, the river depth for each vertex, and the river slope for each vertex comprises: acquiring a preset roughness coefficient; determining a hydraulic radius of each vertex based on the river width of each vertex and the river depth of each vertex; and determining the actual water flow speed of each vertex according to the hydraulic radius of each vertex, the river gradient of each vertex and the preset roughness coefficient.
  11. 11. A river flow rate treatment apparatus, the apparatus comprising: The system comprises a preset river curve acquisition module, a river surface model acquisition module and a river surface model acquisition module, wherein the preset river curve acquisition module is configured to perform acquisition of a preset river curve; a projection module configured to perform projection of the initial river surface model onto a terrain surface; a model updating module configured to perform acquisition of a terrain area covered by the initial river water surface model in the terrain surface and to convert the terrain area into a grid to obtain an updated river water surface model; A river information determination module configured to perform determining a river width and a river depth for each vertex on the updated river surface model, and determining a river slope for each vertex on the updated river surface model; A water flow magnitude determination module configured to perform determining an actual water flow velocity magnitude for each vertex based on the river width of each vertex, the river depth of each vertex, and the river slope of each vertex; A water flow velocity determination module configured to perform determining actual water flow velocity information for each vertex based on the normalized direction vector for each vertex and the actual water flow velocity magnitude for each vertex.
  12. 12. An electronic device, comprising: A processor; a memory for storing the processor-executable instructions; Wherein the processor is configured to execute the instructions to implement the river flow rate treatment method of any one of claims 1 to 10.
  13. 13. A computer readable storage medium, wherein instructions in the computer readable storage medium, when executed by a processor of a server, enable the server to perform the river flow rate treatment method of any one of claims 1 to 10.

Description

River flow velocity processing method and device, electronic equipment and storage medium Technical Field The present disclosure relates to the field of computer graphics and game development technologies, and in particular, to a river flow rate processing method, apparatus, electronic device, and storage medium. Background In the game river system of the related art, the setting of the water flow direction and the flow rate is generally determined by manually drawing a flow direction map or by simple linear interpolation. In order to improve accuracy, the related art also adopts a fluid dynamics simulation scheme to determine the water flow direction and the flow velocity. However, relying on manually drawn flow direction maps or by simple linear interpolation is not only time consuming, but also difficult to adapt to complex terrain. The adoption of the fluid dynamics simulation mode consumes more computing resources, and is not suitable for rendering or interactively generating the game scene in real time. Disclosure of Invention The present disclosure provides a river flow rate processing method, apparatus, electronic device, and storage medium to solve at least the problems in the related art that relying on manually drawn flow direction mapping or determining by simple linear interpolation is not only time-consuming, but also difficult to adapt to complex terrain. The adoption of the fluid dynamics simulation mode consumes more computing resources and is not suitable for real-time rendering or interactive generation of game scenes. The technical scheme of the present disclosure is as follows: According to a first aspect of an embodiment of the present disclosure, there is provided a river flow rate treatment method, including: generating an initial river water surface model according to the preset river curve; Projecting the initial river water surface model to a terrain surface; Acquiring a terrain area covered by the initial river water surface model in the terrain surface, and converting the terrain area into a grid to obtain an updated river water surface model; determining the river width and the river depth of each vertex on the updated river surface model, and determining the river gradient of each vertex on the updated river surface model; determining an actual water flow velocity of each vertex based on the river width of each vertex, the river depth of each vertex, and the river slope of each vertex; The actual water flow velocity information for each vertex is determined based on the normalized direction vector for each vertex and the actual water flow velocity magnitude for each vertex. In an optional embodiment, the preset river curve includes a preset river width parameter, and the generating an initial river surface model according to the preset river curve includes: Generating a cross section curve according to the preset river width parameter at the starting point of the preset river curve or the world coordinate origin; sampling the preset river curve to obtain a preset number of sampling points; Determining the tangential direction of each sampling point; Copying the cross section curves on each sampling point, and adjusting the direction of the cross section curves at each sampling point according to the tangential direction of each sampling point so that the direction of the cross section curves at each sampling point is consistent with the tangential direction of each sampling point; And connecting the cross section curves on each sampling point to obtain the initial river water surface model. In an alternative embodiment, before said generating an initial river surface model according to said preset river curve, said method further comprises: Determining gradient data of points on the preset river curve; after the initial river water surface model is generated according to the preset river curve, the method further comprises the following steps: Determining an initial vertex positioned in an overlapping area under the condition that the initial vertex in the initial river water surface model has the overlapping area in the vertical direction; Determining a height difference between initial vertices located in the overlapping region; And merging the height difference values according to the height difference values and gradient data of the initial vertexes in the overlapped area to obtain a smoothed initial river water surface model, wherein the smoothed initial river water surface model is used for being projected to the terrain surface. In an alternative embodiment, the determining the river width and river depth of each vertex on the updated river surface model includes: acquiring attribute information of each vertex on the updated river water surface model from the initial river water surface model; and determining the river width and the river depth of each vertex on the updated river water surface model based on the attribute information of each vertex on the updated river