Unity 3D-based three-dimensional model wall dynamic processing method and device and storage medium
Through the independent individual of three -dimensional objects in Unity3D, divide and deal with intersecting relationships, perform a vertex and UV's Boer operation, solve the flexibility and performance problems of the three -dimensional model cutting processing in existing technologies, and achieve efficient and stable three -dimensional models. Dynamic treatment.
Patent Information
- Application Number
- CN202311557816.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-21
- Publication Date
- 2025-01-24
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art has a fixed segmentation method for cutting processing when multiple three-dimensional objects intersect in Unity3D, which cannot meet the needs of arbitrary free segmentation model. Moreover, the model generation after cutting is complex, the number of memory accesses is large, and the performance is low.
By separating all three-dimensional objects in the three-dimensional scene into separate individuals, dividing them into walls and non-walls, traversing the intersection relationships, performing Boolean operations on vertices and UVs, regenerating the mesh and replacing the mesh information of the original wall.
The flexible cutting treatment of the three -dimensional model in the Unity3D is implemented, which improves the implementation efficiency, stability and reuse, and is suitable for various irregular three -dimensional objects.
Smart Images

Figure CN119359960A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of three-dimensional model processing, and in particular to a method, device and storage medium for dynamic processing of three-dimensional model walls based on Unity3D. Background Art
[0002] Unity3D is a multi-platform comprehensive game development tool developed by Unity Technologies that allows players to easily create interactive content such as 3D video games, architectural visualization, real-time 3D animation, etc. It is a fully integrated professional game engine.
[0003] Many companies or developers who provide software design and development services for the home improvement and renovation industries will encounter a type of problem when using Unity3D for three-dimensional function development, that is, when multiple three-dimensional objects intersect, these intersecting three-dimensional objects need to be cut. However, in the prior art, if you want to cut and separate the Unity3D model, you generally use model animation to achieve fixed segmentation processing. However, this type of segmentation method is fixed and the form is relatively simple. It cannot meet the needs of free and arbitrary segmentation of the model and cannot achieve flexible and free cutting. At the same time, in the prior art, after cutting the model, two sub-models are often generated and the original model is deleted to achieve the cutting and separation effect. This method is not only complicated in process, but also has a large number of memory accesses and low performance. Summary of the invention
[0004] The main purpose of the present invention is to provide a method, device and storage medium for dynamic processing of three-dimensional model walls based on Unity3D, aiming to solve the above technical problems.
[0005] To achieve the above object, the present invention provides a three-dimensional model wall dynamic processing method based on Unity3D.
[0006] Separate all three-dimensional objects in the three-dimensional scene into separate individuals;
[0007] Divide the individual into a first sub-individual and a second sub-individual, wherein the first sub-individual is a wall that needs to be dynamically processed, and the second sub-individual is a non-wall;
[0008] Traversing all first sub-individuals, and polling and retrieving the intersection relationship between each first sub-individual and all second sub-individuals;
[0009] Perform logical operations on each second sub-individual that has an intersection relationship with the first sub-individual to obtain specific intersection information between the two;
[0010] Perform Boolean operations on vertices and UVs based on the intersection information to obtain new vertex and UV information;
[0011] Regenerate the mesh based on the new vertex and UV information and replace the original wall mesh information.
[0012] In one embodiment, the step of separating all three-dimensional objects in the three-dimensional scene into separate individuals is specifically: screening out all qualified three-dimensional objects from the three-dimensional scene, decoupling these objects and storing them in the array to be processed as independent three-dimensional individuals.
[0013] In one embodiment, after the step of dividing the individual into a first sub-individual and a second sub-individual, wherein the first sub-individual is a wall that needs to be dynamically processed and the second sub-individual is a non-wall, the method further includes:
[0014] All first sub-individuals are stored in the wall stack library, and the second sub-individuals are stored in other stack libraries.
[0015] In one embodiment, the step of traversing all first sub-individuals and polling to retrieve the intersection relationship between each first sub-individual and all second sub-individuals includes:
[0016] All first sub-individuals in the wall stack library are traversed, and the three-dimensional spatial information of each first sub-individual and all second sub-individuals in other stack libraries is polled and retrieved, and the three-dimensional spatial information of each of the individuals is stored by establishing a bounding box.
[0017] In one embodiment, the step of performing a logical operation on each second sub-individual that has an intersection relationship with the first sub-individual to obtain specific intersection information between the two includes:
[0018] According to the bounding box information, the bounding box information is polled and traversed, and the bounding box information of the second sub-individual that does not intersect with the bounding box information corresponding to the first sub-individual is filtered out to obtain the intersection information between the first sub-individual and the second sub-individual.
[0019] In one embodiment, the step of performing Boolean operations on vertices and UVs based on the intersection information to obtain new vertex and UV information includes:
[0020] According to the intersection information between the first sub-individual and the second sub-individual, the polling process is performed again by traversing the wall stack library. During the traversal process, the mesh information of all the second sub-individuals that have an intersection relationship with the current first sub-individual is extracted to perform a mesh merging operation;
[0021] The steps of the mesh merging operation are as follows: merging vertices and correcting transformation matrix information, obtaining a set of vertex arrays after correcting the three-dimensional space transformation matrix through orderly merging of vertex information and correcting transformation matrix information, and performing inner circle vertex culling and invalid vertex optimization on these vertex arrays through the convex hull algorithm, and finally obtaining the optimal convex hull encirclement vertex array;
[0022] After obtaining the optimal convex hull encirclement vertex array, a new mesh object is created using the optimal convex hull encirclement vertex array information, and the mesh object corresponds to the optimal convex hull encirclement vertex array information.
[0023] In one embodiment, after the step of performing Boolean operations on vertices and UVs based on the intersection information to obtain new vertex and UV information, the method further includes:
[0024] Performing thickness expansion processing on the mesh object so that its thickness is greater than the thickness of the first sub-individual;
[0025] A Boolean operation is performed on the mesh after the thickness expansion process and the first sub-individual to generate final vertex array information.
[0026] In one embodiment, the step of regenerating the mesh according to the new vertex and UV information and replacing the mesh information of the original wall includes:
[0027] Generate a new wall mesh object through the final vertex array information to display the processing effect of the original wall;
[0028] Destroy the mesh entity objects in the original wall.
[0029] In addition, to achieve the above-mentioned purpose, the present invention also provides a three-dimensional model wall dynamic processing device based on Unity3D, and the three-dimensional model wall dynamic processing device based on Unity3D includes: a memory, a processor, and a three-dimensional model wall dynamic processing program stored in the memory and executable on the processor, and when the three-dimensional model wall dynamic processing program is executed by the processor, the steps of the three-dimensional model wall dynamic processing method as described above are implemented.
[0030] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer-readable storage medium, on which a three-dimensional model wall dynamic processing program is stored, and when the three-dimensional model wall dynamic processing program is executed by a processor, the steps of the three-dimensional model wall dynamic processing method as described above are implemented.
[0031] Beneficial effects that can be achieved by the present invention: A method for dynamic processing of three-dimensional model walls based on Unity3D proposed in an embodiment of the present invention, by separating all three-dimensional objects in a three-dimensional scene into separate individuals; dividing the individuals into first sub-individuals and second sub-individuals, wherein the first sub-individuals are walls that need to be dynamically processed, and the second sub-individuals are non-walls; traversing all first sub-individuals, polling and retrieving the intersection relationship between each of the first sub-individuals and all second sub-individuals; performing logical operations on each second sub-individual that has an intersection relationship with the first sub-individual, respectively, to obtain specific intersection information between the two; performing Boolean operations on vertices and UVs based on the intersection information, to obtain new vertex and UV information; regenerating a mesh based on the new vertex and UV information and replacing the mesh information of the original wall. The method for dynamic processing of three-dimensional model walls provided in the present application not only improves execution efficiency, but also has high stability and reusability, and can be implemented and applied on various irregular three-dimensional objects. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 It is a schematic diagram of the structure of a device in a hardware operating environment involved in an embodiment of the present invention;
[0033] Figure 2 The figure is a flow chart of an embodiment of a method for dynamic processing of a three-dimensional model wall based on Unity3D of the present invention.
[0034] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0035] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0036] like Figure 1 As shown, Figure 1 It is a schematic diagram of the terminal structure of the hardware operating environment involved in the embodiment of the present invention.
[0037] The terminal of the embodiment of the present invention can be a PC, or it can be a smart phone, a tablet computer, an e-book reader, an MP3 (Moving Picture Experts Group Audio Layer III) player, an MP4 (Moving Picture Experts Group Audio Layer IV) player, a portable computer, or other portable terminal devices with display function.
[0038] like Figure 1As shown, the terminal may include: a processor 1001, such as a CPU, a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0039] Optionally, the terminal may also include a camera, an RF (Radio Frequency) circuit, a sensor, an audio circuit, a WiFi module, and the like. Among them, sensors include light sensors, motion sensors, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display screen according to the brightness of the ambient light, and the proximity sensor may turn off the display screen and / or backlight when the mobile terminal is moved to the ear. As a type of motion sensor, the gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of the mobile terminal (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; of course, the mobile terminal may also be equipped with other sensors such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., which will not be repeated here.
[0040] Those skilled in the art will understand that Figure 1 The terminal structure shown in the figure does not constitute a limitation on the terminal, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0041] like Figure 1 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a three-dimensional model wall dynamic processing program.
[0042] exist Figure 1In the terminal shown, the network interface 1004 is mainly used to connect to the backend server and communicate data with the backend server; the user interface 1003 is mainly used to connect to the client (user end) and communicate data with the client; and the processor 1001 can be used to call the three-dimensional model wall dynamic processing program stored in the memory 1005 and perform the following operations:
[0043] Separate all three-dimensional objects in the three-dimensional scene into separate individuals;
[0044] Divide the individual into a first sub-individual and a second sub-individual, wherein the first sub-individual is a wall that needs to be dynamically processed, and the second sub-individual is a non-wall;
[0045] Traversing all first sub-individuals, and polling and retrieving the intersection relationship between each first sub-individual and all second sub-individuals;
[0046] Perform logical operations on each second sub-individual that has an intersection relationship with the first sub-individual to obtain specific intersection information between the two;
[0047] Perform Boolean operations on vertices and UVs based on the intersection information to obtain new vertex and UV information;
[0048] Regenerate the mesh based on the new vertex and UV information and replace the original wall mesh information.
[0049] Furthermore, the processor 1001 may call the three-dimensional model wall dynamic processing program stored in the memory 1005, and further perform the following operations:
[0050] All qualified three-dimensional objects are selected from the three-dimensional scene, and these objects are decoupled and stored in the array to be processed as independent three-dimensional individuals.
[0051] Furthermore, the processor 1001 may call the three-dimensional model wall dynamic processing program stored in the memory 1005, and further perform the following operations:
[0052] All first sub-individuals are stored in the wall stack library, and the second sub-individuals are stored in other stack libraries.
[0053] Furthermore, the processor 1001 may call the three-dimensional model wall dynamic processing program stored in the memory 1005, and further perform the following operations:
[0054] All first sub-individuals in the wall stack library are traversed, and the three-dimensional spatial information of each first sub-individual and all second sub-individuals in other stack libraries is polled and retrieved, and the three-dimensional spatial information of each of the individuals is stored by establishing a bounding box.
[0055] Furthermore, the processor 1001 may call the three-dimensional model wall dynamic processing program stored in the memory 1005, and further perform the following operations:
[0056] According to the bounding box information, the bounding box information is polled and traversed, and the bounding box information of the second sub-individual that does not intersect with the bounding box information corresponding to the first sub-individual is filtered out to obtain the intersection information between the first sub-individual and the second sub-individual.
[0057] Furthermore, the processor 1001 may call the three-dimensional model wall dynamic processing program stored in the memory 1005, and further perform the following operations:
[0058] According to the intersection information between the first sub-individual and the second sub-individual, the polling process is performed again by traversing the wall stack library. During the traversal process, the mesh information of all the second sub-individuals that have an intersection relationship with the current first sub-individual is extracted to perform a mesh merging operation;
[0059] The steps of the mesh merging operation are as follows: merging vertices and correcting transformation matrix information, obtaining a set of vertex arrays after correcting the three-dimensional space transformation matrix through orderly merging of vertex information and correcting transformation matrix information, and performing inner circle vertex culling and invalid vertex optimization on these vertex arrays through the convex hull algorithm, and finally obtaining the optimal convex hull encirclement vertex array;
[0060] After obtaining the optimal convex hull encirclement vertex array, a new mesh object is created using the optimal convex hull encirclement vertex array information, and the mesh object corresponds to the optimal convex hull encirclement vertex array information.
[0061] Furthermore, the processor 1001 may call the three-dimensional model wall dynamic processing program stored in the memory 1005, and further perform the following operations:
[0062] Performing thickness expansion processing on the mesh object so that its thickness is greater than the thickness of the first sub-individual;
[0063] A Boolean operation is performed on the mesh after the thickness expansion process and the first sub-individual to generate final vertex array information.
[0064] Furthermore, the processor 1001 may call the three-dimensional model wall dynamic processing program stored in the memory 1005, and further perform the following operations:
[0065] Generate a new wall mesh object through the final vertex array information to display the processing effect of the original wall;
[0066] Destroy the mesh entity objects in the original wall.
[0067] The specific embodiments of the data storage device of the present invention are basically the same as the embodiments of the three-dimensional model wall dynamic processing method described below, and will not be described in detail here.
[0068] Reference Figure 2 The first embodiment of the present invention provides a three-dimensional model wall dynamic processing method based on Unity3D, and the three-dimensional model wall dynamic processing method based on Unity3D includes:
[0069] Step S10, separating all three-dimensional objects in the three-dimensional scene into separate entities;
[0070] Step S20, dividing the individual into a first sub-individual and a second sub-individual, the first sub-individual being a wall that needs to be dynamically processed, and the second sub-individual being a non-wall;
[0071] Step S30, traversing all first sub-individuals, and polling and retrieving the intersection relationship between each first sub-individual and all second sub-individuals;
[0072] Step S40, performing a logical operation on each second sub-individual that has an intersection relationship with the first sub-individual, and obtaining specific intersection information between the two;
[0073] Step S50, performing Boolean operations on vertices and UVs based on the intersection information to obtain new vertex and UV information;
[0074] Step S60, regenerate the mesh according to the new vertex and UV information and replace the mesh information of the original wall.
[0075] In this embodiment, the implementation and design method are based on real mathematical Boolean operation logic, which not only improves the execution efficiency, but also has high stability and reusability, and can be implemented and applied on various irregular three-dimensional objects.
[0076] Wherein, step S10 specifically includes the following steps:
[0077] All qualified three-dimensional objects are selected from the three-dimensional scene, and these objects are decoupled and stored in the to-be-processed array StackA as independent three-dimensional individuals.
[0078] Based on the above implementation and design method, step S20 specifically includes the following steps:
[0079] A conceptual definition is given to all three-dimensional entities stored in StackA to be processed. They are divided into two categories of objects: the first sub-individual (Wall) on which holes are to be opened, and the second sub-individual (Other) on which holes are to be opened.
[0080] Based on the above implementation and design method, step S30 specifically includes the following steps:
[0081] Based on step S20, all three-dimensional entities have been conceptualized into two types of objects, one is wall and the other is non-wall. All walls are stored in the wall stack library WallStack and all non-walls are stored in the other stack library OtherStack.
[0082] Traverse all the walls in WallStack, poll and retrieve the 3D spatial information of each wall and all non-wall objects in OtherStack, and establish a bounding box Bounds to store the 3D spatial information of each object, such as the object's own 3D spatial coordinates, the object's own size, and the object's own boundary information for subsequent calculations and processing.
[0083] Based on the above implementation and design method, step S40 specifically includes the following steps:
[0084] At this point, after the three-dimensional spatial information processing in step S30, the bounding box Bounds information of each object (including wall and non-wall Other) has been obtained, and then these bounding box Bounds information are polled and traversed, and the bounding box Bounds of non-wall Other that do not intersect with the corresponding wall Wall bounding box Bounds information are filtered out, so that the intersection information between all walls Wall and all other non-walls Other that can be used for actual statistics can be obtained.
[0085] Based on the above implementation and design method, step S50 specifically includes the following steps:
[0086] The intersection information between all walls Wall and all other non-walls Other is obtained in step S40, and the polling process is performed again by traversing the storage list WallStack of all walls Wall. During the traversal process, the mesh information of all non-walls Other that have an intersection relationship with the current processing object wall Wall is extracted for mesh merging operation.
[0087] The main processing process of the mesh merging operation is the merging of vertices and the correction of transformation matrix information. After the orderly merging of vertex information and the correction of transformation matrix information, a set of vertex arrays VertexArray after the correction of three-dimensional space transformation matrix will be obtained. These vertex arrays VertexArray are processed by convex hull algorithm (ConvexHull) to remove inner circle vertices and optimize invalid vertices, and finally the optimal convex hull encirclement ConvexVertexArray vertex array is obtained.
[0088] After obtaining the optimal convex hull enclosing circle ConvexVertexArray vertex array, a new mesh object ConvexMesh is created using the ConvexVertexArray vertex array information. The mesh object ConvexMesh is generated by the entity conversion of the data object representing the ConvexVertexArray vertex array.
[0089] In order to solve the possible situation that the thickness of the ConvexMesh object in three-dimensional space is not smaller than the wall object Wall, which may lead to the failure of the Boolean operation, the ConvexMesh will be expanded to force its thickness to be greater than the thickness of the wall Wall to ensure the normal operation of the Boolean operation.
[0090] After the thickness expansion is completed, Boolean operations can be performed on the wall and the ConvexMesh mesh after the thickness expansion. After the operation, a set of final vertex array information ResaultConvexArray will be generated, which will be used to generate the final new wall mesh object.
[0091] Based on the above implementation and design method, step S60 specifically includes the following steps:
[0092] In step S50, a set of final vertex array information ResaultConvexArray is generated, and a new wall mesh object NewWallMesh is created using the set of vertex array information ResaultConvexArray. The new wall mesh object NewWallMesh is the final mesh object entity used to display the wall hole effect.
[0093] The mesh entity object in the original wall object is destroyed to avoid memory overflow, and the original mesh entity object is destroyed and then reset to the NewWallMesh mesh entity object. So far, the dynamic hole design and implementation of a single wall has been completed.
[0094] Continue to repeat the dynamic hole design and implementation of all walls along this logic until the traversal process is completed. After the processing logic of all walls is completed, reasonable memory recycling and object management are performed.
[0095] In addition, an embodiment of the present invention further provides a computer-readable storage medium, on which a three-dimensional model wall dynamic processing program is stored. When the three-dimensional model wall dynamic processing program is executed by a processor, the following operations are implemented:
[0096] Separate all three-dimensional objects in the three-dimensional scene into separate individuals;
[0097] Divide the individual into a first sub-individual and a second sub-individual, wherein the first sub-individual is a wall that needs to be dynamically processed, and the second sub-individual is a non-wall;
[0098] Traversing all first sub-individuals, and polling and retrieving the intersection relationship between each first sub-individual and all second sub-individuals;
[0099] Perform logical operations on each second sub-individual that has an intersection relationship with the first sub-individual to obtain specific intersection information between the two;
[0100] Perform Boolean operations on vertices and UVs based on the intersection information to obtain new vertex and UV information;
[0101] Regenerate the mesh based on the new vertex and UV information and replace the original wall mesh information.
[0102] Furthermore, when the three-dimensional model wall dynamic processing program is executed by the processor, the following operations are also implemented:
[0103] All qualified three-dimensional objects are selected from the three-dimensional scene, and these objects are decoupled and stored in the array to be processed as independent three-dimensional individuals.
[0104] Furthermore, when the three-dimensional model wall dynamic processing program is executed by the processor, the following operations are also implemented:
[0105] All first sub-individuals are stored in the wall stack library, and the second sub-individuals are stored in other stack libraries.
[0106] Furthermore, when the three-dimensional model wall dynamic processing program is executed by the processor, the following operations are also implemented:
[0107] All first sub-individuals in the wall stack library are traversed, and the three-dimensional spatial information of each first sub-individual and all second sub-individuals in other stack libraries is polled and retrieved, and the three-dimensional spatial information of each of the individuals is stored by establishing a bounding box.
[0108] Furthermore, when the three-dimensional model wall dynamic processing program is executed by the processor, the following operations are also implemented:
[0109] According to the bounding box information, the bounding box information is polled and traversed, and the bounding box information of the second sub-individual that does not intersect with the bounding box information corresponding to the first sub-individual is filtered out to obtain the intersection information between the first sub-individual and the second sub-individual.
[0110] Furthermore, when the three-dimensional model wall dynamic processing program is executed by the processor, the following operations are also implemented:
[0111] According to the intersection information between the first sub-individual and the second sub-individual, the polling process is performed again by traversing the wall stack library. During the traversal process, the mesh information of all the second sub-individuals that have an intersection relationship with the current first sub-individual is extracted to perform a mesh merging operation;
[0112] The steps of the mesh merging operation are as follows: merging vertices and correcting transformation matrix information, obtaining a set of vertex arrays after correcting the three-dimensional space transformation matrix through orderly merging of vertex information and correcting transformation matrix information, and performing inner circle vertex culling and invalid vertex optimization on these vertex arrays through the convex hull algorithm, and finally obtaining the optimal convex hull encirclement vertex array;
[0113] After obtaining the optimal convex hull encirclement vertex array, a new mesh object is created using the optimal convex hull encirclement vertex array information, and the mesh object corresponds to the optimal convex hull encirclement vertex array information.
[0114] Furthermore, when the three-dimensional model wall dynamic processing program is executed by the processor, the following operations are also implemented:
[0115] Performing thickness expansion processing on the mesh object so that its thickness is greater than the thickness of the first sub-individual;
[0116] A Boolean operation is performed on the mesh after the thickness expansion process and the first sub-individual to generate final vertex array information.
[0117] Furthermore, when the three-dimensional model wall dynamic processing program is executed by the processor, the following operations are also implemented:
[0118] Generate a new wall mesh object through the final vertex array information to display the processing effect of the original wall;
[0119] Destroy the mesh entity objects in the original wall.
[0120] The specific embodiments of the computer-readable storage medium of the present invention are basically the same as the embodiments of the above-mentioned application software security vulnerability detection method, and will not be described in detail here.
[0121] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0122] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0123] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present invention.
[0124] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A three-dimensional model wall dynamic processing method based on Unity3D, characterized in that: The three-dimensional model wall dynamic processing method based on Unity3D includes the following steps: Separate all three-dimensional objects in the three-dimensional scene into separate individuals; Divide the individual into a first sub-individual and a second sub-individual, wherein the first sub-individual is a wall that needs to be dynamically processed, and the second sub-individual is a non-wall; Traversing all first sub-individuals, and polling and retrieving the intersection relationship between each first sub-individual and all second sub-individuals; Perform logical operations on each second sub-individual that has an intersection relationship with the first sub-individual to obtain specific intersection information between the two; Perform Boolean operations on vertices and UVs based on the intersection information to obtain new vertex and UV information; Regenerate the mesh based on the new vertex and UV information and replace the original wall mesh information.
2. The method for dynamic processing of a three-dimensional model wall based on Unity3D as claimed in claim 1, characterized in that: The step of separating all three-dimensional objects in the three-dimensional scene into separate individuals is specifically as follows: all three-dimensional objects that meet the conditions are screened out from the three-dimensional scene, and these objects are decoupled and stored in the array to be processed as independent three-dimensional individuals.
3. The method for dynamic processing of a three-dimensional model wall based on Unity3D as claimed in claim 2, characterized in that: After the step of dividing the individual into a first sub-individual and a second sub-individual, wherein the first sub-individual is a wall that needs to be dynamically processed and the second sub-individual is a non-wall, the method further includes: All first sub-individuals are stored in the wall stack library, and the second sub-individuals are stored in other stack libraries.
4. The method for dynamic processing of three-dimensional model walls based on Unity3D according to claim 3, characterized in that: The step of traversing all first sub-individuals and polling to retrieve the intersection relationship between each first sub-individual and all second sub-individuals includes: All first sub-individuals in the wall stack library are traversed, and the three-dimensional spatial information of each first sub-individual and all second sub-individuals in other stack libraries is polled and retrieved, and the three-dimensional spatial information of each of the individuals is stored by establishing a bounding box.
5. The method for dynamic processing of three-dimensional model walls based on Unity3D according to claim 4, characterized in that: The step of performing a logical operation on each second sub-individual that has an intersection relationship with the first sub-individual to obtain specific intersection information between the two includes: According to the bounding box information, the bounding box information is polled and traversed, and the bounding box information of the second sub-individual that does not intersect with the bounding box information corresponding to the first sub-individual is filtered out to obtain the intersection information between the first sub-individual and the second sub-individual.
6. The method for dynamic processing of three-dimensional model walls based on Unity3D according to claim 5, characterized in that: The step of performing Boolean operations on vertices and UV based on the intersection information to obtain new vertex and UV information includes: According to the intersection information between the first sub-individual and the second sub-individual, the polling process is performed again by traversing the wall stack library. During the traversal process, the mesh information of all the second sub-individuals that have an intersection relationship with the current first sub-individual is extracted to perform a mesh merging operation; The steps of the mesh merging operation are as follows: merging vertices and correcting transformation matrix information, obtaining a set of vertex arrays after correcting the three-dimensional space transformation matrix through orderly merging of vertex information and correcting transformation matrix information, and performing inner circle vertex culling and invalid vertex optimization processing on these vertex arrays through the convex hull algorithm, and finally obtaining the optimal convex hull encirclement vertex array; After obtaining the optimal convex hull encirclement vertex array, a new mesh object is created using the optimal convex hull encirclement vertex array information, and the mesh object corresponds to the optimal convex hull encirclement vertex array information.
7. The method for dynamic processing of three-dimensional model walls based on Unity3D according to claim 6, characterized in that: After the step of performing Boolean operations on vertices and UVs based on the intersection information to obtain new vertex and UV information, the method further includes: Performing thickness expansion processing on the mesh object so that its thickness is greater than the thickness of the first sub-individual; A Boolean operation is performed on the mesh after the thickness expansion process and the first sub-individual to generate final vertex array information.
8. The method for dynamic processing of three-dimensional model walls based on Unity3D according to claim 7, characterized in that: The step of regenerating the mesh according to the new vertex and UV information and replacing the mesh information of the original wall includes: Generate a new wall mesh object through the final vertex array information to display the processing effect of the original wall; Destroy the mesh entity objects in the original wall.
9. A three-dimensional model wall dynamic processing device based on Unity3D, characterized in that: The Unity3D-based three-dimensional model wall dynamic processing device includes: a memory, a processor, and a three-dimensional model wall dynamic processing program stored in the memory and executable on the processor. When the three-dimensional model wall dynamic processing program is executed by the processor, the steps of the three-dimensional model wall dynamic processing method as described in any one of claims 1 to 8 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a three-dimensional model wall dynamic processing program, and when the three-dimensional model wall dynamic processing program is executed by the processor, the steps of the three-dimensional model wall dynamic processing method according to any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Convex hull and OBB (Oriented Bounding Box)-based three-dimensional grid model framework extracting method
CN102254343A
Boolean calculation method for triangular grid data and system thereof
CN102682476A
Trimming method of detail level of 3D geometric virtual model based on point, line and surface
CN109410332A
Mesh-free boundary hole repairing method and device for live-action three-dimensional model
CN111583409A
Real object quantity calculation method and device based on Revit and storage medium
CN113642070A
