Model topological structure detection method and related equipment
By acquiring mesh data from 3D models for topological structure detection and utilizing the analysis methods of directed edge and normal data, the problem of identifying topological anomalies in 3D models has been solved, improving the accuracy and efficiency of detection and reducing rendering anomalies.
Patent Information
- Application Number
- CN202511797876.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-02
- Publication Date
- 2026-05-01
AI Technical Summary
Existing technologies struggle to effectively identify topological anomalies in 3D models, leading to rendering errors, increased rendering overhead, and difficulty in guaranteeing resource quality.
By acquiring preset model mesh data, we perform model shell integrity detection, model internal and external reversal detection, and shell intersection detection. We use vertex data and face data to determine directed edges for matching analysis, and emit rays through normal data for detection analysis, generating model topology detection results.
It improves the accuracy and efficiency of model topology detection and reduces rendering anomalies.
Smart Images

Figure CN121959039A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of software technology for digital cultural product production, and in particular to a method and related equipment for detecting model topology. Background Technology
[0002] Currently, in some 3D model development scenarios, topological anomalies during model construction often lead to rendering errors, increased rendering overhead, and increased pressure. Traditional model analysis methods often struggle to identify topological anomalies in the model, are time-consuming, and fail to guarantee resource quality, easily resulting in rendering errors.
[0003] In summary, the technical problems existing in the relevant technologies need to be improved. Summary of the Invention
[0004] The main objective of this application is to propose a model topology detection method and related equipment, which can realize the detection of model topology anomalies, effectively improve the accuracy and efficiency of identification, and thus effectively reduce the problem of rendering anomalies.
[0005] To achieve the above objectives, one aspect of this application proposes a model topology detection method, the method comprising: Obtain preset model mesh data; wherein, the preset model mesh data includes vertex data and face data; Based on the preset model mesh data, a preset topology detection is performed to generate a model topology detection result. The preset topology detection includes at least one of model shell integrity detection, model inside / outside reversal detection, and shell intersection detection. Among them, performing model shell integrity detection includes matching analysis of directed edges determined by the vertex data and the face data. Performing model inside / outside reversal detection and shell intersection detection includes ray emission based on the normal data determined by the vertex data and the face data, and then combining the ray hit results for detection analysis.
[0006] In some embodiments, performing model shell integrity detection based on the preset model mesh data includes: Based on the preset model mesh data, the directed edges corresponding to each model triangle face are determined through the preset vertex order, and then the directed edges are reversed to obtain the reverse edges. Traverse each of the directed edges according to the reverse edge to query the directed edges that satisfy the preset matching conditions, and obtain a preset edge set; wherein, the preset matching conditions include that the directed edge coincides with the reverse edge and has the same direction; The integrity information of the model shell is determined based on the preset edge set; wherein, the integrity information of the model shell includes either the model shell being complete or the model shell being incomplete.
[0007] In some embodiments, the step of traversing each of the directed edges according to the reverse edge to query the directed edges that satisfy the preset matching conditions and obtain a preset edge set includes: Construct a preset vector list; wherein the preset vector list stores the directed edges; The preset vector list is traversed according to the reverse edge to determine whether there is a target edge in the preset vector list; wherein, the target edge includes the directed edge that satisfies the preset matching condition; When it is determined that the target edge exists in the preset vector list, the target edge is deleted from the preset vector list to obtain the target vector list.
[0008] In some embodiments, the vertex data includes a vertex array, and the face data includes a triangle array; Based on the preset model mesh data, perform inversion detection of the model's internal and external aspects, including: The vertex 3D vectors are determined based on the vertex array and the triangle array, and then the vertex 3D vectors are transformed to the world coordinate system to obtain world coordinate data; The center coordinates of the face are calculated based on the world coordinate data, and the directed edge is determined using the world coordinate data. Then, the direction of the first normal is determined based on the directed edge. The target triangle is determined by using rays based on the center coordinates of the face and the first normal direction. Then, model inversion analysis is performed based on the target triangle to obtain model inversion information. The target triangle includes the model triangle hit by the ray.
[0009] In some embodiments, the step of calculating the surface center coordinates based on the world coordinate data, determining the directed edge using the world coordinate data, and then determining the first normal direction based on the directed edge includes: The coordinates of the face center are obtained by calculating the average value of the preset coordinate data; wherein, the preset coordinate data includes the world coordinate data corresponding to the three vertices of the model triangle face; The preset coordinate data are subtracted sequentially to obtain the directed edges corresponding to the model triangles; The first normal direction is calculated using the cross product algorithm based on the directed edge.
[0010] In some embodiments, the step of determining the target triangular face using rays based on the face center coordinates and the first normal direction, and then performing model inversion analysis based on the target triangular face to obtain model inversion information, includes: A ray is emitted along the opposite direction of the first normal direction based on the coordinates of the surface center, and the ray hit information is recorded. When it is determined from the ray hit information that the ray did not hit the model triangle, the model inversion information is determined to be an inversion topology anomaly; or, when it is determined from the ray hit information that the ray hit the model triangle, the model inversion information is determined to be an inversion topology normal.
[0011] In some embodiments, emitting a ray in the opposite direction to the first normal direction based on the surface center coordinates and recording the ray hit information includes: The starting point coordinates are determined by offsetting the center coordinates of the surface in the opposite direction along the first normal direction by a preset unit length. A ray is emitted in the opposite direction to the first normal direction based on the starting coordinates, and the ray hit information is then recorded.
[0012] In some embodiments, shell cross-detection is performed based on the preset model mesh data, including: The dot product of the second normal direction and the first normal direction of the target triangle is calculated to obtain the dot product result. Based on the dot product results, shell cross analysis is performed to determine the shell cross information of the model.
[0013] In some embodiments, before performing model inversion detection or shell cross-detection based on the preset model mesh data, the method further includes: Set the back-side hit parameter; wherein, the back-side hit parameter is used to control the rendering engine to allow the collider to hit from the inside of the collider; Execution status parameters are set to determine frame information based on the execution status parameters, and then frame processing is performed based on the frame information.
[0014] To achieve the above objectives, another aspect of this application proposes a model topology detection device, the device comprising: The first module is used to acquire preset model mesh data; wherein, the preset model mesh data includes vertex data and face data; The second module is used to perform a preset topology detection based on the preset model mesh data and generate a model topology detection result. The preset topology detection includes at least one of model shell integrity detection, model inside / outside reversal detection, and shell intersection detection. Among them, performing model shell integrity detection includes matching analysis of directed edges determined by the vertex data and the face data, and performing model inside / outside reversal detection and shell intersection detection includes ray emission based on the normal data determined by the vertex data and the face data, and then combining the ray hit results for detection analysis.
[0015] To achieve the above objectives, another aspect of this application provides an electronic device, the electronic device comprising: At least one processor; At least one memory for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor performs the method described above.
[0016] To achieve the above objectives, another aspect of the embodiments of this application proposes a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method.
[0017] To achieve the above objectives, another aspect of this application provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method. The embodiments of this application include at least the following beneficial effects: This application provides a model topology detection method, apparatus, electronic device, storage medium, and program product. This solution acquires preset model mesh data and performs preset topology detection based on the preset model mesh data, including at least one of model shell integrity detection, model internal / external inversion detection, and shell intersection detection, thereby generating a model topology detection result and achieving model topology anomaly detection. The preset model mesh data includes vertex data and face data. Correspondingly, performing model shell integrity detection includes matching analysis of directed edges determined by vertex data and face data, while performing model internal / external inversion detection and shell intersection detection includes ray emission based on normal data determined by vertex data and face data, and then combining the ray hit results for detection analysis. It is easy to understand that the embodiments of the present invention determine directed edges from vertex data and face data, and then perform matching analysis on the directed edges to analyze the integrity of the model. At the same time, based on the ray emission method of the normal data determined by vertex data and face data, the model is analyzed for the existence of inversion and shell intersection by the ray hit results, thereby obtaining the model topology detection results. This effectively improves the accuracy of model topology detection and anomaly identification, and thus reduces the problem of model rendering anomalies. Attached Figure Description
[0018] Figure 1 This is a schematic diagram of normal model rendering provided in an embodiment of the present invention; Figure 2 This is a schematic diagram showing the model with opposite orientations (inside and out) provided in the embodiments of the present invention; Figure 3 This is a schematic diagram of the normal topology provided in an embodiment of the present invention; Figure 4 This is a schematic diagram of a shell cross-topology anomaly provided in an embodiment of the present invention; Figure 5 This is a flowchart of the model topology detection method provided in the embodiments of the present invention; Figure 6 This is a flowchart of a model shell integrity detection based on preset model mesh data provided in an embodiment of the present invention; Figure 7 This is a flowchart provided by an embodiment of the present invention, which traverses each directed edge according to the reverse edge to query directed edges that satisfy preset matching conditions and obtains a preset edge set; Figure 8 This is a flowchart of the inversion detection of the model inside and outside based on preset model mesh data provided in the embodiments of the present invention; Figure 9This is a flowchart provided by an embodiment of the present invention, which calculates the center coordinates of a surface based on world coordinate data, determines the directed edges using the world coordinate data, and then determines the direction of the first normal based on the directed edges. Figure 10 This is a flowchart provided by an embodiment of the present invention, which determines the target triangular face by using rays based on the center coordinates of the face and the first normal direction, and then performs model inversion analysis based on the target triangular face to obtain model inversion information. Figure 11 This is a flowchart provided by an embodiment of the present invention, showing how a ray is emitted along the opposite direction of the first normal direction based on the coordinates of the surface center and how ray hit information is recorded. Figure 12 This is a flowchart of shell cross-detection based on preset model mesh data provided in an embodiment of the present invention; Figure 13 This is a flowchart of setting the back-side hit parameters and execution status parameters provided in an embodiment of the present invention; Figure 14 This is a schematic diagram of the model topology detection device provided in an embodiment of the present invention; Figure 15 This is a schematic diagram of the hardware structure of the electronic device provided in an embodiment of the present invention. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit it. In the following description, when referring to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with those of this application; they are merely examples of apparatuses and methods consistent with some aspects of the embodiments of this application as detailed in the appended claims.
[0020] It is understood that the terms “first,” “second,” etc., used in this application may be used herein to describe various concepts, but unless otherwise stated, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another. For example, without departing from the scope of the embodiments of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the words “if,” “when,” or “in response to a determination” as used herein may be interpreted as “when…” or “when…” or “in response to a determination.”
[0021] As used in this application, the terms "at least one", "multiple", "each", "any", etc., "at least one" includes one, two or more, "multiple" includes two or more, "each" refers to each of the corresponding multiples, and "any" refers to any one of the multiples.
[0022] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0023] Before providing a detailed description of the embodiments of this application, some of the nouns and terms involved in the embodiments of this application will be explained first. The nouns and terms involved in the embodiments of this application are subject to the following interpretations.
[0024] Model mesh: is the core data structure that defines the geometry of a 3D model, and it consists of vertices and indices.
[0025] Model topology refers to the connection and layout relationships between elements (points, nodes) in a model. It focuses on the connection relationships rather than the physical properties of the elements themselves.
[0026] Triangle face: In 3D modeling, a triangle face is the most basic polygonal face consisting of three vertices and three sides. It is the most basic building block of the surface of a 3D model. Any complex 3D model can be approximated by a combination of a large number of triangle faces.
[0027] Currently, in some 3D model development scenarios, topological anomalies during model construction often lead to rendering errors, increased rendering overhead, and increased pressure. Traditional model analysis methods often struggle to identify topological anomalies in the model, are time-consuming, and fail to guarantee resource quality, easily resulting in rendering errors.
[0028] For example, backface culling is a common optimization strategy in 3D game development. It sets the front and back faces of triangles based on the vertex order. The rendering engine automatically checks the position of the triangles relative to the camera; the front face is rendered normally, while the back face is not rendered (displayed as transparent). Backface culling can significantly reduce the load on the graphics card and decrease overdraw. Level of Detail (LOD) is another commonly used optimization strategy. It requires configuring models of different precisions, switching between high-precision and low-precision models based on the distance between the model and the camera. For projects with a large amount of resources, sometimes automatically generated low-precision models are used. These models sometimes exhibit rendering errors, even at a distance, but if they occupy a large area, these errors can be quite noticeable. Figure 1 and Figure 2 As shown. Among them, Figure 1 This is a schematic diagram of a normally rendered model, while Figure 2 This is a rendering illustration of an abnormal model with the orientation reversed. Accordingly, for the given example model, large-scale repair requires enabling double-sided rendering, which incurs additional performance overhead. Furthermore, with the rapid development of generative artificial intelligence (AI), many AIs now generate 3D models based on prompts / images. However, unlike humans who model according to a process, AI generates models with high polygon counts and messy topology. Their processing method is like "molding" a huge "mold" into its final shape through collapse. Besides being difficult to modify, such large models, especially in game scenarios, create a significant rendering burden. Therefore, scripts are needed to process slightly lower-precision models, but this method may cause topological issues. In addition to the problems mentioned above, format conversion errors, Boolean operation mistakes, and improper mirroring operations can also lead to abnormal model topology, and there may be issues with intersecting shells. While this generally doesn't cause rendering anomalies, it is a typical example of a topological anomaly: "non-manifold geometry," such as... Figure 3 and Figure 4 As shown. Among them, Figure 3 This is a schematic diagram of a normal topology, while Figure 4 This is a schematic diagram of an anomalous topology with intersecting shells.
[0029] In view of this, this application provides a model topology detection method, device, electronic device, storage medium, and program product. This solution acquires preset model mesh data including vertex data and face data, and performs preset topology detection based on the preset model mesh data. This includes at least one of model shell integrity detection, model inversion detection, and shell cross detection. Model shell integrity detection includes matching analysis of directed edges determined by vertex data and face data. Model inversion detection and shell cross detection include ray emission based on normal data determined by vertex data and face data, and then combining the ray hit results for detection analysis, ultimately generating model topology detection results. This achieves model topology anomaly detection, effectively improving the accuracy and efficiency of identification, and thus effectively reducing rendering anomaly problems. It can be widely used in digital cultural product production software, digital cultural creative software, and animation and game production fields in the digital creative industry.
[0030] The model topology detection method provided in this application relates to the field of software technology for digital cultural product production. The model topology detection method provided in this application can be applied to a terminal, a server, or software running on a terminal or server. In some embodiments, the terminal can be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, or in-vehicle terminal, but is not limited to these. The server can be configured as an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The server can also be a node server in a blockchain network. The software can be an application implementing the model topology detection method, but is not limited to the above forms.
[0031] This application can be used in a wide variety of general-purpose or special-purpose computer system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics devices, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices. This application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform specific tasks or implement specific abstract data types. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0032] Figure 5 This is an optional flowchart of the model topology detection method provided in the embodiments of this application. Figure 5 The method may include, but is not limited to, steps S110 to S120.
[0033] Step S110: Obtain preset model mesh data. The preset model mesh data includes vertex data and face data.
[0034] Specifically, in this embodiment of the invention, the preset model mesh data refers to the set of mesh data of the 3D model that needs to be topologically detected. Correspondingly, vertex data refers to the coordinate parameters of each vertex of the 3D model, and face data refers to the triangular faces formed by triangles composed of vertex indices in the 3D model. The 3D model is approximated by a combination of several triangular faces.
[0035] In practical applications, the preset model mesh data can be all the meshes in the FBX (Filmbox) file of the 3D model to be detected. During the model topology detection process, this embodiment of the invention first reads all the FBX (Filmbox) files of the 3D model to obtain the preset model mesh data, including the vertex data and triangle data of the 3D model.
[0036] Step S120: Perform a preset topology detection based on the preset model mesh data to generate a model topology detection result. The preset topology detection includes at least one of the following: model shell integrity detection, model internal / external reversal detection, and shell intersection detection. Specifically, model shell integrity detection involves matching analysis of directed edges determined by vertex and face data. Model internal / external reversal detection and shell intersection detection involve ray emission based on normal data determined by vertex and face data, followed by detection and analysis based on the ray hit results.
[0037] Specifically, in this embodiment of the invention, model shell integrity detection refers to detecting whether the shell of the 3D model is complete, such as whether the model has missing faces or unclosed areas. Correspondingly, model inversion detection refers to detecting whether the model's internal and external directions are correct. Since 3D models have clearly defined internal and external surfaces, inversion can lead to rendering errors. Additionally, shell intersection detection refers to detecting whether the 3D model has self-intersections or component intersections. Correspondingly, in this embodiment of the invention, model topology detection results refer to an abnormal topology check report for the 3D model requiring topology detection. For example, in this embodiment of the invention, model topology detection results may include visual tables, images, etc., to help developers quickly understand the model's topology anomalies.
[0038] In practical applications, after obtaining the preset model network data of a 3D model, this embodiment of the invention performs at least one of the following detection processes based on vertex and face data: model shell integrity detection, model inversion detection, and shell intersection detection, to generate a model topology detection result. In this embodiment, one or more topology detection processes can be executed according to actual detection needs. For example, only model shell integrity detection or model inversion detection can be performed, or both model shell integrity and model inversion can be detected simultaneously, or shell integrity, model inversion, and shell intersection can be detected sequentially. By flexibly selecting the required topology detection, this embodiment of the invention can effectively improve the accuracy of topology detection while ensuring detection efficiency.
[0039] For example, in some game development projects, it is necessary to perform model topology detection on the 3D models of game characters or scenes to avoid rendering anomalies. Accordingly, this embodiment of the invention first obtains the vertex and face data of the 3D models of the game characters or scenes to be detected, and determines the preset topology detection to be performed based on the detection requirements of the corresponding 3D models. For example, if a game character model needs to simultaneously detect model integrity, inversion, and shell intersection, this embodiment of the invention, when detecting model shell integrity based on preset model mesh data, determines the integrity information of the game character model by performing matching analysis on the directed edges determined by the vertex and face data. Simultaneously, when performing model inversion and shell intersection detection based on preset model mesh data, ray emission is performed based on the normal data determined by the vertex and face data, and the detection analysis is combined with the ray hit results to obtain the corresponding inversion and shell intersection information. In this embodiment of the invention, after sequentially performing topological structure detection on the 3D model (including integrity, internal / external reversal, and cross-checking at least one), the detection information obtained from each inspection process—namely, model shell integrity information, model internal / external reversal information, and model shell cross-checking information—is combined to generate a model topological structure inspection report. This enables multi-dimensional topological structure detection of the 3D model, improving detection accuracy and generating model topological structure detection results. In this embodiment, the model topological structure detection results can be saved as a CSV table for later viewing.
[0040] One of the above technical solutions has the following advantages or beneficial effects: The embodiments of the present invention analyze the integrity of the model by matching and analyzing the directed edges determined by vertex data and face data. At the same time, based on the determined normal data, the model is analyzed for whether there is inversion between the inside and outside and shell intersection by ray projection. The model topology is detected from multiple different detection dimensions to obtain the model topology detection results, which effectively improves the accuracy of model topology detection and anomaly identification, thereby reducing the problem of model rendering anomalies.
[0041] Reference Figure 6 In some embodiments of the present invention, the integrity detection of the model shell is performed based on preset model mesh data, including but not limited to the following steps: Step S210: Based on the preset model mesh data, determine the directed edges corresponding to each model triangle face through the preset vertex order, and then reverse the directed edges to obtain the reverse edges.
[0042] Step S220: Traverse each directed edge according to the reverse edge to query the directed edges that satisfy the preset matching conditions, and obtain the preset edge set. The preset matching conditions include that the directed edge coincides with the reverse edge and the direction is opposite.
[0043] Step S230: Determine the integrity information of the model shell based on the preset edge set. The integrity information of the model shell includes either the model shell being complete or the model shell being incomplete.
[0044] Specifically, in this embodiment of the invention, a model triangle refers to a triangle formed by triangles composed of vertex indices in the model. The 3D model is approximated by a combination of several triangles. A directed edge refers to a connection with a direction, i.e., an edge pointing from one vertex to another. In this embodiment, a triangle is defined by three directed edges. Correspondingly, a reverse edge is a directed edge with the opposite direction to the original edge. For example, if one of the directed edges of a triangle is (A, B), then its corresponding reverse edge is (B, A). Correspondingly, the preset edge set in this embodiment refers to the set of directed edges that do not meet the preset matching conditions, i.e., the set of directed edges that do not coincide with the reverse edges and have opposite directions. Furthermore, in this embodiment, the model shell integrity information refers to whether the 3D model shell is complete, including two states: incomplete model shell and complete model.
[0045] In practical applications, this embodiment of the invention first performs vertex matching according to a preset vertex order based on the vertex data in the preset model mesh data, thereby determining the directed edges of each model triangle. Correspondingly, each determined directed edge is reversed to obtain the corresponding reverse edge, facilitating subsequent shell integrity analysis. For example, this embodiment first scans all FBX files of a game character or scene 3D model to read all the meshes of the model, obtaining preset model mesh data. The preset model mesh data includes vertex data. Based on the rule that three vertices form a triangle, this embodiment calculates the three directed edges corresponding to each model triangle according to the vertex order. Then, this embodiment inverts each calculated directed edge to obtain the reverse edge. After determining the directed edges and corresponding reverse edges of each model triangle using the preset model mesh data, this embodiment traverses each directed edge of the 3D model based on the reverse edge to determine whether there exists a directed edge in each directed edge of the model that coincides with the reverse edge and has the same direction; that is, whether each directed edge in the model has another directed edge that completely coincides with it and has the opposite direction. In this invention, for a complete 3D model shell, each directed edge has one and only one other directed edge that is completely opposite in direction and coincidentally overlaps with it. If there are edges in the same direction, it indicates that the adjacent faces are in opposite directions; conversely, if there are no overlapping edges, it indicates that the shell is incomplete. For example, in the detection process of some 3D modeling projects, this embodiment of the invention performs reverse edge matching on each directed edge of the 3D model according to preset shell integrity conditions. It is easy to understand that in this embodiment, the reverse edges are obtained by inverting the directed edges. Therefore, by matching these reverse edges with the original directed edges of the model, it is possible to determine whether each directed edge of the model corresponds to another directed edge that satisfies the preset shell integrity condition. For example, each directed edge of a complete shell has one and only one other directed edge that is completely opposite in direction and coincidentally overlaps with it. This embodiment of the invention, by constructing reverse edges, can effectively improve the accuracy and efficiency of judging the integrity of the model shell. By matching and analyzing directed edges and reverse edges according to preset shell integrity conditions, it can determine whether the shell of the model is complete, thereby determining the integrity information of the model shell and realizing the integrity detection of the constructed 3D model. Therefore, in this embodiment of the invention, the presence of directed edges that meet the preset matching conditions is analyzed based on the reverse edges, thereby filtering out directed edges in the model that cannot be matched with reverse edges, i.e. directed edges without overlapping edges, determining the preset edge set, and then judging whether the model is complete based on the filtered preset edge set to obtain model integrity information.
[0046] One of the above technical solutions has the following advantages or beneficial effects: By traversing each directed edge of the model to query whether there is a way to satisfy the preset matching conditions, the present invention can determine whether there is a model integrity problem in the three-dimensional model, such as an incomplete model shell, based on the matching results, i.e., the preset edge set, thereby effectively improving the accuracy and efficiency of model integrity detection.
[0047] Reference Figure 7 In some embodiments of the present invention, each directed edge is traversed according to the reverse edge to query the directed edges that satisfy the preset matching conditions, thereby obtaining a preset edge set, including but not limited to the following steps: Step S310: Construct a preset vector list. The preset vector list stores directed edges.
[0048] Step S320: Traverse the preset vector list based on the reverse edges to determine whether a target edge exists in the preset vector list. The target edge includes directed edges that satisfy preset matching conditions.
[0049] Step S330: When it is determined that there is a target edge in the preset vector list, the target edge is deleted from the preset vector list to obtain the target vector list.
[0050] Specifically, in this embodiment of the invention, the preset vector list refers to a pre-constructed three-dimensional vector list used to store corresponding model data, including directed edges of the model's triangular faces. Correspondingly, the target edge refers to a directed edge that meets preset matching conditions, i.e., a directed edge in the three-dimensional model that completely coincides with the reverse edge and has the same direction. Furthermore, the target vector list is the vector list obtained by removing the target edges stored in the preset vector list.
[0051] In practical applications, during the construction of the preset edge set, this embodiment of the invention first constructs a preset vector list and stores each directed edge of the model in this preset vector list. Next, based on each reverse edge, this embodiment of the invention iterates through each directed edge in the preset vector list to query directed edges that satisfy preset matching conditions, i.e., directed edges that completely overlap with the reverse edge and have the same direction. Accordingly, if a directed edge in the preset vector list is found to satisfy the preset matching conditions, then that directed edge is taken as the target edge and deleted from the preset vector list. Further, after completing the matching and filtering of each reverse edge and deleting the corresponding target edge, a target vector list is constructed. If the target vector list still contains directed edges, it indicates that the model has directed edges without overlapping edges, meaning the model is incomplete; conversely, if the target vector list is empty, it indicates that the model is complete.
[0052] One of the above technical solutions has the following advantages or beneficial effects: By constructing a preset vector list and removing directed edges that meet preset matching conditions from the preset vector list, the present invention can quickly and accurately determine whether there is a directed edge in the model that cannot be matched with another directed edge that overlaps with it and has the opposite direction, thereby determining the integrity of the three-dimensional model and further improving the accuracy and efficiency of model integrity detection.
[0053] In some embodiments of the present invention, vertex data includes a vertex array, and face data includes a triangle face array. Accordingly, as Figure 8 As shown, inversion detection of the model's internal and external components is performed based on the preset model mesh data, including but not limited to the following steps: Step S410: Determine the three-dimensional vectors of the vertices based on the vertex array and the triangle array, and then transform them to the world coordinate system to obtain the world coordinate data.
[0054] Step S420: Calculate the center coordinates of the face based on the world coordinate data, determine the directed edges using the world coordinate data, and then determine the direction of the first normal based on the directed edges.
[0055] Step S430: Determine the target triangular face using rays based on the center coordinates of the face and the direction of the first normal. Then, perform an inversion analysis of the model's interior and exterior based on the target triangular face to obtain the inversion information. The target triangular face includes the model triangular face hit by the ray.
[0056] Specifically, in this embodiment of the invention, the vertex array refers to an array containing the coordinates of all vertices of the model, where each vertex typically has its position coordinates defined in three-dimensional space. Simultaneously, the triangle array refers to an array containing all triangular faces of the model, where each triangular face consists of three vertex indices pointing to the corresponding vertex in the vertex array. Furthermore, world coordinate data refers to the coordinate representation of the model's vertices in its local coordinate system converted to coordinates in the global coordinate system of the three-dimensional scene. The model's local coordinate system is a coordinate system established relative to the model's origin, describing the relative positions of vertices within the model, while the world coordinate system is the global coordinate system in the three-dimensional scene, describing the absolute positions of all objects in the scene. Additionally, in this embodiment of the invention, the target triangle face refers to the model triangle face hit by a ray emitted based on the face's center coordinates and the first normal direction. Correspondingly, this embodiment of the invention uses information about another model triangle face hit by a ray emitted based on the center coordinates and normal direction of the model triangle face to determine whether there is a situation where the inside and outside of a face in the three-dimensional model are reversed.
[0057] In practical applications, during the calculation of preset surface parameters (i.e., the coordinates of the surface center and the direction of the first normal), this embodiment of the invention first determines the three-dimensional vectors of the vertices using the obtained vertex array and triangle array. For example, the obtained vertex array is a three-dimensional vector used to record coordinates, such as {0,1,2,0,2,3,4,5,6...}, where the vertex coordinates at index 0 are (0,1,2), the vertex coordinates at index 1 are (0,2,3), and the vertex coordinates at index 2 are (4,5,6). The triangle array, on the other hand, is an integer that records indices, such as {{1,-1,0},{-1,-1,0},{-1,1,0}...}, where the first triangle index is {1,-1,0} and the second triangle index is {-1,-1,0}. Accordingly, the length of the triangle array (triangle face array) should be a multiple of 3 (theoretically, for a successfully imported Unity model, the array length is logically strictly a multiple of 3). Within a range less than the array length, starting from 0, increment by 3 each time to obtain the index. That is, for each index i, take triangle array [i], triangle array [i+1], and triangle array [i+2] as the indices of the three vertices of the current triangle. For example, if index i is 0, then the three vertex indices are determined to be (0,1,2). Next, obtain the three three-dimensional vectors corresponding to the three vertex indices in the vertex array, i.e., vertex coordinates. For example, if the three vertex indices of the current triangle are determined to be (0,1,2), then the corresponding three vertex coordinates are determined to be (0,1,2), (0,2,3), and (4,5,6). Next, this embodiment of the invention transforms the obtained vertex three-dimensional vectors (vertex coordinates) into the world coordinate system to obtain the corresponding world coordinate data. For example, this embodiment of the invention can use Transform.TransformPoint to convert the three vertex three-dimensional vectors into three coordinate points in the world coordinate system, i.e., world coordinate data. In the example of this embodiment of the invention, if the object does not move, the local coordinates are the same as the world coordinates. However, if the object undergoes transformations, such as translation, rotation, or scaling, matrix transformation is required. The principle is that each object has a corresponding transformation matrix, and the world coordinates can be obtained by multiplying the local coordinates by the transformation matrix.
[0058] Furthermore, in this embodiment of the invention, the center point coordinates of each model triangle are calculated based on the determined world coordinate data, i.e., the face center coordinates. Simultaneously, the directed edges of each model triangle are calculated according to the vertex order using the determined world coordinate data. This allows for the calculation of the corresponding normal vector, i.e., the first normal direction, from each directed edge of the model triangle, thus achieving accurate calculation of the preset face parameters. Further, after calculating the preset face parameters of each model triangle, this embodiment of the invention iterates through the face center coordinates and the first normal direction of each model triangle. Based on the face center coordinates and the first normal direction, rays are emitted to determine the corresponding facets of each model triangle, i.e., the model triangles hit by the rays. The target triangles hit by the rays are then analyzed to determine whether the 3D model has inverted facets, i.e., inverted facet analysis is performed to obtain inverted facet information, thereby detecting inverted facets. For example, in some 3D model processing projects, it is necessary to analyze whether related models have inverted facets to avoid rendering errors. Accordingly, in this embodiment of the invention, after determining the center coordinates and normal vectors (first normal direction) of each model triangle facet of the 3D model, rays are emitted based on the center coordinates and normal vectors to determine the target triangle faces corresponding to each model triangle facet in the 3D model. Then, by analyzing the hit status of the target triangle faces—for example, whether a target triangle facet is hit, and whether the hit is on the inner or outer side—the existence of model triangle faces with reversed inner and outer sides in the 3D model is analyzed, obtaining model inversion information, thereby effectively improving the accuracy of model topology detection. One of the above technical solutions has the following advantages or beneficial effects: This embodiment of the invention transforms the model's coordinate data from a local coordinate system to a world coordinate system to reduce the differences in local coordinate systems, unify the direction reference, and effectively improve the accuracy of the center coordinates and the first normal direction, thereby improving the accuracy of model topology detection.
[0059] Reference Figure 9 In some embodiments of the present invention, the coordinates of the face center are calculated based on world coordinate data, and the directed edges are determined using the world coordinate data. Then, the direction of the first normal is determined based on the directed edges, including but not limited to the following steps: Step S510: Calculate the average coordinate value of the preset coordinate data to obtain the center coordinates of the face. The preset coordinate data includes the world coordinate data corresponding to the three vertices of the model's triangular face.
[0060] Step S520: Subtract the preset coordinate data sequentially to obtain the directed edges corresponding to the model triangles.
[0061] Step S530: Calculate the first normal direction based on the directed edge using the cross product algorithm.
[0062] Specifically, in this embodiment of the invention, the preset coordinate data refers to the world coordinate data of the vertices of each triangle face of the model. Additionally, the cross product algorithm, also known as vector product, is an operation between two vectors in three-dimensional space, resulting in a new vector perpendicular to the original two vectors.
[0063] In practical applications, embodiments of the present invention determine the center coordinates of each facet by averaging the world coordinates of the three vertices of each model triangle. For example, if the world coordinates of the three vertices of a model triangle are {1,-1,0}, {-1,-1,0}, and {-1,1,0}, the present invention adds these three world coordinates and averages them to obtain the new center point coordinates {-0.33,-0.33,0}, which is the center point coordinate of the facet. Correspondingly, embodiments of the present invention obtain the three directed edges of the model triangle by successively subtracting the preset coordinate data, i.e., the three world coordinates of each model triangle. For example, in this embodiment of the invention, the three world coordinates mentioned above are subtracted sequentially, such as {-1,-1,0}-{1,-1,0}, {-1,1,0}-{-1,-1,0}, and {1,-1,0}-{-1,1,0}, to obtain the corresponding directed edges, such as {-2,0,0}, {0,2,0}, and {2,-2,0}. Alternatively, this embodiment of the invention can determine the corresponding reverse edges by multiplying the determined directed edges by negative one, i.e., {2,0,0}, {0,-2,0}, and {-2,2,0}. Finally, for each model triangle, this embodiment of the invention randomly selects two directed edges and calculates their corresponding normal vectors using the cross product algorithm. For example, in an embodiment of the present invention, two directed edges are randomly selected to calculate the cross product, such as {-2,0,0}x{0,2,0} or {-2,0,0}^{0,2,0}, thereby obtaining a vector {0,0,-4} perpendicular to the plane (model triangle) where these two directed edges are located, and normalizing it (dividing it by its own length) to obtain a vector {0,0,-1} with a length of 1, which is the first normal direction.
[0064] One of the above technical solutions has the following advantages or beneficial effects: By averaging the world coordinate data and calculating the normal direction of the model triangle face using the cross product algorithm, the embodiments of the present invention can effectively improve the accuracy and efficiency of the calculation of the center coordinates and normal direction, which facilitates the subsequent detection and analysis of model inward and outward flipping and model shell intersection.
[0065] Reference Figure 10In some embodiments of the present invention, the target triangular face is determined by rays based on the center coordinates of the face and the direction of the first normal, and then the model inversion analysis is performed based on the target triangular face to obtain the model inversion information, including but not limited to the following steps: Step S610: Emit a ray in the opposite direction of the first normal direction according to the coordinates of the surface center, and record the ray hit information.
[0066] Step S620: If the ray hit information determines that the ray did not hit the model triangle, the model's internal and external inversion information is determined to be an internal and external inversion topology anomaly; or, if the ray hit information determines that the ray hit the model triangle, the model's internal and external inversion information is determined to be an internal and external inversion topology normal.
[0067] Specifically, in this embodiment of the invention, ray hit information refers to the situation of the model triangle face hit by the emitted ray, such as whether the ray hits the model triangle face, or the direction of the hit model triangle face, etc. Correspondingly, internal and external inversion topology anomaly refers to the situation where the model has internal and external inversion, while internal and external inversion topology normal refers to the situation where the model does not have internal and external inversion.
[0068] In practical applications, after determining the center coordinates and first normal direction of each triangular face of the model, this embodiment of the invention analyzes whether the model has an inversion anomaly using ray casting. Accordingly, this embodiment first creates two puppet GameObjects and attaches a MeshFilter component and a MeshCollider component to them respectively. Simultaneously, it attaches the Mesh loaded in the previous steps (i.e., the preset model mesh data) to the components and iterates over the face center coordinates and first normal direction recorded in the previous steps. Then, this embodiment determines the ray origin based on the face center coordinates and uses the opposite direction of the first normal direction as the ray emission direction, emitting the ray and recording the ray's hit on the face to obtain ray hit information. Specifically, during the detection of inversion anomalies in the shell, if a ray is emitted along the opposite direction of the normal to any face of the complete shell, the ray will definitely hit the inner surface of the other face; conversely, if the ray does not hit the face, it indicates that the model has inverted faces. Therefore, this embodiment of the invention determines whether a ray hits a model triangular face by recording the ray hit information. Specifically, if the ray hit information determines that the ray did not hit any model triangle, then the model is determined to have an inversion anomaly, meaning the inversion information indicates an inversion topology anomaly. Conversely, if the ray hit information determines that the ray hit a model triangle, then the model is determined not to have an inversion problem, meaning the inversion information indicates a normal inversion topology.
[0069] One of the above technical solutions has the following advantages or beneficial effects: The embodiments of the present invention perform model inversion detection by ray projection, which can quickly and accurately detect model inversion anomalies, thereby reducing rendering anomalies while ensuring performance.
[0070] Reference Figure 11 In some embodiments of the present invention, a ray is emitted along the opposite direction of the first normal direction based on the coordinates of the surface center, and the ray hit information is recorded, including but not limited to the following steps: Step S710: Offset the center coordinates of the surface by a preset unit length in the opposite direction along the first normal direction to determine the starting point coordinates.
[0071] Step S720: Emit a ray in the opposite direction to the first normal direction based on the starting coordinates, and then record the ray hit information.
[0072] Specifically, in this embodiment of the invention, the preset unit length refers to a pre-set starting point offset unit, which can be adjusted according to the project scale. It can typically be set to any very small unit length value, such as 0.0001 units. Correspondingly, the starting point coordinates refer to the starting point coordinates of the emitted ray.
[0073] In practical applications, after calculating the coordinates of the face center and the first normal direction, this embodiment of the invention first offsets the face center coordinates along the opposite direction of the normal direction by a preset unit length, and uses the resulting new coordinate point as the starting coordinates of the ray. For example, this embodiment of the invention offsets the face center coordinates by 0.0001 units along the first normal direction to obtain the starting coordinates. Then, this embodiment of the invention uses the starting coordinates as the starting point of the ray, emits the ray along the opposite direction of the first normal direction, and records the ray's hit on the face, obtaining ray hit information. During this detection process, this embodiment of the invention can choose to use Gizmos to identify the ray direction to observe the calculation process.
[0074] One of the above technical solutions has the following advantages or beneficial effects: By offsetting the center coordinates of the face along the normal direction, this embodiment of the invention can alleviate the problem of the emitted ray immediately hitting the emitting face, thus improving the reliability and accuracy of inversion detection of the model's interior and exterior. Typically, the ray is set to stop after hitting the first face because it has better performance than infinite penetration. Furthermore, this embodiment of the invention only requires information about the first face other than the model triangle containing the center coordinates. The purpose of this step is to detect the orientation through another face. If the emitting face is hit, it is impossible to define "inner" and "outer". Therefore, this embodiment of the invention introduces coordinate offset to avoid the problem of the ray directly hitting the starting face, thereby improving the reliability of model topology detection.
[0075] Reference Figure 12 In some embodiments of the present invention, shell cross-detection is performed based on preset model mesh data, including but not limited to the following steps: Step S810: Perform a dot product calculation between the second normal direction and the first normal direction of the target triangle to obtain the dot product result.
[0076] Step S820: Perform shell cross analysis based on the dot product results to determine the shell cross information of the model.
[0077] Specifically, in this embodiment of the invention, shell intersection refers to the intersection or combination of two or more shell structures in space. While shell intersections generally do not cause rendering anomalies, they are typical topological anomalies, i.e., non-manifold geometry, making it difficult to guarantee model resource quality and prone to model defects such as gaps and overlaps. In this embodiment of the invention, the second normal direction refers to the direction of the normal vector of the target triangle. Correspondingly, the dot product result is the scalar value obtained by calculating the dot product of the normal vector of the original triangle (first normal direction) of the emitting ray and the normal vector of the target triangle (second normal direction). The sign of this dot product value allows for quick determination of the relative direction of the two vectors.
[0078] In practical applications, this embodiment of the invention first analyzes the relative orientation between the hit target triangle and the original model triangle using dot product calculation. Accordingly, this embodiment calculates the dot product between the second normal direction of the target triangle and the first normal direction of the original model triangle, and then determines the model shell intersection information based on the dot product result. If the dot product result is greater than zero, it indicates that the two triangles are in the same direction, and a topological anomaly is reported. Conversely, if the dot product result is equal to zero, it indicates that the two triangles are perpendicular, and this is recorded but not reported. Other cases are left unprocessed. Furthermore, in some detection projects where it is necessary to simultaneously detect model integrity, inversion, and shell intersection, this embodiment first determines whether the 3D model has passed the previous checks, i.e., whether the model shell is complete and whether the model has inversion. Accordingly, the detection principle for model shell intersection is the same as that for inversion; the judgment rule is that if the model passes the first two checks, but a ray hits an outer surface of a face, it indicates that the model has shell intersection. Therefore, when the model shell integrity information is determined to be intact and the model internal and external reversal information is determined to be normal internal and external reversal topology, the embodiments of the present invention further perform shell cross detection.
[0079] For example, in the topology detection process of some game 3D models, embodiments of the present invention determine whether the game 3D model has shell intersections by analyzing the hit status of the target triangles hit by each ray during the model's inversion detection process, such as whether the ray hits the inner or outer surface of the target triangle. Correspondingly, if the relevant detection requirements do not require inversion detection of the model, embodiments of the present invention can directly determine the corresponding normal vectors through the vertex and face data of the 3D model, and then emit rays in the opposite direction of these normal vectors to obtain the corresponding target triangles. This allows for subsequent dot product calculation and analysis to obtain the model's shell intersection information.
[0080] One of the above technical solutions has the following advantages or beneficial effects: The embodiments of the present invention can effectively improve the efficiency of cross detection of model shell by using dot product calculation, and by combining the analysis of model integrity and internal and external reversal, the reliability of model topology detection is effectively improved. Through a progressive three-type inspection process, the efficiency and accuracy of traditional methods are optimized, thereby obtaining the detection results of model topology.
[0081] Reference Figure 13 In some embodiments of the present invention, before performing model inversion detection or shell cross detection based on preset model mesh data, the model topology detection method provided by the embodiments of the present invention further includes, but is not limited to, the following steps: Step S910: Set the backface hit parameter. The backface hit parameter controls the rendering engine to allow the collider to hit from the inside.
[0082] Step S920: Set execution status parameters to determine frame information based on execution status parameters, and then perform frame processing based on frame information.
[0083] Specifically, in this embodiment of the invention, the "hit back face" parameter refers to a pre-set global physical rule parameter that controls whether the rendering engine allows a collider, such as a 3D model, to hit another collider from the inside. For example, a ray can hit any triangle face of a 3D model from its interior. Additionally, the "execution state parameter" refers to the execution state data of the detection system, which is a custom integer value. Different numbers correspond to different execution states and are used for frame segmentation judgments.
[0084] In practical applications, rendering engines typically do not allow hitting any face of a collider from its inside. Therefore, if it is necessary to hit another face from the inside, such as emitting a ray inward from a model triangle for inversion detection, a backface hit parameter needs to be set to allow the rendering engine to hit another face from the inside. Since the goal of this embodiment is to detect faces with topological anomalies, such models may have inverted inside and outside surfaces. Therefore, this embodiment first needs to determine if the inner face can be hit, and then determine the orientation of the hit face. Furthermore, since the code and GUI are executed synchronously, completing all operations simultaneously may cause the user interface to be blocked (frozen). Besides a poor user experience, it is also impossible to interrupt the execution process. Frame-based processing can divide complex calculations into multiple frames, ensuring that other functions are not affected, thus reducing single-frame load, avoiding stuttering, and improving smoothness. Therefore, this embodiment determines the corresponding frame information through set execution state parameters, and then processes each execution operation in frames using the frame information, thereby avoiding problems such as untimely memory release and window blocking.
[0085] One of the above technical solutions has the following advantages or beneficial effects: The embodiments of the present invention set global physical rules (hit back face parameters) to control the rendering engine to allow hitting the collider from the inside of the collider, thereby improving the reliability of model inversion and shell cross detection. At the same time, by setting execution state parameters to perform frame-by-frame processing, the single-frame load can be effectively reduced, stuttering can be reduced, and detection smoothness can be effectively improved.
[0086] To better illustrate the technical solution of this invention, a specific example is provided below. This example can be applied to a test scenario of building 3D models in digital cultural product production software. By performing topology detection on the constructed 3D model, it is determined whether there are any topology anomalies. Accordingly, this invention first scans all files ending with the .fbx suffix in a preset directory, i.e., the 3D data files of the 3D model that need to be topology detected. Then, it loads all materials from the FBX files and checks whether double-sided rendering is enabled for each. If double-sided rendering is enabled, it is marked and the detection of that model is skipped; otherwise, if double-sided rendering is not enabled, the detection process is further performed. Next, this invention loads all Meshes from the FBX files, i.e., the preset model mesh data, and creates an empty 3D vector list. Accordingly, this invention matches vertices, faces, and normals in sequence according to the rule of three vertices per face, using the vertex array, triangle array, and normal array of the Mesh. After converting the vertex coordinates to world space coordinates, the center coordinates of the face are calculated by averaging the values. Simultaneously, the three directed edges of the model's triangular face are calculated based on the vertex order, and the normal direction is calculated using the cross product normal vector. The calculated center coordinates and normal direction are then recorded. Next, this embodiment reverses the calculated three directed edges and compares them one by one with each directed edge of the model stored in the created 3D vector list. If there are overlapping directed edges with opposite directions, the reversed edge is removed from the list; otherwise, the original edge is added to the list. In this step, this embodiment can optionally identify the normal direction to assist in observing the model's topology. Correspondingly, when all faces of the 3D model have been accessed, the 3D vector list is checked for any remaining directed edges. If unpaired edges remain in the list, it indicates that the shell is incomplete, and the first type of check fails, meaning the model shell is incomplete. The user can customize whether to continue the next check. Correspondingly, when it is determined to continue the detection task, this embodiment further sets global physical rules, i.e., hit back face parameters, to allow hitting back face surfaces, and sets execution state parameters for frame-by-frame processing to avoid memory leaks and window blocking. Next, this embodiment of the invention creates two puppet GameObjects and attaches a MeshFilter component and a MeshCollider component to them respectively. The previously loaded Mesh is attached to these components, and the previously recorded center coordinates and normal direction are iterated. Then, this embodiment of the invention obtains the starting coordinates of the ray by offsetting the center coordinates 0.0001 units in the opposite direction of the normal, thereby preventing the ray from immediately hitting the emitting face. Then, this embodiment of the invention uses the starting coordinates as the ray's origin and emits a ray in the opposite direction of the normal. Accordingly, if the emitted ray hits a face of the model, the hit information is recorded; if the ray misses, a topology anomaly is indicated.Similarly, if a topological anomaly is determined to be an inverted topology within and outside the model, this embodiment of the invention can also customize whether to proceed with further checks. Correspondingly, Gizmos can also be used to identify ray directions to observe the computation process. Further, if the option to continue checking is selected, this embodiment of the invention iterates over the ray hit information recorded in the previous steps and obtains the normals of the hit surfaces, then performs a dot product between these normals and the normals of the original surfaces. If the dot product result is greater than 0, it indicates that the two surfaces are in the same direction, and a topological anomaly is reported; conversely, if the dot product result is equal to 0, it indicates that the two surfaces are perpendicular, and the result is recorded but not reported; other cases are left unprocessed. Finally, this embodiment of the invention restores the set global physical rules, resumes the execution state, and saves the obtained detection results as a CSV table to obtain the model topology detection results, which can be viewed and analyzed by relevant personnel.
[0087] It should be noted that the embodiments of the present invention analyze and determine the integrity of the model shell based on the vertex, face, and normal data of the mesh. By emitting rays in the opposite direction of the normal, and using ray projection combined with normal data to perform inversion detection, the shell intersection is determined by analyzing the normal of the hit face and the normal of the original face. This progressive three-type inspection process optimizes the efficiency and accuracy of traditional methods, thereby obtaining the detection results of the model topology. It can reduce the occurrence of rendering anomalies while ensuring performance. Especially for projects with a large number of model materials, it can also save a lot of time for manual verification. It can be widely used in the fields of digital cultural product production software, digital cultural creative software, and animation and game production in the digital creative industry.
[0088] Please see Figure 14 This application also provides a model topology detection device that can implement the above-described method. The device includes: The first module 1010 is used to acquire preset model mesh data. The preset model mesh data includes vertex data and face data.
[0089] The second module 1020 is used to perform preset topology detection based on preset model mesh data and generate model topology detection results. The preset topology detection includes at least one of the following: model shell integrity detection, model interior / exterior reversal detection, and shell intersection detection. Specifically, model shell integrity detection involves matching analysis of directed edges determined by vertex and face data; model interior / exterior reversal detection and shell intersection detection involve ray emission based on normal data determined by vertex and face data, and then combining the ray hit results for detection and analysis.
[0090] It is understood that the content of the above method embodiments is applicable to the present device embodiments. The specific functions implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0091] This application also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the above-described method. This electronic device can be any smart terminal, including tablet computers, in-vehicle computers, etc.
[0092] It is understood that the content of the above method embodiments is applicable to this device embodiment. The specific functions implemented by this device embodiment are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0093] Please see Figure 15 , Figure 15 The hardware structure of an electronic device according to another embodiment is illustrated. The electronic device includes: The processor 1110 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application. The memory 1120 can be implemented as a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 1120 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 1120 and is called and executed by the processor 1110 using the methods described in the embodiments of this application. The input / output interface 1130 is used to implement information input and output; The communication interface 1140 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.). Bus 1150 transmits information between various components of the device (e.g., processor 1110, memory 1120, input / output interface 1130, and communication interface 1140); The processor 1110, memory 1120, input / output interface 1130 and communication interface 1140 are connected to each other within the device via bus 1150.
[0094] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method.
[0095] It is understood that the content of the above method embodiments is applicable to this storage medium embodiment. The specific functions implemented in this storage medium embodiment are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those achieved in the above method embodiments.
[0096] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.
[0097] It is understood that the content of the above method embodiments is applicable to the embodiments of this program product. The specific functions implemented by the embodiments of this program product are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0098] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0099] The embodiments described in this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.
[0100] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this application, and may include more or fewer steps than shown, or combine certain steps, or different steps.
[0101] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0102] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.
[0103] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0104] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0105] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0106] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0107] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0108] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0109] The preferred embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of the present application shall be within the scope of the claims of the present application.
Claims
1. A method for detecting the topology of a model, characterized in that, The method includes the following steps: Obtain preset model mesh data; wherein, the preset model mesh data includes vertex data and face data; Based on the preset model mesh data, a preset topology detection is performed to generate a model topology detection result. The preset topology detection includes at least one of model shell integrity detection, model inside / outside reversal detection, and shell intersection detection. Among them, performing model shell integrity detection includes matching analysis of directed edges determined by the vertex data and the face data. Performing model inside / outside reversal detection and shell intersection detection includes ray emission based on the normal data determined by the vertex data and the face data, and then combining the ray hit results for detection analysis.
2. The method according to claim 1, characterized in that, Perform model shell integrity detection based on the preset model mesh data, including: Based on the preset model mesh data, the directed edges corresponding to each model triangle face are determined through the preset vertex order, and then the directed edges are reversed to obtain the reverse edges. Traverse each of the directed edges according to the reverse edge to query the directed edges that satisfy the preset matching conditions, and obtain a preset edge set; wherein, the preset matching conditions include that the directed edge coincides with the reverse edge and has the same direction; The integrity information of the model shell is determined based on the preset edge set; wherein, the integrity information of the model shell includes either the model shell being complete or the model shell being incomplete.
3. The method according to claim 2, characterized in that, The step of traversing each directed edge according to the reverse edge to query the directed edges that satisfy the preset matching conditions, and obtaining a preset edge set, includes: Construct a preset vector list; wherein the preset vector list stores the directed edges; The preset vector list is traversed according to the reverse edge to determine whether there is a target edge in the preset vector list; wherein, the target edge includes the directed edge that satisfies the preset matching condition; When it is determined that the target edge exists in the preset vector list, the target edge is deleted from the preset vector list to obtain the target vector list.
4. The method according to claim 1, characterized in that, The vertex data includes a vertex array, and the face data includes a triangle face array; Based on the preset model mesh data, perform inversion detection of the model's internal and external aspects, including: The vertex 3D vectors are determined based on the vertex array and the triangle array, and then the vertex 3D vectors are transformed to the world coordinate system to obtain world coordinate data; The center coordinates of the face are calculated based on the world coordinate data, and the directed edge is determined using the world coordinate data. Then, the direction of the first normal is determined based on the directed edge. The target triangle is determined by using rays based on the center coordinates of the face and the first normal direction. Then, model inversion analysis is performed based on the target triangle to obtain model inversion information. The target triangle includes the model triangle hit by the ray.
5. The method according to claim 4, characterized in that, The step of calculating the center coordinates of the face based on the world coordinate data, determining the directed edge using the world coordinate data, and then determining the direction of the first normal based on the directed edge includes: The coordinates of the face center are obtained by calculating the average value of the preset coordinate data; wherein, the preset coordinate data includes the world coordinate data corresponding to the three vertices of the model triangle face; The preset coordinate data are subtracted sequentially to obtain the directed edges corresponding to the model triangles; The first normal direction is calculated using the cross product algorithm based on the directed edge.
6. The method according to claim 4, characterized in that, The process involves determining the target triangular face using rays based on the center coordinates of the face and the first normal direction, and then performing an inversion analysis of the model based on the target triangular face to obtain inversion information, including: A ray is emitted along the opposite direction of the first normal direction based on the coordinates of the surface center, and the ray hit information is recorded. When it is determined from the ray hit information that the ray did not hit the model triangle, the model inversion information is determined to be an inversion topology anomaly; or, when it is determined from the ray hit information that the ray hit the model triangle, the model inversion information is determined to be an inversion topology normal.
7. The method according to claim 6, characterized in that, The step of emitting a ray along the opposite direction of the first normal direction based on the coordinates of the surface center and recording the ray hit information includes: The starting point coordinates are determined by offsetting the center coordinates of the surface in the opposite direction along the first normal direction by a preset unit length. A ray is emitted in the opposite direction to the first normal direction based on the starting coordinates, and the ray hit information is then recorded.
8. The method according to claim 4, characterized in that, Based on the preset model mesh data, shell cross-detection is performed, including: The dot product of the second normal direction and the first normal direction of the target triangle is calculated to obtain the dot product result. Based on the dot product results, shell cross analysis is performed to determine the shell cross information of the model.
9. The method according to claim 1, characterized in that, Before performing model inversion detection or shell cross-detection based on the preset model mesh data, the method further includes: Set the back-side hit parameter; wherein, the back-side hit parameter is used to control the rendering engine to allow the collider to hit from the inside of the collider; Execution status parameters are set to determine frame information based on the execution status parameters, and then frame processing is performed based on the frame information.
10. A model topology detection device, characterized in that, The device includes: The first module is used to acquire preset model mesh data; wherein, the preset model mesh data includes vertex data and face data; The second module is used to perform a preset topology detection based on the preset model mesh data and generate a model topology detection result. The preset topology detection includes at least one of model shell integrity detection, model inside / outside reversal detection, and shell intersection detection. Among them, performing model shell integrity detection includes matching analysis of directed edges determined by the vertex data and the face data, and performing model inside / outside reversal detection and shell intersection detection includes ray emission based on the normal data determined by the vertex data and the face data, and then combining the ray hit results for detection analysis.
11. An electronic device, characterized in that, include: At least one processor; At least one memory for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor implements the method as described in any one of claims 1 to 9.
12. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 9.
13. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 9.
