A river scene generation method, generation device, electronic equipment and medium

CN122949112APending Publication Date: 2026-10-20ZHUHAI KEMU SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611347919.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-02
Publication Date
2026-10-20

AI Technical Summary

Technical Problem

然而,现有自动化方案在处理不同宽度规格的河流交叉时,无法自动适应交叉口处宽窄变化所带来的衔接需求,生成的交叉口区域普遍存在模型错位、接缝不匹配、视觉过渡生硬等问题

Benefits of technology

[0015]本申请实施例提供的河流场景生成方法、生成装置、电子设备及介质,获取经颜色标定的地形网格;将具有相同颜色且彼此连通的网格单元合并为一个类型块;提取每个类型块的二维直骨架路径,得到表征河流骨架走向的骨架线;对提取出的所有骨架线进行路径筛选与连接优化,以断开不同类型路径之间的不合理连接,并使不同规格的路径之间保持预设的间隔;在经优化的路径上生成等距分布的生成点,并为每个生成点计算沿路径方向的切线朝向;根据各生成点所在路径局部的连接关系进行分组,并依据切线朝向将对应生成点实例化为河流模型,以构成包含至少两种不同宽度规格河流交叉的河流场景。通过本申请,降低了手动摆放模型和反复调整交叉口衔接的工作量。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure FT_1
    Figure FT_1
  • Figure FT_2
    Figure FT_2
  • Figure FT_3
    Figure FT_3
Patent Text Reader

Abstract

This application provides a method, apparatus, electronic device, and medium for generating river scenes, including: acquiring a color-coded terrain mesh; merging interconnected mesh cells of the same color into a type block; extracting the two-dimensional straight skeleton path of each type block to obtain skeleton lines representing the direction of the river skeleton; performing path filtering and connection optimization on all extracted skeleton lines to break unreasonable connections between different types of paths and maintain a preset interval between paths of different specifications; generating equidistantly distributed generation points on the optimized paths and calculating the tangent orientation along the path direction for each generation point; grouping the generation points according to the local connection relationships of the paths where each generation point is located, and instantiating the corresponding generation points into river models according to the tangent orientation to construct a river scene containing at least two different width specifications of intersecting rivers. This application reduces the workload of manually placing models and repeatedly adjusting intersection connections.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and more specifically, to a method, apparatus, electronic device, and medium for generating river scenes. Background Technology

[0002] Currently, in game scene creation, the placement of terrain assets such as rivers is traditionally done manually by artists. River models are placed segment by segment in the scene, and connections to complex structures such as intersections are achieved through manual adjustments. When level design changes or river courses or intersection layouts need to be repeatedly modified, artists must readjust the position and orientation of each model, resulting in a large workload, long processing time, and severely slowing down project iteration efficiency.

[0003] To address these issues, the industry has attempted to use automation to assist in the construction of river scenes. However, existing automated solutions cannot automatically adapt to the connection requirements caused by changes in river width at intersections when handling river intersections of varying widths. The generated intersection areas generally suffer from model misalignment, mismatched seams, and abrupt visual transitions. These problems still require manual inspection and repair, failing to effectively reduce the repeated adjustment costs of intersection connections and hindering the realization of fully automated river scene generation. Summary of the Invention

[0004] In view of this, the purpose of this application is to provide a method, apparatus, electronic device and medium for generating river scenes, so as to overcome at least one of the above-mentioned defects.

[0005] In a first aspect, embodiments of this application provide a method for generating a river scene. The method includes: acquiring a color-coded terrain grid, wherein different colors are used to identify different transverse width specifications of the river, and the terrain grid is composed of multiple grid cells; classifying the grid cells in the terrain grid according to color attributes, and merging grid cells with the same color and interconnected into a type block; extracting a two-dimensional straight skeleton path for each type block to obtain a skeleton line representing the direction of the river skeleton; and performing path filtering and connection optimization on all extracted skeleton lines to disconnect unreasonable connections between different types of paths and to make different specifications... The paths of the grid maintain a preset interval; equidistantly distributed generation points are generated on the optimized path, and the tangent orientation along the path direction is calculated for each generation point; the generation points are grouped according to the local connection relationship of the path where each generation point is located, and the corresponding generation points are instantiated into river models according to the tangent orientation to form a river scene containing at least two different width specifications of river intersections; wherein, the generation points at straight connection points are instantiated into straight river models, the generation points at same type intersections are instantiated into intersection models of uniform specifications, and the generation points at non-standard intersections are instantiated into connection models with two end interfaces adapted to different river lateral width specifications.

[0006] In one optional embodiment of this application, the path filtering and connection optimization includes: filtering path segments that conform to the width specifications corresponding to their respective river types from the skeleton lines; splitting each path segment into sub-segments by nodes, detecting the type attributes of the nodes at both ends of each sub-segment, and deleting the sub-segment if the types at both ends are inconsistent, and shifting the two sub-segments adjacent to the deleted sub-segment along the path direction toward the center point of the deleted sub-segment by half the length of the deleted sub-segment, and then reconnecting the shifted sub-segments; reconstructing the continuous sub-segments of the same type after the above processing into a complete path, detecting the structural nodes in the reconstructed path, and deleting sub-segments that simultaneously meet the following conditions: located within the narrow path range, associated with the wide path, and with a sub-segment length less than a preset threshold.

[0007] In one optional embodiment of this application, generating equidistantly distributed generation points on the optimized path and calculating the tangent orientation along the path direction for each generation point includes: performing linear interpolation subdivision along the optimized path at fixed intervals to obtain uniformly distributed generation points; and calculating a secondary tangent vector for each generation point as the initial tangent orientation using polygon frame nodes.

[0008] In one optional embodiment of this application, the step of calculating the tangent orientation along the path direction for each generated point further includes: stretching the optimized path vertically to form a planar patch, and calculating the curvature of the planar patch; passing the curvature back to the generated points on the optimized path through an attribute transfer method; and adjusting the initial tangent orientation according to the sign of the curvature, wherein the generated points at convex corners maintain the tangent orientation unchanged, and the generated points at concave corners have their tangent orientation reversed.

[0009] In one optional embodiment of this application, the grouping based on the local connection relationship of the path where each generation point is located includes: dividing the generation points into straight line segment points, three-way intersection points of the same type, three-way intersection points of different types, and corner points based on the connection relationship between the quadtree hierarchy and path nodes used when classifying the type blocks; wherein, the three-way intersection points of the same type are three-way intersections where all three connecting edges are of the same river width specification, the three-way intersection points of different types are three-way intersections where the three connecting edges contain different river width specifications, and the corner points are generation points at the corner of the path that are not three-way intersections.

[0010] In one optional embodiment of this application, the corresponding generated point is instantiated into a river model according to the tangent orientation in the following manner: a straight river model is instantiated for a straight segment point, a three-way intersection model of the same type is instantiated for a three-way intersection model of the same specification, a three-way intersection model of different types is instantiated for a three-way intersection model of mixed specifications, and a corner model is instantiated for a corner point; wherein, the placement orientation of the straight river model, the three-way intersection model of the same specification, the three-way intersection model of the mixed specifications, and the corner model is determined by the tangent orientation of the corresponding generated point.

[0011] In one optional embodiment of this application, the terrain grid is a quadrilateral grid array, and the lateral width of the river is an integer multiple of the side length of the grid cell.

[0012] Secondly, this application also provides a river scene generation device, the device comprising: a terrain mesh acquisition module, used to acquire a color-coded terrain mesh, wherein different colors are used to identify different river lateral width specifications, and the terrain mesh is composed of multiple mesh units; a type block merging module, used to classify the mesh units in the terrain mesh according to color attributes, and merge mesh units with the same color and interconnected into a type block; a skeleton line obtaining module, used to extract the two-dimensional straight skeleton path of each type block to obtain a skeleton line representing the direction of the river skeleton; and a skeleton line processing module, used to perform path filtering and connection optimization on all extracted skeleton lines to disconnect the paths of different types. The system connects paths of different specifications reasonably, maintaining a preset interval between them; a tangent orientation calculation module generates equidistantly distributed generation points on the optimized path and calculates the tangent orientation along the path direction for each generation point; a river scene composition module groups the generation points according to the local connection relationships of the paths where they are located, and instantiates the corresponding generation points into river models based on the tangent orientation to form a river scene containing at least two different width specifications of river intersections; wherein, the generation points at straight connection points are instantiated into straight river models, the generation points at same-type intersections are instantiated into intersection models of uniform specifications, and the generation points at non-standard intersections are instantiated into connection models with interfaces at both ends adapted to different river lateral width specifications.

[0013] Thirdly, embodiments of this application also provide an electronic device, including: a processor, a memory, and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the memory via the bus, and when the machine-readable instructions are executed by the processor, the steps of the method described above are performed.

[0014] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a computer program that, when executed by a processor, performs the steps of the method described above.

[0015] The river scene generation method, generation device, electronic device, and medium provided in this application embodiment acquire a color-coded terrain mesh; merge mesh cells of the same color that are interconnected into a type block; extract the two-dimensional straight skeleton path of each type block to obtain skeleton lines representing the direction of the river skeleton; perform path filtering and connection optimization on all extracted skeleton lines to disconnect unreasonable connections between different types of paths and maintain a preset interval between paths of different specifications; generate equidistantly distributed generation points on the optimized paths, and calculate the tangent orientation along the path direction for each generation point; group the generation points according to the local connection relationship of the paths where each generation point is located, and instantiate the corresponding generation points into river models according to the tangent orientation to form a river scene containing at least two different width specifications of intersecting rivers. This application reduces the workload of manually placing models and repeatedly adjusting intersection connections.

[0016] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0017] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 A flowchart of the river scene generation method provided in the embodiments of this application; Figure 2 This is one of the schematic diagrams illustrating terrain grid color selection provided in the embodiments of this application; Figure 3 This is a second schematic diagram illustrating the terrain grid color selection provided in the embodiments of this application; Figure 4 This is a schematic diagram of the imported terrain grid provided in the embodiments of this application; Figure 5 This is a schematic diagram of the river grid generation path provided in an embodiment of this application; Figure 6 The flowchart for path filtering and connection optimization provided in this application embodiment; Figure 7This is a schematic diagram of a river structure node provided in an embodiment of this application; Figure 8 A flowchart for calculating the tangent orientation along the path direction for each generated point, provided as an embodiment of this application; Figure 9A This is one of the schematic diagrams illustrating the path subdivision parameter control provided in the embodiments of this application; Figure 9B This is a second schematic diagram illustrating the path subdivision parameter control provided in an embodiment of this application. Figure 9C This is the third schematic diagram illustrating the path subdivision parameter control provided in the embodiments of this application; Figure 10A This is one of the schematic diagrams illustrating tangent generation and direction adjustment provided in the embodiments of this application; Figure 10B This is a second schematic diagram illustrating tangent generation and direction adjustment provided in an embodiment of this application. Figure 11A One of the schematic diagrams for instantiating and generating groups provided in the embodiments of this application; Figure 11B This is a second schematic diagram illustrating the instantiation and generation of groups provided in an embodiment of this application; Figure 11C This is the third schematic diagram illustrating the instantiation and generation of groups provided in the embodiments of this application; Figure 12A One of the schematic diagrams illustrating the effect of the mixing and intersecting of wide and narrow rivers provided in the embodiments of this application; Figure 12B This is the second schematic diagram illustrating the effect of the mixing and intersecting of wide and narrow rivers as provided in the embodiments of this application. Figure 12C This is a schematic diagram illustrating the effect of a river intersection of the same type as provided in an embodiment of this application; Figure 12D This is a schematic diagram illustrating the connection effect of a mixed wide and narrow river intersection provided in an embodiment of this application; Figure 12E This is a schematic diagram illustrating the overall generation effect of the complete river scene provided in the embodiments of this application; Figure 13 This is a schematic diagram of the structure of the river scene generation device provided in the embodiments of this application; Figure 14 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0019] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of this application. Based on the embodiments of this application, every other embodiment obtained by those skilled in the art without inventive effort falls within the scope of protection of this application.

[0020] First, the applicable scenarios for this application will be introduced. This application can be applied to the field of computer technology.

[0021] Research has revealed that existing procedural river generation schemes struggle to automatically identify intersection types and accurately match corresponding connection models when dealing with river intersections of varying widths. When rivers of different widths converge, the generated intersections often exhibit problems such as model misalignment, mismatched seams, or abrupt visual transitions. These anomalies still require manual troubleshooting and repair by artists, significantly reducing the automation level of procedural generation and failing to fundamentally solve the time and manpower consumption associated with repeatedly adjusting intersection connections.

[0022] Based on this, embodiments of this application provide a method, apparatus, electronic device, and medium for generating river scenes, to at least solve the aforementioned technical problem of automatic intersection matching. This method, through color attribute-driven terrain meshes, path filtering and connection optimization, and grouping instantiation based on connection relationships, automatically generates a complete river scene with intersections of varying widths from an artist-drawn colored mesh with a single click, reducing the workload of manually placing models and repeatedly adjusting intersection connections.

[0023] Please see Figure 1 , Figure 1 This is a flowchart illustrating the river scene generation method provided in an embodiment of this application. Figure 1 As shown in the embodiments of this application, the river scene generation method includes: S101. Obtain the color-coded terrain grid.

[0024] Different colors are used to indicate different river width specifications, and the terrain grid is composed of multiple grid cells.

[0025] In this embodiment, the terrain grid is a quadrilateral grid array, and the lateral width of the river is an integer multiple of the side length of the grid cell.

[0026] The creation of this terrain mesh follows these standardized specifications: a fixed conversion ratio is established between the mesh unit and the world coordinate system scale, for example, 1 mesh unit corresponds to 1 world unit, 10 world units, or 100 world units. This conversion ratio needs to be determined in conjunction with the overall proportion of the project's art assets and should be documented in the project's technical specification document. All subsequent related tools must adhere to this standard. Based on the rendering and collision detection accuracy requirements of the 3D engine, the mesh can be subdivided and adjusted. After subdivision, each individual sub-mesh unit must still adhere to the aforementioned basic unit specifications. By standardizing the scale, accurate asset integration and seamless scene transitions are ensured during data transfer between different tools.

[0027] Create a basic terrain mesh in the 3D editor, consisting of multiple mesh units. This mesh is generated by default as a square array with a row and column spacing of 1 basic unit, and the vertices are aligned with the origin of the world coordinate system. Predefine the correspondence between colors and the horizontal width of rivers. For example, red corresponds to a river with a horizontal width of 5 mesh units, green corresponds to a river with a horizontal width of 3 mesh units, yellow corresponds to a city river with a horizontal width of 5 mesh units, and cyan corresponds to a village river with a horizontal width of 3 mesh units, etc. This correspondence can be uniformly set according to project requirements and documented.

[0028] Using the selection box or point selection function provided by the editor, artists can select one or more continuous mesh cells and apply the corresponding color with one click. The color is rendered on the mesh surface in real time for visual verification. At the same time, the color information is written into the vertex attributes of the mesh to ensure that the color attribute of each mesh cell corresponds one-to-one with the vertex.

[0029] Specifically, please refer to Figure 2 as well as Figure 3 , Figure 2 This is one of the schematic diagrams illustrating terrain grid color selection provided in the embodiments of this application. Figure 3 This is a second schematic diagram illustrating the terrain grid color selection provided in the embodiments of this application, as shown below. Figure 2 as well as Figure 3 As shown, the terrain grid consists of multiple square grid cells arranged in a grid. Different grid cells are displayed in different colors according to their designated type. The red area represents the set of grid cells designated as rivers with a horizontal width of 5 grid units (i.e., "Type 5 Rivers"); the yellow area represents the set of grid cells designated as urban rivers with a horizontal width of 5 grid units (i.e., "Type 5 Urban Rivers"); and the green area represents the set of grid cells designated as rivers with a horizontal width of 3 grid units (i.e., "Type 3 Rivers"). The figure also shows some undesignated grid cells (maintaining their default color) for artists to designate later. Figure 2 and Figure 3The diagram illustrates the color distribution of terrain grids under different calibration layouts. Furthermore, the color-type correspondence in this application also includes cyan corresponding to villages with a horizontal width of 3 grid units, which are not shown in the diagram. In practical applications, the corresponding grid units can be calibrated according to project requirements.

[0030] After color calibration is completed, the mesh assets are exported as geometry exchange files containing vertex color attributes, which serve as standardized input for subsequent procedural processing.

[0031] S102. Classify the grid cells in the terrain grid according to the color attribute, and merge grid cells with the same color and connected to each other into a type block.

[0032] After importing the terrain mesh asset with vertex color attributes, convert it into an editable geometry format.

[0033] Specifically, please refer to Figure 4 , Figure 4 This is a schematic diagram showing the imported terrain mesh provided in an embodiment of this application. Figure 4 As shown, the terrain mesh is displayed in a shaded mode in the 3D viewport. This mesh consists of multiple quadrilateral mesh cells, each with vertices carrying color attributes calibrated in step S101. The viewport displays a color distribution corresponding to the calibrated colors, with different colors distinguishing different mesh types. Users can switch the mesh display mode using display switching controls (e.g., a wireframe / shaded switch button) in the viewport interface: in wireframe mode, the mesh's topology and vertex distribution can be viewed; in shaded mode, the distribution of vertex colors in each mesh cell can be viewed. This visualization allows operators to intuitively verify the completeness of input data, the accuracy of color attribute preservation, and the non-destructive nature of the mesh topology before procedural processing.

[0034] It reads the vertex color attribute of each grid cell. Based on the preset color-type correspondence rule, it assigns a type identifier to each grid cell. For example, red corresponds to type identifier 51, yellow corresponds to type identifier 52, green corresponds to type identifier 31, and cyan corresponds to type identifier 32. Different numbers are used to distinguish the horizontal width specification of the river and the asset category.

[0035] A quadtree data structure is used to spatially partition the classified grid cells. The quadtree partitioning is independent of grid resolution; instead, it determines the required level depth based on the data type and data variant structure to be processed. The quadtree serves two functions here: firstly, it accelerates spatial retrieval by quickly locating and filtering the classified grid cells; secondly, it assists in path generation by merging adjacent grid cells of the same type based on the quadtree, providing a spatial organization foundation for path extraction of subsequent type blocks.

[0036] The entire grid array is subdivided layer by layer according to a quadtree structure, so that grid cells with the same type identifier and that are adjacent and connected to each other are organized into the same type block, which is the basic unit for subsequent path extraction. The level depth of the quadtree can be adjusted according to the complexity of the scene and the requirements of retrieval efficiency. After classification is completed, the accuracy of the classification results can be checked by color visualization.

[0037] S103. Extract the two-dimensional straight skeleton path of each type block to obtain the skeleton line representing the direction of the river skeleton.

[0038] For each type block composed of the same type of mesh units, this step uses the 2D straight skeleton node built into the 3D software. This method was chosen because it accurately preserves the outline features and connectivity of the type block, avoiding path offsets or breakpoints caused by irregular block shapes, and is suitable for path generation requirements of linear or regional assets such as rivers and villages. The 2D straight skeleton algorithm is then applied to convert it into 2D path lines. During the conversion, the skeleton offset is set to 0.5 mesh units to ensure the extracted path is centered on the type block. A rounded corner processing mode is used with a radius of 0.2 mesh units to avoid sharp turns at path corners. Path simplification is also enabled simultaneously, with a simplification threshold set to 0.1 mesh units to remove redundant vertices on the path, ensuring smooth skeleton lines and reducing the computational load of subsequent processing.

[0039] Please see Figure 5 , Figure 5 This is a schematic diagram of the river grid generation path provided in an embodiment of this application. Figure 5 As shown, the 3D viewport simultaneously displays the mesh cells classified in step S102 and the path lines extracted by the 2D straight skeleton algorithm. Continuous mesh cells with the same grayscale or color constitute a type block. Different types of mesh blocks are distinguished by different grayscales or colors; for example, dark areas represent river type blocks with a horizontal width of 5 mesh units, and light areas represent river type blocks with a horizontal width of 3 mesh units. The path lines (shown as highlighted lines in the figure) are located in the central area of ​​each type block. The extension direction of the path is consistent with the overall direction of the type block. The corners of the path are rounded to create a smooth transition, and there are no redundant vertices on the path line. The path lines of different type blocks are independent and do not overlap. The path lines within the same type block are continuous and without breaks, indicating that the 2D straight skeleton conversion successfully transforms the type blocks into skeleton paths that can be processed in subsequent steps (path filtering and connection optimization).

[0040] After the conversion is complete, check the continuity and integrity of each skeleton line one by one to confirm that there are no breaks or intersections in the paths of the same type of block, and that the paths of different types of blocks do not overlap. If any abnormality occurs, you can go back to adjust the continuity of the type of block or correct the conversion parameters.

[0041] S104. Perform path filtering and connection optimization on all extracted skeleton lines to disconnect unreasonable connections between different types of paths and maintain a preset interval between paths of different specifications.

[0042] The path selection and connection optimization process comprises three stages: The first stage is specification filtering, which selects path segments that meet the width requirements based on the lateral width specifications corresponding to the river type; the second stage is type consistency detection and displacement reconnection, which splits the path segments by nodes and checks the type attributes at both ends, performing deletion, displacement, and reconnection operations on segments with inconsistent types; the third stage is redundant segment cleanup, which reconstructs continuous segments of the same type into complete paths after processing, and detects and deletes segments that simultaneously meet the conditions of being located within a narrow path, having a connection with a wide path, and having a length less than a preset threshold. For detailed implementation methods of the above three stages, please refer to the following steps.

[0043] Please refer to Figure 6 , Figure 6 This is a flowchart illustrating path filtering and connection optimization provided in an embodiment of this application. Figure 6 As shown, path filtering and connection optimization are performed in the following ways: S201. Select path segments from the skeleton lines that meet the width specifications corresponding to their respective river types.

[0044] In the preceding steps, each type block has been assigned a type identifier, which also contains the lateral width specification information of the river. For example, type identifier 51 corresponds to a river with a lateral width of 5 grid units, and type identifier 31 corresponds to a river with a lateral width of 3 grid units. Based on this type identifier, specification filtering is performed on all skeleton lines, and the river width corresponding to each skeleton line is detected segment by segment. Path segments whose path width does not conform to the preset specification are removed.

[0045] For skeleton lines with type identifiers of 51 or 52, only path segments with a width of 5 grid units are retained, and redundant parts with width deviations are discarded. For skeleton lines with type identifiers of 31 or 32, only path segments with a width of 3 grid units are retained. During filtering, the continuity of the path is checked simultaneously. If a path segment is broken due to partial rejection caused by local width fluctuations, that broken section is treated as the target for subsequent connection optimization. After specification filtering, each skeleton line contains only path segments that strictly match its river type, eliminating mixed paths caused by ambiguous type determination or gradual width changes in boundary regions. This provides standardized input data for subsequent sub-segment splitting and type consistency checks.

[0046] S202. Divide each path segment into sub-segments by nodes, check the type attributes of the nodes at both ends of each sub-segment, if the types at both ends are inconsistent, delete the sub-segment, and shift the two sub-segments adjacent to the deleted sub-segment along the path direction toward the center point of the deleted sub-segment by half the length of the deleted sub-segment, and then reconnect the shifted sub-segments.

[0047] Path nodes include corner points and connection points. Corner points are locations where the path deviates significantly, and connection points are intersections between different path segments. Along the path's extension direction, the portion between adjacent nodes is divided into independent sub-segments, with each sub-segment having a node at each end. After division, the type attributes associated with the nodes at both ends of each sub-segment are read. These attributes originate from the type identifier assigned to the grid cell to which the node belongs in the previous classification step. When one end of a sub-segment has a node type of a wide river (e.g., 5 grid units) and the other end has a node type of a narrow river (e.g., 3 grid units), it indicates that the sub-segment crosses two different river regions and is considered an unreasonable connection that should be removed.

[0048] After deleting a segment, a blank space appears in its original position, the span of which is equal to the length of the deleted segment. To fill the blank space and restore the connection between adjacent segments, half the length of the deleted segment is calculated as the displacement. The segment located at one end of the blank space and originally adjacent to the deleted segment is displaced by this displacement along the path direction towards the center point of the deleted segment. Similarly, the segment located at the other end of the blank space and originally adjacent to the deleted segment is displaced by the same displacement along the path direction towards the center point of the deleted segment.

[0049] After the aforementioned displacement, the originally separate endpoints of two adjacent sub-segments approach and overlap each other. Then, these two sub-segments are reconnected at this overlapping position, completing the closure of the connection point. This displacement and reconnection method automatically creates a preset positional interval between different types of paths. The size of this interval corresponds to the space originally occupied by the deleted sub-segment, preventing overlap or excessive fitting between different types of paths and providing spatial conditions for the independent instantiation of different types of rivers in the future.

[0050] On curved paths, to ensure smooth connections between adjacent segments after displacement, the u-value weight of the segment breakpoint can be sampled from its original position onto the corresponding line segment. By controlling the u-value weight, the corresponding spatial position on the line segment is obtained and assigned to the breakpoint, allowing the breakpoint to smoothly displace along the line segment, with the displacement range not exceeding the length of the line segment. When deleting multiple segments, they can be deleted simultaneously in parallel according to the built-in algorithm structure of the 3D software, or they can be deleted sequentially as needed.

[0051] S203. Reconstruct the continuous sub-segments of the same type after the above processing into a complete path, detect the structural nodes in the reconstructed path, and delete the sub-segments that meet the following conditions: located within the narrow path, associated with the wide path, and with a sub-segment length less than a preset threshold.

[0052] After the deletion and reconnection process in S202, the path may be divided into multiple discontinuous segments. These segments, belonging to the same type and whose endpoints are reconnected and adjacent, need to be merged and reassembled in the order they occur along the path direction to form a complete and continuous path. During reconstruction, the tangent directions of adjacent segments at the connection points are checked for consistency. If angular deviations exist, interpolation is used to smooth the transition, ensuring a smooth reconstructed path.

[0053] On the reconstructed path, locate all structural nodes one by one, including corner points and connection points between different paths.

[0054] Please see Figure 7 , Figure 7 This is a schematic diagram of a river structure node provided in an embodiment of this application. Figure 7 As shown, the 3D viewport displays the complete path line obtained after path reconstruction, with multiple structural nodes of different types labeled on the path line. Among them, corner nodes (marked with circles in the figure) are located at the points where the path deviates, reflecting changes in path direction; connecting nodes between different path segments (marked with diamonds in the figure) are located at the intersections of multiple path segments, reflecting the topological connections of the path. The figure also exemplarily shows the locations of structural nodes within the narrow path that are associated with the wide path (e.g., Figure 7 Nodes highlighted or marked with a specific color are identified as redundant subpaths to be deleted if their subpaths simultaneously meet the condition that their length is less than a preset threshold. This diagram provides a clear understanding of the different types of structural nodes and their criteria for selection during path optimization.

[0055] Centered on each structural node, detect the sub-segment it belongs to. Filter out sub-segments that simultaneously meet the following three conditions and delete them: The sub-segment is located within the narrow path range, meaning its type attribute corresponds to a small river lateral width specification, such as 3 grid units; the sub-segment is associated with a wide path, determined by the distance between the structural node on the sub-segment and the path segment of the wide path not exceeding 1 grid unit, or the structural node is directly connected to the wide path; the length of the sub-segment is less than a preset threshold, which is determined by converting the actual length based on the grid units set in the project. After deleting the above redundant sub-segments, if a path break occurs at the original location, perform center point displacement and reconnection operations as described in S202 on the adjacent sub-segments on both sides of the break to restore path continuity. Such redundant segments typically appear at the edge of the intersection of narrow and wide rivers. Because they are too short to independently support the instantiation of a complete river model, keeping them would cause visually unnatural connections or model overlap. Deleting them makes the path layout in the intersection area more regular and clear, and maintains a reasonable positional interval between narrow and wide paths, providing a standardized path structure for the subsequent grouping of generated points and the instantiation of corresponding models.

[0056] S105. Generate equidistantly distributed generation points on the optimized path, and calculate the tangent orientation along the path direction for each generation point.

[0057] This step comprises two stages: point generation and initial tangent calculation, and tangent orientation adjustment based on curvature. The first stage generates uniformly distributed points along the optimized path and calculates a secondary tangent vector for each point as the initial tangent orientation. Specific generation methods and initial tangent orientation calculation methods are detailed in subsequent steps. The second stage, to adapt to path curvature, stretches the path lines vertically along the world coordinate system to form planar patches, calculates the curvature of these patches, and then assigns the curvature values ​​back to the generated points on the path using an attribute transfer method.

[0058] The initial tangent orientation is adjusted based on the sign of the curvature: for generation points at convex corners with positive curvature, the tangent orientation remains unchanged; for generation points at concave corners with negative curvature, the tangent orientation is reversed; for straight segments with zero curvature, the tangent orientation remains unchanged. After this adjustment, each generation point obtains a final tangent orientation that matches the path curvature direction.

[0059] Specifically, please refer to Figure 8 , Figure 8 This is a flowchart illustrating the calculation of the tangent orientation along the path direction for each generated point, provided as an embodiment of this application. For example... Figure 8 As shown, the tangent orientation along the path direction is calculated for each generated point in the following manner: S301. Perform linear interpolation subdivision along the optimized path at fixed intervals to obtain uniformly distributed generation points.

[0060] The optimized path's structural nodes serve as the subdivision benchmark, including corner points and connection points. Each path is subdivided into segments at preset intervals, with a default interval of 2 grid units. This parameter can be adjusted based on the actual size of the river asset model. Within each subdivision interval, linear interpolation with a step size of 1 grid unit is performed, based on the unit length converted from the actual asset size, to generate uniformly distributed asset generation points along the path segment by segment. The distance error between adjacent generated points is controlled within 0.1 grid units to ensure the uniformity of model layout during subsequent asset instantiation. Each generated point automatically inherits the type attribute of its corresponding path segment during generation, allowing subsequent steps to group points according to type.

[0061] For further details, please refer to Figure 9A , Figure 9B and Figure 9C , Figure 9A This is one of the schematic diagrams illustrating the path subdivision parameter control provided in the embodiments of this application; Figure 9B This is a second schematic diagram illustrating the path subdivision parameter control provided in an embodiment of this application. Figure 9C This is the third schematic diagram of the path subdivision parameter control provided in the embodiments of this application.

[0062] like Figure 9A As shown, the 3D viewport displays the path line of a wide river (e.g., a river type with a horizontal width of 5 grid units) after path filtering and connection optimization, along with the evenly distributed generated points on it. The subdivision spacing between adjacent generated points is relatively large, for example, the default spacing is 2 grid units, and the generated points are arranged equidistantly along the path direction.

[0063] like Figure 9B As shown, the 3D viewport displays the path of a narrow river (e.g., a river type with a horizontal width of 3 grid units) and its evenly distributed generation points. The subdivision spacing between adjacent generation points corresponds to the actual size of the asset and can be independently adjusted according to the model size of different types of rivers. Different river types can have different subdivision step size parameters.

[0064] like Figure 9C As shown, the 3D viewport displays the distribution of generated points at structural nodes (including corners and connectors) along the path. Structural nodes are automatically used as subdivision reference points, ensuring that key locations along the path are marked as asset generation points, preventing model misalignment at corners or connectors due to excessively large interpolation spans. The figures illustrate the differences in the layout of generated points along the path under different subdivision parameter settings. These subdivision parameters can be uniformly adjusted according to the grid units and world coordinate system conversion ratio set in the early stages of the project.

[0065] S302. Calculate the secondary tangent vector for each generated point using the polygon frame nodes, as the initial tangent orientation.

[0066] The path with generation points generated by S301 is input into the polygon frame node. This node can identify the extension direction of the path and calculate the tangent direction at each generation point. The node uses the secondary tangent mode, which calculates a secondary tangent vector perpendicular to the tangent direction of the path at that point, lying within the path plane, and accurately representing the local extension direction of the path. The coordinate system is set to the world coordinate system, consistent with the 3D engine's coordinate system, to avoid orientation deviations during subsequent model instantiation. The precision mode is set to high precision, ensuring that the calculated tangent direction error is no greater than 0.01 radians. After calculation, each generation point obtains a secondary tangent vector, which is stored as the initial tangent orientation in the generation point's attributes, providing basic orientation data for subsequent curvature adjustment and orientation control during model instantiation.

[0067] Please see Figure 10A and Figure 10B , Figure 10A This is one of the schematic diagrams illustrating tangent generation and direction adjustment provided in the embodiments of this application; Figure 10B This is a second schematic diagram illustrating tangent generation and direction adjustment provided in an embodiment of this application.

[0068] like Figure 10A As shown, the 3D viewport displays the path lines and the generated points along the path. Each generated point carries a secondary tangent vector calculated from the polygon frame nodes (indicated by arrows in the figure). This secondary tangent vector is distributed along the path's extension direction, indicating the local orientation of the path at the corresponding location. The figure exemplifies the distribution of tangent directions at different generated points on straight path segments and corner paths. The secondary tangent directions on straight segments consistently point towards the path's extension direction, while the secondary tangent directions at corners deviate from the path's orientation.

[0069] like Figure 10B As shown, the 3D viewport displays the final tangent orientation after curvature adjustment. The generated points at convex corners retain their original secondary tangent orientation (arrows point in the path's extension direction), while the secondary tangent orientations of the generated points at concave corners are reversed (arrows are flipped 180 degrees). Different colored or styled arrows distinguish the differences in tangent orientation before and after adjustment. This adjustment ensures that the tangent orientation of each generated point on the path matches the path's curvature direction, guaranteeing that the orientation of the subsequently instantiated river model aligns with the path's direction.

[0070] In an optional embodiment of this application, calculating the tangent orientation along the path direction for each generated point further includes: The optimized path is stretched vertically to form a planar patch, and the curvature of the planar patch is calculated. The curvature is then passed back to the generation point on the optimized path using an attribute transfer method. The initial tangent orientation is adjusted according to the sign of the curvature, where the generation point at the convex corner retains the tangent orientation, while the generation point at the concave corner has its tangent orientation reversed.

[0071] Here, the vertical direction refers to the upward axis in the world coordinate system. After stretching, the path is transformed from a one-dimensional line into a two-dimensional patch. The geometry of the patch contains the concavity and convexity information caused by the path's curvature. The curvature of this planar patch is calculated using curvature calculation nodes to obtain the curvature values ​​at various points on the patch surface. The sign of the curvature value is determined by the corner direction: a positive curvature value at a clockwise corner corresponds to a convex corner, and a negative curvature value at a counterclockwise corner corresponds to a concave corner. The absolute value of the curvature reflects the steepness of the corner.

[0072] When passing attributes, matching is performed based on spatial location. The curvature value of the sampling point on the patch that is closest to the generation point is written into the attribute of the generation point, so that each generation point obtains the accurate curvature data of its path position.

[0073] For convex corners with positive curvature, the initial tangent orientation is already aligned with the path's curvature direction, and this orientation is maintained. For concave corners with negative curvature, the initial tangent orientation is opposite to the path's curvature direction; this orientation is reversed by multiplying it by negative one, causing it to align with the outer extension direction of the concave corner. For straight segments with zero curvature, the tangent orientation remains unchanged, preserving the initial calculation result. After this adjustment, the tangent orientation of each generated point matches the local curvature direction of the path, ensuring that the subsequently instantiated river model correctly conforms to the path's direction at both convex and concave corners.

[0074] S106. Group the generated points according to the local connectivity of the paths where each point is located, and instantiate the corresponding generated points into river models according to the orientation of the tangent, so as to form a river scene containing at least two different width specifications of intersecting rivers.

[0075] Grouping is performed based on the local connectivity of the path where each generation point is located, including: based on the quadtree hierarchy and path node connectivity used when classifying the type of block, the generation points are divided into straight line segments, three-way intersections of the same type, three-way intersections of different types, and corner points; wherein, the three-way intersections of the same type are three-way intersections where all three connecting edges are of the same river width, the three-way intersections of different types are three-way intersections where the three connecting edges contain different river widths, and the corner points are generation points at path corners that are not three-way intersections.

[0076] The quadtree hierarchy information originates from the quadtree data structure established during the spatial partitioning of grid cells in the preceding steps. This data structure records the spatial adjacency and hierarchical relationships between different types of blocks, while the connection relationships of path nodes describe the topological structure of the path at forks and intersections. Straight line segments are located on straight lines without corners or connection points along the path, and these points are evenly distributed along the path direction. For example, three connecting edges of the same type correspond to a river with a horizontal width of 5 grid units; for example, two connecting edges correspond to a river with a horizontal width of 5 grid units, and one connecting edge corresponds to a river with a horizontal width of 3 grid units.

[0077] Please see Figure 11A , Figure 11B and Figure 11C , Figure 11A One of the schematic diagrams for instantiating and generating groups provided in the embodiments of this application; Figure 11B This is a second schematic diagram illustrating the instantiation and generation of groups provided in an embodiment of this application; Figure 11C This is the third schematic diagram of instantiating and generating groups provided in the embodiments of this application.

[0078] like Figure 11A As shown, the 3D viewport displays generated points divided into groups of straight lines. These generated points are located on straight segments of the path without corners or connection points. The generated points are evenly distributed along the path direction and are instantiated as straight river models (shown as rectangular strip models in the figure, with the model orientation aligned with the tangent direction).

[0079] like Figure 11B As shown, the 3D viewport displays generated points divided into corner groups. These generated points are located at the corners of the path (non-T-shaped connections) and are instantiated as corner models (shown as L-shaped or arc-shaped models in the figure). The bending angle of the model is consistent with the corner angle of the path, and the model orientation is aligned with the tangent direction at the corner.

[0080] like Figure 11C As shown, the 3D viewport displays generated points divided into intersection groups. These generated points are located at the T-shaped connection nodes of the path and are instantiated as three-way intersection models. Intersections with three connecting edges of the same type are instantiated as uniform-sized three-way intersection models, while intersections with three connecting edges containing different types (e.g., a mix of wide and narrow) are instantiated as mixed-sized three-way intersection models. The width of each interface in the mixed-sized three-way intersection model is adapted to the lateral width of the river on the corresponding connecting edge. The orientation of the instantiated models in each figure is determined by the tangent orientation of the corresponding generated point, aligning the model's extension direction with the path's direction.

[0081] The corresponding generated points are instantiated into river models based on the tangent orientation in the following ways: straight river models are instantiated for straight line segments, three-way intersection models of the same type are instantiated for intersections of the same specification, three-way intersection models of different types are instantiated for intersections of different specifications, and corner models are instantiated for corner points; wherein, the orientation of the straight river models, three-way intersection models of the same specification, three-way intersection models of the same specification, and corner models is determined by the tangent orientation of the corresponding generated points.

[0082] In practice, all grouped generation points are traversed, and the corresponding model is selected from the model library according to the group category: straight line segments are instantiated into straight river models, three-way intersections of the same type are instantiated into three-way intersection models of uniform specifications, three-way intersections of different types are instantiated into three-way intersection models of mixed specifications, and the width of each interface of the model corresponds to the horizontal width specification of the river of each connecting edge; corner points are instantiated into corner models, and the curvature angle of the corner model is consistent with the corner angle of the path. When each model is instantiated, the tangent direction of the corresponding generation point is read as the forward axis direction of the model for placement, so that the extension direction of the model is aligned with the path direction.

[0083] Furthermore, the mapping relationship between color and river type can be extended. When more river types or width specifications need to be added, new items can be configured in the color-type correspondence rules, and the subsequent classification and instantiation code can be extended accordingly without changing the overall generation process framework.

[0084] Please see Figure 12A , Figure 12B , Figure 12C , Figure 12D and Figure 12E , Figure 12A One of the schematic diagrams illustrating the effect of the mixing and intersecting of wide and narrow rivers provided in the embodiments of this application; Figure 12B This is the second schematic diagram illustrating the effect of the mixing and intersecting of wide and narrow rivers as provided in the embodiments of this application. Figure 12C This is a schematic diagram illustrating the effect of a river intersection of the same type as provided in an embodiment of this application; Figure 12D This is a schematic diagram illustrating the connection effect of a mixed wide and narrow river intersection provided in an embodiment of this application; Figure 12E This is a schematic diagram illustrating the overall generation effect of the complete river scene provided in the embodiments of this application.

[0085] like Figure 12A As shown, the 3D engine viewport displays a complete river scene generated through the above steps. The scene contains at least two types of rivers with different horizontal widths. Wide rivers (e.g., with a horizontal width of 5 grid units) and narrow rivers (e.g., with a horizontal width of 3 grid units) are seamlessly connected at the intersection using a three-way junction model of mixed specifications. The paths of different types of rivers maintain a preset interval, and there are no cases of model misalignment or mismatched seams.

[0086] like Figure 12B As shown, the 3D engine viewport displays a different layout for the river crossing effect. Rivers of different widths are smoothly connected at multiple intersections through corresponding three-way intersection models, resulting in a neat overall layout.

[0087] like Figure 12C As shown, the 3D engine viewport displays the effect of similar crossroads between wide rivers. The width of each interface of the three-way intersection model of the same type is consistent, the width of the river model of the three connecting edges is the same, and the transition at the intersection is smooth and natural.

[0088] like Figure 12D As shown, the 3D engine viewport displays the effect of identical intersections between narrow rivers, as well as the effect of mixed narrow and wide intersections between narrow and wide rivers. All types of intersections are accurately connected through corresponding three-way intersection models.

[0089] like Figure 12E As shown, the 3D engine viewport displays the overall generated effect of the river scene. The river models for straight sections are evenly arranged along the path, while those at corners conform to the path's curvature. At intersections, the width of each interface of the three-way intersection model matches the corresponding connecting edge specifications. The models are smoothly connected, and the overall scene presents a unified cartoon style. Using the technical solution provided in this application, artists only need to color-code the terrain mesh to generate a complete river scene with various width specifications and smooth intersection connections with a single click.

[0090] Compared with existing river generation methods that rely on fixed rules or manual placement, the river scene generation method, generation device, electronic device, and medium provided in this application obtain color-coded terrain grids and classify and merge grid units into type blocks based on color attributes. After extracting the two-dimensional straight skeleton paths of the type blocks, path filtering and connection optimization are performed. Unreasonable connections between different types of paths are disconnected, and paths of different specifications are kept at preset intervals. Then, based on the connection relationship of the generation points, grouping and instantiating are performed. The generation points at irregular intersections are instantiated into connection models with two-end interfaces adapted to different river width specifications. This solves the problems of misaligned intersection models, stiff connections, and repeated manual adjustments required when dealing with river intersections of different width specifications in existing solutions. It realizes the automatic generation of colored grids drawn by artists into a complete river scene containing at least two different width specifications with smooth intersection connections with one click, reducing the workload of manually placing models and repeatedly adjusting intersection connections.

[0091] Based on the same inventive concept, this application also provides a river scene generation device corresponding to the river scene generation method. Since the principle of the device in this application is similar to the above-mentioned river scene generation method in this application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.

[0092] Please see Figure 13 , Figure 13 This is a schematic diagram of the structure of the river scene generation device provided in an embodiment of this application. Figure 13 As shown, the river scene generation device 1300 includes: The terrain grid acquisition module 1301 is used to acquire a color-coded terrain grid, wherein different colors are used to identify different river lateral width specifications, and the terrain grid is composed of multiple grid cells; The type block merging module 1302 is used to classify the grid cells in the terrain grid according to the color attribute, and merge the grid cells with the same color and connected to each other into a type block. The skeleton line is obtained by module 1303, which is used to extract the two-dimensional straight skeleton path of each type block to obtain the skeleton line representing the direction of the river skeleton. The skeleton line processing module 1304 is used to perform path filtering and connection optimization on all extracted skeleton lines to disconnect unreasonable connections between different types of paths and maintain a preset interval between paths of different specifications. The tangent orientation calculation module 1305 is used to generate equally spaced generation points on the optimized path and calculate the tangent orientation along the path direction for each generation point. The river scene composition module 1306 is used to group the generated points according to the local connection relationship of the path where each generated point is located, and instantiate the corresponding generated points into river models according to the tangent orientation, so as to form a river scene containing at least two different width specifications of river intersections; wherein, the generated points at the straight connection are instantiated into straight river models, the generated points at the same type of intersection are instantiated into intersection models of uniform specifications, and the generated points at the different type of intersection are instantiated into connection models with the two ends of the interface adapted to different river lateral width specifications.

[0093] Please see Figure 14 , Figure 14 This is a schematic diagram of the structure of the electronic device provided in an embodiment of this application. Figure 14 As shown, the electronic device 500 includes a processor 510, a memory 520, and a bus 530.

[0094] The memory 520 stores machine-readable instructions executable by the processor 510. When the electronic device 500 is running, the processor 510 and the memory 520 communicate via the bus 530. When the machine-readable instructions are executed by the processor 510, they can perform the operations described above. Figure 1 The steps of the river scene generation method in the method embodiment shown are described in detail in the method embodiment, and will not be repeated here.

[0095] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, can perform the above-described actions. Figure 1 The steps of the river scene generation method in the method embodiment shown are described in detail in the method embodiment, and will not be repeated here.

[0096] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0097] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the shown or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.

[0098] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0099] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0100] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0101] Finally, it should be noted that the above-described embodiments are merely specific implementations of this application, used to illustrate the technical solutions of this application, and not to limit them. The scope of protection of this application is not limited thereto. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this application. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for generating river scenes, characterized in that, include: Obtain a color-coded terrain grid, wherein different colors are used to identify different river lateral width specifications, and the terrain grid is composed of multiple grid cells; The grid cells in the terrain grid are classified according to their color attributes, and grid cells with the same color and connected to each other are merged into a type block. Extract the two-dimensional straight skeleton path of each type block to obtain the skeleton line representing the direction of the river skeleton; All extracted skeleton lines are filtered and their connections are optimized to break unreasonable connections between different types of paths and to maintain a preset interval between paths of different specifications. Generate equidistantly distributed generation points on the optimized path, and calculate the tangent orientation along the path direction for each generation point; Grouping is performed based on the local connectivity of the paths where each generation point is located, and the corresponding generation point is instantiated as a river model according to the tangent orientation to form a river scene containing at least two different width specifications of river intersections; wherein, the generation point at the straight connection is instantiated as a straight river model, the generation point at the same type of intersection is instantiated as a uniform specification intersection model, and the generation point at the non-standard intersection is instantiated as a connection model with the two ends of the interface adapted to different river lateral width specifications.

2. The method according to claim 1, characterized in that, The path filtering and connection optimization include: Select path segments from the skeleton lines that meet the width specifications corresponding to their respective river types; Each path segment is split into sub-segments by nodes. The type attributes of the nodes at both ends of each sub-segment are checked. If the types at both ends are inconsistent, the sub-segment is deleted. The two sub-segments adjacent to the deleted sub-segment are shifted along the path direction toward the center point of the deleted sub-segment by half the length of the deleted sub-segment. The shifted sub-segments are then reconnected. After the above processing, the continuous sub-segments of the same type are reconstructed into a complete path. The structural nodes in the reconstructed path are detected, and sub-segments that meet the following conditions are deleted: they are located within the narrow path, have a relationship with the wide path, and the sub-segment length is less than a preset threshold.

3. The method according to claim 1, characterized in that, The step of generating equidistantly distributed generation points on the optimized path and calculating the tangent orientation along the path direction for each generation point includes: Linear interpolation is performed at fixed intervals along the optimized path to obtain uniformly distributed generation points; Using polygon frame nodes, calculate the secondary tangent vector for each generated point as the initial tangent orientation.

4. The method according to claim 3, characterized in that, The step of calculating the tangent orientation along the path direction for each generated point also includes: The optimized path is stretched vertically to form a planar patch, and the curvature of the planar patch is calculated. The curvature is passed back to the generation point on the optimized path using an attribute passing method. The initial tangent orientation is adjusted according to the sign of the curvature, wherein the generation point at the convex corner maintains the tangent orientation unchanged, and the generation point at the concave corner reverses the tangent orientation.

5. The method according to claim 1, characterized in that, The grouping based on the local connectivity of the paths where each generation point is located includes: Based on the quadtree hierarchy and path node connection relationship used when classifying the type of blocks, the generated points are divided into straight line segment points, three-way intersection points of the same type, three-way intersection points of different types, and corner points. Among them, the same type of three-way intersection point is a three-way intersection where all three connecting edges are of the same river lateral width specification, the different type of three-way intersection point is a three-way intersection where the three connecting edges contain different river lateral width specifications, and the turning point is a point at the corner of the path that is not a three-way intersection generation point.

6. The method according to claim 5, characterized in that, The corresponding generated points are instantiated into a river model based on the tangent orientation in the following manner: Instantiate a straight river model for straight line segments, instantiate a three-way intersection model of uniform specifications for three-way intersections of the same type, instantiate a three-way intersection model of mixed specifications for three-way intersections of different types, and instantiate a corner model for corner points. The orientation of the straight river model, the uniform three-way intersection model, the mixed three-way intersection model, and the corner model is determined by the orientation of the tangent at the corresponding generation point.

7. The method according to claim 1, characterized in that, The terrain grid is a quadrilateral grid array, and the lateral width of the river is an integer multiple of the side length of the grid cell.

8. A river scene generation device, characterized in that, include: The terrain grid acquisition module is used to acquire a color-coded terrain grid, wherein different colors are used to identify different river lateral width specifications, and the terrain grid is composed of multiple grid cells; The type block merging module is used to classify the grid cells in the terrain grid according to the color attribute, and merge grid cells with the same color and connected to each other into a type block; The skeleton line acquisition module is used to extract the two-dimensional straight skeleton path of each type block, and obtain the skeleton line representing the direction of the river skeleton; The skeleton line processing module is used to filter and optimize the connections of all extracted skeleton lines, so as to disconnect unreasonable connections between different types of paths and maintain a preset interval between paths of different specifications. The tangent orientation calculation module is used to generate equidistantly distributed generation points on the optimized path and calculate the tangent orientation along the path direction for each generation point. The river scene composition module is used to group the generated points according to the local connection relationship of the path where each generated point is located, and instantiate the corresponding generated points into river models according to the tangent orientation, so as to form a river scene containing at least two different width specifications of river intersections; wherein, the generated points at the straight connection are instantiated into straight river models, the generated points at the same type of intersection are instantiated into intersection models of uniform specifications, and the generated points at the different type of intersection are instantiated into connection models with the two end interfaces adapted to different river lateral width specifications.

9. An electronic device, characterized in that, include: The device includes a processor, a memory, and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is in operation, the processor communicates with the memory via the bus, and the processor executes the machine-readable instructions to perform the steps of the method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of the method as described in any one of claims 1 to 7.