Loading method, device, equipment, medium and product of historical and cultural block model

By compiling the Assimp library in Unreal Engine, reading and generating ProceduralMesh model objects, the problem of Unreal Engine being difficult to load and edit historical and cultural block models is solved, and support and dynamic repair management of various three-dimensional model data types are realized.

CN119762691APending Publication Date: 2025-04-04GUANGZHOU URBAN PLANNING & DESIGN SURVEY RES INST
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411678338.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-22
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

It is difficult for the existing technology to directly load and edit historical and cultural block models in the running state of Unreal Engine, and the native Unreal Engine only supports FBX and OBJ models and is not compatible with more data types such as GLTF and GLB.

Method used

Compile the Assimp library in Unreal Engine, call the Assimp library to read the historical and cultural block model data, generate ProceduralMesh model objects in real time, and support online editing of the model to adjust the pose and scale of the model.

Benefits of technology

It realizes loading and editing of a variety of three-dimensional model data types in Unreal Engine, including GLTF, GLB, etc., supports dynamic repair management, and improves the editability and compatibility of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119762691A_ABST
    Figure CN119762691A_ABST
Patent Text Reader

Abstract

The present invention discloses a method, device, equipment, medium and product for loading a historical and cultural block model. The method comprises: compiling an Assimp library in an Unreal Engine, and calling the Assimp library to read historical and cultural block model data; generating a ProceduralMesh model object in real time according to the historical and cultural block model data; attaching the ProceduralMesh model object to an Actor model object, and editing the posture and scale of the Actor model object; wherein the Actor model object is the parent node of the ProceduralMesh model object, and when the Actor model object is edited, the ProceduralMesh model object will also be edited accordingly; stripping the ProceduralMesh model object from the Actor model object, and using the compiled Unreal Engine to load the edited ProceduralMesh model object in a scene. By compiling the Assimp library in the Unreal Engine, the present invention can not only load FBX and OBJ models natively supported by the Unreal Engine, but also be compatible with more data types such as GLTF and GLB, and also support online model editing to adjust the posture and scale of the model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer information processing technology, and in particular to a method, device, equipment, medium and product for loading a historical and cultural block model based on an Unreal Engine. Background Art

[0002] In recent years, my country has paid more and more attention to the display and utilization, style protection, and dynamic supervision of historical and cultural blocks. The use of GIS, digital twins, BIM and other technical means can provide digital support for the intelligent display and repair management of historical and cultural blocks. Unreal Engine is one of the current mainstream game engines. Thanks to the powerful 3D scene rendering technology of Unreal Engine, using Unreal Engine to build a digital twin platform has become an important research direction. With the continuous advancement of Unreal Engine's application in the digital twin platform, directly loading and editing the historical and cultural block model under the running state of Unreal Engine has become a key issue that needs to be solved urgently.

[0003] However, existing technologies often preload model data into scenes in the development state. When the digital twin engine is facing the design needs of dynamic repair management of historical and cultural blocks, it is necessary to agree on the scene plan with the developer in advance, and the developer will customize the development on this basis. Finally, the user can compare and analyze the model plan. It can be seen that this method has more complicated development and deployment steps, and only supports preloading into the scene in the development state, but does not support dynamic loading, which makes it difficult to meet the needs of dynamic repair management during the display of historical and cultural blocks. In addition, the native Unreal Engine only supports FBX and OBJ models, and is not compatible with more three-dimensional geographic model data types such as GLTF and GLB. Summary of the invention

[0004] The technical problem to be solved by the present invention is to provide a method, device, equipment, medium and product for loading a historical and cultural block model based on the Unreal Engine. By compiling the Assimp library in the Unreal Engine, not only can the FBX and OBJ models natively supported by the Unreal Engine be loaded, but more data types such as GLTF and GLB can also be compatible, and online editing of the model is also supported to adjust the posture and scale of the model.

[0005] In order to achieve the above object, an embodiment of the present invention provides a method for loading a historical and cultural block model, comprising:

[0006] Compile the Assimp library in the Unreal Engine, and call the Assimp library to read the historical and cultural block model data;

[0007] Generate a ProceduralMesh model object in real time according to the historical and cultural block model data;

[0008] Attach the ProceduralMesh model object to the Actor model object, and edit the posture and scale of the Actor model object; wherein the Actor model object is the parent node of the ProceduralMesh model object, and when the Actor model object is edited, the ProceduralMesh model object will also be edited accordingly;

[0009] The ProceduralMesh model object is separated from the Actor model object, and the edited ProceduralMesh model object is loaded into the scene using the compiled Unreal Engine.

[0010] As an improvement of the above solution, the historical and cultural block model data at least includes facet vertices, facet vertex order, facet coordinates, facet normals, UV, vertex colors and tangents.

[0011] As an improvement of the above solution, the real-time generation of ProceduralMesh model objects based on the historical and cultural block model data specifically includes:

[0012] Create an empty ProceduralMesh model object in Unreal Engine;

[0013] The historical and cultural block model data are assigned one by one to the empty ProceduralMesh model object to generate the ProceduralMesh model object.

[0014] As an improvement of the above solution, the editing of the posture and scale of the Actor model object specifically includes:

[0015] Obtaining the position offset, angle offset, and scale offset of the user's editing operation on the Actor model object;

[0016] Determine the spatial position of the ProceduralMesh model object after editing according to the position offset and the position adjustment factor;

[0017] Determining the orientation of the ProceduralMesh model object after editing according to the angle offset and the angle adjustment factor;

[0018] Determining the scale of the ProceduralMesh model object after editing according to the scale offset and the scale adjustment factor;

[0019] The offset is a preset adjustment step or a preset adjustment value; the adjustment factor is used to control the amount of change in the actual scene corresponding to when the user operates a unit.

[0020] As an improvement of the above solution, the spatial position of the ProceduralMesh model object after editing is:

[0021]

[0022] Where, [X′, Y′, Z′] T Indicates the spatial position of the edited ProceduralMeshr model object; [X, Y, Z] T Indicates the spatial position of the ProceduralMesh model object before editing; T = [ΔX, ΔY, ΔZ] T Represents the position offset; λ T represents the position adjustment factor;

[0023] The orientation of the ProceduralMesh model object after editing is:

[0024]

[0025] In the formula, [α′, β′, γ′] T Indicates the orientation of the ProceduralMesh model object after editing; [α, β, γ] T Indicates the orientation of the ProceduralMesh model object before editing; P = [Δα, Δβ, Δγ] T Indicates the angle offset; λ R Represents the angle adjustment factor.

[0026] As an improvement of the above solution, determining the scale of the edited ProceduralMesh model object according to the scale offset and the scale adjustment factor specifically includes:

[0027] The properties of the bounding box of the ProceduralMesh model object are used as the scale adjustment object; wherein the minimum bounding box of the ProceduralMesh model object is composed of the three-dimensional coordinates of the center point of the bounding box and the extension vector [Extend] from the center point to the X, Y, and Z directions x ,Extend y ,Extend z ] T The scale can be represented by any edge of the minimum bounding box in the X, Y, or Z directions.

[0028] The scale of the edited ProceduralMesh model object is:

[0029] L′=L+λ lΔl;

[0030] Where L′ represents the scale of the ProceduralMesh model object after editing; L represents the scale of the ProceduralMesh model object before editing; Δl represents the scale offset; λ l Represents the scale adjustment factor.

[0031] The embodiment of the present invention further provides a loading device for a historical and cultural block model, comprising:

[0032] A data reading module, used to compile the Assimp library in the Unreal Engine and call the Assimp library to read the historical and cultural block model data;

[0033] A model generation module, used to generate a ProceduralMesh model object in real time according to the historical and cultural block model data;

[0034] A model editing module, used to attach the ProceduralMesh model object to the Actor model object, and edit the posture and scale of the Actor model object; wherein the Actor model object is the parent node of the ProceduralMesh model object, and when the Actor model object is edited, the ProceduralMesh model object will also be edited accordingly;

[0035] The model loading module is used to separate the ProceduralMesh model object from the Actor model object, and use the compiled Unreal Engine to load the edited ProceduralMesh model object in the scene.

[0036] An embodiment of the present invention also provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor implements the method for loading the historical and cultural block model described in any one of the above items when executing the computer program.

[0037] An embodiment of the present invention also provides a computer-readable storage medium, which includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute any of the above-mentioned methods for loading the historical and cultural block model.

[0038] An embodiment of the present invention further provides a computer program product, which includes a computer program or computer instructions. When the computer program or the computer instructions are executed by a processor, the method for loading the historical and cultural block model described in any one of the above items is implemented.

[0039] Compared with the prior art, the beneficial effects of a method, device, equipment, medium and product for loading a historical and cultural block model provided by an embodiment of the present invention are: by compiling the Assimp library in the Unreal Engine and calling the Assimp library to read the historical and cultural block model data; generating a ProceduralMesh model object in real time according to the historical and cultural block model data; attaching the ProceduralMesh model object to the Actor model object, and editing the posture and scale of the Actor model object; wherein the Actor model object is the parent node of the ProceduralMesh model object, and when the Actor model object is edited, the ProceduralMesh model object will also be edited accordingly; stripping the ProceduralMesh model object from the Actor model object, and using the compiled Unreal Engine to load the edited ProceduralMesh model object in the scene. By compiling the Assimp library in the Unreal Engine, the embodiment of the present invention can not only load the FBX and OBJ models natively supported by the Unreal Engine, but also be compatible with more data types such as GLTF and GLB, and also support online model editing to adjust the posture and scale of the model. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 It is a flow chart of a preferred embodiment of a method for loading a historical and cultural block model provided by the present invention;

[0041] Figure 2 It is a schematic diagram of a bounding box in a method for loading a historical and cultural block model provided by the present invention;

[0042] Figure 3 It is a structural schematic diagram of a preferred embodiment of a loading device for a historical and cultural block model provided by the present invention;

[0043] Figure 4 It is a structural schematic diagram of a preferred embodiment of a terminal device provided by the present invention. DETAILED DESCRIPTION

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

[0045] See also Figure 1 , Figure 1The figure is a flow chart of a preferred embodiment of a method for loading a historical and cultural block model provided by the present invention. The method for loading a historical and cultural block model comprises:

[0046] S1, compile the Assimp library in the Unreal Engine, and call the Assimp library to read the historical and cultural block model data;

[0047] S2, generating a ProceduralMesh model object in real time according to the historical and cultural block model data;

[0048] S3, attaching the ProceduralMesh model object to the Actor model object, and editing the posture and scale of the Actor model object; wherein the Actor model object is the parent node of the ProceduralMesh model object, and when the Actor model object is edited, the ProceduralMesh model object will also be edited accordingly;

[0049] S4, separating the ProceduralMesh model object from the Actor model object, and using the compiled Unreal Engine to load the edited ProceduralMesh model object into the scene.

[0050] Specifically, an embodiment of the present invention provides a model loading method based on Unreal Engine, which is applied to the historical and cultural block model. The historical and cultural block model can be directly loaded and edited in the running state of Unreal Engine to meet the needs of dynamic repair management in the display process of the historical and cultural block. First, the Assimp library is compiled in the Unreal Engine, and the Assimp library is called to read the historical and cultural block model data. Then, according to the read historical and cultural block model data, a ProceduralMesh (procedural mesh) model object is generated in real time. Secondly, the generated ProceduralMesh model object is attached to the Actor model object, and ArchViz is integrated to edit the posture and scale of the Actor model object. Among them, the Actor model object is a basic component of the 3D world in the Unreal Engine and can be used to express a 3D model. It is important that it has spatial attributes such as posture and scale, and can be adjusted and edited using the ArchViz tool. In addition, the spatial attributes such as the posture and scale of the Actor model object can be opened to the user for editing, that is, the user can set its three-dimensional position and scale. The ProceduralMesh model object can create a custom 3D model based on the model vertex and triangle data in the running state. It can directly create a 3D model of any shape that does not exist in the scene based on the model parameters. Therefore, attach the ProceduralMesh model object to the Actor model object, and make the Actor model object the parent node of the ProceduralMesh model object, that is, the ProceduralMesh model object inherits the Actor model object. Then, when the user edits the spatial properties of the Actor model object through the ArchViz tool, the spatial coordinates and scale of the ProceduralMesh model object are also edited accordingly. For example, if the parent node Actor moves, the ProceduralMesh attached to it will also move accordingly. Finally, the ProceduralMesh model object is stripped from the Actor model object and the Actor model object is destroyed, so that the ProceduralMesh model object no longer inherits the Actor model object and exists as an independent object. The stripped ProceduralMesh model object is a custom 3D model created based on model parameters such as model vertices and triangle data. It also has a three-dimensional position and scale set by the user. At this time, the compiled Unreal Engine is used to load the edited ProceduralMesh model object into the scene.

[0051] It should be noted that the model loading method provided in the embodiment of the present invention can be applied not only to the loading of historical and cultural block models, but also to the loading of other building models.

[0052] The embodiment of the present invention can not only load FBX and OBJ models natively supported by the Unreal Engine by compiling the Assimp library in the Unreal Engine, but also be compatible with more data types such as GLTF and GLB, and also support online editing of the model to adjust the posture and scale of the model.

[0053] In another preferred embodiment, the historical and cultural block model data at least includes patch vertices, patch vertex order, patch coordinates, patch normals, UV, vertex colors, and tangents.

[0054] Specifically, the historical and cultural block model data in the embodiment of the present invention at least includes facet vertices, facet vertex order, facet coordinates, facet normals, UV, vertex colors and tangents. These data play an important role in the historical and cultural block model, and they jointly determine the geometric shape, surface texture, color and lighting effects of the model. By accurately setting these data, a historical and cultural block model with high realism and rich details can be created. Among them, facet vertices refer to the basic geometric elements that constitute the model surface, that is, the vertices of the triangle. In three-dimensional modeling, the model surface is usually composed of many small triangular facets, and the vertices of these facets are facet vertices. For the historical and cultural block model, the facet vertices will include the vertices of all visible elements such as buildings, roads, and greenery in the block. Facet vertex order refers to the arrangement order of the three vertices that constitute the triangular facet. This order determines the direction and shape of the triangle. In three-dimensional modeling, the correct vertex order is crucial for the rendering and display of the model. Facet coordinates refer to the position information of the facet vertices in three-dimensional space. These coordinates determine the shape and position of the model in virtual space. For the historical and cultural block model, the patch coordinates will include the precise location information of all buildings, roads, greenery and other elements in the block. The patch normal refers to the vector that is perpendicular to the triangular patch and points to the outside of the model. The normal is crucial to the rendering and lighting effects of the model because it determines how light interacts with the surface of the model. In the historical and cultural block model, the correct normal setting can ensure that the surface lighting effects of elements such as buildings and roads are more realistic. UV refers to the texture mapping coordinate, which defines the position information of each point on the image and corresponds these points to the vertices on the three-dimensional model. In the historical and cultural block model, the UV coordinates are used to accurately map the texture image (such as the brick pattern on the surface of the building, the road texture, etc.) to the model surface. Vertex color refers to defining the color of the model surface by assigning color values ​​to the vertices of the model. In the historical and cultural block model, vertex color can be used to simulate the color changes on the surface of the building, the color of the road, etc. Vertex color is usually stored in the form of vertex data, and the color of the entire model surface is calculated based on the interpolation between vertices during the rendering process. The tangent is a vector perpendicular to the normal, which defines the texture direction of the model surface. In the historical and cultural block model, tangents are crucial to the rendering effect of textures. Correct tangent settings can ensure that the texture is oriented correctly on the model surface, thus enhancing the realism of the model.

[0055] In another preferred embodiment, the real-time generation of the ProceduralMesh model object according to the historical and cultural block model data specifically includes:

[0056] Create an empty ProceduralMesh model object in Unreal Engine;

[0057] The historical and cultural block model data are assigned one by one to the empty ProceduralMesh model object to generate the ProceduralMesh model object.

[0058] Specifically, when the embodiment of the present invention generates a ProceduralMesh model object in real time based on the historical and cultural block model data, it first creates an empty ProceduralMesh model object in the Unreal Engine, which is equivalent to initializing a new ProceduralMesh model object without attributes. Then, the historical and cultural block model data read from the Assimp library, such as patch vertices, patch vertex order, patch coordinates, patch normals, UV, vertex colors, tangents, etc., are assigned to the empty ProceduralMesh model object one by one, thereby generating a ProceduralMesh model object.

[0059] In another preferred embodiment, the editing of the posture and scale of the Actor model object specifically includes:

[0060] Obtaining the position offset, angle offset, and scale offset of the user's editing operation on the Actor model object;

[0061] Determine the spatial position of the ProceduralMesh model object after editing according to the position offset and the position adjustment factor;

[0062] Determining the orientation of the ProceduralMesh model object after editing according to the angle offset and the angle adjustment factor;

[0063] Determining the scale of the ProceduralMesh model object after editing according to the scale offset and the scale adjustment factor;

[0064] The offset is a preset adjustment step or a preset adjustment value; the adjustment factor is used to control the amount of change in the actual scene corresponding to when the user operates a unit.

[0065] Specifically, editing can be achieved through external devices or directly through data input, for example, it can be achieved by the user dragging the mouse or by the user setting a specific value. When editing is achieved by capturing the user's editing operation offset, T = [ΔX, ΔY, ΔZ] T is the position offset of the user's editing operation, R = [Δα, Δβ, Δγ] Tis the angle offset of the user's editing operation, and Δl is the scale offset of the user's editing operation. Get the position offset, angle offset, and scale offset of the user's editing operation on the Actor model object. Then, determine the spatial position of the edited ProceduralMesh model object based on the position offset and the position adjustment factor; determine the orientation of the edited ProceduralMesh model object based on the angle offset and the angle adjustment factor; and determine the scale of the edited ProceduralMesh model object based on the scale offset and the scale adjustment factor.

[0066] It should be noted that the offset is a preset adjustment step or a preset adjustment value. In order to control the user's adjustment of T, R, and Δl, the offset can be limited, that is, the change in each adjustment can be {0.1, 0.2, 0.3...}. To achieve precise editing and adjustment, the user can directly set the specific values ​​of the posture and scale of the ProceduralMesh model object. The adjustment factor is used to control the change in the actual scene corresponding to the user's operation of a unit.

[0067] In another preferred embodiment, the spatial position of the ProceduralMesh model object after editing is:

[0068]

[0069] Where, [X′, Y′, Z′] T Indicates the spatial position of the edited ProceduralMeshr model object; [X, Y, Z] T Indicates the spatial position of the ProceduralMesh model object before editing; T = [ΔX, ΔY, ΔZ] T Represents the position offset; λ T represents the position adjustment factor;

[0070] The orientation of the ProceduralMesh model object after editing is:

[0071]

[0072] In the formula, [α′, β′, γ′] T Indicates the orientation of the ProceduralMesh model object after editing; [α, β, β] T Indicates the orientation of the ProceduralMesh model object before editing; R = [Δα, Δβ, Δγ] T Indicates the angle offset; λ R Represents the angle adjustment factor.

[0073] Specifically, if the posture of the ProceduralMesh model object before editing is [X, Y, Z] T and [α,β,γ] T To represent its spatial position and orientation, the posture of the edited ProceduralMesh model object is:

[0074]

[0075] Where, [X′, Y′, Z′] T Indicates the spatial position of the edited ProceduralMeshr model object; [X, Y, Z] T Indicates the spatial position of the ProceduralMesh model object before editing; T = [ΔX, ΔY, ΔZ] T Represents the position offset; λ T represents the position adjustment factor;

[0076]

[0077] In the formula, [α′, β′, γ′] T Indicates the orientation of the ProceduralMesh model object after editing; [α, β, γ] T Indicates the orientation of the ProceduralMesh model object before editing; R = [Δα, Δβ, Δγ] T Indicates the angle offset; λ R Represents the angle adjustment factor.

[0078] In another preferred embodiment, determining the scale of the edited ProceduralMesh model object according to the scale offset and the scale adjustment factor specifically includes:

[0079] The properties of the bounding box of the ProceduralMesh model object are used as the scale adjustment object; wherein the minimum bounding box of the ProceduralMesh model object is composed of the three-dimensional coordinates of the center point of the bounding box and the extension vector [Extend] from the center point to the X, Y, and Z directions x ,Extend y ,Extend z ] T The scale can be represented by any edge of the minimum bounding box in the X, Y, or Z directions.

[0080] The scale of the edited ProceduralMesh model object is:

[0081] L′=L+λ l Δl;

[0082] Where L′ represents the scale of the ProceduralMesh model object after editing; L represents the scale of the ProceduralMesh model object before editing; Δl represents the scale offset; λ l Represents the scale adjustment factor.

[0083] Specifically, the embodiment of the present invention can use the properties of the bounding box of the ProceduralMesh model object as a scale adjustment object to adjust its scale. Figure 2 , Figure 2 It is a schematic diagram of a bounding box in a method for loading a historical and cultural block model provided by the present invention. A bounding box is a simple geometric body, usually a rectangular box, which completely surrounds all vertices of the model and is an important basis for determining the size and position of the model. Adjusting the scale of a ProceduralMesh model object usually means changing the size of the model, which can be achieved by modifying the size of its bounding box. The minimum bounding box of a ProceduralMesh model object consists of the three-dimensional coordinates of the center point of the bounding box and the extension vector [Extend] from the center point in the X, Y, and Z directions. x ,Extend y ,Extend z ] T The scale can be represented by any edge of the minimum bounding box in the X, Y, and Z directions. The scale of the edited ProceduralMesh model object is:

[0084] L′=L+λ l Δl;

[0085] Where L′ represents the scale of the ProceduralMesh model object after editing; L represents the scale of the ProceduralMesh model object before editing; Δl represents the scale offset; λ l Represents the scale adjustment factor.

[0086] Correspondingly, the present invention also provides a loading device for a historical and cultural block model, which can implement all the processes of the loading method for the historical and cultural block model in the above embodiment.

[0087] See also Figure 3 , Figure 3 1 is a schematic diagram of a preferred embodiment of a loading device for a historical and cultural block model provided by the present invention. The loading device for the historical and cultural block model comprises:

[0088] The data reading module 301 is used to compile the Assimp library in the Unreal Engine and call the Assimp library to read the historical and cultural block model data;

[0089] A model generation module 302 is used to generate a ProceduralMesh model object in real time according to the historical and cultural block model data;

[0090] The model editing module 303 is used to attach the ProceduralMesh model object to the Actor model object, and edit the posture and scale of the Actor model object; wherein the Actor model object is the parent node of the ProceduralMesh model object, and when the Actor model object is edited, the ProceduralMesh model object will also be edited accordingly;

[0091] The model loading module 304 is used to separate the ProceduralMesh model object from the Actor model object, and use the compiled Unreal Engine to load the edited ProceduralMesh model object into the scene.

[0092] Preferably, the historical and cultural block model data at least includes facet vertices, facet vertex order, facet coordinates, facet normals, UV, vertex colors and tangents.

[0093] Preferably, the model generation module 302 specifically includes:

[0094] The model creation unit 312 is used to create an empty ProceduralMesh model object in the Unreal Engine;

[0095] The model assignment unit 322 is used to assign the historical and cultural block model data to the empty ProceduralMesh model object one by one to generate the ProceduralMesh model object.

[0096] Preferably, editing the posture and scale of the Actor model object specifically includes:

[0097] Obtaining the position offset, angle offset, and scale offset of the user's editing operation on the Actor model object;

[0098] Determine the spatial position of the ProceduralMesh model object after editing according to the position offset and the position adjustment factor;

[0099] Determining the orientation of the ProceduralMesh model object after editing according to the angle offset and the angle adjustment factor;

[0100] Determining the scale of the ProceduralMesh model object after editing according to the scale offset and the scale adjustment factor;

[0101] The offset is a preset adjustment step or a preset adjustment value; the adjustment factor is used to control the amount of change in the actual scene corresponding to when the user operates a unit.

[0102] Preferably, the spatial position of the ProceduralMesh model object after editing is:

[0103]

[0104] Where, [X′, Y′, Z′] T Indicates the spatial position of the edited ProceduralMeshr model object; [X, Y, Z] T Indicates the spatial position of the ProceduralMesh model object before editing; T = [ΔX, ΔY, ΔZ] T Represents the position offset; λ T represents the position adjustment factor;

[0105] The orientation of the ProceduralMesh model object after editing is:

[0106]

[0107] In the formula, [α′, β′, γ′] T Indicates the orientation of the ProceduralMesh model object after editing; [α, β, γ] T Indicates the orientation of the ProceduralMesh model object before editing; R = [Δα, Δβ, Δγ] T Indicates the angle offset; λ R Represents the angle adjustment factor.

[0108] Preferably, determining the scale of the edited ProceduralMesh model object according to the scale offset and the scale adjustment factor specifically includes:

[0109] The properties of the bounding box of the ProceduralMesh model object are used as the scale adjustment object; wherein the minimum bounding box of the ProceduralMesh model object is composed of the three-dimensional coordinates of the center point of the bounding box and the extension vector [Extend] from the center point to the X, Y, and Z directions x ,Extend y ,Extend z ]T The scale can be represented by any edge of the minimum bounding box in the X, Y, or Z directions.

[0110] The scale of the edited ProceduralMesh model object is:

[0111] L′=L+λ l Δl;

[0112] Where L′ represents the scale of the ProceduralMesh model object after editing; L represents the scale of the ProceduralMesh model object before editing; Δl represents the scale offset; λ l Represents the scale adjustment factor.

[0113] In the specific implementation, the working principle, control process and technical effect achieved by the loading device of the historical and cultural block model provided in the embodiment of the present invention are the same as those of the loading method of the historical and cultural block model in the above-mentioned embodiment, and will not be repeated here.

[0114] See also Figure 4 , Figure 4 4 is a schematic diagram of a preferred embodiment of a terminal device provided by the present invention. The terminal device includes a processor 401, a memory 402, and a computer program stored in the memory 402 and configured to be executed by the processor 401. When the processor 401 executes the computer program, the method for loading the historical and cultural block model described in any of the above embodiments is implemented.

[0115] Preferably, the computer program can be divided into one or more modules / units (such as computer program 1, computer program 2, ...), and the one or more modules / units are stored in the memory 402 and executed by the processor 401 to complete the present invention. The one or more modules / units can be a series of computer program instruction segments that can complete specific functions, and the instruction segments are used to describe the execution process of the computer program in the terminal device.

[0116] The processor 401 can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor, or the processor 401 can be any conventional processor. The processor 401 is the control center of the terminal device, and various parts of the terminal device are connected using various interfaces and lines.

[0117] The memory 402 mainly includes a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function, etc., and the data storage area can store related data, etc. In addition, the memory 402 can be a high-speed random access memory, or a non-volatile memory, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, and a flash card (Flash Card), etc., or the memory 402 can also be other volatile solid-state storage devices.

[0118] It should be noted that the above terminal device may include, but is not limited to, a processor and a memory. Those skilled in the art will understand that Figure 4 The structural diagram is only an example of the above-mentioned terminal device and does not constitute a limitation of the above-mentioned terminal device. It may include more or less components than shown in the figure, or combine certain components, or different components.

[0119] An embodiment of the present invention also provides a computer-readable storage medium, which includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute the method for loading the historical and cultural block model described in any of the above embodiments.

[0120] An embodiment of the present invention further provides a computer program product, which includes a computer program or computer instructions. When the computer program or the computer instructions are executed by a processor, the method for loading the historical and cultural block model described in any of the above embodiments is implemented.

[0121] The embodiment of the present invention provides a method, device, equipment, medium and product for loading a historical and cultural block model, by compiling an Assimp library in an Unreal Engine, and calling the Assimp library to read the historical and cultural block model data; generating a ProceduralMesh model object in real time according to the historical and cultural block model data; attaching the ProceduralMesh model object to an Actor model object, and editing the posture and scale of the Actor model object; wherein the Actor model object is the parent node of the ProceduralMesh model object, and when the Actor model object is edited, the ProceduralMesh model object will also be edited accordingly; stripping the ProceduralMesh model object from the Actor model object, and using the compiled Unreal Engine to load the edited ProceduralMesh model object in the scene. The embodiment of the present invention compiles the Assimp library in the Unreal Engine, so that not only the FBX and OBJ models natively supported by the Unreal Engine can be loaded, but also more data types such as GLTF and GLB can be compatible, and online model editing is also supported to adjust the posture and scale of the model.

[0122] It should be noted that the system embodiment described above is merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the system embodiment provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines. A person of ordinary skill in the art may understand and implement it without paying any creative effort.

[0123] The above is a preferred embodiment of the present invention. It should be pointed out that a person skilled in the art can make several improvements and modifications without departing from the principle of the present invention. These improvements and modifications are also considered to be within the scope of protection of the present invention.

Claims

1. A method for loading a historical and cultural block model, characterized in that: include: Compile the Assimp library in the Unreal Engine, and call the Assimp library to read the historical and cultural block model data; Generate a ProceduralMesh model object in real time according to the historical and cultural block model data; Attach the ProceduralMesh model object to the Actor model object, and edit the posture and scale of the Actor model object; wherein the Actor model object is the parent node of the ProceduralMesh model object, and when the Actor model object is edited, the ProceduralMesh model object will also be edited accordingly; The ProceduralMesh model object is separated from the Actor model object, and the edited ProceduralMesh model object is loaded into the scene using the compiled Unreal Engine.

2. The method for loading a historical and cultural block model as claimed in claim 1, characterized in that: The historical and cultural block model data at least includes facet vertices, facet vertex order, facet coordinates, facet normals, UV, vertex colors and tangents.

3. The method for loading a historical and cultural block model as claimed in claim 2, characterized in that: The real-time generation of a ProceduralMesh model object according to the historical and cultural block model data specifically includes: Create an empty ProceduralMesh model object in Unreal Engine; The historical and cultural block model data are assigned one by one to the empty ProceduralMesh model object to generate the ProceduralMesh model object.

4. The method for loading a historical and cultural block model as claimed in claim 1, characterized in that: The editing of the posture and scale of the Actor model object specifically includes: Obtaining the position offset, angle offset, and scale offset of the user's editing operation on the Actor model object; Determine the spatial position of the ProceduralMesh model object after editing according to the position offset and the position adjustment factor; Determining the orientation of the ProceduralMesh model object after editing according to the angle offset and the angle adjustment factor; Determining the scale of the ProceduralMesh model object after editing according to the scale offset and the scale adjustment factor; The offset is a preset adjustment step or a preset adjustment value; the adjustment factor is used to control the amount of change in the actual scene corresponding to when the user operates a unit.

5. The method for loading a historical and cultural block model as claimed in claim 4, characterized in that: The spatial position of the ProceduralMesh model object after editing is: Where, [X′, Y′, Z′] T Indicates the spatial position of the edited ProceduralMeshr model object; [X, Y, Z] T Indicates the spatial position of the ProceduralMesh model object before editing; T = [ΔX, ΔY, ΔZ] T Represents the position offset; λ T represents the position adjustment factor; The orientation of the ProceduralMesh model object after editing is: In the formula, [α′, β′, γ′] T Indicates the orientation of the ProceduralMesh model object after editing; [α, β, γ] T Indicates the orientation of the ProceduralMesh model object before editing; R = [Δα, Δβ, Δγ] T Indicates the angle offset; λ R Represents the angle adjustment factor.

6. The method for loading a historical and cultural block model as claimed in claim 5, characterized in that: Determining the scale of the edited ProceduralMesh model object according to the scale offset and the scale adjustment factor specifically includes: The properties of the bounding box of the ProceduralMesh model object are used as the scale adjustment object; wherein the minimum bounding box of the ProceduralMesh model object is composed of the three-dimensional coordinates of the center point of the bounding box and the extension vector [Extend] from the center point to the X, Y, and Z directions x ,Extend y ,Extend z ] T The scale can be represented by any edge of the minimum bounding box in the X, Y, or Z directions. The scale of the edited ProceduralMesh model object is: L′=L+λ l Δl; Where L′ represents the scale of the ProceduralMesh model object after editing; L represents the scale of the ProceduralMesh model object before editing; Δl represents the scale offset; λ l Represents the scale adjustment factor.

7. A loading device for a historical and cultural block model, characterized in that: include: A data reading module, used to compile the Assimp library in the Unreal Engine and call the Assimp library to read the historical and cultural block model data; A model generation module, used to generate a ProceduralMesh model object in real time according to the historical and cultural block model data; A model editing module, used to attach the ProceduralMesh model object to the Actor model object, and edit the posture and scale of the Actor model object; wherein the Actor model object is the parent node of the ProceduralMesh model object, and when the Actor model object is edited, the ProceduralMesh model object will also be edited accordingly; The model loading module is used to separate the ProceduralMesh model object from the Actor model object, and use the compiled Unreal Engine to load the edited ProceduralMesh model object in the scene.

8. A terminal device, characterized in that: It includes a processor and a memory, wherein a computer program is stored in the memory, and the computer program is configured to be executed by the processor, and when the processor executes the computer program, it implements the method for loading the historical and cultural block model as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein when the device where the computer-readable storage medium is located executes the computer program, the method for loading the historical and cultural block model as described in any one of claims 1 to 6 is implemented.

10. A computer program product, characterized in that The computer program product includes a computer program or computer instructions, and when the computer program or the computer instructions are executed by a processor, the method for loading the historical and cultural block model as described in any one of claims 1 to 6 is implemented.