Unity engine-based three-dimensional map boundary automatic generation method

Through an automated generation method based on the Unity engine, the problems of low efficiency and insufficient accuracy in 3D map boundary generation are solved, and efficient and accurate 3D map boundary generation and diversified rendering are achieved, which is suitable for urban planning and virtual reality scenarios.

CN120655844APending Publication Date: 2025-09-16WEICHUANG SOFTWARE NANJING CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510717580.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-30
Publication Date
2025-09-16

AI Technical Summary

Technical Problem

Existing 3D map boundary generation methods are inefficient and rely on manual modeling, making them difficult to adapt to the rapid generation of large-scale land parcel models. They also suffer from visualization errors such as inconsistent and overlapping boundaries and lack parametric control, making it difficult to meet the accuracy and diversity requirements of modern urban information systems for 3D maps.

Method used

An automated generation method based on the Unity engine is used to generate continuous elevation boundary curves through GIS data analysis, interpolation, and smooth filtering. The three-dimensional shell is extruded in stages and topology optimization is performed. Combined with the energy minimization model and UV mapping, smooth splicing and texture mapping are achieved, and real-time switching of multiple rendering styles is supported.

Benefits of technology

It improves modeling efficiency, reduces error rate, achieves high-precision 3D map boundary generation, supports diverse rendering styles and flexible parametric control, and is suitable for batch modeling and real-time updating of large-scale land parcel models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120655844A_ABST
    Figure CN120655844A_ABST
Patent Text Reader

Abstract

The invention discloses a Unity engine-based three-dimensional map boundary automatic generation method, which relates to the technical field of three-dimensional map boundary generation, and comprises the following steps: carrying out coordinate calibration and topology check on two-dimensional GIS boundary data to generate a continuous elevation boundary curve; extruding the two-dimensional elevation boundary curve into a three-dimensional shell according to stages, performing energy minimization optimization on the three-dimensional shell, and generating a three-dimensional plot model; voxel subdivision is carried out on the three-dimensional shell, section curved surfaces are automatically generated along different height sections, and UV automatic unfolding and island division mapping are completed; and exporting the three-dimensional model as an FBX file, and realizing multi-style rendering in Unity. According to the method, the three-dimensional map modeling efficiency is remarkably improved through automatic GIS boundary extraction, elevation interpolation and spline fitting; a topological constraint and energy optimization strategy is adopted, so that the problems of inner and outer boundary mismatch and model errors are effectively solved; and meanwhile, multi-parameter section definition and an adjustable rendering style are introduced, so that comprehensive parameterization and visual diversity of the boundary structure are realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of three-dimensional map boundary generation, and in particular to a method for automatically generating three-dimensional map boundaries based on a Unity engine. Background Art

[0002] With the development of urban informatization and digital twin technology, 3D maps are increasingly being used in scenarios such as urban planning, traffic simulation, emergency management, and virtual reality. To accurately represent urban terrain and land boundary information within a 3D visualization platform, it is often necessary to construct a corresponding 3D map boundary model based on 2D vector data (such as Shapefile or GeoJSON format) exported from a Geographic Information System (GIS).

[0003] However, in the actual modeling process, the existing methods generally have the following technical problems: First, the vector boundaries exported by the GIS system only have two-dimensional contour information. The existing construction process mostly relies on 3D modelers to perform manual tracing and extrusion modeling vertex by vertex through software tools (such as 3dsMax and Blender). This is not only inefficient, but also requires a high level of operator experience. It is difficult to adapt to the needs of rapid generation of large-scale land models, which seriously restricts the automation level of map engineering. Second, when faced with complex boundary structures containing embedded areas such as lakes and rivers, traditional methods often need to model the inner and outer boundaries separately and layout them. The traditional boundary extrusion method is very easy to cause boundary inconsistency due to problems such as coordinate offset and topological structure difference, which in turn causes visualization errors such as cracks and overlaps at the edges of the 3D model. According to statistics, the error rate can be as high as 12% or more, seriously affecting the map rendering quality and subsequent interactive stability. In addition, the existing boundary extrusion methods mostly use fixed sections or simple vertical projections, lack of parametric control of the boundary structure, and difficult to flexibly adjust geometric features such as cross-sectional shape, edge chamfers, and curvature smoothness according to different land uses. As a result, the modeling results lack personalization and scalability, which is not conducive to supporting multi-style rendering or refined planning and analysis needs.

[0004] Therefore, there is an urgent need for a 3D map boundary generation method that supports boundary parametric modeling, automatically identifies internal and external contours, eliminates topological errors, and has the ability to integrate efficient modeling and visualization, so as to meet the dual requirements of modern urban information systems for rapid generation and precision control of 3D maps. Summary of the Invention

[0005] In view of the problems of low manual efficiency, boundary data mismatch and lack of parameterized control of structure in the process of converting existing GIS plane maps into three-dimensional models when generating three-dimensional map boundaries, the present invention is proposed.

[0006] Therefore, the problem to be solved by the present invention is how to provide a method for automatically generating three-dimensional map boundaries based on the Unity engine.

[0007] In order to solve the above technical problems, the present invention provides the following technical solutions:

[0008] In the first aspect, an embodiment of the present invention provides a method for automatically generating three-dimensional map boundaries based on the Unity engine, comprising: calibrating the coordinate system of the imported two-dimensional GIS boundary data and performing a topological check to distinguish and eliminate abnormal "inner boundary" and "outer boundary" elements; extracting the DEM elevation data of the corresponding area, interpolating the boundary sampling points and smoothing them through weighted average filtering; fitting the smoothed discrete boundary point sequence to generate a continuous elevation boundary curve; according to urban planning and terrain characteristics, extruding the two-dimensional elevation boundary curve in stages along the vertical direction to generate a three-dimensional shell with thickness, and separating the facets at each height intersection to avoid geometric overlap; optimizing the extruded three-dimensional shell based on an energy minimization model so that adjacent facets are automatically stretched or shrunk and smoothly spliced; automatically identifying the hole structure, and generating a standardized three-dimensional land parcel model of "shell minus internal holes" through Boolean difference operation; voxel meshing of the generated three-dimensional shell, and based on topological The optimization algorithm generates the optimal support network and converts the retained voxel group into a smooth continuous triangular mesh; parametric sections are defined along different height segments and scanned horizontally to generate three-dimensional surfaces with various cross-sectional shapes; LSCM-based UV automatic unfolding and secondary optimization are adopted, and an automatic islanding strategy is applied to contour depressions and inner hole areas to complete texture mapping; the above-mentioned three-dimensional model is exported as an FBX file, and different LOD levels are automatically generated according to distance; the FBX file is imported into Unity, and a custom Shader system is applied in Unity to achieve real-time switching of multiple rendering styles, and reduce rendering overhead through GPU instancing and batch rendering optimization; the UnityEditor extension plug-in is used to realize one-click import of FBX and textures, automatically generate Prefabs and bind LODs and Shaders, and support triggering secondary generation and hot updates of modules such as "data preprocessing - extrusion and optimization - structure generation and UV mapping" through remote interfaces at runtime.

[0009] As a preferred solution of the method for automatically generating three-dimensional map boundaries based on the Unity engine described in the present invention, bilinear interpolation or cubic spline interpolation is used for interpolation of DEM elevation data, and the interpolation result is smoothed by a weighted average filtering algorithm based on window size to eliminate mutations and ensure the continuity of the elevation curve.

[0010] As a preferred solution of the method for automatically generating three-dimensional map boundaries based on the Unity engine described in the present invention, the two-dimensional boundary curve is divided into three stages: bedrock layer height, building height upper limit and landmark building customized height, and vertical extrusion is performed. The height of each stage is automatically calculated according to a unified scale parameter, and face separation is performed at the junction to avoid geometric overlap.

[0011] As a preferred solution of the method for automatically generating three-dimensional map boundaries based on the Unity engine described in the present invention, the energy minimization model discretizes the three-dimensional shell into a vertex mesh and solves it using the L-BFGS iterative algorithm to automatically stretch or shrink local facets while maintaining texture and geometric consistency, thereby achieving seamless splicing and smooth control.

[0012] As a preferred solution of the method for automatically generating three-dimensional map boundaries based on the Unity engine described in the present invention, voxel meshing and topology optimization iteratively optimize the internal segmented areas of the model through finite element analysis and SIMP method to minimize the total volume while satisfying structural strength constraints, and convert the optimization results into a smooth triangular mesh.

[0013] As a preferred solution of the method for automatically generating three-dimensional map boundaries based on the Unity engine described in the present invention, the following steps are performed: when automatically mapping UV on the three-dimensional surface, a flattening algorithm based on LSCM is used for UV unfolding, and texture stretching energy is minimized through secondary optimization; an automatic islanding strategy is further applied to contour concave and inner hole areas to prevent map overlap.

[0014] As a preferred solution of the method for automatically generating three-dimensional map boundaries based on the Unity engine described in the present invention, the custom Shader system supports three rendering modes: realistic style, holographic style and flat low-polygon style, and uses GPU instantiation technology and the UnityAddressable system to perform batch rendering optimization and on-demand loading, which is used to reduce the number of DrawCalls and reduce runtime memory usage.

[0015] In a second aspect, the present invention further solves the problems existing in the generation of three-dimensional map boundaries. In an embodiment, a system for automatically generating three-dimensional map boundaries based on the Unity engine is provided, which includes: a data processing module for performing coordinate system calibration and topology checking on imported two-dimensional GIS boundary data, distinguishing "inner boundaries" from "outer boundaries", and extracting and interpolating DEM elevation data of the corresponding area; an extrusion and topology optimization module for performing vertical extrusion in stages according to the bedrock layer, the upper limit of building height, and the customized height of landmark buildings based on the two-dimensional elevation boundary curve output by the data processing module, and separating the interfaces of the extrusion stages to avoid geometric overlap; an intelligent structure generation and UV mapping module for performing voxel meshing on the three-dimensional land shell output by the extrusion and topology optimization module, and automatically unfolding and performing secondary optimization on the three-dimensional surface, and applying an automatic islanding strategy to the contour concave and inner hole areas to complete texture mapping; a rendering integration module for exporting the three-dimensional model output by the intelligent structure generation and UV mapping module as an FBX file, and automatically generating different LOD levels according to distance. At the same time, a custom shader system is applied in Unity based on the FBX file to achieve real-time switching of multiple rendering styles.

[0016] In a third aspect, an embodiment of the present invention provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: when the computer program is executed by the processor, any step of the method for automatically generating three-dimensional map boundaries based on the Unity engine as described in the first aspect of the present invention is implemented.

[0017] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein: when the computer program is executed by a processor, it implements any step of the method for automatically generating three-dimensional map boundaries based on the Unity engine as described in the first aspect of the present invention.

[0018] The beneficial effects of the present invention are:

[0019] 1. This invention introduces technologies such as automatic GIS data parsing, elevation interpolation and smoothing filtering, spline curve fitting, and multi-stage parameter extrusion, avoiding the traditional point-by-point outlining and manual modeling process. It can automatically generate a continuous, smooth, and terrain-compliant 3D map boundary model without manual intervention, greatly improving modeling efficiency and making it suitable for batch modeling and real-time updating of large-scale plots.

[0020] 2. This invention distinguishes between inner and outer contours during boundary processing, ensuring correct polygonal nesting through topological constraints and automatic Boolean operations. Furthermore, it introduces energy minimization and curvature optimization strategies during elevation interpolation, extrusion modeling, and mesh reconstruction to effectively eliminate problems such as boundary misalignment and facet overlap. This allows the boundary error of the final 3D model to be controlled within 1 meter, with an overall error rate far lower than the 12% of traditional methods, significantly improving model accuracy and visualization quality.

[0021] 3. This invention builds a flexible boundary parameter control system that supports structured adjustable parameters including cross-sectional shape (such as rectangle, trapezoid, arch), extrusion height, multi-level waistline, chamfer curvature, etc.; combined with UV unwrapping and Shader system, it can achieve real-time rendering style switching (realistic, holographic, cartoon, etc.) on the Unity platform, meeting the needs of different urban planning, display and simulation scenarios for map model diversity and customization;

[0022] 4. This invention adopts modular design, adapts to various GIS format inputs, supports template-based automatic LOD generation and batch Shader binding, and provides a runtime hot update mechanism. New plot models can be dynamically loaded into the client Unity scene through AssetBundle. It is suitable for complex business scenarios such as dynamic expansion and remote updating, and has good engineering practical value. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] To more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. Those skilled in the art can also derive other drawings based on these drawings without inventive effort. Among them:

[0024] Figure 1 This is a flow chart for implementing the present invention in Example 1.

[0025] Figure 2 This is an implementation effect diagram of the present invention.

[0026] Figure 3 This is the final effect diagram of the present invention. DETAILED DESCRIPTION

[0027] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0028] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.

[0029] Secondly, the term "one embodiment" or "embodiment" herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The phrase "in one embodiment" appearing in various places throughout this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive of other embodiments.

[0030] Example 1

[0031] Reference Figure 1 - Figure 3 , which is the first embodiment of the present invention, provides a method for automatically generating 3D map boundaries based on the Unity engine. This method automatically generates a high-quality, parameterized, and scalable 3D map boundary model from 2D GIS data, and implements one-click multi-style rendering and hot update in the Unity engine. The method includes the following steps:

[0032] Step S1: 2D image preprocessing and elevation extraction module, which includes the following sub-steps:

[0033] S1-1: Import GIS data and extract boundary contours, which includes vectorized planar map files (supporting Shapefile, GeoJSON, etc.) with administrative division information exported by general GIS software (such as ArcGIS and QGIS). Then, the imported vector data is calibrated and standardized into an engineering projection coordinate system (such as WGS84→Web Mercator or local engineering coordinate system) to ensure spatial consistency between data from different sources; the attribute fields of vector boundary features (such as administrative division ID) are used to distinguish between "inner boundaries" (internal polygons such as lakes and rivers) and "outer boundaries" (the overall outline of the administrative area), and each closed polygon is topologically checked to eliminate overlaps, hanging edges, and self-intersections.

[0034] S1-2: Elevation data association and interpolation, which involves downloading the numerical elevation model (DEM) of the corresponding area from a third-party remote sensing or public platform and storing it in raster format; extracting a series of boundary points on the two-dimensional boundary polygon contour according to a set sampling density (for example, one sampling point every 10 meters), and interpolating the corresponding raster elevation values ​​(such as bilinear interpolation or cubic spline interpolation) to obtain the precise elevation of each sampling point on the boundary; secondly, to avoid sudden changes caused by elevation interpolation errors, a weighted average filtering algorithm based on window size is used to smooth the original interpolation point sequence to ensure that the elevation curve is continuous and suitable for subsequent extrusion;

[0035] It should be noted that the weighted average filtering algorithm, when actually processing each interpolation point, selects adjacent points within a certain range before and after it, assigning different weights based on their distance (the closer the distance, the greater the weight). The elevations of these points are then multiplied by their respective weights, and the sum is used to replace the elevation of the current point. This way, the elevation data, which may have previously changed suddenly, is smoothed by the surrounding gentle values, avoiding obvious jumps and achieving smooth processing of the original interpolation point sequence.

[0036] S1-3: Boundary curve parameterization processing, which includes fitting a spline curve (such as B-spline or Bezier curve) to the sequence of discrete boundary points with elevation after processing to generate a continuous differentiable boundary curve. During the fitting process, the control points are determined by least squares optimization, taking into account both the smoothness and accuracy of the curve; then the outer boundary contour line and the internal concave contour line (such as lakes, rivers, islands, etc.) are obtained using the above-mentioned fitted curve. By constraining its topological relationship (the inner boundary is completely nested outside the outer boundary), seamless connection can be guaranteed in the subsequent extrusion stage; wherein, in the curve fitting stage, the maximum allowable error threshold is set (such as less than 1 / 3 of the sampling interval), and local subdivision is performed for areas with large fitting errors to ensure that the spatial deviation between the final boundary line and the original GIS data is less than 1 meter;

[0037] It should be noted that the control points are determined through least-squares optimization. Specifically, during fitting, a network of control points is first established based on the coordinates of the boundary sampling points. The error between the curve generated by these control points and the original sampling points is then minimized. At the same time, smoothness constraints are added to the optimization objective to ensure that the curve adheres closely to the sampling points without excessive cornering or jitter. The optimization process continuously adjusts the control point positions until a set of control points is found that achieves the optimal balance between overall smoothness and restoration accuracy.

[0038] Step S2: Parametric extrusion and topology optimization module. The purpose is to obtain a coherent and smooth two-dimensional closed curve (including elevation information) after completing the above boundary fitting and coordinate transformation. Next, it is converted into a three-dimensional model with a hierarchical structure. It includes the following sub-steps:

[0039] S2-1: Multi-stage height-controlled extrusion. Specifically, the extrusion process is divided into several height stages based on urban planning or terrain characteristics. For each height stage, the two-dimensional boundary curve is extruded vertically to obtain a three-dimensional boundary shell with thickness. In order to ensure that the surfaces of different stages are independent of each other when superimposed, "surface separation" is required at the junction of the stages. That is, the shell is automatically divided into two or more surface units at the boundary height to avoid geometric overlap or intersection. A unified set of scale parameters (α, β, γ, etc.) is provided to automatically calculate the height values ​​of each stage based on the input urban terrain characteristics.

[0040] For example, the several height stages include bedrock height (corresponding to the highest point of the terrain), upper limit of building height (e.g., within 50m), and customized height of landmark buildings (which can be specified by external parameters);

[0041] The height values ​​at each stage can be calculated using the following formula:

[0042] H i =H max ×α i ;

[0043] In the formula, i=1,2,...,n,α i represents the scaling factor of the i-th stage, which is automatically recommended by the user based on planning requirements or by the algorithm (e.g., weight allocation based on factors such as population density and land properties); H max is the maximum terrain elevation within the boundary;

[0044] It should be noted that "surface separation" is based on the following principles: first, the extrusion curve is checked at each height node to see if there is a local curvature mutation; second, if there is a mutation, a horizontal dividing line is automatically subdivided to split the surface unit into two parts, upper and lower parts; in addition, a three-dimensional mesh topology reconnection algorithm is applied to ensure that each surface unit can form a closed shell after reconnection.

[0045] S2-2: Energy minimization and smooth control. In order to ensure the smoothness of the extruded surface and meet the rationality of the structure, an energy minimization model is introduced to define the separation surface. and its corresponding model attribute set I (which may include vertex normals, curvatures, texture coordinates and other feature information), automatically stretching or shrinking adjacent intersecting areas through energy function optimization to achieve seamless splicing;

[0046] Specifically, the above energy function can be expressed by the following formula:

[0047]

[0048] Where, Represents the model surface to be segmented or adjusted; is any point on the surface; I(p) is the model attribute corresponding to point p (such as texture, normal or curvature value, etc.); is the attribute gradient, which represents the rate of attribute change; R(p) is the geometric regularization term (e.g., a curvature-based smoothness metric); α and β are adjustable parameters that weigh the weight of attribute preservation and geometric smoothness, respectively; dA is the surface micro-area element;

[0049] Furthermore, the energy function is solved by variational method to obtain the segmentation or adjustment scheme that minimizes the energy and satisfies the boundary conditions. For vertex meshes, the energy function is converted into matrix form and solved by an iterative method (such as the L-BFGS algorithm), so that the redundant or intersecting faces are automatically separated while maintaining the texture and geometric consistency between adjacent faces, and the local folding problem is eliminated.

[0050] S2-3: Automatic Hole Identification and Segmented Extrusion, which includes the identification of internal lakes and rivers. Specifically, all "porous structures"—areas excluded from the land parcel (usually water bodies or open spaces)—are marked during the 2D boundary fitting phase. This module processes these internal holes individually: First, by determining the direction of the boundary vertex sequence (clockwise or counterclockwise), it determines which polygons are external contours and which are internal contours. Second, the contour curve of each internal hole is segmented and extruded. The extrusion height can be lower than the extrusion height of the outer boundary (for example, the lake surface remains at zero height or is set to a certain depth below the surface), forming a distinct 3D shell. Third, a Boolean difference operation is performed on the 3D shells corresponding to the inner and outer boundaries, ultimately forming a standardized 3D land parcel model of "shell minus internal holes."

[0051] Step S3: Intelligent structure generation and UV mapping module. This module aims to introduce intelligent topology optimization and automatic unfolding after obtaining the basic 3D land boundary shell, optimize the internal support structure and automate material mapping, and further improve the model's accuracy and rendering effect. It includes the following sub-steps:

[0052] S3-1: Topology optimization structure generation. For different application scenarios (such as enhancing the compressive strength of the model, reducing the number of facets, ensuring rendering efficiency, etc.), the following constraint parameters can be input: based on the physical force distribution that the model may withstand in the scene (such as the force on the simulated building foundation, the force on the cable operation, etc.); setting the material density and elastic modulus corresponding to the virtual model; limiting the maximum occupied volume or minimum channel width of the internal support structure to ensure subsequent visualization or equipment operation requirements.

[0053] Secondly, an “optimal support network” is obtained through an optimization algorithm, which consists of voxel meshing within the boundary shell and treating each voxel cell as an optional material or removal area, and then defining the objective function:

[0054]

[0055] Where ρ(x)∈{0,1} indicates whether each voxel is retained; C(ρ) is the stiffness energy obtained by mechanical simulation; V(ρ) is the overall voxel volume; λ is the volume penalty factor, which can control the degree of model lightweighting;

[0056] Furthermore, a finite element (FEM) analysis method is used to iteratively optimize ρ(x) (e.g., using the SIMP method), and finally an "optimal support network" is obtained;

[0057] Finally, the support structure is extracted and reconstructed, which includes extracting the retained voxel group from the optimization results and converting the discrete voxels into a continuous triangular mesh using the Marching Cubes algorithm; topological pruning and surface fitting are performed on the mesh to eliminate isolated small areas, making the internal structure smoother and easier to render.

[0058] S3-3: Parametric section generation and automatic UV unfolding, which includes parametric section definition, 3D surface generation, and automatic UV mapping;

[0059] Specifically, parametric cross-section definition allows for the definition of various cross-sectional shapes (e.g., rectangular, trapezoidal, arched, etc.) for different height segments of the boundary shell, based on planning requirements or aesthetic requirements. Each cross-sectional shape is described by a set of adjustable parameters: width, thickness, arch height, chamfer radius, etc. The system provides preset templates (urban roads, building bases, green belts, etc.), and users can also define cross-sectional parameters.

[0060] 3D surface generation involves "transversely scanning" the parameterized cross-section along the boundary curve trajectory to automatically generate a continuous surface. Each scan line is stretched or scaled according to its height to achieve a variety of "waistline" or "cornice" shape variations. During surface generation, the internal support grid obtained in step S3-1 above is combined with operations such as cutting holes and reinforcement to ensure that the surface fits the internal structure.

[0061] UV automatic mapping uses the LSCM algorithm to flatten the three-dimensional boundary surface into a two-dimensional UV space, trying to keep the local angle undistorted, that is, satisfying the Cauchy-Riemann equation, which can be expressed by the following formula:

[0062]

[0063] Where (x, y, z) represents the three-dimensional surface vertex coordinates, and (u, v) represents the two-dimensional UV coordinates;

[0064] Furthermore, based on LSCM, the flattening results are further optimized to define the texture stretching energy:

[0065]

[0066] Where, J ΔT is the Jacobian matrix of the triangular face ΔT from 3D to 2D, and I is the identity matrix. The texture distortion is minimized by the least squares iteration.

[0067] Then, for complex areas such as concave contours and inner holes, an automatic islanding strategy is set to divide the surface into several UV islands, maintaining a certain gap between each UV island to avoid map overlap.

[0068] Step S4: Unity scene integration and multi-style rendering module. The purpose is to import the model into Unity for further rendering and visualization after completing 3D model generation, structure optimization, and UV unfolding, and to achieve a one-click multi-style map boundary effect. It includes the following sub-steps:

[0069] S4-1: FBX export and LOD level generation, which includes using the export function of 3D modeling software such as 3dsMax or Maya to export the final model into FBX format, as well as automatic LOD generation strategy.

[0070] It should be noted that exporting to FBX format requires: retaining key information such as vertex normals, UV coordinates, material channels, and generating models of different resolutions by height segmentation (i.e. Level of Detail, LOD);

[0071] The automatic LOD generation strategy includes automatically switching the most appropriate LOD model based on the distance from the camera to the model center; using a mesh simplification algorithm based on error metrics (QEMQ) to automatically generate several simplified versions of the original high-resolution mesh; providing a batch processing process to automatically generate three to four levels of precision FBX files during export, and binding them to the same prefab's LOD system through scripts in Unity;

[0072] S4-2: Customized Shader system and style switching, including Shader requirement overview, real-time parameterized control, GPU acceleration and batch rendering optimization.

[0073] Specifically, the shader requirements overview is to meet the diverse requirements for map border rendering effects in different scenarios (realistic urban planning, holographic demonstrations, low-polygon styles, etc.). A parameterizable shader system is designed. For example, it supports the following main rendering styles:

[0074] Realistic style: emphasizes lighting, shadows and material details, using outdoor physically based rendering (PBR) models;

[0075] Holographic style: simulate holographic projection effects through edge glow, translucent overlay and dynamic scanning lines;

[0076] Flat low-polygon style: based on cartoon rendering, it reduces texture details and uses color block gradients to achieve visual impact.

[0077] Real-time parametric control: Shader provides multiple adjustable parameters (such as edge glow intensity, glow color, translucency, scanning speed, etc.), which can be adjusted externally through Unity scripts or Editor panel with one click; and at runtime, different rendering styles can be dynamically switched and smoothly transitioned (such as cross-scene switching or timeline driving) through UI interaction or preset scripts.

[0078] GPU acceleration and batch rendering optimization: On the one hand, for the same plot or similar boundary models, GPU instancing (GDM) is enabled to significantly reduce DrawCalls; on the other hand, some batch post-processing (such as halo diffusion of edge glow) is placed in the Compute Shader to achieve efficient boundary point screening and luminous amount calculation; on the other hand, when the scene is large, the UnityAddressable system is used to load FBX and materials on demand, combined with screen space culling technology (OC) to reduce memory usage and rendering pressure.

[0079] S4-3: Unattended automated pipeline, which includes UnityEditor extension plug-in module and runtime secondary generation module.

[0080] Among them, UnityEditor extension plug-in: Write a set of Editor extension tools to realize one-click import, resource switching, material generation, LOD and Shader binding and other full process automation:

[0081] Resource import stage: automatically import FBX models and textures in batches, and automatically classify them into corresponding folders according to naming conventions;

[0082] Prefab generation stage: Create a corresponding Prefab for each plot model, and package the LOD group, Collider, NavMesh properties, etc.

[0083] Shader binding stage: read the style configuration file and automatically assign different styles of material balls to Prefabs;

[0084] Scene construction phase: Place the Prefabs of each block in the corresponding position according to the coordinate information, and package the scene partitions according to the blocks they are in to facilitate subsequent version iterations and hot updates.

[0085] Runtime secondary generation: Under some application requirements (such as dynamic urban expansion and land parcel updates), it supports receiving new 2D boundary data or elevation data through remote interfaces at runtime, triggering the background service to perform "1-3 modules" (data preprocessing, extrusion and optimization, support structure generation and UV mapping), and then updating the latest model to the client Unity through AssetBundle, automatically completing hot updates and rendering.

[0086] In summary, the present invention significantly improves the efficiency of 3D map modeling through automated GIS boundary extraction, elevation interpolation, and spline fitting. It adopts topological constraints and energy optimization strategies to effectively solve the problems of internal and external boundary mismatch and model error. At the same time, it introduces multi-parameter section definition and adjustable rendering style to achieve comprehensive parameterization and visualization diversity of boundary structures, thereby improving the accuracy, flexibility, and engineering applicability of the model as a whole.

[0087] Example 2

[0088] Embodiment 2 is the second embodiment of the present invention. This embodiment differs from the first embodiment in that it further provides a system for automatically generating three-dimensional map boundaries based on the Unity engine, including:

[0089] The data processing module is used to perform coordinate system calibration and topology checking on the imported 2D GIS boundary data, distinguish "inner boundaries" from "outer boundaries", extract and interpolate DEM elevation data of the corresponding area, smooth the discrete boundary sampling points using weighted average filtering, and generate continuous elevation boundary curves through spline curve fitting;

[0090] The extrusion and topology optimization module is used to perform vertical extrusion in stages based on the bedrock layer, building height limit, and customized landmark building height according to the 2D elevation boundary curves output by the data processing module. It separates the interfaces of the extrusion stages to avoid geometric overlap, discretizes the 3D shell generated after extrusion into a vertex mesh, and optimizes vertex stretching or shrinking based on an energy minimization model to achieve smooth splicing of adjacent facets. It automatically identifies porous structures such as internal lakes and rivers, and generates a 3D land model of "shell minus internal holes" through Boolean difference operations.

[0091] The intelligent structure generation and UV mapping module is used to perform voxel meshing on the 3D land shell output by the extrusion and topology optimization module. It then performs iterative topology optimization based on finite element analysis and SIMP methods, extracting the optimal support network and converting it into a smooth, continuous triangular mesh. It also sets parameterized sections based on different height segments and automatically generates 3D surfaces with various cross-sectional shapes by scanning horizontally along boundary curve paths. It also uses an LSCM-based flattening algorithm to automatically unfold the 3D surface and perform secondary optimization. It also applies an automatic islanding strategy to concave contours and internal holes to complete texture mapping.

[0092] The rendering integration module is used to export the three-dimensional model output by the intelligent structure generation and UV mapping module into an FBX file that retains vertex normals, UV coordinates and material channel information, and automatically generates different LOD levels according to distance; in Unity, a custom Shader system is applied based on the FBX file to achieve real-time switching between three rendering styles: realistic, holographic and flat low-polygon, and batch rendering optimization and on-demand loading are performed through GPU instancing technology and the UnityAddressable system; and through the UnityEditor extension plug-in module, one-click import of FBX and textures, automatic generation of Prefabs and binding of corresponding LODs and Shaders are achieved, and at the same time, support is supported to trigger the secondary generation and hot update of each module of "data processing - extrusion and optimization - intelligent structure generation and UV mapping" through the remote interface at runtime, thereby realizing unattended automation of the entire process.

[0093] This embodiment also provides a computer device, which is applicable to a method for automatically generating three-dimensional map boundaries based on the Unity engine, including: a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement a method for automatically generating three-dimensional map boundaries based on the Unity engine as proposed in the above embodiment.

[0094] The computer device may be a terminal, comprising a processor, a memory, a communication interface, a display screen and an input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device comprises 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 communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner may be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. The display screen of the computer device may be a liquid crystal display or an electronic ink display screen, and the input device of the computer device may be a touch layer covering the display screen, or a button, trackball or touchpad provided on the housing of the computer device, or an external keyboard, touchpad or mouse.

[0095] This embodiment also provides a storage medium having a computer program stored thereon, which, when executed by a processor, implements a method for automatically generating three-dimensional map boundaries based on the Unity engine as proposed in the above embodiment; the storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, disk or optical disk.

[0096] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.

Claims

1. A method for automatically generating 3D map boundaries based on the Unity engine, characterized by: include: Step S1: calibrate the coordinate system of the imported 2D GIS boundary data and perform a topological check to distinguish and eliminate abnormal "inner boundary" and "outer boundary" elements; extract the DEM elevation data of the corresponding area, interpolate the boundary sampling points and smooth them through weighted average filtering; fit the smoothed discrete boundary point sequence to generate a continuous elevation boundary curve; Step S2: Based on urban planning and terrain characteristics, the 2D elevation boundary curve is extruded in stages along the vertical direction to generate a thick 3D shell. Facets are separated at each elevation boundary to avoid geometric overlap. The extruded 3D shell is optimized based on an energy minimization model, allowing adjacent facets to automatically stretch or shrink and achieve smooth splicing. Hole structures are automatically identified, and a standardized 3D land parcel model consisting of "shell minus internal holes" is generated through a Boolean difference operation. Step S3: The generated 3D shell is meshed with voxels, and an optimal support network is generated based on a topology optimization algorithm. The retained voxel group is converted into a smooth continuous triangular mesh. Parametric sections are defined along different height segments and scanned horizontally to generate 3D surfaces with various cross-sectional shapes. LSCM-based UV automatic unfolding and secondary optimization are performed, and an automatic islanding strategy is applied to the contour concavities and inner hole areas to complete texture mapping. Step S4: Export the above-mentioned 3D model as an FBX file and automatically generate different LOD levels according to distance; import the FBX file into Unity, apply the custom Shader system in Unity, realize real-time switching of multiple rendering styles, and reduce rendering overhead through GPU instancing and batch rendering optimization; use the UnityEditor extension plug-in to realize one-click import of FBX and textures, automatically generate Prefabs and bind LOD and Shader, and support triggering secondary generation and hot update of modules such as "data preprocessing - extrusion and optimization - structure generation and UV mapping" through remote interfaces at runtime.

2. The method for automatically generating three-dimensional map boundaries based on the Unity engine according to claim 1, characterized in that: In step S1, bilinear interpolation or cubic spline interpolation is used to interpolate the DEM elevation data, and the interpolation result is smoothed by a weighted average filtering algorithm based on the window size to eliminate mutations and ensure the continuity of the elevation curve.

3. The method for automatically generating 3D map boundaries based on the Unity engine according to claim 1, characterized in that: In step S2, the two-dimensional boundary curve is divided into three stages: bedrock layer height, building height upper limit and landmark building customized height for vertical extrusion. The height of each stage is automatically calculated according to the unified scale parameter, and the surface separation is performed at the junction to avoid geometric overlap.

4. The method for automatically generating 3D map boundaries based on the Unity engine according to claim 1, wherein: The energy minimization model in step S2 discretizes the three-dimensional shell into a vertex mesh and solves it using the L-BFGS iterative algorithm to automatically stretch or shrink local patches while maintaining texture and geometric consistency to achieve seamless splicing and smooth control.

5. The method for automatically generating 3D map boundaries based on the Unity engine according to claim 1, wherein: The voxel mesh generation and topology optimization in step S3 iteratively optimizes the internal segmentation area of ​​the model through finite element analysis and SIMP method to minimize the total volume while satisfying the structural strength constraints, and converts the optimization results into a smooth triangular mesh.

6. The method for automatically generating three-dimensional map boundaries based on the Unity engine according to claim 1, characterized in that: In step S3, when UV automatic mapping is performed on the three-dimensional surface, a flattening algorithm based on LSCM is used for UV unfolding, and the texture stretching energy is minimized through secondary optimization; an automatic islanding strategy is further applied to the contour concave and inner hole areas to prevent map overlap.

7. The method for automatically generating 3D map boundaries based on the Unity engine according to claim 1, characterized in that: The custom shader system in step S4 supports three rendering modes: realistic style, holographic style, and flat low-polygon style. It also uses GPU instancing technology and the UnityAddressable system to perform batch rendering optimization and on-demand loading to reduce the number of DrawCalls and reduce runtime memory usage.

8. A system for automatically generating 3D map boundaries based on the Unity engine, based on the method for automatically generating 3D map boundaries based on the Unity engine according to any one of claims 1 to 7, characterized in that: include, The data processing module is used to perform coordinate system calibration and topology checking on the imported 2D GIS boundary data, distinguish "inner boundary" from "outer boundary", and extract and interpolate DEM elevation data of the corresponding area; The extrusion and topology optimization module is used to perform vertical extrusion in stages according to the bedrock layer, building height limit, and customized height of landmark buildings based on the two-dimensional elevation boundary curve output by the data processing module, and separate the interfaces of the extrusion stages to avoid geometric overlap; The intelligent structure generation and UV mapping module is used to perform voxel meshing on the 3D land shell output by the extrusion and topology optimization modules. It also automatically unfolds the UV of the 3D surface and performs secondary optimization. It also applies an automatic islanding strategy to the concave contours and inner hole areas to complete texture mapping. The rendering integration module is used to export the 3D models output by the intelligent structure generation and UV mapping modules as FBX files, and automatically generate different LOD levels based on distance. At the same time, a custom shader system is applied in Unity based on the FBX file to achieve real-time switching of multiple rendering styles.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method for automatically generating three-dimensional map boundaries based on the Unity engine are implemented in any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for automatically generating a three-dimensional map boundary based on the Unity engine according to any one of claims 1 to 7 are implemented.