Model duplicate removal method and device based on unreal engine, equipment and storage medium

By generating vertex sets in Unreal Engine and grouping them using a hash algorithm, calculating the geometric center coordinates and mesh file volume, and accurately replacing duplicate models, the problems of inaccurate identification and inaccurate replacement of duplicate models are solved, improving storage efficiency and visual effects.

CN121962548APending Publication Date: 2026-05-01SHANGHAI ZULE INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHANGHAI ZULE INFORMATION TECHNOLOGY CO LTD
Filing Date
2025-12-01
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

In the construction of 3D scenes based on Unreal Engine, inaccurate judgment of duplicate models and imprecise replacement positions and angles lead to redundant consumption of storage resources and poor visual effects.

Method used

By obtaining the original vertex coordinates, world coordinates, and rotation angles of the model, a vertex set is generated and converted into a feature code matrix. The vertex set is then grouped using a hash algorithm, and the geometric center coordinates and position offsets are calculated. The mesh file volume is read to determine the baseline and the model to be replaced, and the replacement is performed based on the position offsets and rotation angles.

Benefits of technology

It improves the accuracy of duplicate model filtering, reduces redundant consumption of storage resources and engine loading pressure, while ensuring the integrity of visual effects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121962548A_ABST
    Figure CN121962548A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a model deduplication method and device based on an unreal engine, equipment and a storage medium, and the method comprises the steps: obtaining a plurality of original vertex coordinates, world coordinates and rotation angles of each model, and generating a vertex set corresponding to each model based on a preset sorting rule and the plurality of original vertex coordinates; calculating a characteristic value corresponding to each vertex set, and grouping the plurality of models according to each characteristic value to obtain a plurality of repeated model groups; calculating a geometric center coordinate of each model according to a plurality of vertex coordinates in each vertex set, and calculating a position offset of a world coordinate and the geometric center coordinate of each model; and determining a reference model and a to-be-replaced model in each repeated model group based on each read grid file volume, and replacing the to-be-replaced model with the corresponding reference model based on the position offset and the rotation angle. The accuracy of repeated model screening and the accuracy of the to-be-replaced position and the to-be-replaced angle are improved, and storage resource redundancy consumption and engine loading pressure are reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Model deduplication methods, devices, equipment, and storage media based on Unreal Engine Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, device and storage medium for deduplication of models based on Unreal Engine. Background Technology

[0002] In the fields of architectural visualization, game development, and virtual simulation, which are based on Unreal Engine for 3D scene construction, high fidelity and rapid construction of complex scenes are core requirements. The achievement of this goal depends heavily on the import and integration of massive 3D resources. Developers usually need to import thousands or even tens of thousands of 3D models, such as BIM components from all disciplines, standardized prefabricated models, and high-precision scene elements, in order to restore building structures, build game worlds, or simulate industrial scenes. Among these, there will be duplicate models with completely identical geometric structures, which will lead to redundant consumption of storage resources and significantly increase the loading pressure on the engine, causing problems such as scene lag, frame rate drop, and even memory overflow.

[0003] In related technologies, in order to solve the problem of a large number of duplicate models with completely identical geometric structures, the file names and storage formats of each model are usually matched one by one to filter out duplicate models. This filtering method is difficult to accurately identify duplicate models with identical geometric structures but different file names and storage formats, and is prone to misjudgment or omission. It cannot adapt to the efficient development needs of complex scenarios. Furthermore, during the process of replacing duplicate models, the inaccuracy of the replacement position and replacement angle leads to inconsistency with the original scene layout, thereby affecting the visual effect. Summary of the Invention

[0004] This application provides a method, apparatus, device, and storage medium for model deduplication based on Unreal Engine, solving the problems of inaccurate identification of duplicate models and imprecise replacement positions and angles during the deduplication or replacement of duplicate models, which affect visual effects. It can calculate the geometric center coordinates of each model based on the coordinates of multiple vertices in each vertex set, and calculate the position offset based on the world coordinates and geometric center coordinates of each model; it reads the mesh file volume of each model, determines the base model and the model to be replaced in each duplicate model group based on the mesh file volume, and replaces the model to be replaced with the base model based on the position offset and rotation angle. This improves the accuracy of duplicate model selection, as well as the accuracy of the replacement position and angle, while reducing redundant consumption of storage resources and engine loading pressure, and fully ensuring visual effects.

[0005] In a first aspect, embodiments of this application provide a model deduplication method based on Unreal Engine, comprising: acquiring multiple original vertex coordinates, world coordinates, and rotation angles of each model, and generating a vertex set corresponding to each model based on a preset sorting rule and the multiple original vertex coordinates; converting each vertex set into a feature code matrix, calculating the feature value corresponding to the feature code matrix using a hash algorithm, grouping the multiple models according to the feature values ​​to obtain multiple duplicate model groups; calculating the geometric center coordinates of each model based on the multiple vertex coordinates in each vertex set, and calculating the position offset between the world coordinates and the geometric center coordinates of each model; reading the mesh file volume of each model, determining the base model and the model to be replaced in each duplicate model group based on the mesh file volume, and replacing the model to be replaced with the corresponding base model based on the position offset and the rotation angle.

[0006] Optionally, generating the vertex set corresponding to each model based on the preset sorting rules and the multiple original vertex coordinates includes: sorting the multiple original vertex coordinates according to the preset sorting rules to obtain an ordered vertex set; counting the total number of the original vertex coordinates; calculating the sampling interval based on the total number and a preset algorithm; uniformly sampling the multiple original vertex coordinates based on the sampling interval; and generating a sampled vertex set based on the sampling results.

[0007] Optionally, determining the baseline model and the model to be replaced in each of the repeating model groups based on the volume of each of the mesh files includes: comparing the mesh file volumes corresponding to each model in the repeating model group, and determining the target model corresponding to the smallest mesh file volume according to the comparison result; if there is only one target model, determining the target model as the baseline model of the repeating model group, and determining the models other than the baseline model as the models to be replaced in the repeating model group; if there are multiple target models, obtaining the loading time of the target models, sorting the multiple target models according to the loading time, determining the target model corresponding to the earliest loading time in the sorting result as the baseline model, and determining the models other than the baseline model as the models to be replaced in the repeating model group.

[0008] Optionally, replacing the model to be replaced with the corresponding reference model based on the position offset and the rotation angle includes: determining the replacement position of the model to be replaced according to the position offset and the rotation angle, and replacing the model to be replaced with the corresponding reference model at the replacement position.

[0009] Optionally, after obtaining multiple repeating model groups, the method further includes: calculating the volume deviation value between any two models in each repeating model group, comparing the volume deviation value with a preset deviation threshold, and performing group verification on each repeating model group based on the comparison result.

[0010] Optionally, the step of using a hash algorithm to calculate the eigenvalues ​​corresponding to the feature code matrix includes: normalizing the feature code matrix to obtain a standard matrix, and calculating the mean of each row of the standard matrix; constructing a feature vector based on the mean of each row, and performing a hash operation on the feature vector, and determining the first preset number of bits in the operation result as the eigenvalues ​​of the feature code matrix.

[0011] Optionally, after obtaining multiple original vertex coordinates, world coordinates, and rotation angles of each model, the method further includes: converting the rotation angles into quaternion format to obtain a target rotation angle; correspondingly, replacing the model to be replaced with the reference model based on the position offset and the rotation angle includes: replacing the model to be replaced with the reference model based on the position offset and the target rotation angle.

[0012] In a second aspect, embodiments of this application provide a model deduplication device based on Unreal Engine, comprising: a data acquisition module for acquiring multiple original vertex coordinates, world coordinates, and rotation angles of each model; a vertex set generation module for generating vertex sets corresponding to each model based on a preset sorting rule and the multiple original vertex coordinates; a duplicate model group determination module for converting each vertex set into a feature code matrix, calculating the feature value corresponding to the feature code matrix using a hash algorithm, and grouping the multiple models according to the feature values ​​to obtain multiple duplicate model groups; a position offset determination module for calculating the geometric center coordinates of each model based on the multiple vertex coordinates in each vertex set, and calculating the position offset between the world coordinates and the geometric center coordinates of each model; a model type determination module for reading the mesh file volume of each model, and determining the base model and the model to be replaced in each duplicate model group based on the mesh file volume; and a model replacement module for replacing the model to be replaced with the corresponding base model based on the position offset and the rotation angle.

[0013] In a third aspect, embodiments of this application provide an electronic device, the device comprising: one or more processors; and a storage device configured to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the Unreal Engine-based model deduplication method described in the first aspect.

[0014] In a fourth aspect, embodiments of this application provide a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform the Unreal Engine-based model deduplication method as described in the first aspect.

[0015] In this embodiment, multiple original vertex coordinates, world coordinates, and rotation angles of each model are obtained, and a vertex set corresponding to each model is generated based on a preset sorting rule and multiple original vertex coordinates. Each vertex set is converted into a feature code matrix, and the feature values ​​corresponding to the feature code matrix are calculated using a hash algorithm. Multiple models are grouped according to each feature value to obtain multiple duplicate model groups. The geometric center coordinates of each model are calculated based on multiple vertex coordinates in each vertex set, and the position offset between the world coordinates and the geometric center coordinates of each model is calculated. The mesh file volume of each model is read, and the base model and the model to be replaced in each duplicate model group are determined based on the mesh file volume. The model to be replaced is replaced with the corresponding base model based on the position offset and rotation angle. This improves the accuracy of duplicate model selection, as well as the accuracy of the replacement position and replacement angle. While reducing redundant consumption of storage resources and engine loading pressure, it fully guarantees the visual effect. Attached Figure Description

[0016] Figure 1 is a flowchart of a model deduplication method for Unreal Engine provided in an embodiment of this application; Figure 2 is a flowchart of a vertex set generation method provided in an embodiment of this application; Figure 3 is a flowchart of a method for determining a baseline model and a model to be replaced provided in an embodiment of this application; Figure 4 is a structural schematic diagram of a model deduplication device based on Unreal Engine provided in an embodiment of this application; Figure 5 is a structural schematic diagram of a model deduplication device based on Unreal Engine provided in an embodiment of this application. Detailed Implementation

[0017] To make the objectives, technical solutions, and advantages of this application clearer, specific embodiments of this application will be described in further detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are merely for explaining this application and not for limiting it. It should also be noted that, for ease of description, only the parts relevant to this application are shown in the drawings, not all of them. Before discussing exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe operations (or steps) as sequential processes, many of these operations can be performed in parallel, concurrently, or simultaneously. Furthermore, the order of the operations can be rearranged. The process can be terminated when its operation is completed, but may also have additional steps not included in the drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.

[0018] 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. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.

[0019] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0020] The following description, in conjunction with the accompanying drawings, details the Unreal Engine-based model deduplication method, apparatus, device, and medium provided in this application through specific embodiments and application scenarios.

[0021] The model deduplication method based on Unreal Engine provided in this application embodiment is used in scenarios where Building Information Models are rendered in the Unreal Engine. Based on the above application scenario, it can be understood that the execution subject of each step can be a computer device. This computer device refers to any electronic device with data computing, processing, and storage capabilities, such as mobile phones, PCs (Personal Computers), tablet computers, and other terminal devices, or it can be a server or other devices. This application embodiment does not limit this.

[0022] Figure 1 is a flowchart of a model deduplication method for Unreal Engine provided in an embodiment of this application. As shown in Figure 1, it includes: step S101, obtaining multiple original vertex coordinates, world coordinates and rotation angles of each model, and generating a vertex set corresponding to each model based on a preset sorting rule and multiple original vertex coordinates.

[0023] The model can be a Building Information Modeling (BIM) system, a digital 3D model that integrates the physical and functional characteristics of a building project throughout its entire lifecycle, containing multi-dimensional information such as the geometry, material, performance, and relationships of components. Raw vertex coordinates refer to unprocessed 3D spatial coordinate data. World coordinates refer to a global coordinate system used to uniformly describe all components, geometric elements, and spatial information in the BIM model; its coordinate values ​​typically use real physical units and can be directly mapped to the geographic coordinates of the actual project site. Rotation angle refers to the spatial orientation parameter of the BIM model Actor in the Unreal Engine scene, used to define the model's tilt, rotation, etc., in the world coordinate system. An Actor can refer to the core instance object in Unreal Engine that carries the BIM model; it is an interactive and editable entity in the scene, containing attributes such as the model's mesh resources, world coordinates, rotation angle, scaling, and parent relationships. Predefined sorting rules refer to a predefined method for prioritizing 3D coordinates to unify the vertex order of BIM models with the same geometric structure. A vertex set refers to a dataset composed of the 3D coordinates of all vertices of the BIM model.

[0024] In one embodiment, the original vertex coordinates are stored in the UStaticMesh (static mesh) resource mounted on the Actor. The original vertex coordinates of each model need to be extracted through the mesh interface. The spatial orientation parameters of each Actor model in the Unreal Engine scene are obtained through the SetActorRotation() interface. The corresponding world coordinates are extracted from the Actor's Transform component. Multiple original vertex coordinates are sorted according to a preset sorting rule, and a vertex set corresponding to each model is generated based on the sorting result. For example, sorting is done in descending order of y-coordinate values. The sorted original vertex coordinates are then filtered according to a preset filtering rule, and a vertex set corresponding to each model is generated based on the filtered original vertex coordinates. For example: V={v1(x1,y1,z1),v2(x2,y2,z2),...,v n (x n ,y n ,z n When filtering the sorted original vertex coordinates, multiple target vertex coordinates with small distance differences between them can be selected, and only one target vertex coordinate needs to be retained.

[0025] Step S102: Convert each vertex set into a feature code matrix, use a hash algorithm to calculate the feature values ​​corresponding to the feature code matrix, and group multiple models according to each feature value to obtain multiple duplicate model groups.

[0026] Here, the feature code matrix can refer to a matrix formed by organizing the geometric feature codes of multiple BIM models in a structured manner according to a unified dimension. The hash algorithm can refer to an irreversible algorithm that maps the standardized geometric feature data of a BIM model to a fixed-length unique string. The eigenvalue can refer to a fixed-length unique string calculated from the standardized geometric feature data of a BIM model using a hash algorithm. A repeating model group can refer to a set of BIM model Actors with the same geometric structure in a scene, where each repeating model group includes at least two Actor instances.

[0027] In one embodiment, each vertex set is converted into a feature code matrix of dimension m×3, where each row corresponds to the (x, y, z) coordinates of a vertex, and m is the number of vertex coordinates. The feature code matrix is ​​input into a hash algorithm, which outputs feature values. The coordinate values ​​are retained to 6 decimal places, and the hash calculation uses double-precision floating-point arithmetic to ensure that the feature values ​​of identical geometric models are completely consistent, and the collision probability of feature values ​​of different models is ≤1e-18. After calculating the feature values ​​corresponding to each model, exact string matching is used to determine whether the feature values ​​are the same. Models with the same feature values ​​are grouped together, resulting in multiple groups of BIM models with the same geometric structure, i.e., duplicate model groups.

[0028] Step S103: Calculate the geometric center coordinates of each model based on the coordinates of multiple vertices in each vertex set, and calculate the position offset between the world coordinates and the geometric center coordinates of each model.

[0029] The set center coordinates refer to the reference coordinate point in a preset space, obtained by aggregating and calculating the coordinate information of all elements within the set using a specific mathematical algorithm, which can represent the center of the overall positional distribution of the set. The position offset refers to the quantitative index of the difference between the world coordinates of the BIM model Actor and its own geometric center coordinates in a preset coordinate system, used to characterize the degree and direction of the spatial displacement of the BIM model Actor's world coordinates relative to the reference position.

[0030] In one embodiment, the average coordinates C = (avg(x), avg(y), avg(z)) of multiple vertex coordinates in each vertex set are calculated, and the difference between the world coordinates and the geometric center coordinates of each model is calculated. If the world coordinates of a certain BIM model are P... i Then the position offset ΔP i =P i -C.

[0031] Step S104: Read the mesh file volume of each model, determine the reference model and the model to be replaced in each repeated model group based on the mesh file volume, and replace the model to be replaced with the corresponding reference model based on the position offset and rotation angle.

[0032] In this context, "mesh file volume" refers to the storage space occupied on disk by a static mesh file that stores the geometric data of the BIM model. "Base model" refers to the core model instance selected from the repeating model group as the replacement benchmark, serving as the unified replacement target for all repeating models within the group. "Models to be replaced" refers to all BIM model Actor instances in the repeating model group, excluding the base model, that need to be replaced as the base model.

[0033] In one embodiment, the mesh file volume is read through the Unreal Engine File System API (FPlatformFileManager), the mesh file volumes corresponding to each BIM model in each repeating model group are compared, and the smallest BIM model in the repeating model group is determined as the base model of the group based on the comparison results. The remaining models in the group are determined as models to be replaced, and the replacement position of the corresponding model to be replaced is determined based on the position offset and rotation angle. At the replacement position, the corresponding model to be replaced is replaced with the base model corresponding to the repeating model group.

[0034] In another possible embodiment, the scene display is refreshed by executing the UpdateComponentTransforms() interface, the original model (i.e. the model to be replaced) is removed from the scene hierarchy by calling the RemoveFromRoot() interface, the unreferenced original model resource files are deleted by the UAssetManager interface, and a replacement log is generated, recording the model ID, position, and rotation angle before and after the replacement.

[0035] In this embodiment, multiple original vertex coordinates, world coordinates, and rotation angles of each model are obtained, and a vertex set corresponding to each model is generated based on a preset sorting rule and multiple original vertex coordinates. Each vertex set is converted into a feature code matrix, and the feature values ​​corresponding to the feature code matrix are calculated using a hash algorithm. Multiple models are grouped according to each feature value to obtain multiple duplicate model groups. The geometric center coordinates of each model are calculated based on multiple vertex coordinates in each vertex set, and the position offset between the world coordinates and the geometric center coordinates of each model is calculated. The mesh file volume of each model is read, and the base model and the model to be replaced in each duplicate model group are determined based on the mesh file volume. The model to be replaced is replaced with the corresponding base model based on the position offset and rotation angle. This improves the accuracy of duplicate model selection, as well as the accuracy of the replacement position and replacement angle. While reducing redundant consumption of storage resources and engine loading pressure, it fully guarantees the visual effect.

[0036] Optionally, the model to be replaced is replaced with the corresponding reference model based on the position offset and rotation angle, including: determining the replacement position of the model to be replaced based on the position offset and rotation angle, and replacing the model to be replaced with the corresponding reference model at the replacement position.

[0037] In one embodiment, the calculated positional offset determines the offset distance and direction of the model to be replaced relative to the geometric center coordinates of the reference model in the world coordinate system. Simultaneously, combined with rotation angle parameters, the spatial orientation of the model to be replaced is precisely adjusted to ensure it maintains the same rotational attitude as the reference model. Then, the SetStaticMesh() interface is called to replace the mesh resources of the model to be replaced with those of the reference model, ensuring that BIM models with the same structure have identical gateway resources.

[0038] In this embodiment, the replacement position of the model to be replaced is determined based on the position offset and rotation angle, and the model to be replaced is replaced with the corresponding reference model at the replacement position. This ensures that the position and posture of the replaced model in the scene are consistent with the original model, further improving the accuracy of model replacement and the overall visual effect of the scene.

[0039] Optionally, after obtaining multiple repeating model groups, the method further includes: calculating the volume deviation value between any two models in each repeating model group, comparing the volume deviation value with a preset deviation threshold, and performing group verification on each repeating model group based on the comparison result.

[0040] The volume deviation value can refer to the absolute value of the difference in the volume of the mesh files corresponding to any two BIM models within the same repeating model group. The preset deviation threshold can refer to the allowable range of volume difference values ​​set in advance to verify the consistency of the geometric structure of the models within the repeating model group, such as ≤2%. In one embodiment, by traversing all models within each repeating model group, the volume deviation value between every two models is calculated, and the calculated volume deviation value is compared with the preset deviation threshold. If the volume deviation value is less than or equal to the preset deviation threshold, the two models are considered to belong to the same geometric structure, the grouping is accurate, and they are retained in the original repeating model group; if the volume deviation value is greater than the preset deviation threshold, the two models are considered to have different geometric structures, and one or both models are removed from the original repeating model group, or they are assigned to other repeating model groups with the same structure.

[0041] This application embodiment calculates the volume deviation value between any two models in each repeating model group, compares the volume deviation value with a preset deviation threshold, and performs group verification on each repeating model group based on the comparison result. This can further improve the accuracy of repeating model grouping, ensure that the models in each repeating model group have the same geometric structure, and provide a reliable basis for subsequent benchmark model screening and model replacement operations.

[0042] Optionally, a hash algorithm is used to calculate the eigenvalues ​​corresponding to the feature code matrix, including: normalizing the feature code matrix to obtain a standard matrix, and calculating the mean of each row of the standard matrix; constructing a feature vector based on the mean of each row, and performing a hash operation on the feature vector, and determining the first preset number of bits in the operation result as the eigenvalues ​​of the feature code matrix.

[0043] Here, the standard matrix refers to the matrix form obtained by normalizing the feature code matrix, where the numerical range of all elements is unified to a specific interval. The row mean refers to the scalar value obtained by calculating the arithmetic average of all elements in each row of the standard matrix, used to characterize the central tendency of the data in that row. The eigenvector refers to a one-dimensional vector formed by sequentially combining the row means of the standard matrix, used as input data for hash operations. The preset bit length refers to the pre-set truncation length of the hash operation result to balance the uniqueness of the feature value and computational efficiency; for example, taking the first 64 bits as the final feature value.

[0044] In one embodiment, the feature code matrix M (m×3 dimensions) is first normalized, mapping each element value to the interval [0,1] to obtain the standard matrix M'. Then, the mean of each row in M' is calculated. This forms a feature vector, for example: .

[0045] After generating the feature vector, a SHA-256 hash operation is performed on the feature vector F to generate a fixed-length hash string. Finally, the first preset number of bits (e.g., 64 bits) of this string are extracted as the feature value of the feature code matrix. The hash calculation uses double-precision floating-point arithmetic.

[0046] In this embodiment, a standard matrix is ​​obtained by normalizing the feature code matrix, and the mean of each row of the standard matrix is ​​calculated. A feature vector is constructed based on the mean of each row, and a hash operation is performed on the feature vector. The first preset number of bits in the operation result is determined as the feature value of the feature code matrix. This can ensure that the feature values ​​of models with the same geometric structure are consistent, and the probability of collision between feature values ​​of different models is extremely low, which effectively improves the accuracy and robustness of grouping repeated models.

[0047] Optionally, after obtaining multiple original vertex coordinates, world coordinates, and rotation angles of each model, the method further includes: converting the rotation angle into a quaternion format to obtain a target rotation angle; and replacing the model to be replaced with the reference model based on the position offset and the target rotation angle.

[0048] Quaternion format refers to a mathematical tool used to represent rotation in three-dimensional space, consisting of a real part and three imaginary parts. In one embodiment, the obtained rotation angle (Eulerian angle form) is converted into a target rotation angle in quaternion form by calling the rotation transformation interface provided by Unreal Engine. In the subsequent model replacement process, based on the position offset and the target rotation angle, the model to be replaced is precisely replaced with the reference model by calling the model transformation interface of Unreal Engine.

[0049] In this embodiment, by converting the rotation angle into a quaternion format to obtain the target rotation angle, the gimbal lock problem can be eliminated, ensuring that the replaced model is completely consistent with the original model in terms of spatial position and rotational attitude, thereby further improving the accuracy of model replacement and the overall visual effect of the scene.

[0050] Figure 2 is a flowchart of a vertex set generation method provided in an embodiment of this application. As shown in Figure 2, it includes: step S1011, sorting multiple original vertex coordinates based on a preset sorting rule to obtain an ordered vertex set.

[0051] Step S1012: Count the total number of original vertex coordinates, calculate the sampling interval based on the total number and the preset algorithm, and uniformly sample multiple original vertex coordinates based on the sampling interval, and generate a sampled vertex set based on the sampling results.

[0052] Here, an ordered vertex set can refer to a 3D coordinate dataset obtained by standardizing and sorting the original vertex set according to a preset sorting rule. The sampling interval can refer to the index difference between two adjacent extracted vertices in the ordered sequence when constructing a sampled vertex set from the ordered vertex set. A sampled vertex set can also refer to a simplified 3D coordinate dataset formed by uniformly extracting vertices from the ordered vertex set according to a preset sampling interval.

[0053] In one embodiment, multiple original vertex coordinates are sorted according to a pre-set sorting priority to obtain multiple ordered vertex sets. For example, if the preset sorting rule is: first priority: x-coordinate values ​​(arrived in ascending order); second priority: y-coordinate values ​​(arrived in ascending order); third priority: z-coordinate values ​​(arrived in ascending order); then, the original vertex coordinates are first sorted in ascending order of x-coordinate values. If there are original vertex coordinates with the same x-coordinate value, they are then sorted in ascending order of y-coordinate values. If there are original vertex coordinates with the same x-coordinate and y-coordinate values, they are then sorted in ascending order of z-coordinate values. This yields the final sorting result, and an ordered sorted set V'={v'1,v'2,...,v'} is generated based on the final sorting result. nTo ensure that models with the same geometry maintain consistency in vertex order, in one possible embodiment, the sum of Euclidean distances between the vertex sets before and after sorting is calculated, and the difference between the sums of two adjacent Euclidean distances is calculated. Based on the calculation results, it is verified whether the sorting process has changed the geometric features of the model. For example, the difference between the sums of two adjacent Euclidean distances is compared with a preset distance deviation threshold. If it is less than or equal to the preset distance deviation threshold, the geometric features of the model have not been changed, and the sampling is accurate.

[0054] In one embodiment, the total number of original vertex coordinates is counted, and the sampling interval k is calculated based on the total number and a preset algorithm. The preset algorithm can be: k = max(1, floor(n / 1000)), where n is the total number of original vertex coordinates corresponding to each BIM model, 1000 is a preset threshold for the number of vertices to be retained, floor(n / 1000) is a floor function to avoid decimals in the sampling interval, and max(1, floor(n / 1000)) represents the larger of 1 and floor(n / 1000). After calculating the sampling interval k, multiple original vertex coordinates are uniformly sampled based on the sampling interval k, and a sampled vertex set is generated based on the sampling results, for example: .

[0055] In one possible embodiment, if the number of samples obtained after sampling according to the sampling interval is greater than 1000, then only the first 1000 vertices are retained, and a sampled vertex set is generated based on these 1000 vertices. If the total number of original vertex coordinates does not exceed 1000, then all vertices are retained, and a sampled vertex set is generated based on all retained vertices.

[0056] In this embodiment, multiple original vertex coordinates are sorted according to a preset sorting rule to obtain an ordered vertex set. The total number of original vertex coordinates is counted, and a sampling interval is calculated based on the total number and a preset algorithm. Then, multiple original vertex coordinates are uniformly sampled based on the sampling interval, and a sampled vertex set is generated based on the sampling results. In the above scheme, by standardizing and uniformly sampling the original vertex coordinates, the order of vertices in models with the same geometric structure is ensured to be consistent, providing a reliable foundation for subsequent feature code matrix generation and model grouping. Uniform sampling significantly reduces computational complexity and improves processing efficiency while preserving key geometric information. Dynamically calculating the sampling interval using a preset algorithm avoids feature distortion caused by differences in the number of vertices.

[0057] In one possible embodiment, the surface features of the model are determined by calculating the rate of change of vertex normals. For example, the rate of change of vertex normals is compared with a preset threshold. Regions where the rate of change of vertex normals is greater than the preset threshold are identified as curvature abrupt change regions, and the sampling density of these curvature abrupt change regions is increased. For instance, if the rate of change of vertex normals is >30° / meter, the sampling density is increased by 2-3 times. This sampling method ensures that key geometric features are not lost.

[0058] Figure 3 is a flowchart of a method for determining a baseline model and a replacement model provided in an embodiment of this application. As shown in Figure 3, it includes: step S1041, comparing the mesh file volumes corresponding to each model in the repeating model group, and determining the target model corresponding to the smallest mesh file volume based on the comparison results.

[0059] Step S1042: If there is only one target model, the target model is determined as the baseline model of the repeating model group, and the models other than the baseline model are determined as the replacement models of the repeating model group.

[0060] Step S1043: When there are multiple target models, obtain the loading time of the target models, sort the multiple target models according to the loading time, determine the target model with the earliest loading time in the sorting result as the baseline model, and determine the models other than the baseline model as the models to be replaced in the duplicate model group.

[0061] Here, the target model can refer to the model with the smallest mesh file size, and there can be one or more target models. Loading time refers to the time it takes for Unreal Engine to load the target model. In one embodiment, when there is only one target model, it is directly designated as the baseline model for the repeating model group, and all other models in the repeating model group are designated as models to be replaced. When there are multiple target models, the loading time of each target model is accurately obtained using Unreal Engine's built-in performance analysis tools or logging functionality. When there are multiple target models, they are sorted according to their loading time from earliest to latest. After sorting, the target model with the earliest loading time is selected as the baseline model. All other models in the repeating model group, excluding the baseline model, are designated as models to be replaced.

[0062] In this embodiment, the mesh file volumes corresponding to each model in the repeating model group are compared, and the target model corresponding to the smallest mesh file volume is determined based on the comparison results. If there is only one target model, it is designated as the baseline model for the repeating model group, and the models other than the baseline model are designated as models to be replaced in the repeating model group. If there are multiple target models, the loading times of the target models are obtained, and the multiple target models are sorted according to their loading times. The target model with the earliest loading time in the sorting results is designated as the baseline model, and the models other than the baseline model are designated as models to be replaced in the repeating model group. In the above scheme, directly determining the baseline model when there is only one target model avoids unnecessary computational overhead. Introducing a loading time sorting mechanism when there are multiple target models optimizes the selection criteria for the baseline model and improves processing efficiency.

[0063] Figure 4 is a schematic diagram of a model deduplication device based on Unreal Engine provided in an embodiment of this application. As shown in Figure 4, it includes: a data acquisition module 21, used to acquire multiple original vertex coordinates, world coordinates, and rotation angles of each model; a vertex set generation module 22, used to generate vertex sets corresponding to each model based on a preset sorting rule and the multiple original vertex coordinates; a duplicate model group determination module 23, used to convert each vertex set into a feature code matrix, calculate the feature value corresponding to the feature code matrix using a hash algorithm, and group the multiple models according to the feature values ​​to obtain multiple duplicate model groups; a position offset determination module 24, used to calculate the geometric center coordinates of each model based on the multiple vertex coordinates in each vertex set, and calculate the position offset between the world coordinates and the geometric center coordinates of each model; a model type determination module 25, used to read the mesh file volume of each model, and determine the base model and the model to be replaced in each duplicate model group based on the mesh file volume; and a model replacement module 26, used to replace the model to be replaced with the corresponding base model based on the position offset and the rotation angle.

[0064] In this embodiment, multiple original vertex coordinates, world coordinates, and rotation angles of each model are obtained, and a vertex set corresponding to each model is generated based on a preset sorting rule and multiple original vertex coordinates. Each vertex set is converted into a feature code matrix, and the feature values ​​corresponding to the feature code matrix are calculated using a hash algorithm. Multiple models are grouped according to each feature value to obtain multiple duplicate model groups. The geometric center coordinates of each model are calculated based on multiple vertex coordinates in each vertex set, and the position offset between the world coordinates and the geometric center coordinates of each model is calculated. The mesh file volume of each model is read, and the base model and the model to be replaced in each duplicate model group are determined based on the mesh file volume. The model to be replaced is replaced with the corresponding base model based on the position offset and rotation angle. This improves the accuracy of duplicate model selection, as well as the accuracy of the replacement position and replacement angle. While reducing redundant consumption of storage resources and engine loading pressure, it fully guarantees the visual effect.

[0065] In one possible embodiment, the vertex set generation module 22 is specifically used to: sort the multiple original vertex coordinates according to a preset sorting rule to obtain an ordered vertex set; count the total number of the original vertex coordinates, calculate the sampling interval based on the total number and a preset algorithm, and uniformly sample the multiple original vertex coordinates based on the sampling interval, and generate a sampled vertex set according to the sampling results.

[0066] In one possible embodiment, the model type determination module 25 is specifically used to: compare the mesh file volumes corresponding to each model in the repeating model group, and determine the target model corresponding to the smallest mesh file volume based on the comparison results; if there is only one target model, determine the target model as the baseline model of the repeating model group, and determine the models other than the baseline model as the models to be replaced in the repeating model group; if there are multiple target models, obtain the loading time of the target models, sort the multiple target models according to the loading time, determine the target model corresponding to the earliest loading time in the sorting results as the baseline model, and determine the models other than the baseline model as the models to be replaced in the repeating model group.

[0067] In one possible embodiment, the model replacement module 26 is specifically configured to: determine the replacement position of the model to be replaced based on the position offset and the rotation angle, and replace the model to be replaced with the corresponding reference model at the replacement position.

[0068] In one possible embodiment, a group verification module is further included, specifically used for: calculating the volume deviation value between any two models in each repeating model group, comparing the volume deviation value with a preset deviation threshold, and performing group verification on each repeating model group based on the comparison result.

[0069] In one possible embodiment, the repeating model group determination module 23 is specifically used to: normalize the feature code matrix to obtain a standard matrix, and calculate the mean of each row of the standard matrix; construct a feature vector based on the mean of each row, and perform a hash operation on the feature vector, and determine the first preset number of bits in the operation result as the feature value of the feature code matrix.

[0070] In one possible embodiment, a format conversion module is further included, specifically used to: convert the rotation angle into a quaternion format to obtain a target rotation angle; the model type determination module 25 is specifically used to: replace the model to be replaced with the reference model based on the position offset and the target rotation angle.

[0071] This application also provides an electronic device, which can integrate a Unreal Engine-based model deduplication device provided in this application. Figure 5 is a structural schematic diagram of a Unreal Engine-based model deduplication device provided in this application. Referring to Figure 5, the Unreal Engine-based model deduplication device includes: an input device 33, an output device 34, a memory 32, and one or more processors 31; the memory 32 is used to store one or more programs; when one or more programs are executed by one or more processors 31, the one or more processors 31 implement the Unreal Engine-based model deduplication method provided in the above embodiments. The input device 33, output device 34, memory 32, and processors 31 can be connected via a bus or other means. Figure 5 shows an example of connection via a bus.

[0072] Memory 32, as a computing device readable storage medium, can be used to store software programs, computer-executable programs, and modules, such as the program instructions / modules corresponding to the Unreal Engine-based model deduplication method provided in any embodiment of this application. Memory 32 may mainly include a program storage area and a data storage area, wherein the program storage area may store the operating system and at least one application program required for a function; the data storage area may store data created according to the use of the device, etc. In addition, memory 32 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some instances, memory 32 may further include memory remotely located relative to processor 31, and these remote memories can be connected to the device via a network. Examples of the aforementioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0073] Input device 33 can be used to receive input digital or character information, and to generate key signal inputs related to user settings and function control of the device. Output device 34 may include display devices such as a display screen.

[0074] The processor 31 executes various functional applications and data processing of the device by running software programs, instructions and modules stored in the memory 32, thereby implementing the above-mentioned Unreal Engine-based model deduplication method.

[0075] The Unreal Engine-based model deduplication apparatus, device, and computer provided above can be used to execute the Unreal Engine-based model deduplication method provided in any of the above embodiments, and have corresponding functions and beneficial effects.

[0076] This application embodiment also provides a storage medium for storing computer-executable instructions. When executed by a computer processor, the computer-executable instructions are used to execute the Unreal Engine-based model deduplication method provided in the above embodiment. The Unreal Engine-based model deduplication method includes: obtaining multiple original vertex coordinates, world coordinates, and rotation angles of each model, and generating a vertex set corresponding to each model based on a preset sorting rule and the multiple original vertex coordinates; converting each vertex set into a feature code matrix, calculating the feature value corresponding to the feature code matrix using a hash algorithm, grouping the multiple models according to each feature value to obtain multiple duplicate model groups; calculating the geometric center coordinates of each model based on the multiple vertex coordinates in each vertex set, and calculating the position offset between the world coordinates and the geometric center coordinates of each model; reading the mesh file volume of each model, determining the base model and the model to be replaced in each duplicate model group based on the mesh file volume, and replacing the model to be replaced with the corresponding base model based on the position offset and the rotation angle.

[0077] Storage medium – any type of memory device or storage device. The term “storage medium” is intended to include: mounting media, such as CD-ROMs, floppy disks, or magnetic tape devices; computer system memory or random access memory, such as DRAM, DDR RAM, SRAM, EDO RAM, Rambus RAM, etc.; non-volatile memory, such as flash memory, magnetic media (e.g., hard disks or optical storage); registers or other similar types of memory elements, etc. Storage media may also include other types of memory or combinations thereof. Furthermore, storage media may reside in a first computer system in which a program is executed, or may reside in a different second computer system connected to the first computer system via a network (such as the Internet). The second computer system can provide program instructions to the first computer for execution. The term “storage medium” can include two or more storage media that may reside in different locations (e.g., in different computer systems connected via a network). Storage media may store program instructions (e.g., specifically implemented as a computer program) executable by one or more processors.

[0078] Of course, the computer-executable instructions provided in the embodiments of this application are not limited to the Unreal Engine-based model deduplication method described above, but can also execute related operations in the Unreal Engine-based model deduplication method provided in any embodiment of this application.

[0079] The Unreal Engine-based model deduplication apparatus, device, and storage medium provided in the above embodiments can execute the Unreal Engine-based model deduplication method provided in any embodiment of this application. For technical details not described in detail in the above embodiments, please refer to the Unreal Engine-based model deduplication method provided in any embodiment of this application.

[0080] The above description is merely a preferred embodiment and the technical principles employed in this application. This application is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions that can be made by those skilled in the art will not depart from the scope of protection of this application. Therefore, although this application has been described in detail through the above embodiments, this application is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of this application, the scope of which is determined by the scope of the claims.

Claims

1. A model deduplication method based on Unreal Engine, characterized in that, include: Obtain multiple original vertex coordinates, world coordinates, and rotation angles for each model, and generate a vertex set corresponding to each model based on a preset sorting rule and the multiple original vertex coordinates; Each vertex set is converted into a feature code matrix, and a hash algorithm is used to calculate the feature value corresponding to the feature code matrix. The multiple models are grouped according to the feature values ​​to obtain multiple duplicate model groups. The geometric center coordinates of each model are calculated based on the coordinates of multiple vertices in each vertex set, and the position offset between the world coordinates and the geometric center coordinates of each model is calculated. Read the mesh file volume of each model, determine the base model and the model to be replaced in each of the repeated model groups based on the mesh file volume, and replace the model to be replaced with the corresponding base model based on the position offset and the rotation angle.

2. The model deduplication method based on Unreal Engine according to claim 1, characterized in that, The step of generating a vertex set corresponding to each model based on a preset sorting rule and the multiple original vertex coordinates includes: sorting the multiple original vertex coordinates according to the preset sorting rule to obtain an ordered vertex set; counting the total number of the original vertex coordinates; calculating the sampling interval based on the total number and a preset algorithm; uniformly sampling the multiple original vertex coordinates based on the sampling interval; and generating a sampled vertex set based on the sampling results.

3. The model deduplication method based on Unreal Engine according to claim 1, characterized in that, The step of determining the baseline model and the replacement model in each of the repeating model groups based on the mesh file volume includes: comparing the mesh file volumes corresponding to each model in the repeating model group, and determining the target model corresponding to the smallest mesh file volume according to the comparison result; if there is only one target model, determining the target model as the baseline model of the repeating model group, and determining the models other than the baseline model as the replacement models of the repeating model group; if there are multiple target models, obtaining the loading time of the target models, sorting the multiple target models according to the loading time, determining the target model corresponding to the earliest loading time in the sorting result as the baseline model, and determining the models other than the baseline model as the replacement models of the repeating model group.

4. The model deduplication method based on Unreal Engine according to claim 1, characterized in that, The step of replacing the model to be replaced with the corresponding reference model based on the position offset and the rotation angle includes: determining the replacement position of the model to be replaced according to the position offset and the rotation angle, and replacing the model to be replaced with the corresponding reference model at the replacement position.

5. The model deduplication method based on Unreal Engine according to claim 1, characterized in that, After obtaining multiple repeating model groups, the method further includes: calculating the volume deviation value between any two models in each repeating model group, comparing the volume deviation value with a preset deviation threshold, and performing group verification on each repeating model group based on the comparison result.

6. The model deduplication method based on Unreal Engine according to claim 1, characterized in that, The step of using a hash algorithm to calculate the eigenvalues ​​corresponding to the feature code matrix includes: normalizing the feature code matrix to obtain a standard matrix, and calculating the mean of each row of the standard matrix; constructing a feature vector based on the mean of each row, and performing a hash operation on the feature vector, and determining the first preset number of bits in the operation result as the eigenvalues ​​of the feature code matrix.

7. The model deduplication method based on Unreal Engine according to any one of claims 1-6, characterized in that, After obtaining multiple original vertex coordinates, world coordinates, and rotation angles of each model, the method further includes: converting the rotation angles into quaternion format to obtain the target rotation angle; correspondingly, replacing the model to be replaced with the reference model based on the position offset and the rotation angle includes: replacing the model to be replaced with the reference model based on the position offset and the target rotation angle.

8. A model deduplication device based on Unreal Engine, characterized in that, include: The data acquisition module is used to acquire multiple original vertex coordinates, world coordinates, and rotation angles for each model; The vertex set generation module is used to generate vertex sets corresponding to each model based on preset sorting rules and the coordinates of the multiple original vertices. The repeating model group determination module is used to convert each vertex set into a feature code matrix, calculate the feature value corresponding to the feature code matrix using a hash algorithm, and group the multiple models according to each feature value to obtain multiple repeating model groups; The position offset determination module is used to calculate the geometric center coordinates of each model based on the coordinates of multiple vertices in each vertex set, and to calculate the position offset between the world coordinates and the geometric center coordinates of each model. The model type determination module is used to read the mesh file volume of each model and determine the baseline model and the model to be replaced in each of the repeated model groups based on the mesh file volume. The model replacement module is used to replace the model to be replaced with the corresponding reference model based on the position offset and the rotation angle.

9. An electronic device, characterized in that, The device includes: one or more processors; and a storage device for storing one or more programs, which, when executed by the one or more processors, cause the one or more processors to implement the Unreal Engine-based model deduplication method as described in any one of claims 1-7.

10. A storage medium for storing computer-executable instructions, characterized in that, The computer-executable instructions, when executed by a computer processor, are used to perform the Unreal Engine-based model deduplication method as described in any one of claims 1-7.