Method and device for generating three-dimensional building model
By acquiring the original outline vector data of buildings, using data processing tools to generate standardized geographic data and construct 3D mesh data, the problems of accuracy, efficiency and applicability of 3D building modeling in existing technologies are solved, and high-quality 3D building model generation and physical collision detection are achieved.
Patent Information
- Application Number
- CN202511750410.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-26
- Publication Date
- 2026-02-24
AI Technical Summary
Existing technologies have shortcomings in terms of accuracy, efficiency, and applicability in 3D building modeling. Manual modeling is inefficient, tilted models are coarse and costly, point cloud modeling equipment is expensive and cannot meet the requirements of physical collision detection, and GeoJSON file processing and model optimization are inadequate.
By acquiring the original outline vector data of the building, standardized geographic data, including height attribute data, is generated using data processing tools. Three-dimensional mesh data is constructed and vertically stretched to generate a three-dimensional model of the building, and physical collision attributes are added to the static mesh.
It improves the accuracy and efficiency of 3D modeling, generates high-quality 3D building models, has strong applicability, and can realize physical collision detection and efficient large-scale building group modeling.
Smart Images

Figure CN121564276A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of infrastructure and IT (Information Technology) support technology, and in particular to a method and apparatus for generating three-dimensional building models. Background Technology
[0002] With the rapid development of smart applications such as smart cities, smart parks, and smart campuses, 3D building models play a crucial role in these applications. 3D models not only help users better understand and manage various facilities and resources in cities, parks, and campuses, but also significantly improve the efficiency and quality of urban planning, construction, and management. Furthermore, 3D models provide rich data support for smart city and smart park applications, enabling a more comprehensive understanding of various issues within cities, parks, and campuses, thus allowing for the development of more scientific and rational solutions.
[0003] When constructing 3D scenes, in addition to core building models, it is often necessary to introduce large-scale building complexes to fill the scene, preventing it from being too empty and enhancing its overall aesthetics. Unreal Engine (UE), with its powerful rendering and simulation capabilities, has quickly become the mainstream engine for digital twin visualization. To build large-scale building models in Unreal Engine, the following methods are commonly used: manual modeling, tilted models, point cloud modeling, and modeling using GeoJSON files.
[0004] However, existing technologies have many shortcomings in practical applications. While manual modeling can achieve high-precision models, it requires highly skilled modelers, is cumbersome and inefficient, and is prone to losing materials and textures during format conversion. Tilt models, although low-cost, are coarse and inaccurate in structural representation, requiring extensive manual correction. Point cloud modeling faces the problems of expensive equipment and high professional requirements, and cannot meet the needs of applications based on physical collision detection. Using GeoJSON files for modeling also suffers from insufficient processing of the original files and optimization of model effects, and cannot achieve physical collision detection.
[0005] In summary, existing technologies have varying degrees of shortcomings in terms of accuracy, efficiency, and applicability in 3D building modeling. Summary of the Invention
[0006] This application provides a method and apparatus for generating a three-dimensional building model to solve the technical problems of varying degrees of defects in the accuracy, efficiency and applicability of existing technologies in three-dimensional building modeling.
[0007] To solve the above-mentioned technical problems, this application is implemented as follows:
[0008] In a first aspect, embodiments of this application provide a method for generating a three-dimensional building model, the method comprising:
[0009] Obtain the original outline vector data of the building to be modeled, and process the original outline vector data using a data processing tool to obtain standardized geographic data, wherein the standardized geographic data includes the height attribute data of the building to be modeled.
[0010] Based on the standardized geographic data, generate three-dimensional mesh data of the foundation of the building to be modeled;
[0011] Based on the outline shape of the base defined by the three-dimensional mesh data, the edges of the outline shape are vertically stretched according to the height attribute data to construct a three-dimensional building model.
[0012] Optionally, after constructing a 3D building model by vertically stretching the edges of the contour shape based on the contour shape of the base defined by the 3D mesh data according to the height attribute data, the method further includes:
[0013] Configure the 3D building model as a static mesh for the game engine, and add physical collision properties to the static mesh.
[0014] Optionally, the standardized geographic data may further include: a unique identifier for the building to be modeled and geometric information of the outline of the building to be modeled, defined by a sequence of latitude and longitude coordinates;
[0015] The process involves acquiring the original outline vector data of at least one building to be modeled, and then processing the original outline vector data using a data processing tool to obtain standardized geographic data, including:
[0016] Obtain the original outline vector data of at least one building to be modeled, and perform fusion and split processing on the original outline vector data based on the data processing tool to obtain the geometric information of the outline of the building to be modeled, defined by the latitude and longitude coordinate sequence, corresponding to each of the at least one building to be modeled.
[0017] Add the corresponding unique identifier and the corresponding height attribute data to the geometric information of the outline of the building to be modeled, which is defined by the latitude and longitude coordinate sequence, to obtain the standardized geographic data;
[0018] The standardized geographic data is converted to GeoJSON format and stored in GeoJSON format.
[0019] Optionally, the standardized geographic data further includes: a unique identifier for the building to be modeled and geometric information of the building's outline defined by a sequence of latitude and longitude coordinates; the three-dimensional mesh data includes base vertex data and base index data; generating the three-dimensional mesh data of the base of the building to be modeled based on the standardized geographic data includes:
[0020] The latitude and longitude coordinate sequence is converted into the world coordinate system coordinates of the game engine to obtain the base vertex data;
[0021] The base vertex data is triangulated to generate base index data that defines the connection relationships between the three vertices of a triangle.
[0022] Optionally, the three-dimensional mesh data includes base vertex data and base index data; based on the outline shape of the base defined by the three-dimensional mesh data, the edges of the outline shape are vertically stretched according to the height attribute data to construct a three-dimensional architectural model, including:
[0023] Traverse the edges of the contour shape of the base defined by the base vertex data, and vertically stretch each edge into a rectangular wall according to the height attribute data to generate wall vertex data and wall index data;
[0024] Copy the base vertex data, use the height attribute data as the height value of the roof vertex data to obtain the roof vertex data, and directly reuse the base index data as the roof index data;
[0025] The wall vertex data, wall index data, roof vertex data, and roof index data are combined to form the three-dimensional building model.
[0026] Optionally, configuring the architectural 3D model as a static mesh for the game engine includes:
[0027] Calculate the normal vector of each vertex in the 3D building model, and normalize the normal vector.
[0028] Configure the 3D building model, which includes normalized normal vectors, as the static mesh.
[0029] Optionally, adding physical collision properties to the static mesh includes:
[0030] Obtain the physical configuration object of the static mesh and configure the physical configuration object to disable the default simplified collider generation of the game engine, while enabling complex collision mode and two-sided collision detection. The complex collision mode directly uses the rendered mesh of the static mesh for collision detection.
[0031] The geometric data of the rendered mesh of the static mesh is converted into physical mesh data that can be recognized by the physics engine in the game engine, and the physical mesh data is set as the collision geometry of the physical body configuration object.
[0032] Secondly, embodiments of this application provide an apparatus for generating a three-dimensional building model, the apparatus comprising:
[0033] The acquisition module is used to acquire the original outline vector data of the building to be modeled, and to process the original outline vector data based on the data processing tool to obtain standardized geographic data, wherein the standardized geographic data includes the height attribute data of the building to be modeled.
[0034] The execution module is used to generate three-dimensional mesh data of the base of the building to be modeled based on the standardized geographic data;
[0035] Based on the outline shape of the base defined by the three-dimensional mesh data, the edges of the outline shape are vertically stretched according to the height attribute data to construct a three-dimensional building model.
[0036] Thirdly, embodiments of this application provide a network device, including: a processor, a memory, and a program stored in the memory and executable on the processor, wherein when the program is executed by the processor, it implements the steps of the method for generating a three-dimensional building model as described in the first aspect.
[0037] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the method for generating a three-dimensional building model as described in the first aspect.
[0038] Fifthly, embodiments of this application provide a computer program product, including computer instructions, which, when executed by a processor, implement the steps of the method for generating a three-dimensional building model as described in the first aspect.
[0039] In this embodiment, by acquiring the original outline vector data of the building to be modeled and processing it using data processing tools, standardized geographic data can be effectively generated, which includes the height attribute data of the building. This process, by standardizing the original data, ensures data consistency and accuracy, laying a solid foundation for subsequent 3D modeling. Next, 3D mesh data of the building's base is generated based on the standardized geographic data, giving the model a good structural foundation. Furthermore, combining the 3D mesh data and height attribute data, and using the outline shape of the base defined by the 3D mesh data as a basis, the edges of the outline shape are vertically stretched according to the height attribute data to construct the 3D building model. This process not only improves the model's accuracy but also significantly enhances modeling efficiency. Compared to traditional manual modeling and other modeling methods, this modeling method based on standardized data and automated calculation significantly improves accuracy and avoids the errors and inefficiencies commonly found in manual modeling. In addition, using standardized geographic data improves the model's applicability, making the modeling process for different buildings more consistent and efficient, generating high-quality 3D building models. Attached Figure Description
[0040] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:
[0041] Figure 1 A flowchart illustrating a method for generating a three-dimensional building model, as provided in an embodiment of this application;
[0042] Figure 2 This is a schematic diagram of a bottom-stretched box body provided in an embodiment of this application;
[0043] Figure 3 A schematic diagram of a side wall modeling provided for an embodiment of this application;
[0044] Figure 4 A flowchart illustrating a method for generating a three-dimensional building model, as provided in an embodiment of this application;
[0045] Figure 5 A structural block diagram of a device for generating a three-dimensional building model provided in an embodiment of this application;
[0046] Figure 6 This is a structural block diagram of a network device provided in an embodiment of this application. Detailed Implementation
[0047] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0048] Figure 1 This paper illustrates a method for generating a three-dimensional building model according to an embodiment of this application, such as... Figure 1 As shown, the method includes:
[0049] Step S101: Obtain the original outline vector data of at least one building to be modeled, and process the original outline vector data using a data processing tool to obtain standardized geographic data;
[0050] The standardized geographic data includes the height attribute data of the building to be modeled.
[0051] Step S102: Generate 3D mesh data of the foundation of the building to be modeled based on standardized geographic data;
[0052] Step S103: Based on the outline shape of the base defined by the 3D mesh data, the edges of the outline shape are vertically stretched according to the height attribute data to construct a 3D building model.
[0053] The data processing tool could be QGIS (Quantum Geographic Information System). QGIS is an open-source, cross-platform geographic information system desktop application that provides users with the ability to collect, edit, store, analyze, manage, and visualize geospatial data.
[0054] It should be noted that the method for generating 3D building models described in this application aims to transform raw 2D geographic information into 3D models with geometric shape and physical interaction capabilities that can be directly used in game engines through a systematic process. First, the original outline vector data of the building to be modeled is acquired, and this data is processed using professional data processing tools. Through operations such as fusion and splitting, the outline geometric information of each building, defined by a precise latitude and longitude coordinate sequence, is extracted. Then, a unique identifier and key height attribute data are assigned to each building. Finally, the standardized geographic data format is converted to GeoJSON format and stored, laying the data foundation for subsequent automated modeling.
[0055] Subsequently, by parsing standardized geographic data, geographic coordinates are converted into world coordinates for the game engine, forming vertex data for the building's foundation. This data is then triangulated to construct mesh index data defining the foundation plane. Finally, the core modeling operation is completed through extrusion calculations. Using the foundation's 3D mesh data and height attribute data, each contour edge of the foundation is vertically extruded to generate the wall mesh. Simultaneously, the foundation vertices are copied and raised to form the roof, thus combining the walls, roof, and foundation into a closed 3D architectural model.
[0056] Figure 1 The method shown can model directly using GeoJSON building vector outline data within a high-rendering game engine, Unreal Engine, without relying on modeling software. It uses triangulation and extrusion based on building height data to create the top and surrounding walls, and can utilize multiple materials and collision methods. This improves the efficiency of large-scale building complex modeling and 3D scene construction, saves labor costs, and generates high-quality models. Thus, it enables efficient and automated conversion from building outline data with height attributes to 3D solid models that can be immediately integrated into virtual environments.
[0057] In one possible implementation, after constructing a 3D building model by vertically stretching the edges of the outline shape based on the contour shape of the base defined by 3D mesh data according to the height attribute data, the method further includes: configuring the 3D building model as a static mesh of the game engine and attaching physical collision attributes to the static mesh.
[0058] It's important to note that after constructing the 3D architectural model through stretching calculations, it needs to be successfully integrated into the game engine's runtime environment. Specifically, the model data needs to be configured as a resource object recognized by the game engine: a static mesh. This involves more than just data format conversion; it also means injecting rendering and interactive attributes that the engine can handle into the model. Adding physical collision attributes to the static mesh is a crucial step. This is achieved by configuring specific physics parameters, disabling the engine's default simplified collider generation method, and instead enabling a complex collision mode. The core of this mode is to directly use the static mesh's own precisely rendered mesh as the basis for collision detection. Subsequently, the system will convert the geometric data of this rendered mesh into physical mesh data recognizable by the underlying physics engine and officially set it as the collision geometry.
[0059] This allows the generated 3D building model to be transformed from a purely visual model into an object with physical properties in the virtual world. Every surface of the building, such as its walls and roof, can perform precise collision detection and interaction with other dynamic objects in the game (such as characters and bullets), thus laying the foundation for building a believable and interactive virtual city scene.
[0060] In one possible implementation, attaching physical collision properties to a static mesh includes: obtaining a physical configuration object for the static mesh and configuring the physical configuration object to disable the game engine's default simplified collider generation, while enabling complex collision mode and two-sided collision detection. The complex collision mode directly uses the rendered mesh of the static mesh for collision detection; converting the geometric data of the rendered mesh of the static mesh into physical mesh data that can be recognized by the physics engine in the game engine, and setting the physical mesh data as the collision geometry of the physical configuration object.
[0061] It should be further explained that the core operation in the specific implementation of adding physical collision attributes to a static mesh is a deep configuration of the physical configuration object of the static mesh. This process first requires setting key parameters of the obtained physical configuration object. The purpose is to abandon the simplified automatic collision generation method commonly used by game engines to improve performance, which is insufficient in precision, and instead explicitly enable complex collision mode and simultaneously enable two-sided collision detection function.
[0062] The complex collision mode here essentially uses the rendered mesh of the static mesh used for graphics display directly as the basis for collision judgment in the physics simulation, thus ensuring absolute consistency between physical boundaries and visual outlines. Next, the geometric data of the rendered mesh that constitutes the appearance of the static mesh is transformed through specific processing to generate dedicated physical mesh data that the game engine's underlying physics engine can recognize and process. Finally, this high-precision physical mesh data is officially designated as the collision geometry corresponding to the physics configuration object.
[0063] This gives the static mesh of the building a precise collision volume that perfectly matches its complex visualization model, so that both the building's facade and internal spatial structure (thanks to dual-sided collision detection) can produce expected physical interactions with moving objects in the game, thereby establishing a realistic and credible spatial obstruction and collision interaction relationship in the virtual environment.
[0064] In one possible implementation, the standardized geographic data further includes: a unique identifier for the building to be modeled and geometric information of the building's outline defined by a latitude and longitude coordinate sequence; acquiring the original outline vector data of at least one building to be modeled, and processing the original outline vector data using a data processing tool to obtain standardized geographic data, including: acquiring the original outline vector data of at least one building to be modeled, and performing fusion and splitting processing on the original outline vector data using a data processing tool to obtain the geometric information of the outline of each building to be modeled, defined by a latitude and longitude coordinate sequence; adding a corresponding unique identifier and corresponding height attribute data to the geometric information of the outline of the building to be modeled, defined by the latitude and longitude coordinate sequence, to obtain standardized geographic data; converting the format of the standardized geographic data to GeoJSON format and storing the GeoJSON format standardized geographic data.
[0065] It should be noted that, in the processing stage after acquiring the original contour vector data, the core of this method lies in using data processing tools to deeply process the original data to form standardized geographic data. First, the original contour vector data of at least one building to be modeled is fused and split. The direct purpose is to clearly separate each independent building to be modeled from potentially messy or related data, and accurately extract the geometric information of its contour defined by the latitude and longitude coordinate sequence.
[0066] Subsequently, the system assigns two key attributes to each extracted contour geometry: a unique identifier used to uniquely identify the building in subsequent processes, and height attribute data—a core parameter determining the height of its 3D model. After adding these attributes, the standardized geographic data is converted to GeoJSON format and stored as GeoJSON-formatted standardized geographic data.
[0067] The overall effect of this series of operations is to transform raw vector data from different sources and with potentially different formats into a standardized data format that is structurally unified, information-complete, and machine-readable. This file not only records the plan shape and spatial location of each building, but also carries its identification and key height information, thus providing a solid and reliable data foundation for the subsequent fully automated 3D model generation process.
[0068] In one possible implementation, the standardized geographic data also includes: a unique identifier for the building to be modeled and geometric information of the building's outline defined by a sequence of latitude and longitude coordinates; the 3D mesh data includes base vertex data and base index data; generating the 3D mesh data of the base of the building to be modeled based on the standardized geographic data includes: converting the latitude and longitude coordinate sequence into the world coordinate system coordinates of the game engine to obtain the base vertex data; and performing triangulation on the base vertex data to generate base index data that defines the connection relationship between the three vertices of a triangle.
[0069] It's important to note that the core task in generating the 3D mesh data for the building's foundation is to transform the 2D planar outline defined in the standardized geographic data into a 3D mesh structure understandable by the game engine. This process begins by parsing the exported GeoJSON-formatted standardized geographic data, extracting the geometric information of the building outline defined by latitude and longitude coordinate sequences, and then precisely mapping these geographic coordinates to the game engine's world coordinate system using a coordinate transformation algorithm. This yields a series of foundation vertex data located in 3D space. Subsequently, the system performs triangulation on these foundation vertex data. This crucial step aims to decompose the potentially complex polygonal foundation plane into a series of standard meshes composed of triangles, and to explicitly define the connection relationships between the three vertices of each triangle by generating foundation index data.
[0070] The overall effect of this step is to successfully construct a 3D mesh model with clear geometric topological relationships from a geographic information dataset containing only continuous contour points. This model consists of discrete vertices and triangular patches, thus providing an accurate base mesh foundation for the subsequent generation of architectural 3D models through stretching calculations.
[0071] In one possible implementation, a 3D building model is constructed based on the outline shape of the base defined by 3D mesh data and the edges of the outline shape are vertically stretched according to the height attribute data. This includes: traversing the edges of the outline shape of the base defined by the base vertex data, vertically stretching each edge into a rectangular wall according to the height attribute data, generating wall vertex data and wall index data; copying the base vertex data, using the height attribute data value as the height value of the roof vertex data to obtain the roof vertex data, and directly reusing the base index data as the roof index data; and combining the wall vertex data, wall index data, roof vertex data, and roof index data together to form the 3D building model.
[0072] It should be noted that in the specific implementation of constructing a three-dimensional building model through stretching calculation based on three-dimensional mesh data and height attribute data, the core mechanism lies in transforming a two-dimensional base plane geometry into a three-dimensional entity with a sense of volume through vertical expansion.
[0073] First, the system systematically traverses each base contour edge defined by the base vertex data and stretches each edge vertically according to the values specified in the height attribute data, thereby generating rectangular walls corresponding to the four walls of the building. This operation produces wall vertex data describing the wall positions and wall index data defining the triangles formed by the walls. Simultaneously, to construct the roof structure, the system copies the base vertex data and uniformly assigns the height attribute data values to the height coordinates of these vertices, thus obtaining the roof vertex data located at the top of the building. For efficiency reasons, the existing base index data is directly reused as the roof index data.
[0074] Finally, by integrating the newly generated wall vertex data and wall index data with the roof vertex data and roof index data obtained after the elevation, a structurally closed 3D building model is formed.
[0075] The overall effect of this step is to quickly and accurately construct a three-dimensional building model containing vertical walls and a horizontal roof from a two-dimensional base grid that only represents the building's footprint, laying the geometric foundation for ultimately presenting the realistic three-dimensional form of the building in the virtual scene.
[0076] In one possible implementation, configuring the 3D building model as a static mesh for the game engine includes: calculating the normal vector of each vertex in the 3D building model and normalizing the normal vector; configuring the 3D building model containing the normalized normal vector as a static mesh.
[0077] It's important to note that the core of this operation is calculating the normal vector of each vertex in the 3D building model. This calculation aims to determine the orientation of the surface where each vertex is located and to normalize these normal vectors, adjusting their length to a standard unit length. Subsequently, this 3D building model, containing the normalized normal vector information, is officially configured as a static mesh resource in the game engine.
[0078] Therefore, by assigning precise and standardized normal information to the model vertices, it is ensured that the surface of the static mesh can interact correctly with the light sources in the scene when it is rendered by the game engine, thus presenting a light and shadow transition and shadow effect that conforms to three-dimensional stereoscopic perception, which greatly enhances the visual realism and three-dimensionality of the building model in the virtual environment.
[0079] In summary, in this embodiment, by acquiring the original outline vector data of the building to be modeled and processing it using data processing tools, standardized geographic data can be effectively generated, which includes the height attribute data of the building. This process, by standardizing the original data, ensures data consistency and accuracy, laying a solid foundation for subsequent 3D modeling. Next, 3D mesh data of the building's base is generated based on the standardized geographic data, giving the model a good structural foundation. Furthermore, by combining the 3D mesh data and height attribute data, a 3D building model is constructed through stretching calculations. This process not only improves the model's accuracy but also significantly enhances modeling efficiency. Compared to traditional manual modeling and other modeling methods, this modeling approach based on standardized data and automated calculations significantly improves accuracy and avoids the errors and inefficiencies commonly found in manual modeling. In addition, using standardized geographic data improves the model's applicability, making the modeling process for different buildings more consistent and efficient, generating high-quality 3D building models.
[0080] This paper will now provide an overview of a method for generating a three-dimensional building model as shown in the embodiments of this application. First, it will introduce some basic principles upon which the embodiments of this application rely, such as... Figure 2 As shown in the embodiment of this application, the architectural white model of the method only has the four sides and the top surface, and does not use the bottom surface (the bottom surface will be covered by the terrain, and the bottom surface does not need to be observed during normal browsing, so the method shown in the embodiment of this application does not model the bottom surface), and the vertex data in the vertex array is cut into triangle vertices.
[0081] The modeling principle of the side is as follows Figure 3 As shown, in order to calculate the normals and texture coordinates UV (U and V represent the horizontal and vertical axes of the 2D texture, respectively), the side faces not only do not share vertices with the top face, but also adjacent side faces do not share vertices (e.g., Figure 3 As shown in the figure, each vertex of the side will be used twice, that is, the number of triangles is N*2, and the final number of vertices used on the side is N*4, where N is the number of sides of the building.
[0082] Furthermore, when calculating normals and texture coordinates, normals can be calculated directly using the cross product of vectors. If a = (1, 0, 0) and b = (0, 1, 0), then the normal vector is: n = (0·0 - 0·1, 0·0 - 1·0, 1·1 - 0·0) = (0,0, 1) (i.e., the z-axis direction perpendicular to the xy plane). Texture coordinates can be calculated using the difference between the coordinates of the vertex and the starting point and the size of the texture tile.
[0083] The method shown in this embodiment can be applied to a large-scale building complex modeling and rapid 3D scene construction system, the system comprising:
[0084] Data preprocessing module: Performs fusion and splitting operations on building outline vector data to solve the building fragmentation problem caused by map tiling, adds unique identifiers and height fields, and exports it as a GeoJSON file (i.e., standardized geographic data in GeoJSON format) to provide standardized data for subsequent modeling.
[0085] Data parsing and conversion module: Loads the content of GeoJSON file into memory and parses it, extracts key information, and converts latitude and longitude coordinates into UE coordinates to provide location basis for Unreal Engine to generate buildings.
[0086] The geometry generation module triangulates the parsed building base outline data, arranges the vertices appropriately, generates triangle indices, stores the polygon data into the model set, and constructs the basic geometric structure for building modeling; it traverses the polygon data, generates wall vertices and indices, creates the top polygon, and completes the initial construction of the building from a two-dimensional outline to a three-dimensional solid structure, while also handling related attribute settings.
[0087] Rendering optimization module: Calculates and normalizes normal vectors based on triangle vertex data to eliminate rendering artifacts, ensures the accuracy of lighting and shadow representation of the building model, and improves rendering effects; generates geometric data and rendering resources for static meshes, calculates bounding boxes, defines hierarchical details, binds materials, and completes various preparatory work before model rendering.
[0088] Physics Interaction Module: Configures high-precision, two-sided collision custom physical properties for static mesh components, initializes collision parameters and sets the chaos physical mesh to achieve realistic physical interaction and prevent scene clipping.
[0089] Based on this system, this application proposes a method for large-scale building complex modeling and rapid 3D scene construction, which can be referred to. Figure 4 The specific implementation steps are as follows:
[0090] 1. Data Preprocessing: Building outline vector data is preprocessed using QGIS's Dissolve and Multipart to Singlepart operations to resolve building fragmentation issues caused by map tiling. This ensures each building outline is an independent polygon, allowing the repaired data to be directly used for high-precision modeling and avoiding geometric errors (such as gaps and overlaps) caused by tile boundaries. Explicitly added unique identifiers and height fields provide foundational data support for subsequent individualized modeling and physical interaction. The preprocessed original building outline vector data includes the building's floor number and latitude and longitude information, including multi-feature splitting, addition of unique identifier attribute fields, and GeoJSON file export. This can be divided into the following steps:
[0091] (1) Due to the map tiling, buildings at the intersection of tiles will be cut off. QGIS is used to process and the tile boundary vector geometry is dissolved. The fusion attribute field is selected as the number of floors.
[0092] (2) The fusion will merge all features with the same building height into one feature, that is, Polygon to MultiPolygon. Here, it is necessary to split and convert multiple features into single features. In QGIS, vector geometry performs MultiPart to signleParts, and each building outline is a separate data block, which makes subsequent building individualization easier to process.
[0093] (3) Add a unique identifier field uniqueId. First, add an integer field UniqueId. In QGIS, update the data using the field calculator to make it unique.
[0094] (4) Add a height field and calculate based on the floor number segment, using the following formula:
[0095] Height = Floor × H + C;
[0096] Wherein, Floor is the number of floors in the building, in units of floors; H is the preset standard height of a single floor, in units of meters per floor; C is the preset additional height of the roof structure, in units of meters; and Height is the calculated total height of the building, in units of meters.
[0097] As a preferred implementation method, the standard height H of a single floor is taken as 3 meters, and the additional height C of the roof structure is taken as 1 meter. The calculation formula is: Height = Floor × 3 + 1.
[0098] (5) Set the latitude and longitude coordinate reference system WGS84 for the building outline data, process the coordinates and store them in Geometry, store the processed building outline data UniqueId and height in feature, and export the GeoJSON file.
[0099] 2. GeoJSON Data Parsing: Load the contents of the GeoJSON file into memory, parse the JSON data in memory, extract the features array from the GeoJSON data, traverse each features array, extract attributes, parse the unique ID and height, extract geometric information such as latitude and longitude, and convert the latitude and longitude information into UE coordinates to facilitate finding the corresponding location in Unreal Engine to generate buildings.
[0100] 3. Triangulation: The parsed building base contour data is triangulated. Each individual building base contour data point is sequentially traversed, using its latitude and longitude as vertices, arranged clockwise. If the building is ring-shaped with a hole in the middle, the coordinates of the points above the hole are arranged counter-clockwise. Every three consecutive vertices form a triangle, and the index value of each triangle corresponds to the sequence number of the coordinates in the input building base contour data. The processed building base contour polygon data is stored in the model collection ModelSData. It should be noted that the clockwise or counter-clockwise arrangement is not restricted and can be flexibly set according to actual needs.
[0101] 4. Raise the building base outline: Iterate through each polygon data in ModelsData and perform the following operations on each polygon:
[0102] (1) Generate wall vertices: Vertex calculation: Generate 4 vertices for each polygon edge (current point → next point), namely, left bottom (LeftBottom), left top (LeftTop), right top (RightTop), and right bottom (RightBottom). The coordinates of the top of each wall are superimposed with the Z-axis coordinates according to the stair height value; UV mapping: Set the first channel, i.e., texture coordinates, set the bottom UV to (0,0), and the top UV to (0,1). The second channel stores the unique ID of the building for passing custom data UV (used for subsequent material parameter queries); Bounding box generation: Update the global bounding box. For the X-coordinate of the bottom left (LeftBottom) of the wall, compare the current global minimum X-component with the input vertex X-component, and update MinPosition.x with the smaller one. Compare the current global maximum X-component with the input vertex X-component, and update MaxPosition.x with the larger one. For the Y-coordinate, compare the current global minimum Y-component with the input vertex Y-component, and update MinPosition.Y with the smaller one. Compare the current global maximum Y-component with the input vertex Y-component, and update MaxPosition.Y with the larger one. For the Z-coordinate, compare the current global minimum Z-component with the input vertex Z-component, and update MinPosition.Z with the larger one. Compare the current global maximum Z-component with the input vertex Z-component, and update MaxPosition.Z with the larger one. Repeat the above steps to set the top left (LeftTop), top right (RightTop), and bottom right (RightBottom).
[0103] (2) Generate wall index: Generate 2 triangles for each wall. The first triangle is in the order of bottom left vertex, top left vertex, top right vertex. The second triangle is in the order of bottom left vertex, top right vertex, bottom right vertex.
[0104] Triangle 1: Bottom left → Top left → Top right
[0105] Triangle 2: Bottom left → Top right → Bottom right
[0106] The indices are appended to the Indices array in the order shown above.
[0107] (3) Generate top polygon: Vertex generation: For each vertex of the polygon, generate the top vertex (height = building height), set the first channel, i.e. texture coordinates, set the bottom UV to (0,0), and set the top UV to (0,1). The second channel stores the building's unique ID (for subsequent material parameter queries) to pass custom data UV. Index generation: Directly use the Indices output by triangulation, and offset the index value to the starting position of the top vertex.
[0108] 5. Normal Calculation: A normal is a unit vector in 3D space that is perpendicular to the tangent plane at a point on a surface. For a plane, the direction of the normal is unique; for a curved surface (such as a sphere), the normal changes continuously with the curvature of the surface and always points outward from the surface. It directly affects lighting, shadows, and rendering effects.
[0109] The vertex data within `Indices` is processed in units of triangles, with each iteration processing one triangle (3 indices). Based on the three index values V0, V1, and V2 of the current triangle, the corresponding vertex reference is retrieved from the vertex array `vertices`, and the edge vectors are calculated. Two edge vectors, V01 and V02, are defined: v01: a vector pointing from v0 to v1, and v02: a vector pointing from v0 to v2. The Y-coordinates of V01 and V02 are then inverted. Next, the normal vector is obtained by cross-product of v01 and v02, and the Y-coordinates of V01 and V02 are inverted again to normalize the normal vector to a unit vector. This avoids rendering issues caused by inconsistent vector lengths and eliminates potential seam imperfections (such as dark spots caused by inconsistent normals between adjacent faces) that may arise from automated calculations.
[0110] 6. Rendering Data Configuration: This involves procedurally generating the geometry and rendering resources for static meshes within Unreal Engine. This primarily involves defining mesh sections, binding materials, and initializing resources. Specifically:
[0111] (1) Bounding box calculation: The bounding box is initialized by using the MinPosition in the lower left corner and the MaxPosition in the upper right corner to determine the range of the mesh in three-dimensional space, which is used for subsequent physical collision and lighting calculations. The bounding box is decomposed into the center point (Origin) and the half-length vector (BoxExtent). The buffer for storing vertex positions is initialized. The buffer is used to store vertex attributes (such as UV, normal, tangent, etc.) later. 32-bit high-precision UV coordinates are enabled (the default is 16-bit). High-precision UV can avoid the precision problem when sampling textures (such as texture flickering of distant models) and allow the rendering system to quickly calculate spatial relationships.
[0112] (2) Define the level of detail: Add a default initialized FStaticMeshSection to the Sections array of LOD (Level of Detail) resources for each wall and top mesh of each building model. This can balance rendering performance and detail. Each Section represents a sub-part of the mesh (such as a region with different materials), and enable collision detection and shadow casting for the Section. Then create dynamic material instances and add them to the material slots of the static mesh. The material slot name corresponds to a material index of the mesh.
[0113] 7. Collision Settings: Construct realistic physical interactions to prevent clipping through 3D scenes. Interactions within the scene will generate responses. Configure high-precision, two-sided collision custom physical properties for static mesh components. Suitable for accurate physical simulation of complex geometries (such as thin sheets and decorations).
[0114] (1) Initialize collision parameters: disable the simplified collision (such as convex hull, sphere) generated by the engine by default, allow fully custom collision geometry, obtain the physical body configuration object (UBodySetup) of the static mesh, which stores the physical properties of the mesh (such as collision data, physical material, etc.), set the collision tracking flag to "use complex geometry as simple collision", and allow collision detection on the front and back of the mesh, support the physical simulation of thin sheet geometry (such as glass curtain wall, decorative panel), and avoid the default single-sided collision ignoring back interaction.
[0115] (2) Setting up the Chaos physics mesh: Create a Chaos particle container to store the 3D position information of the vertex data. Iterate through the vertex data and assign the Position of each vertex to the X(i) attribute of the particle array (X(i) represents the position of the i-th particle (in the Chaos engine, particles represent geometric points)). The purpose is to convert the vertices of the static mesh created by the vertex position data of the engine into the particle format of the Chaos physics engine. Divide the number of vertex indices by 3 to get the total number of triangle faces. Iterate through the triangle faces and construct a Chaos physics mesh for each face.
[0116] In summary, this application proposes an automatic generation method for 3D building models. Through data processing tools, it preprocesses building outline vector data, parses GeoJSON files, transforms coordinates, triangulates and constructs a basic model, processes polygon data to generate wall information, and calculates normals. This method can programmatically generate geometric data and rendering resources for static meshes, enabling efficient rendering in Unreal Engine. Simultaneously, it features high-precision collision detection, enhancing the realism and interactivity of the 3D scene, thus optimizing rendering effects and improving user experience. It successfully solves technical challenges such as data fragmentation and lack of consistency, achieving high-precision modeling, improving modeling efficiency, reducing costs, and meeting the needs of high-precision 3D scene construction.
[0117] Compared with the prior art, the method for generating three-dimensional building models shown in the embodiments of this application has the following advantages: The proposal of this application uses GeoJSON building vector contour data for triangulation in Unreal Engine and stretching based on building height data to create the top surface and the surrounding walls respectively. It has two advantages: 1) It can create multiple materials and collisions for a single building, and 2) It improves the efficiency of modeling and three-dimensional scene building.
[0118] Compared with the three traditional methods for creating large-scale building models—manual modeling, oblique modeling, point cloud modeling, and GeoJSON-generated data—this application proposal has the following significant technical advantages:
[0119] 1. Comprehensiveness of Data Processing: This application performs in-depth preprocessing on the building outline vector data. Addressing the building fragmentation issue caused by map tiling, it ensures that each building outline is an independent polygon through fusion and splitting operations, correcting geometric errors such as gaps and overlaps. In contrast, existing technologies only mention reading GeoJSON data without addressing the repair and optimization of the data itself, making their data quality assurance less comprehensive than that of this application.
[0120] 2. Enriched Data Attributes: This application explicitly adds unique identifiers and height fields during preprocessing, providing fundamental data support for subsequent individual building modeling and physical interaction, thus giving building data more attribute information that can be used for analysis and manipulation. Existing technologies do not enrich or expand data attributes.
[0121] 3. Modeling Process: This application starts with triangulation and systematically constructs a 3D model of the building through a series of steps, including raising the building base outline, generating wall vertices and indices, and generating top polygons, taking into account the details and structure of each part of the building. Existing technologies focus on the visualization of GeoJSON data and do not elaborate on the model construction process, thus falling short of this application in terms of modeling quality and detail.
[0122] 4. Richness of Rendering and Interaction Functions: This application provides detailed rendering data configuration within the Unreal Engine, including bounding box calculation, Level of Detail (LOD) definition, material binding, and resource initialization. By setting the LOD, rendering performance and detail can be balanced, and high-precision UV coordinates can be enabled to avoid texture sampling issues. This provides the rendering system with a wealth of configuration options to achieve high-quality rendering effects. While existing technologies mention material writing, their overall rendering settings are not as detailed and comprehensive as those in this application.
[0123] 5. Improved Physical Interaction: This application sets collision parameters, creates chaotic physical meshes, and constructs realistic physical interactions. This prevents clipping during 3D scene navigation and enables responsive interactions within the scene, making it suitable for accurate physical simulation of complex geometries. Existing technologies do not address physical interaction, thus lacking in scene interactivity and realism.
[0124] Figure 5 An apparatus for generating a three-dimensional building model according to an embodiment of this application is shown, such as... Figure 5 As shown, the device 50 includes:
[0125] The acquisition module 501 is used to acquire the original outline vector data of at least one building to be modeled, and to process the original outline vector data based on a data processing tool to obtain standardized geographic data, wherein the standardized geographic data includes the height attribute data of the building to be modeled.
[0126] The execution module 502 is used to generate three-dimensional mesh data of the base of the building to be modeled based on the standardized geographic data; and to construct a three-dimensional model of the building by vertically stretching the edges of the outline shape based on the height attribute data, using the outline shape defined by the three-dimensional mesh data as a basis.
[0127] In one possible implementation, the execution module 502 is further configured to construct a 3D building model by vertically stretching the edges of the outline shape based on the outline shape of the base defined by the 3D mesh data and according to the height attribute data, and then configure the 3D building model as a static mesh of the game engine and attach physical collision attributes to the static mesh.
[0128] In one possible implementation, the standardized geographic data also includes: a unique identifier for the building to be modeled and geometric information of the building's outline defined by a sequence of latitude and longitude coordinates;
[0129] The acquisition module 501 is also used to acquire the original contour vector data of at least one building to be modeled, and to perform fusion and split processing on the original contour vector data based on the data processing tool to obtain the geometric information of the contour of each building to be modeled, which is defined by the latitude and longitude coordinate sequence.
[0130] To obtain standardized geographic data, the geometric information of the outline of the building to be modeled, defined by the latitude and longitude coordinate sequence, is added with a corresponding unique identifier and corresponding height attribute data.
[0131] Convert standardized geographic data to GeoJSON format and store the standardized geographic data in GeoJSON format.
[0132] In one possible implementation, the standardized geographic data also includes: a unique identifier for the building to be modeled and geometric information of the building's outline defined by a sequence of latitude and longitude coordinates; the 3D mesh data includes base vertex data and base index data; the execution module 502 is also used to convert the latitude and longitude coordinate sequence into world coordinates of the game engine to obtain base vertex data;
[0133] Triangulation is performed on the base vertex data to generate base index data that defines the connection relationships between the three vertices of a triangle.
[0134] In one possible implementation, the execution module 502 is also used to traverse the edges of the base contour shape defined by the base vertex data, and vertically stretch each edge into a rectangular wall according to the height attribute data, generating wall vertex data and wall index data.
[0135] Copy the base vertex data, use the height attribute data as the height value of the roof vertex data to obtain the roof vertex data, and directly reuse the base index data as the roof index data;
[0136] The wall vertex data, wall index data, roof vertex data, and roof index data are combined to form a 3D building model.
[0137] In one possible implementation, the execution module 502 is further configured to calculate the normal vector of each vertex in the 3D building model and normalize the normal vector; and configure the 3D building model containing the normalized normal vector as a static mesh.
[0138] In one possible implementation, the execution module 502 is further configured to obtain the physical body configuration object of the static mesh and configure the physical body configuration object to disable the game engine's default simplified collider generation, while enabling complex collision mode and two-sided collision detection. The complex collision mode directly uses the rendered mesh of the static mesh for collision detection. The geometric data of the rendered mesh of the static mesh is converted into physical mesh data that can be recognized by the physics engine in the game engine, and the physical mesh data is set as the collision geometry of the physical body configuration object.
[0139] In summary, in this embodiment, by acquiring the original outline vector data of the building to be modeled and processing it using data processing tools, standardized geographic data can be effectively generated, which includes the height attribute data of the building. This process, by standardizing the original data, ensures data consistency and accuracy, laying a solid foundation for subsequent 3D modeling. Next, 3D mesh data of the building's base is generated based on the standardized geographic data, giving the model a good structural foundation. Furthermore, by combining the 3D mesh data and height attribute data, a 3D building model is constructed through stretching calculations. This process not only improves the model's accuracy but also significantly enhances modeling efficiency. Compared to traditional manual modeling and other modeling methods, this modeling approach based on standardized data and automated calculations significantly improves accuracy and avoids the errors and inefficiencies commonly found in manual modeling. In addition, using standardized geographic data improves the model's applicability, making the modeling process for different buildings more consistent and efficient, generating high-quality 3D building models.
[0140] This application provides a network device 60, such as... Figure 6 As shown, the network device 60 includes a processor 601, a memory 602, and a program stored in the memory 602 and executable on the processor 601. When the program is executed by the processor 601, it implements the steps of a method for generating a three-dimensional building model as shown in the above embodiment.
[0141] This application also provides a computer-readable storage medium storing a computer program. When executed by a processor, the computer program implements the steps of the method for generating a three-dimensional building model as shown in the above embodiments, and achieves the same technical effect. To avoid repetition, it will not be described again here. The computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc.
[0142] This application also provides a computer program product, including computer instructions. When executed by a processor, the computer instructions implement the steps of the method for generating a three-dimensional building model as shown in the above embodiments, and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0143] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0144] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0145] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. A method for generating a three-dimensional building model, characterized in that, The method includes: Obtain the original outline vector data of the building to be modeled, and process the original outline vector data using a data processing tool to obtain standardized geographic data, wherein the standardized geographic data includes the height attribute data of the building to be modeled. Based on the standardized geographic data, generate three-dimensional mesh data of the foundation of the building to be modeled; Based on the outline shape of the base defined by the three-dimensional mesh data, the edges of the outline shape are vertically stretched according to the height attribute data to construct a three-dimensional building model.
2. The method according to claim 1, characterized in that, After constructing a 3D building model by vertically stretching the edges of the contour shape based on the height attribute data according to the contour shape defined by the 3D mesh data, the method further includes: Configure the 3D building model as a static mesh for the game engine, and add physical collision properties to the static mesh.
3. The method according to claim 2, characterized in that, The standardized geographic data also includes: a unique identifier for the building to be modeled and geometric information of the building's outline defined by a sequence of latitude and longitude coordinates; The process involves acquiring the original outline vector data of at least one building to be modeled, and then processing the original outline vector data using a data processing tool to obtain standardized geographic data, including: Obtain the original outline vector data of at least one building to be modeled, and perform fusion and split processing on the original outline vector data based on the data processing tool to obtain the geometric information of the outline of the building to be modeled, defined by the latitude and longitude coordinate sequence, corresponding to each of the at least one building to be modeled. Add the corresponding unique identifier and the corresponding height attribute data to the geometric information of the outline of the building to be modeled, which is defined by the latitude and longitude coordinate sequence, to obtain the standardized geographic data; The standardized geographic data is converted to GeoJSON format and stored in GeoJSON format.
4. The method according to claim 1, characterized in that, The standardized geographic data also includes: a unique identifier for the building to be modeled and geometric information of the building's outline defined by a sequence of latitude and longitude coordinates; the 3D mesh data includes base vertex data and base index data; generating the 3D mesh data of the base of the building to be modeled based on the standardized geographic data includes: The latitude and longitude coordinate sequence is converted into the world coordinate system coordinates of the game engine to obtain the base vertex data; The base vertex data is triangulated to generate base index data that defines the connection relationships between the three vertices of a triangle.
5. The method according to claim 1, characterized in that, The three-dimensional mesh data includes base vertex data and base index data; based on the outline shape of the base defined by the three-dimensional mesh data, the edges of the outline shape are vertically stretched according to the height attribute data to construct a three-dimensional architectural model, including: Traverse the edges of the contour shape of the base defined by the base vertex data, and vertically stretch each edge into a rectangular wall according to the height attribute data to generate wall vertex data and wall index data; Copy the base vertex data, use the height attribute data as the height value of the roof vertex data to obtain the roof vertex data, and directly reuse the base index data as the roof index data; The wall vertex data, wall index data, roof vertex data, and roof index data are combined to form the three-dimensional building model.
6. The method according to claim 2, characterized in that, Configuring the 3D building model as a static mesh for the game engine includes: Calculate the normal vector of each vertex in the 3D building model, and normalize the normal vector. Configure the 3D building model, which includes normalized normal vectors, as the static mesh.
7. The method according to claim 2, characterized in that, Adding physical collision properties to the static mesh includes: Obtain the physical configuration object of the static mesh and configure the physical configuration object to disable the default simplified collider generation of the game engine, while enabling complex collision mode and two-sided collision detection. The complex collision mode directly uses the rendered mesh of the static mesh for collision detection. The geometric data of the rendered mesh of the static mesh is converted into physical mesh data that can be recognized by the physics engine in the game engine, and the physical mesh data is set as the collision geometry of the physical body configuration object.
8. A device for generating three-dimensional building models, characterized in that, The device includes: The acquisition module is used to acquire the original outline vector data of the building to be modeled, and to process the original outline vector data based on the data processing tool to obtain standardized geographic data, wherein the standardized geographic data includes the height attribute data of the building to be modeled. The execution module is used to generate three-dimensional mesh data of the base of the building to be modeled based on the standardized geographic data; Based on the outline shape of the base defined by the three-dimensional mesh data, the edges of the outline shape are vertically stretched according to the height attribute data to construct a three-dimensional building model.
9. A network device, characterized in that, include: A processor, a memory, and a program stored in the memory and executable on the processor, wherein the program, when executed by the processor, implements the steps of the method for generating a three-dimensional building model 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, implements the steps of the method for generating a three-dimensional building model as described in any one of claims 1 to 7.
11. A computer program product, characterized in that, It includes computer instructions, which, when executed by a processor, implement the steps of the method for generating a three-dimensional building model as described in any one of claims 1 to 7.