Method, device and computer equipment for rendering water flow area in virtual scene

By automatically rendering the water surface of the water flow area in a virtual scene, the problem of inefficient production of fluid mesh models in the prior art is solved, and more efficient water flow area rendering is achieved, which is suitable for the rendering needs of large virtual scenes.

CN115193034BActive Publication Date: 2025-02-18NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210759205.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-29
Publication Date
2025-02-18
Estimated Expiration
2042-06-29

AI Technical Summary

Technical Problem

In the prior art, the grid model production of fluids in virtual scenes is inefficient, and it is necessary to manually adjust the position of the grid vertex to adapt to the terrain model, which takes a long time.

Method used

A method for rendering water flow areas in a virtual scene is provided. By obtaining the water flow area model in the plot model, a water surface grid is generated, and water flow direction information is constructed based on the direction information of the skeleton line, so as to automatically render the water surface of the water flow area.

Benefits of technology

It improves the production efficiency of fluid mesh models and reduces the time for manual adjustment, especially when rendering large world maps, which significantly reduces the time-consuming construction of map models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115193034B_ABST
    Figure CN115193034B_ABST
Patent Text Reader

Abstract

The present application provides a method, device, computer equipment and storage medium for rendering a water flow area in a virtual scene. The method includes: obtaining a water flow area model corresponding to the water flow area in a land model; generating a water surface mesh corresponding to the land model according to the model edge points of the water flow area model; obtaining the direction information of the skeleton line of the water surface mesh, and constructing the water flow direction information of each mesh vertex on the water surface mesh according to the direction information of the skeleton line; and rendering the water surface of the water flow area based on the water surface mesh and the water flow direction information of the mesh vertices. The method constructs a water surface mesh that conforms to the land model through the water flow area model in the land model, and constructs the water flow direction information of each mesh vertex on the water surface mesh according to the direction information of the skeleton line of the water surface mesh, and then renders the water surface mesh based on the flow direction information of the water surface mesh and the mesh vertices, simulating the water surface flow effect and improving the rendering efficiency of the virtual scene.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, device, computer equipment and computer-readable storage medium (storage medium for short) for rendering a water flow area in a virtual scene. Background Art

[0002] With the continuous development of electronic games, 3D games are becoming more and more popular, and fluids in virtual scenes in 3D games, such as water flow and magma, are often an indispensable part. However, the production of fluids in virtual scenes often requires the construction of a fluid mesh model by manually constructing patches, and the height information of the mesh model corresponding to the fluid changes with the terrain. It is necessary to further manually adjust the position of the mesh vertices on the mesh model to make the mesh model corresponding to the fluid adapt to the terrain model. The production of the fluid mesh model is inefficient and time-consuming. Summary of the invention

[0003] Based on this, it is necessary to provide a rendering method, device, computer equipment and storage medium for the water flow area in a virtual scene to improve the production efficiency of the fluid mesh model in response to the above technical problems.

[0004] In a first aspect, the present application provides a method for rendering a water flow area in a virtual scene, the method comprising:

[0005] Obtain the water flow area model corresponding to the water flow area in the land parcel model;

[0006] Generate a water surface grid corresponding to the land model according to the model edge points of the water flow area model;

[0007] Obtain the direction information of the skeleton line of the water surface grid, and construct the water flow direction information of each grid vertex on the water surface grid according to the direction information of the skeleton line;

[0008] Based on the water surface mesh and the water flow direction information of the mesh vertices, the water surface in the water flow area is rendered.

[0009] In some embodiments of the present application, the step of obtaining a water flow area model corresponding to a water flow area in a land parcel model includes:

[0010] Obtaining a land parcel model and a map image corresponding to the land parcel model;

[0011] Extracting the initial water flow layer of the water flow area in the map image;

[0012] Extract the water flow area model in the land parcel model based on the initial water flow layer.

[0013] In some embodiments of the present application, the step of extracting a water flow area model in a land parcel model based on an initial water flow layer comprises:

[0014] The initial water flow layer is expanded based on the layer edge line of the initial water flow layer to obtain the target water flow layer;

[0015] Extract the water flow area model in the land parcel model based on the target water flow layer.

[0016] In some embodiments of the present application, the step of generating a water surface grid corresponding to the land parcel model according to the model edge points of the water flow area model includes:

[0017] Smoothing the height information of the model edge points of the water flow area model to obtain the target edge points;

[0018] Construct the water surface grid corresponding to the land model based on the target edge points.

[0019] In some embodiments of the present application, the land parcel model includes at least two land parcel sub-models;

[0020] The step of generating a water surface grid corresponding to the land block model according to the model edge points of the water flow area model comprises:

[0021] For any plot sub-model, the model edge points of the water flow area model in the plot sub-model are smoothed to obtain the target edge points of the water flow area model in the plot sub-model;

[0022] Based on the target edge points of the water flow area model in the land parcel sub-model, a water surface sub-grid corresponding to the land parcel model is constructed;

[0023] The water surface subgrids corresponding to the sub-models of each block are spliced ​​together to obtain the water surface grid.

[0024] In some embodiments of the present application, the step of splicing the water surface subgrids corresponding to the block submodels to obtain the water surface grid includes:

[0025] Extracting the grid edge points of each water surface sub-grid and the projection coordinates of the grid edge points on the two-dimensional plane;

[0026] Calculate the distance between any two grid edge points based on the projection coordinates of the grid edge points;

[0027] The two grid edge points whose distance value is less than the preset distance threshold are merged to obtain the water surface grid.

[0028] In some embodiments of the present application, the step of obtaining the direction information of the skeleton line of the water surface grid includes:

[0029] Get the number of endpoints of the skeleton line;

[0030] If the number of endpoints of the skeleton line is equal to 2, or the number of endpoints of the skeleton line is not equal to 2 and there is no pre-selected end skeleton point on the skeleton line, the skeleton points are sorted based on the height information of each skeleton point in the skeleton line to obtain a sorting result;

[0031] According to the sorting result, the direction information of each skeleton point is obtained to obtain the direction information of the skeleton line.

[0032] In some embodiments of the present application, after the step of obtaining the number of endpoints of the skeleton line, the method further includes:

[0033] If the number of endpoints of the skeleton line is not equal to 2 and the skeleton line includes the ending skeleton point, multiple starting skeleton points are randomly selected on the skeleton line;

[0034] Obtain path information between the starting skeleton point and the ending skeleton point based on the skeleton line;

[0035] The direction information of the skeleton line is obtained based on the path information.

[0036] In some embodiments of the present application, the step of constructing the water flow direction information of each mesh vertex on the water surface mesh according to the direction information of the skeleton line includes:

[0037] Generate initial flow direction information of each mesh vertex on the water surface mesh based on the direction information of the skeleton line;

[0038] Obtaining an obstacle model in the land mass model, and determining a first mesh vertex in the water surface mesh according to surface position information of the obstacle model; the first mesh vertex is a mesh vertex in the water surface mesh whose flow direction information is affected by the obstacle model;

[0039] Calculating target flow direction information of the first mesh vertex based on the normal vector of the obstacle model and the initial flow direction information of the first mesh vertex;

[0040] Based on the target flow direction information of the first mesh vertex in the water surface mesh and the initial flow direction information of the second mesh vertex, the water flow direction information of the water surface mesh is generated; the second mesh vertex is the mesh vertex in the water surface mesh other than the first mesh vertex.

[0041] In a second aspect, the present application provides a device for rendering a water flow area in a virtual scene, the device comprising:

[0042] A regional model acquisition module is used to obtain a water flow regional model corresponding to a water flow region in a land parcel model;

[0043] A water surface mesh generation module is used to generate a water surface mesh corresponding to the land model according to the model edge points of the water flow area model;

[0044] A water flow direction acquisition module is used to obtain the direction information of the skeleton line of the water surface grid, and construct the water flow direction information of each grid vertex on the water surface grid according to the direction information of the skeleton line;

[0045] The water surface model rendering module is used to render the water surface in the water flow area based on the water surface mesh and the water flow direction information of the mesh vertices.

[0046] In a third aspect, the present application further provides a computer device, the computer device comprising:

[0047] one or more processors;

[0048] Memory; and

[0049] One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement a method for rendering a water flow area in a virtual scene.

[0050] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and the computer program is loaded by a processor to execute the steps in the method for rendering a water flow area in a virtual scene.

[0051] In a fifth aspect, an embodiment of the present application provides a computer program product or a computer program, the computer program product or the computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method provided in the first aspect above.

[0052] The rendering method, device, computer equipment and storage medium of the water flow area in the above virtual scene obtain the water flow area model corresponding to the water flow area in the land model; generate the water surface mesh corresponding to the land model according to the model edge points of the water flow area model; obtain the direction information of the skeleton line of the water surface mesh, and construct the water flow direction information of each mesh vertex on the water surface mesh according to the direction information of the skeleton line; render the water flow area based on the water surface mesh and the water flow direction information of the mesh vertex. The method obtains the water flow area model, and then generates the corresponding water surface mesh based on the model edge points of the water flow area model, and generates the flow direction information of each mesh vertex on the water surface mesh by obtaining the direction information of the skeleton line of the water surface mesh, and finally renders the water surface of the water flow area in combination with the flow direction information of the water surface mesh and the mesh vertex, so as to realize the fully automatic generation of the water surface mesh corresponding to the water flow area, and simulate the water surface flow effect by rendering the water surface mesh, especially when rendering the virtual scene corresponding to the large world map, effectively improves the generation efficiency of the water surface mesh and reduces the time consumption of building the map model. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0054] Figure 1 is a flow chart of a method for rendering a water flow area in a virtual scene in an embodiment of the present application;

[0055] Figure 2 is a schematic diagram of a plot model in an embodiment of the present application;

[0056] Figure 3A It is a flow chart of the steps of obtaining the water flow area model in the embodiment of the present application;

[0057] Figure 3B is a schematic diagram of a map image in an embodiment of the present application;

[0058] Figure 3C is a schematic diagram of an initial water flow layer and a target water flow layer in an embodiment of the present application;

[0059] Figure 3D It is a schematic diagram of the effect of extracting a water flow area model from a target water flow layer in a land parcel model in an embodiment of the present application;

[0060] Figure 4A is a schematic diagram of the edge points of the model in the embodiment of the present application;

[0061] Figure 4B is a schematic diagram of a water surface grid in an embodiment of the present application;

[0062] Figure 4C is a schematic diagram of a model edge point obtained after the height information in the coordinate information of the model edge point is set to zero in an embodiment of the present application;

[0063] Figure 4D This is a schematic diagram of the effect of the model edge points after simplified processing in the embodiment of the present application;

[0064] Figure 4E is a schematic diagram of the effect of model edge points after smoothing height information in an embodiment of the present application;

[0065] Figure 5A It is a schematic diagram of the process of generating a water surface grid in an embodiment of the present application;

[0066] Figure 5B is a schematic diagram of a water surface grid obtained by splicing water surface subgrids in an embodiment of the present application;

[0067] Figure 5C is a schematic diagram of the effect of a water surface grid obtained by merging two grid edge points whose distance values ​​are less than a preset distance threshold in an embodiment of the present application;

[0068] Figure 6 is a schematic flow chart of the step of obtaining the direction information of the skeleton line in an embodiment of the present application;

[0069] Figure 7 is a flowchart of another step of obtaining direction information of a skeleton line in an embodiment of the present application;

[0070] Fig. 8A It is a flow chart of the steps of obtaining water flow direction information of each grid vertex on the water surface grid in the embodiment of the present application;

[0071] Figure 8B is a schematic diagram of a normal vector when the obstacle model is a sphere in an embodiment of the present application;

[0072] Fig. 9A is a schematic diagram of the effect of smoothing and blurring the water surface sub-grid in the embodiment of the present application;

[0073] Fig. 9B is a schematic diagram of a grid edge point obtained after the height information in the coordinate information is set to zero in an embodiment of the present application;

[0074] Fig. 9C is a schematic diagram of the skeleton line of the water surface grid in an embodiment of the present application;

[0075] Fig.9D is a schematic diagram of the color attributes corresponding to each skeleton point on the skeleton line in the embodiment of the present application;

[0076] Fig.9E is a schematic diagram of an obstacle model in an embodiment of the present application;

[0077] Fig.10 is a schematic diagram of the structure of a rendering device for a water flow area in a virtual scene in an embodiment of the present application;

[0078] Fig.11 It is a schematic diagram of the structure of a computer device in an embodiment of the present application. DETAILED DESCRIPTION

[0079] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.

[0080] In the description of this application, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this application, "plurality" means two or more, unless otherwise clearly and specifically defined.

[0081] In the description of the present application, the word "for example" is used to mean "used as an example, illustration or explanation". Any embodiment described as "for example" in the present application is not necessarily to be construed as being more preferred or advantageous than other embodiments. The following description is given to enable any technician in the field to implement and use the present invention. In the following description, details are listed for the purpose of explanation. It should be understood that a person of ordinary skill in the art can recognize that the present invention can be implemented without using these specific details. In other examples, well-known structures and processes will not be elaborated in detail to avoid obscuring the description of the present invention with unnecessary details. Therefore, the present invention is not intended to be limited to the embodiments shown, but is consistent with the widest scope consistent with the principles and features disclosed in the present application.

[0082] The rendering method of the water flow area in the virtual scene provided in the embodiment of the present application can be run on a terminal device or a server. Among them, the terminal device can be a local terminal device. Among them, the server can be an independent physical server, or it can be a server cluster or distributed system composed of multiple physical servers, or it can be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. Take the rendering method of the water flow area in the virtual scene applied to the electronic game scene as an example. The electronic game server can generate the flow areas such as rivers, rivers, and seas in the virtual scene of the game based on the rendering method of the water flow area in the virtual scene, and realize the rendering of the big world in the game.

[0083] See also Figure 1 The embodiment of the present application provides a method for rendering a water flow area in a virtual scene, which is mainly illustrated by applying the method to the server 100. The method includes steps S110 to S140, which are as follows:

[0084] S110, obtaining a water flow area model corresponding to the water flow area in the land parcel model.

[0085] Among them, the land model refers to the three-dimensional model used to represent the terrain of plains, mountains, rivers, etc. in the virtual scene. The water flow area refers to the areas such as rivers, lakes, and seas, and the water flow area model refers to the three-dimensional model of the terrain of the water system areas such as rivers, lakes, and seas in the land model. Figure 2 As shown, Figure 2 A schematic diagram of a plot model in an embodiment of the present application is shown. Figure 2 The plot model shown can represent terrain such as mountains, rivers, lakes, etc. in the virtual scene. For example, part 210 is used to represent the mountains in the virtual scene, and the black area in part 220 is used to represent the rivers in the virtual scene.

[0086] The water flow area model in the land parcel model may be determined in advance through manual identification; or the water flow area model in the land parcel model may be determined through the water flow area in the map image.

[0087] Specifically, in one embodiment, Figure 3A As shown, the step of obtaining the water flow area model corresponding to the water flow area in the land parcel model may include:

[0088] S310: Acquire a land parcel model and a map image corresponding to the land parcel model.

[0089] S320, extracting an initial water flow layer of the water flow area in the map image.

[0090] S330, extracting a water flow area model from the land parcel model based on the initial water flow layer.

[0091] Among them, the map image refers to the image of the terrain types corresponding to different locations that have been planned, such as Figure 3B As shown, Figure 3B Schematic diagram of a map image in an embodiment of the present application.

[0092] The initial water flow layer refers to the layer information corresponding to the water flow area obtained from the map image. It can be understood that the initial water flow layer is two-dimensional layer information. The server can read the initial water flow layer in the map image, and then use the initial water flow layer as a mask layer to extract the water flow area model from the plot model.

[0093] Specifically, after obtaining the initial water flow layer, the plot model is marked based on the initial water flow layer as a mask layer. The area covered by the mask layer is marked as 1, and the area not covered by the mask layer is marked as 0. The server extracts the area marked as 1 in the plot model as the subsequent processing object, thereby obtaining the water flow area model.

[0094] Furthermore, the step of extracting the water flow area model in the plot model based on the initial water flow layer may specifically include: expanding the initial water flow layer based on the layer edge line of the initial water flow layer to obtain the target water flow layer; and extracting the water flow area model in the plot model based on the target water flow layer.

[0095] Among them, after obtaining the initial water flow layer, the layer edge line of the initial water flow layer is used as a reference to expand the initial water flow layer outward to obtain the target water flow layer, and then the target water flow layer is used as a mask layer to cut out the water flow area model from the plot model.

[0096] See also Figure 3C as well as Figure 3D , Figure 3C The left figure in the figure shows the initial water flow layer marked on the land model, and the right figure shows the target water flow layer obtained by expanding the initial water flow layer based on the layer edge line; Figure 3D The left image in the figure shows the target water flow layer, and the right image shows the water flow area model obtained from the land parcel model based on the target water flow layer in the left image.

[0097] The water flow area model is extracted based on the target water flow layer, so that the range of the water flow area model is expanded outward. The water surface mesh subsequently generated based on the water flow area model has a larger coverage area, avoiding the gap between the rendered water surface and the riverbank area in the plot model, which reduces the authenticity of the water surface animation effect.

[0098] Furthermore, before the step of obtaining the water flow area model corresponding to the water flow area in the plot model, the plot model can be smoothed so that the uneven areas in the plot model become flat. Similarly, the model edge of the water flow area model extracted from the smoothed plot model is flat, so that the water surface mesh subsequently generated according to the model edge points of the water flow area model is smooth as a whole, closer to the water surface effect, thereby improving the authenticity of the water surface animation effect.

[0099] S120, generating a water surface grid corresponding to the land parcel model according to the model edge points of the water flow area model.

[0100] The model edge points refer to the points on the edge lines in the water flow area model. Specifically, after obtaining the water flow area model, the shared edges in the water flow area model are deleted to obtain the edge lines of the water flow area model. At the same time, the bounding box of the plot model is obtained, and the border lines on the water flow area model are obtained based on the bounding box, and then the edge lines and the points on the border lines are determined as model edge points. After obtaining the model edge points of the water flow area model, the server can use the model edge points as the edge points of the water surface mesh to reconstruct the target water surface mesh. Figure 4A as well as Figure 4B As shown, Figure 4A Schematic diagram of the edge points of the model in the embodiment of the present application ( Figure 4A The model edge points shown do not reflect the height information of each edge point). Figure 4B Based on Figure 4A Schematic diagram of the water surface mesh reconstructed from the edge points of the model shown.

[0101] In one embodiment, a water surface grid corresponding to a land parcel model is generated according to the model edge points of a water flow area model, which may specifically include: smoothing the height information of the model edge points of the water flow area model to obtain target edge points; and constructing a water surface grid corresponding to the land parcel model based on the target edge points.

[0102] Among them, the height information of the model edge points is smoothed in order to adjust the height difference of the model edge points so that the model edge points become smooth in height. The water surface mesh subsequently generated based on the model edge points is smooth as a whole, closer to the water surface effect, and improves the authenticity of the water surface animation effect.

[0103] The height information of the model edge points of the water flow area model is smoothed, and specifically, the projection coordinates of the model edge points on the two-dimensional plane are first obtained, wherein the projection coordinates of the model edge points on the two-dimensional plane can be understood as the coordinate information obtained by setting the height information in the coordinate information of the model edge points to zero; Figure 4C As shown in the figure, after the height information in the coordinate information of the model edge point is set to zero, the ups and downs of the model edge points are transformed into model edge points on a two-dimensional plane. Then, based on the projection coordinates, the model edge points on the same straight line in the two-dimensional plane are obtained to obtain an edge point group; for any edge point group, the target model edge points are filtered from the edge point group, and the model edge points other than the target model edge points are deleted to obtain the simplified model edge points. Subsequently, the simplified model edge points can be used as target edge points to construct the water surface grid corresponding to the plot model. Figure 4D As shown, Figure 4D Taking the model edge points in the ellipse 400 as an example, the line formed by the model edge points in the ellipse 400 is shown as a curve 401, and the model edge points are ups and downs. The three-dimensional surface formed by the model edge points and other model edge points (such as the model edge points outside the ellipse 400) is often also ups and downs; the height information of the model edge points on the line 401 is deleted, so that the model edge points on the line 401 are projected onto the same two-dimensional plane. It can be understood that the model edge points of the line 401 are on the same straight line 402 on the two-dimensional plane, and thus the model edge points except the target model edge point 403 can be deleted, and only the target model edge point 403 is retained. The target model edge point 403 and other model edge points form the simplified model edge points, and the three-dimensional surface formed by the simplified model edge points is flatter, and the water surface mesh subsequently generated based on the model edge points is smoother and closer to the water surface effect.

[0104] Furthermore, the height information of the simplified model edge points can be smoothed again. Specifically, the simplified model edge points are used as a target model. After smoothing and blurring the target model, the height information of the model edge points in the target model is assigned to the simplified model edge points to obtain the model edge points after height information smoothing. Subsequently, the model edge points can be used as target edge points to construct the water surface grid corresponding to the land model. Figure 4E As shown, after the height information is smoothed again, the height information of point 404 is adjusted to the height information shown by point 405, so that the three-dimensional surface formed by the edge points of the model is smoother and closer to the effect of the water surface.

[0105] Since the amount of data in the land parcel model is huge, in order to reduce the computational time of constructing the water surface grid, the land parcel model can be first divided into multiple land parcel sub-models, and then each land parcel sub-model is processed separately to obtain the water surface grid. In one embodiment, the land parcel model includes at least two land parcel sub-models; Figure 5A As shown in FIG. 1 , the steps of generating a water surface mesh according to the model edge points of the water flow area model specifically include:

[0106] S510, for any plot sub-model, smoothing the model edge points of the water flow area model in the plot sub-model to obtain target edge points of the water flow area model in the plot sub-model;

[0107] S520, constructing a water surface sub-grid corresponding to the land parcel model based on the target edge points of the water flow area model in the land parcel sub-model;

[0108] S530, splicing the water surface sub-grids corresponding to the sub-models of each block to obtain a water surface grid.

[0109] Among them, for any plot sub-model, the model edge points of the water flow area model in the plot sub-model are smoothed to obtain the target edge points of the water flow area model in the plot sub-model. For a specific description of the steps, please refer to the above description of smoothing the height information of the model edge points of the water flow area model, which will not be repeated here.

[0110] Specifically, by dividing the plot model into multiple plot sub-models, and then based on the target edge points of the water flow area model in each plot sub-model, a water surface sub-grid corresponding to the plot sub-model is separately constructed, and then based on the position information of each plot sub-model, the water surface sub-grids corresponding to all the plot sub-models are spliced ​​accordingly to obtain a water surface grid.

[0111] Furthermore, before the step of splicing the water surface sub-grids corresponding to the sub-models of each block to obtain the water surface grid, the height information of each grid vertex in the water surface sub-grid can be smoothed for any water surface sub-grid; specifically, the water surface sub-grid is smoothed and blurred, and the height information of each grid vertex in the water surface sub-grid after the smoothing and blurring is assigned to the corresponding grid vertex on the original water surface sub-grid, so as to obtain the water surface sub-grid after the height information is smoothed.

[0112] Among them, due to the inconsistency of the average heights of different land parcel sub-models, the height information between the water surface sub-grids constructed based on the smoothed target edge points corresponding to the land parcel sub-models is discontinuous, and the water surface grids obtained by splicing the water surface sub-grids often have obvious seams, such as Figure 5B As shown; therefore, in one embodiment, the step of splicing the water surface sub-grids corresponding to the sub-models of each block to obtain the water surface grid may specifically include: extracting the grid edge points of each water surface sub-grid, and the projection coordinates of the grid edge points on the two-dimensional plane; calculating the distance value between any two grid edge points based on the projection coordinates of the grid edge points; merging two grid edge points whose distance values ​​are less than a preset distance threshold to obtain the water surface grid.

[0113] The grid edge points refer to the grid vertices on the edge line of the water surface sub-grid.

[0114] Specifically, after extracting the grid edge points of each water surface sub-grid, the height information in the coordinate information of the grid edge points can be set to zero, so that each network edge point is projected onto a two-dimensional plane. By obtaining the projection coordinates of the grid edge points on the two-dimensional plane, the distance value between any two grid edge points on the same two-dimensional plane is calculated based on the projection coordinates of each grid edge point. When the distance value is less than a preset distance threshold, the two grid edge points are merged so that each water surface sub-grid is stitched and spliced ​​to obtain a complete water surface grid corresponding to the terrain model. Figure 5C As shown, Figure 5C A schematic diagram showing the effect of a water surface mesh obtained by merging two mesh edge points whose distance values ​​are less than a preset distance threshold.

[0115] S130, obtaining direction information of the skeleton line of the water surface mesh, and constructing water flow direction information of each mesh vertex on the water surface mesh according to the direction information of the skeleton line.

[0116] Among them, the skeleton line refers to the thin line that is consistent with the connectivity and topological structure of the water surface grid. Due to the complex structure of the water surface grid, the extracted skeleton line has bifurcations. Therefore, in the process of skeleton line extraction, a distance threshold can be set to merge the points on different bifurcations and within the distance threshold to obtain the final skeleton line.

[0117] The direction information can be used to reflect the water flow direction information of the water flow area. Specifically, the direction information includes the direction information of each skeleton point on the skeleton line. After obtaining the skeleton line of the water surface grid, the direction information of the skeleton line can be determined according to the attribute information of each skeleton point on the skeleton line, such as height information, water flow type, etc.

[0118] For example, water flows from high to low. After obtaining the skeleton line, the direction information of the skeleton line can be determined based on the height information of each skeleton point on the skeleton line. For another example, water flows from the source of the river to the lake and then to the sea. After obtaining the skeleton line, the water flow type of each skeleton point on the skeleton line can be obtained first, such as river type, lake type or ocean type, and then the direction information of the skeleton line can be determined based on the water flow type of each skeleton point on the skeleton line.

[0119] In one embodiment, Figure 6 As shown, the step of obtaining the direction information of the skeleton line of the water surface grid includes:

[0120] S610, obtaining the number of endpoints of the skeleton line;

[0121] S620, if the number of endpoints of the skeleton line is equal to 2, or the number of endpoints of the skeleton line is not equal to 2 and there is no pre-selected end skeleton point on the skeleton line, sort the skeleton points based on the height information of each skeleton point in the skeleton line to obtain a sorting result;

[0122] S630, obtaining direction information of each skeleton point according to the sorting result, and obtaining direction information of the skeleton line.

[0123] The endpoint refers to the point at the top (or boundary) of the skeleton line. It can be understood that the endpoint on the skeleton line can be used to reflect the source or end point of the water flow in the water flow area. Specifically, any skeleton point in the skeleton line can be used as a target skeleton point, and the number of neighbor points of the target skeleton point on the skeleton line is calculated, wherein the neighbor point is a skeleton point on the skeleton line whose distance from the target skeleton line is less than a preset distance threshold. If the number of neighbor points is equal to 1, the target skeleton point is determined as the endpoint of the skeleton line.

[0124] Among them, the pre-selected end skeleton point may refer to a skeleton point on the skeleton line whose water flow type belongs to a lake type or an ocean type; specifically, the grid edge line of the water surface grid may be obtained, and then the grid edge line may be determined as the starting position, and the distance information from each grid vertex in the water surface grid to the grid edge line may be calculated, and then based on the distance information of each grid vertex, the vertex attribute information of the grid vertex may be determined, and the vertex attribute information may be represented by color, which may be used to reflect whether the water flow type to which the grid vertex belongs is a lake type or an ocean type; after obtaining the skeleton line of the water surface grid, the skeleton point attribute information of each skeleton point on the skeleton line may be determined according to the vertex attribute information of each mesh vertex in the water surface grid, and the skeleton point attribute information is used to identify whether the water flow type to which the skeleton point belongs is a lake type or an ocean type, that is, to identify whether the skeleton point is a pre-selected end skeleton point.

[0125] For example, taking the representation of vertex attribute information and skeleton point attribute information through color as an example, the vertex attribute information of the mesh edge line can be determined as 0, that is, the mesh edge line is determined to be black, and the vertex attribute information of each mesh vertex is determined based on the shortest distance information from each mesh vertex to the mesh edge line in the water surface mesh, specifically: when the shortest distance information from the mesh vertex to the mesh edge line is greater than or equal to 0.5, the vertex attribute information of the mesh vertex is determined to be white, and when the shortest distance information from the mesh vertex to the mesh edge line is less than 0.5, the vertex attribute information of the mesh vertex is determined to be black; it can be understood that when the water surface mesh is a lake surface or an ocean surface, the water surface mesh has sufficient width and area, so that the distance from the mesh vertex in the center part of the water surface mesh to the mesh edge line is greater than 0.5, thereby obtaining mesh vertices with white vertex attribute information. After obtaining the skeleton line of the water surface mesh, the vertex attribute information (i.e., color) of each mesh vertex in the water surface mesh can be transferred to the skeleton line to determine the vertex attribute information of each skeleton point on the skeleton line. Then, based on the color attribute information of each skeleton point, it is determined whether each skeleton point is a pre-selected end skeleton point, that is, the skeleton point with white color attribute information is determined as the pre-selected end skeleton point.

[0126] After obtaining the number of endpoints on the skeleton line, the type of river of the water surface mesh corresponding to the skeleton line can be determined based on the number of endpoints. For example, when the number of endpoints is 2, the type of river of the water surface mesh corresponding to the skeleton line is a two-headed river. When the number of endpoints is greater than 2, the type of river of the water surface mesh corresponding to the skeleton line is a multi-headed river. For a skeleton line with 2 endpoints, or a skeleton line with more than 2 endpoints and no end skeleton point, the direction information of the skeleton line can be determined based on the principle that water always flows from high to low. Specifically, based on the height information of each skeleton point on the skeleton line, each skeleton point is sorted to obtain a sorting result, and then the sorting result determines the direction information of each skeleton point on the skeleton line.

[0127] Further, in one embodiment, if Figure 7 As shown, after the step of obtaining the number of endpoints of the skeleton line, the following steps are further included:

[0128] S710, if the number of endpoints of the skeleton line is not equal to 2 and the skeleton line includes an ending skeleton point, randomly select multiple starting skeleton points on the skeleton line;

[0129] S720, acquiring path information between the starting skeleton point and the ending skeleton point based on the skeleton line;

[0130] S730, obtaining direction information of the skeleton line based on the path information.

[0131] For skeleton lines with more than 2 endpoints and an end skeleton point, the direction information of the skeleton line can be determined based on the principle that water flows from the source of the river to the lake and then to the sea. Specifically, a point is randomly selected based on the skeleton line, and the obtained point is determined as the starting skeleton point. Then, based on the starting skeleton point, the path information from the starting skeleton to the ending skeleton point is obtained along the skeleton line. The path information includes the path trajectory and the path direction; after determining the path information from each starting skeleton point to the ending skeleton point, the path information is merged to obtain the direction information of the skeleton line.

[0132] After obtaining the direction information of the skeleton line corresponding to the water surface mesh, the water flow direction information of each mesh vertex on the water surface mesh can be constructed based on the direction information of the skeleton line. Specifically, the skeleton line is used as a model, each skeleton point on the skeleton line is used as a model node, and the water surface mesh is used as another model, each mesh vertex on the water surface mesh is used as a model node, and the direction information on each skeleton point is passed as node attribute information to each mesh vertex on the water surface mesh to determine the water flow direction information of each mesh vertex.

[0133] Furthermore, considering the influence of obstacles in the water flow area, such as reefs and river banks in the water flow, on the water flow direction, in one embodiment, Fig. 8A As shown, the steps of constructing the water flow direction information of each mesh vertex on the water surface mesh according to the direction information of the skeleton line specifically include:

[0134] S810, generating initial flow direction information of each mesh vertex on the water surface mesh based on the direction information of the skeleton line.

[0135] Among them, the skeleton line can be used as a model, each skeleton point on the skeleton line can be used as a model node, and the water surface grid can be used as another model, each grid vertex on the water surface grid can be used as a model node, and the direction information on each skeleton point can be passed as node attribute information to each grid vertex on the water surface grid to determine the initial flow direction information of each grid vertex.

[0136] S820, obtaining an obstacle model in the land mass model, and determining a first mesh vertex in the water surface mesh according to surface position information of the obstacle model; the first mesh vertex is a mesh vertex in the water surface mesh whose flow direction information is affected by the obstacle model.

[0137] The obstacles include but are not limited to reefs, riverbanks, etc. in the water flow area, and the obstacle model refers to the three-dimensional model corresponding to the obstacle; it can be understood that around the obstacle, the collision between the water flow and the obstacle will cause the flow direction of the water flow to be opposite. The surface position information of the obstacle model can be the coordinate information of each mesh or mesh vertex in the obstacle model.

[0138] The first grid vertex is a grid vertex whose flow direction information in the water surface grid is affected by the obstacle model.

[0139] After obtaining the obstacle model in the land model, the first mesh vertex whose flow direction information is affected by the obstacle model can be determined from the water surface mesh according to the surface position information of the obstacle model. Specifically, the influence distance threshold of the obstacle model can be set in advance, and then the relative distance value between each mesh vertex and the surface of the obstacle model can be calculated according to the surface position information of the obstacle model and the position information of each mesh vertex in the water surface mesh, and the mesh vertex whose relative distance to the surface of the obstacle model is less than the influence distance threshold is determined as the first mesh vertex. It can be understood that the influence distance threshold can be set according to the surface area or volume of the obstacle model.

[0140] S830, calculating target flow direction information of the first mesh vertex based on the normal vector of the obstacle model and the initial flow direction information of the first mesh vertex.

[0141] Among them, the normal vector refers to the normal vector of the obstacle model surface; Figure 8B As shown, Figure 8B A schematic diagram showing the normal vector when the obstacle model is a sphere.

[0142] Specifically, after obtaining the first mesh vertex where the obstacle affects the water surface mesh, the dot product value of the initial flow direction information of the first mesh vertex and the normal vector of the obstacle model can be calculated, and the dot product value can be determined as the target flow direction information of the first mesh vertex.

[0143] S840, generating water flow direction information of the water surface mesh based on target flow direction information of a first mesh vertex in the water surface mesh and initial flow direction information of a second mesh vertex; the second mesh vertex is a mesh vertex in the water surface mesh other than the first mesh vertex.

[0144] After the target flow direction information of the first mesh vertex is determined, the water flow direction information of the water surface mesh may be generated according to the target flow direction information of the first mesh vertex and the initial flow direction information of the second mesh vertex.

[0145] S140, rendering the water surface in the water flow area based on the water surface mesh and the water flow direction information of the mesh vertices.

[0146] After obtaining the water surface mesh and the water flow direction information of each mesh vertex on the water surface mesh, a Flowmap can be generated based on the water flow direction information of each mesh vertex, and the Flowmap can be used as the vertex color of the water surface mesh for UV mapping of the water surface effect, thereby rendering the water surface in the water flow area and simulating the water surface flow effect.

[0147] In the method for rendering the water flow area in the above virtual scene, the water flow area model corresponding to the water flow area in the land parcel model is obtained; the water surface mesh corresponding to the land parcel model is generated according to the model edge points of the water flow area model; the direction information of the skeleton line of the water surface mesh is obtained, and the water flow direction information of each mesh vertex on the water surface mesh is constructed according to the direction information of the skeleton line; the water surface of the water flow area is rendered based on the water surface mesh and the water flow direction information of the mesh vertex. The method obtains the water flow area model, and then generates the corresponding water surface mesh based on the model edge points of the water flow area model, and generates the flow direction information of each mesh vertex on the water surface mesh by obtaining the direction information of the skeleton line of the water surface mesh, and finally renders the water surface of the water flow area in combination with the flow direction information of the water surface mesh and the mesh vertex, so as to realize the fully automatic generation of the water surface mesh corresponding to the water flow area, and simulate the water surface flow effect through the water surface mesh rendering, especially when rendering the virtual scene corresponding to the large world map, the generation efficiency of the water surface mesh is effectively improved, and the construction time of the map model is reduced.

[0148] The rendering method of the above virtual environment is further explained in combination with the application scenario. Specifically, the rendering method of the above virtual environment can be implemented through Houdini software, wherein Houdini is a multifunctional software that can model, bind, make animations, and make special effects. Users can call multiple different process nodes in Houdini, splice the program code corresponding to each process node together as needed, and package the spliced ​​program code to form a general process; in the process of building and rendering the water surface mesh, it can be based on the general process, and the water surface mesh corresponding to the water flow area can be automatically generated, and the water surface flow effect can be simulated based on the water surface mesh rendering. The implementation process of the virtual environment rendering method will be explained and analyzed step by step.

[0149] 1. Obtain a land parcel model and a map image corresponding to the land parcel model.

[0150] The map image is as follows: Figure 3B As shown in the figure, the map image is an image of the terrain types corresponding to different locations. The land parcel model refers to a three-dimensional model corresponding to the map image, which is used to represent the flat land, mountainous land, river channel and other terrains at different locations in the map image; Figure 2 shown.

[0151] It can be understood that the land parcel model can be divided into a plurality of land parcel sub-models, and the land parcel sub-models can be used as processing units to generate water surface sub-grids corresponding to each land parcel sub-model.

[0152] 2. Extract the initial water flow layer of the water flow area in the map image.

[0153] Specifically, the initial water flow layer can be extracted from the map image through the trace_psd_file node in Houdimi, and then the initial water flow image can be saved as a mask through the heightfield_copylayer node to facilitate subsequent operations.

[0154] 3. Expand the initial water flow layer based on the layer edge line of the initial water flow layer to obtain the target water flow layer.

[0155] In the 3D model, in order to avoid gaps between the rendered water surface mesh and the riverbank area in the land model, the water surface mesh must be inserted into the land model; therefore, after obtaining the initial water flow layer, the heightfield_maskexpand node can be used to make the initial water flow layer overflow, as shown below: Figure 3C shown.

[0156] 4. Smooth the plot model.

[0157] Among them, the terrain model can be smoothed by using the Heightfield_blur node and the ConvertHeightField node, so that the uneven areas in the plot model become flat. Similarly, the model edge of the water flow area model extracted from the smoothed plot model is flat, so that the water surface mesh subsequently generated according to the model edge points of the water flow area model is smooth as a whole, closer to the water surface effect, and the authenticity of the water surface animation effect is improved.

[0158] 5. For any plot sub-model, extract the water flow area model in the plot sub-model based on the target water flow layer.

[0159] Specifically, the land model is identified based on the target water flow layer as the mask layer, the area covered by the mask layer is identified as 1, and the area not covered by the mask layer is identified as 0; then, the non-water flow area identified as 0 in the terrain sub-model can be deleted through the Blast node and the @mask<0.1 expression to obtain the water flow area model in the terrain sub-model, as shown in the following example. Figure 3D shown.

[0160] 6. For any plot sub-model, extract the model edge points of the water flow area model in the plot sub-model.

[0161] Specifically, you can use the Divide node (check Remove Shared Edges in this node) to delete the shared edges (i.e. the edges shared by two faces) in the water flow area model to obtain the edge line: Then, use the box node to obtain the outer frame of the plot submodel, and use the peak node to reduce the outer frame to obtain a point inside the frame. This point is used as a Group, and then the groupcombine node is used to deselect the Group to obtain the point closest to the outer frame. Based on the points on the edge line and the points closest to the outer frame as the model edge points, see Figure 4A , Figure 4A A schematic diagram of the model edge points is shown.

[0162] 7. For any plot sub-model, smoothing is performed on the model edge points of the water flow area model in the plot sub-model to obtain the target edge points of the water flow area model in the plot sub-model.

[0163] Specifically, the model edge points can be first saved as a group "rest1", and then the height information (i.e., the value of the Y axis) of the model edge points in the group "rest1" is set to 0, so that the model edge points are projected onto the same two-dimensional plane, and the model edge points form a figure without ups and downs on the two-dimensional plane, such as Figure 4C shown.

[0164] Then, the model edge points in rest1 are simplified through the facet node to obtain simplified model edge points. Specifically, if there are N (N is greater than 2) model edge points in the group "rest1" on the same straight line, the model edge points on the straight line can be determined as an edge point group; for this edge point group, the target model edge points are selected from the edge point group, and the model edge points other than the target model edge points are deleted, and finally the simplified model edge points are obtained.

[0165] like Figure 4D As shown, Figure 4D Taking the model edge points in the ellipse 400 as an example, the line formed by the model edge points in the ellipse 400 is shown as a curve 401, and the model edge points are ups and downs. The three-dimensional surface formed by the model edge points and other model edge points (such as the model edge points outside the ellipse 400) is often also ups and downs; the height information of the model edge points on the line 401 is deleted, so that the model edge points on the line 401 are projected onto the same two-dimensional plane. It can be understood that the model edge points of the line 401 are on the same straight line 402 on the two-dimensional plane, and thus the model edge points except the target model edge point 403 can be deleted, and only the target model edge point 403 is retained. The target model edge point 403 and other model edge points form a simplified model edge point, and the three-dimensional surface formed by the simplified model edge points is flatter, and the water surface mesh subsequently generated based on the model edge points is smoother and closer to the water surface effect.

[0166] Then, the height information of the simplified model edge points can be smoothed again. Specifically, the simplified model edge points are used as a target model, and the target model is smoothed and blurred. Then, the height information of the model edge points in the target model after smoothing and blurring is assigned to the model edge points, that is, the height information of the simplified model edge points is replaced with the height information of the model edge points in the target model after smoothing and blurring, and finally the model edge points are obtained. Figure 4E As shown, after the height information is smoothed again, the height information of point 404 is adjusted to the height information shown as point 405, so that the three-dimensional surface formed by the edge points of the model is smoother and closer to the effect of the water surface.

[0167] 8. For any land parcel sub-model, a water surface sub-grid corresponding to the land parcel model is constructed based on the target edge points of the water flow area model in the land parcel sub-model.

[0168] Specifically, the water surface sub-grid can be reconstructed based on the target edge points through the remesh node. Figure 4B As shown, Figure 4B A schematic diagram of a water surface sub-grid in an embodiment of the present application is shown.

[0169] Furthermore, for the obtained water surface sub-grid, the height information of each mesh vertex in the water surface sub-grid can be smoothed; specifically, the water surface sub-grid is smoothed and blurred, and the height information of each mesh vertex in the water surface sub-grid after the smoothing and blurring is assigned to the corresponding mesh vertex on the original water surface sub-grid, so as to obtain the water surface sub-grid after the height information is smoothed. Fig. 9A As shown, Fig. 9A A schematic diagram of a water surface mesh after smoothing the height information of each mesh vertex is shown.

[0170] It is understandable that the above steps 2 to 8 can be encapsulated into a river node, and then the river node can be linked to a loop node (such as a foreach node) to implement a loop operation on all land sub-models so that a water surface sub-grid is generated corresponding to the land sub-model.

[0171] 9. Extract the grid edge points of each of the water surface sub-grids and the projection coordinates of the grid edge points on the two-dimensional plane; merge two grid edge points whose distance values ​​are less than a preset distance threshold to obtain a water surface grid.

[0172] Specifically, the mesh edge points of the water surface sub-mesh can be obtained through the divide node, and then the mesh edge points are saved in the group "rest2", and then the height information (i.e., the value of the Y axis) of the mesh edge points in the group "rest2" is set to 0, so that the mesh edge points are projected onto the same two-dimensional plane, and the mesh edge points form a figure without ups and downs on the two-dimensional plane, such as Fig. 9B As shown in the figure, it can be understood that when the height information of the grid edge points is set to zero, the grid edge points between adjacent water surface sub-grids are infinitely close. Then, the points with a distance value less than 0.001 are stitched together through the fuse node to stitch the water surface sub-grids into a water surface grid. After stitching and splicing the various water surface sub-grids, the height information in the coordinate information of each grid edge point is reassigned to each stitched and spliced ​​water surface sub-grid to obtain a complete water surface grid corresponding to the terrain model, as shown in the figure. Figure 5C shown.

[0173] 10. Extract the skeleton line of the water surface mesh.

[0174] Specifically, the skeleton line of the water surface mesh can be extracted through the straight_skeleton_3d node.

[0175] Due to the complex structure of the water surface grid, the extracted skeleton line has bifurcations. Therefore, in the process of skeleton line extraction, the points on different bifurcations and within the preset distance threshold can be merged through the fuse node to obtain the final skeleton line; Fig. 9C As shown, Fig. 9C Schematic diagram showing the skeleton lines of the water surface mesh.

[0176] 11. Obtain direction information of the skeleton line of the water surface grid.

[0177] Specifically, first obtain the number of endpoints of the skeleton line. Take any skeleton point in the skeleton line as the target skeleton point, and calculate the number of neighbor points of the target skeleton point on the skeleton line, where the neighbor point is a skeleton point on the skeleton line whose distance from the target skeleton line is less than a preset distance threshold. If the number of neighbor points is equal to 1, the target skeleton point is the endpoint of the skeleton line, and the endpoint of the skeleton line is saved in the group "npc_one".

[0178] Then, add the class attribute to the skeleton line through the connectivity node, that is, distinguish different skeleton lines through the class attribute.

[0179] For any skeleton line, calculate the number of endpoints on the skeleton line; specifically, for skeleton lines belonging to the same class attribute, calculate the number of points whose skeleton points belong to the group "npc_one".

[0180] If the number of endpoints on the skeleton line is equal to 2, the skeleton line is saved to the group "Towendpoint"; if the number of endpoints is greater than 2, the skeleton line is saved to the group "Nendpoint".

[0181] For the skeleton line in the group "Towendpoint", the height information of the skeleton points on the skeleton line is sorted, that is, the skeleton points are sorted according to their values ​​on the Y axis, and then the direction information of each skeleton point is obtained based on the sorting result to obtain the direction information of the skeleton line; taking two adjacent skeleton points on the skeleton line as an example, the height information of the two skeleton points can be sorted through the sort3 node, and the skeleton points with higher height information are put into the group "stpoint", and the skeleton points with lower height information are put into the group "endpoint"; then, the skeleton points of the group "stpoint" and the skeleton points of the group "endpoint" are input into the findshortestpath node, and the path information between the two adjacent skeleton points from the skeleton point with higher height information to the skeleton point with lower height information is calculated through the findshortestpath node.

[0182] For the skeleton lines in the group "Nendpoint", you can first use the Unshared Edges function in the Group node to obtain the edge lines of the water surface mesh, and save each edge point on the edge line to the group "Unshared Edge".

[0183] Then, the shortest distance from each mesh vertex in the water surface mesh to the group "Unshared Edge" (i.e., the edge line of the water surface mesh) is calculated through the DistanceAlongGeometry node, and the shortest distance is mapped to the range of [0, 1] based on the preset radius value and gradient parameters; after obtaining the output result of the DistanceAlongGeometry node, when the shortest distance information from the mesh vertex to the mesh edge line is greater than or equal to 0.5, the vertex attribute information of the mesh vertex is determined to be white, and when the shortest distance information from the mesh vertex to the mesh edge line is less than 0.5, the vertex attribute information of the mesh vertex is determined to be black.

[0184] It can be understood that when the water surface mesh is a lake surface or an ocean surface, the water surface mesh has sufficient width and area so that the distance from the mesh vertex in the center of the water surface mesh to the mesh edge line is greater than 0.5, and the vertex attribute information is obtained as white mesh vertices.

[0185] Then, the vertex attribute information (i.e., color) is transferred to the skeleton points on the skeleton line through the Attribtransfer node, so that the skeleton points on the skeleton line belonging to lakes or seas appear white, and the skeleton points that are not lakes or seas appear black, such as Fig.9D As shown in the figure, the skeleton point with white color attribute information is used as the pre-set end skeleton point and saved in the group "endpoint".

[0186] Determine whether there is an end skeleton point on the skeleton line that belongs to the group "endpoint".

[0187] If it does not exist, it can be considered that the skeleton line does not pass through the lake or the sea. Then, the skeleton points on the skeleton line are sorted by height information, that is, they are sorted according to their values ​​on the Y-axis, and then the direction information of each skeleton point is obtained based on the sorting result to obtain the direction information of the skeleton line.

[0188] If it exists, it can be considered that the skeleton line passes through a lake or the sea. Then, a random point can be selected on the skeleton line through the Scatter node, and the randomly selected point is used as the starting skeleton point and saved to the group "npc_one". Then, for this skeleton line, a path search is performed through the FindShortestPath node to obtain the path information from the skeleton point belonging to the group "npc_one" (i.e. the starting skeleton point) to the skeleton point belonging to the group "endpoint" (i.e. the ending skeleton point), and then the tangent direction of the path information is calculated through the polyframe node, and the tangent direction is the direction information of the skeleton line.

[0189] 12. Construct water flow direction information of each mesh vertex on the water surface mesh according to the direction information of the skeleton line.

[0190] After obtaining the direction information of the skeleton line, the direction information of the skeleton line can be transferred to the water surface mesh through the Attribtransfer node to obtain the initial flow direction information of each mesh vertex on the water surface mesh.

[0191] Furthermore, if Fig.9E As shown, considering that there may be obstacles such as reefs and river banks in the water flow area, the water flow direction information of the water surface grid is affected by the obstacles and changes; therefore, the obstacle model in the plot model can be obtained, and the first grid vertex in the water surface grid is determined according to the surface position information of the obstacle model; based on the normal vector of the obstacle model and the initial flow direction information of the first grid vertex, the target flow direction information of the first grid vertex is calculated. The first grid vertex is the grid vertex in the water surface grid whose flow direction information is affected by the obstacle model. Based on the normal vector of the obstacle model and the initial flow direction information of the first grid vertex, the target flow direction information of the first grid vertex is calculated. Based on the target flow direction information of the first grid vertex in the water surface grid and the initial flow direction information of the second grid vertex, the water flow direction information of the water surface grid is generated; the second grid vertex is the grid vertex in the water surface grid except the first grid vertex.

[0192] 13. Render the water flow area based on the water surface mesh and the water flow direction information of the mesh vertices.

[0193] Specifically, a Flowmap is generated according to the water surface mesh and the water flow direction information of the mesh vertices, and the Flowmap is imported into a game engine, such as UE4 (Unreal Engine), for rendering to achieve the water surface effect in the rendered virtual scene.

[0194] In order to better implement the method for rendering a water flow area in a virtual scene provided in the embodiment of the present application, on the basis of the method for rendering a water flow area in a virtual scene provided in the embodiment of the present application, a device for rendering a water flow area in a virtual scene is also provided in the embodiment of the present application, such as Fig.10 As shown, the rendering device 1000 of the water flow area in the virtual scene includes:

[0195] The regional model acquisition module 1010 is used to acquire a water flow regional model corresponding to a water flow region in a land parcel model;

[0196] The water surface grid generation module 1020 is used to generate a water surface grid corresponding to the land block model according to the model edge points of the water flow area model;

[0197] The water flow direction acquisition module 1030 is used to acquire the direction information of the skeleton line of the water surface grid, and construct the water flow direction information of each grid vertex on the water surface grid according to the direction information of the skeleton line;

[0198] The water surface model rendering module 1040 is used to render the water surface in the water flow area based on the water surface mesh and the water flow direction information of the mesh vertices.

[0199] In some embodiments of the present application, the regional model acquisition module 1010 is used to obtain a plot model and a map image corresponding to the plot model; extract an initial water flow layer of a water flow area in the map image; and extract a water flow area model in the plot model based on the initial water flow layer.

[0200] In some embodiments of the present application, the regional model acquisition module 1010 expands the initial water flow layer based on the layer edge line of the initial water flow layer to obtain the target water flow layer; and extracts the water flow regional model in the plot model based on the target water flow layer.

[0201] In some embodiments of the present application, the water surface grid generation module 1020 is used to smooth the height information of the model edge points of the water flow area model to obtain the target edge points; and construct the water surface grid corresponding to the plot model based on the target edge points.

[0202] In some embodiments of the present application, the plot model includes at least two plot sub-models; the water surface grid generation module 1020 is used to extract the water flow area model in the plot model based on the initial water flow layer, including: for any plot sub-model, smoothing the model edge points of the water flow area model in the plot sub-model to obtain the target edge points of the water flow area model in the plot sub-model; constructing a water surface sub-grid corresponding to the plot model based on the target edge points of the water flow area model in the plot sub-model; splicing the water surface sub-grids corresponding to each plot sub-model to obtain a water surface grid.

[0203] In some embodiments of the present application, the water surface grid generation module 1020 is used to extract the grid edge points of each water surface sub-grid and the projection coordinates of the grid edge points on the two-dimensional plane; calculate the distance value between any two grid edge points based on the projection coordinates of the grid edge points; merge two grid edge points whose distance values ​​are less than a preset distance threshold to obtain a water surface grid.

[0204] In some embodiments of the present application, the water flow direction acquisition module 1030 is used to obtain the number of endpoints of the skeleton line; if the number of endpoints of the skeleton line is equal to 2, or the number of endpoints of the skeleton line is not equal to 2 and there is no pre-selected end skeleton point on the skeleton line, the skeleton points are sorted based on the height information of each skeleton point in the skeleton line to obtain the sorting result; the direction information of each skeleton point is obtained according to the sorting result to obtain the direction information of the skeleton line.

[0205] In some embodiments of the present application, the water flow direction acquisition module 1030 is used to randomly select multiple starting skeleton points on the skeleton line if the number of endpoints of the skeleton line is not equal to 2 and the skeleton line includes an ending skeleton point; obtain path information between the starting skeleton point and the ending skeleton point based on the skeleton line; and obtain direction information of the skeleton line based on the path information.

[0206] In some embodiments of the present application, the water flow direction acquisition module 1030 is used to generate initial flow direction information of each mesh vertex on the water surface mesh based on the direction information of the skeleton line; obtain the obstacle model in the plot model, and determine the first mesh vertex in the water surface mesh according to the surface position information of the obstacle model; the first mesh vertex is the mesh vertex in the water surface mesh whose flow direction information is affected by the obstacle model; based on the normal vector of the obstacle model and the initial flow direction information of the first mesh vertex, calculate the target flow direction information of the first mesh vertex; based on the target flow direction information of the first mesh vertex in the water surface mesh and the initial flow direction information of the second mesh vertex, generate water flow direction information of the water surface mesh; the second mesh vertex is the mesh vertex in the water surface mesh other than the first mesh vertex.

[0207] For the specific definition of the rendering device of the water flow area in the virtual scene, please refer to the definition of the rendering method of the water flow area in the virtual scene above, which will not be repeated here. Each module in the above-mentioned rendering device of the water flow area in the virtual scene can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0208] In some embodiments of the present application, the rendering device 1000 for the water flow area in the virtual scene can be implemented in the form of a computer program. The computer program can be used in Fig.11 The computer device shown in the figure is run. The memory of the computer device can store various program modules of the rendering device 1000 constituting the water flow area in the virtual scene, for example, Fig.10 The illustrated area model acquisition module 1010, water surface mesh generation module 1020, water flow direction acquisition module 1030 and water surface model rendering module 1040. The computer program composed of various program modules enables the processor to execute the steps of the method for rendering the water flow area in the virtual scene of each embodiment of the present application described in this specification.

[0209] For example, Fig.11 The computer device shown can be Fig.10The region model acquisition module 1010 in the rendering device 1000 of the water flow region in the virtual scene shown executes step S110. The computer device can execute step S120 through the water surface grid generation module 1020. The computer device can execute step S130 through the water flow direction acquisition module 1030. The computer device can execute step S140 through the water surface model rendering module 1040. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external computer device through a network connection. When the computer program is executed by the processor, a method for rendering a water flow region in a virtual scene is implemented.

[0210] Those skilled in the art will understand that Fig.11 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0211] In some embodiments of the present application, a computer device is provided, comprising one or more processors; a memory; and one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the following steps:

[0212] Obtain the water flow area model corresponding to the water flow area in the land parcel model;

[0213] Generate a water surface grid corresponding to the land model according to the model edge points of the water flow area model;

[0214] Obtain the direction information of the skeleton line of the water surface grid, and construct the water flow direction information of each grid vertex on the water surface grid according to the direction information of the skeleton line;

[0215] Based on the water surface mesh and the water flow direction information of the mesh vertices, the water surface in the water flow area is rendered.

[0216] In some embodiments of the present application, the processor also implements the following steps when executing the computer program: acquiring a plot model and a map image corresponding to the plot model; extracting an initial water flow layer of the water flow area in the map image; and extracting a water flow area model in the plot model based on the initial water flow layer.

[0217] In some embodiments of the present application, the processor also implements the following steps when executing the computer program: expanding the initial water flow layer based on the layer edge line of the initial water flow layer to obtain the target water flow layer; and extracting the water flow area model in the plot model based on the target water flow layer.

[0218] In some embodiments of the present application, the processor further implements the following steps when executing the computer program: smoothing the height information of the model edge points of the water flow area model to obtain the target edge points; and constructing the water surface grid corresponding to the plot model based on the target edge points.

[0219] In some embodiments of the present application, the plot model includes at least two plot sub-models; when the processor executes the computer program, the following steps are also implemented: for any plot sub-model, the model edge points of the water flow area model in the plot sub-model are smoothed to obtain the target edge points of the water flow area model in the plot sub-model; based on the target edge points of the water flow area model in the plot sub-model, a water surface sub-grid corresponding to the plot model is constructed; and the water surface sub-grids corresponding to each plot sub-model are spliced ​​to obtain a water surface grid.

[0220] In some embodiments of the present application, the processor also implements the following steps when executing the computer program: extracting the grid edge points of each water surface sub-grid and the projection coordinates of the grid edge points on the two-dimensional plane; calculating the distance value between any two grid edge points based on the projection coordinates of the grid edge points; merging two grid edge points whose distance values ​​are less than a preset distance threshold to obtain a water surface grid.

[0221] In some embodiments of the present application, the processor also implements the following steps when executing the computer program: obtaining the number of endpoints of the skeleton line; if the number of endpoints of the skeleton line is equal to 2, or the number of endpoints of the skeleton line is not equal to 2 and there is no pre-selected end skeleton point on the skeleton line, sorting the skeleton points based on the height information of each skeleton point in the skeleton line to obtain a sorting result; obtaining the direction information of each skeleton point according to the sorting result to obtain the direction information of the skeleton line.

[0222] In some embodiments of the present application, the processor also implements the following steps when executing the computer program: if the number of endpoints of the skeleton line is not equal to 2 and the skeleton line includes an ending skeleton point, randomly select multiple starting skeleton points on the skeleton line; obtain path information between the starting skeleton point and the ending skeleton point based on the skeleton line; and obtain direction information of the skeleton line based on the path information.

[0223] In some embodiments of the present application, the processor also implements the following steps when executing the computer program: generating initial flow direction information of each mesh vertex on the water surface mesh based on the direction information of the skeleton line; obtaining an obstacle model in the plot model, and determining the first mesh vertex in the water surface mesh according to the surface position information of the obstacle model; the first mesh vertex is the mesh vertex in the water surface mesh whose flow direction information is affected by the obstacle model; calculating the target flow direction information of the first mesh vertex based on the normal vector of the obstacle model and the initial flow direction information of the first mesh vertex; generating water flow direction information of the water surface mesh based on the target flow direction information of the first mesh vertex in the water surface mesh and the initial flow direction information of the second mesh vertex; the second mesh vertex is the mesh vertex in the water surface mesh other than the first mesh vertex.

[0224] In some embodiments of the present application, a computer-readable storage medium is provided, which stores a computer program. The computer program is loaded by a processor, so that the processor performs the following steps:

[0225] Obtain the water flow area model corresponding to the water flow area in the land parcel model;

[0226] Generate a water surface grid corresponding to the land model according to the model edge points of the water flow area model;

[0227] Obtain the direction information of the skeleton line of the water surface grid, and construct the water flow direction information of each grid vertex on the water surface grid according to the direction information of the skeleton line;

[0228] Based on the water surface mesh and the water flow direction information of the mesh vertices, the water surface in the water flow area is rendered.

[0229] In some embodiments of the present application, when the computer program is executed by a processor, the following steps are also implemented: obtaining a plot model and a map image corresponding to the plot model; extracting an initial water flow layer of the water flow area in the map image; and extracting a water flow area model in the plot model based on the initial water flow layer.

[0230] In some embodiments of the present application, when the computer program is executed by a processor, the following steps are also implemented: expanding the initial water flow layer based on the layer edge line of the initial water flow layer to obtain the target water flow layer; and extracting the water flow area model in the plot model based on the target water flow layer.

[0231] In some embodiments of the present application, when the computer program is executed by the processor, the following steps are also implemented: smoothing the height information of the model edge points of the water flow area model to obtain the target edge points; and constructing the water surface grid corresponding to the plot model based on the target edge points.

[0232] In some embodiments of the present application, the plot model includes at least two plot sub-models; when the computer program is executed by the processor, the following steps are also implemented: for any plot sub-model, the model edge points of the water flow area model in the plot sub-model are smoothed to obtain the target edge points of the water flow area model in the plot sub-model; based on the target edge points of the water flow area model in the plot sub-model, a water surface sub-grid corresponding to the plot model is constructed; and the water surface sub-grids corresponding to each plot sub-model are spliced ​​to obtain a water surface grid.

[0233] In some embodiments of the present application, when the computer program is executed by the processor, the following steps are also implemented: extracting the grid edge points of each water surface sub-grid and the projection coordinates of the grid edge points on the two-dimensional plane; calculating the distance value between any two grid edge points based on the projection coordinates of the grid edge points; merging two grid edge points whose distance values ​​are less than a preset distance threshold to obtain a water surface grid.

[0234] In some embodiments of the present application, when the computer program is executed by the processor, the following steps are also implemented: obtaining the number of endpoints of the skeleton line; if the number of endpoints of the skeleton line is equal to 2, or the number of endpoints of the skeleton line is not equal to 2 and there is no pre-selected end skeleton point on the skeleton line, sorting the skeleton points based on the height information of each skeleton point in the skeleton line to obtain a sorting result; obtaining the direction information of each skeleton point according to the sorting result to obtain the direction information of the skeleton line.

[0235] In some embodiments of the present application, when the computer program is executed by the processor, the following steps are also implemented: if the number of endpoints of the skeleton line is not equal to 2 and the skeleton line includes an ending skeleton point, randomly select multiple starting skeleton points on the skeleton line; obtain path information between the starting skeleton point and the ending skeleton point based on the skeleton line; and obtain direction information of the skeleton line based on the path information.

[0236] In some embodiments of the present application, when the computer program is executed by the processor, the following steps are also implemented: generating initial flow direction information of each mesh vertex on the water surface mesh based on the direction information of the skeleton line; obtaining an obstacle model in the plot model, and determining the first mesh vertex in the water surface mesh according to the surface position information of the obstacle model; the first mesh vertex is the mesh vertex in the water surface mesh whose flow direction information is affected by the obstacle model; calculating the target flow direction information of the first mesh vertex based on the normal vector of the obstacle model and the initial flow direction information of the first mesh vertex; generating water flow direction information of the water surface mesh based on the target flow direction information of the first mesh vertex in the water surface mesh and the initial flow direction information of the second mesh vertex; the second mesh vertex is the mesh vertex in the water surface mesh other than the first mesh vertex.

[0237] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Any reference to memory, storage, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0238] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0239] The above is a detailed introduction to the rendering method, device, computer equipment and storage medium of a water flow area in a virtual scene provided in an embodiment of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for technical personnel in this field, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A method for rendering a water flow area in a virtual scene, characterized in that: include: Obtain the water flow area model corresponding to the water flow area in the land parcel model; Generating a water surface grid corresponding to the land parcel model according to the model edge points of the water flow area model; Acquire the direction information of the skeleton line of the water surface grid, and construct the water flow direction information of each grid vertex on the water surface grid according to the direction information of the skeleton line; Rendering the water surface of the water flow area based on the water surface mesh and the water flow direction information of the mesh vertices; The step of constructing the water flow direction information of each mesh vertex on the water surface mesh according to the direction information of the skeleton line includes: The skeleton line is taken as a model, each skeleton point on the skeleton line is taken as a model node, and the water surface grid is taken as another model, each mesh vertex on the water surface grid is taken as a model node, and the direction information on each skeleton point is passed as node attribute information to each mesh vertex on the water surface grid to determine the water flow direction information of each mesh vertex, wherein the direction information on the skeleton point is used to reflect the water flow direction information of the water flow area.

2. The method according to claim 1, characterized in that The step of obtaining the water flow area model corresponding to the water flow area in the land parcel model includes: Acquire a land parcel model and a map image corresponding to the land parcel model; Extracting an initial water flow layer of a water flow area in the map image; A water flow area model is extracted in the land parcel model based on the initial water flow layer.

3. The method according to claim 2, characterized in that The step of extracting the water flow area model in the land parcel model based on the initial water flow layer map comprises: Expanding the initial water flow layer based on the layer edge line of the initial water flow layer to obtain a target water flow layer; A water flow area model is extracted in the land parcel model based on the target water flow layer.

4. The method according to claim 1, characterized in that: The step of generating a water surface grid corresponding to the land mass model according to the model edge points of the water flow area model comprises: Smoothing the height information of the model edge points of the water flow area model to obtain target edge points; A water surface grid corresponding to the land parcel model is constructed based on the target edge points.

5. The method according to claim 1, characterized in that The plot model includes at least two plot sub-models; The step of generating a water surface grid corresponding to the land mass model according to the model edge points of the water flow area model comprises: For any plot sub-model, smoothing the model edge points of the water flow area model in the plot sub-model to obtain the target edge points of the water flow area model in the plot sub-model; Constructing a water surface sub-grid corresponding to the land parcel model based on the target edge points of the water flow area model in the land parcel sub-model; The water surface subgrids corresponding to the land parcel submodels are spliced ​​to obtain a water surface grid.

6. The method according to claim 5, characterized in that The step of splicing the water surface subgrids corresponding to the land parcel submodels to obtain a water surface grid comprises: Extracting the grid edge points of each of the water surface sub-grids and the projection coordinates of the grid edge points on a two-dimensional plane; Calculate the distance between any two grid edge points based on the projection coordinates of the grid edge points; The two grid edge points whose distance value is less than the preset distance threshold are merged to obtain the water surface grid.

7. The method according to claim 1, characterized in that The step of obtaining the direction information of the skeleton line of the water surface grid comprises: Obtain the number of endpoints of the skeleton line; If the number of endpoints of the skeleton line is equal to 2, or the number of endpoints of the skeleton line is not equal to 2 and there is no pre-selected end skeleton point on the skeleton line, sorting the skeleton points based on height information of each skeleton point in the skeleton line to obtain a sorting result; The direction information of each of the skeleton points is acquired according to the sorting result to obtain the direction information of the skeleton line.

8. The method according to claim 7, characterized in that After the step of obtaining the number of endpoints of the skeleton line, the method further includes: If the number of endpoints of the skeleton line is not equal to 2 and the skeleton line includes the end skeleton point, a plurality of start skeleton points are randomly selected on the skeleton line; Acquire path information between the starting skeleton point and the ending skeleton point based on the skeleton line; Direction information of the skeleton line is acquired based on the path information.

9. The method according to claim 1, characterized in that: The step of constructing the water flow direction information of each mesh vertex on the water surface mesh according to the direction information of the skeleton line comprises: Generating initial flow direction information of each mesh vertex on the water surface mesh based on the direction information of the skeleton line; Obtaining an obstacle model in the land model, and determining a first grid vertex in the water surface grid according to surface position information of the obstacle model; the first grid vertex is a grid vertex in the water surface grid whose flow direction information is affected by the obstacle model; Calculating target flow direction information of the first mesh vertex based on the normal vector of the obstacle model and the initial flow direction information of the first mesh vertex; Based on the target flow direction information of the first mesh vertex in the water surface mesh and the initial flow direction information of the second mesh vertex, the water flow direction information of the water surface mesh is generated; the second mesh vertex is the mesh vertex in the water surface mesh other than the first mesh vertex.

10. A device for rendering a water flow area in a virtual scene, characterized in that: The device comprises: A regional model acquisition module is used to obtain a water flow regional model corresponding to a water flow region in a land parcel model; A water surface mesh generation module, used to generate a water surface mesh corresponding to the land block model according to the model edge points of the water flow area model; A water flow direction acquisition module, used to acquire the direction information of the skeleton line of the water surface grid, and construct the water flow direction information of each grid vertex on the water surface grid according to the direction information of the skeleton line; A water surface model rendering module, used for rendering the water surface of the water flow area based on the water surface mesh and the water flow direction information of the mesh vertices; The step of constructing the water flow direction information of each mesh vertex on the water surface mesh according to the direction information of the skeleton line includes: The skeleton line is taken as a model, each skeleton point on the skeleton line is taken as a model node, and the water surface grid is taken as another model, each mesh vertex on the water surface grid is taken as a model node, and the direction information on each skeleton point is passed as node attribute information to each mesh vertex on the water surface grid to determine the water flow direction information of each mesh vertex, wherein the direction information on the skeleton point is used to reflect the water flow direction information of the water flow area.

11. A computing device, characterized in that: The computing device comprises: one or more processors; Memory; and One or more applications, wherein the one or more applications are stored in the memory and are configured to be executed by the processor to implement the method for rendering a water flow area in a virtual scene according to any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and the computer program is loaded by a processor to execute the steps in the method for rendering a water flow area in a virtual scene according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Model processing method, model processing device, electronic equipment and readable storage medium

    CN114255306A

  • System for providing real time ocean spatial data using web 3D

    KR101513591B1