CAD modeling-oriented grid adaptive subdivision method and real-time preview method
By employing an adaptive mesh subdivision method for CAD modeling, which utilizes vertex sorting and half-edge structure optimization to optimize mesh subdivision and combines Bézier curves to adjust the LOD level transition, the problems of computational redundancy and visual abruptness in CAD modeling are solved, enabling efficient real-time preview.
Patent Information
- Application Number
- CN202511511296.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-22
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2045-10-22
AI Technical Summary
Existing CAD modeling mesh subdivision algorithms suffer from global computational redundancy, poor dynamic adaptability, poor LOD dynamic adaptability, and frame rate fluctuations, resulting in low computational efficiency and poor visual continuity.
An adaptive mesh subdivision method for CAD modeling is adopted. By sorting vertex coordinates, constructing half-side structures and importance weights ω, the mesh subdivision area is dynamically adjusted. Combined with Bézier curves to optimize the LOD level transition, mesh subdivision and rendering are synchronized.
It improves the dynamic adaptability and computational efficiency of mesh subdivision, enhances visual smoothness, solves the problems of frame rate fluctuation and visual jump, and realizes real-time preview effect.
Smart Images

Figure CN120995800A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer-aided design and real-time graphics computing technology, specifically to a mesh adaptive subdivision method and a real-time preview method for CAD modeling. Background Technology
[0002] In CAD modeling and real-time rendering applications, mesh subdivision technology is a core method for improving model accuracy. Traditional subdivision algorithms—such as the Catmull-Clark subdivision algorithm and the Loop subdivision algorithm—recursively divide the global mesh, leading to the following problems:
[0003] Global computational redundancy: High curvature regions, such as edges and corners, require dense patches to maintain details, while equal subdivision of low curvature regions will generate a large number of redundant patches, increasing the computational load. Existing technologies use local subdivision algorithms to divide regions by curvature thresholds, but curvature calculation relies on offline preprocessing and cannot adapt to dynamic scenes.
[0004] LOD (Level of Details) has poor dynamic adaptability: Existing LOD technologies mostly use pre-generated multi-resolution models, and the switching depends on fixed thresholds, such as distance or viewpoint. This causes LOD jumps in distant or fast-moving scenes, which disrupts visual continuity. Even if dynamic LOD scheduling methods are used, based on frustum culling (determining whether an object is within the camera's field of view and thus determining the LOD level) or adjusting LOD based on screen space error, the problem of visual jumps is not solved when switching levels. Objects experience discontinuous visual abrupt changes at the moment of switching, which destroys the sense of immersion. The essence of this is the discontinuity of geometric, texture, and positional information of different LOD models.
[0005] Frame rate fluctuations: In traditional architectures, geometry processing and rendering are coupled, and subdivision calculations and rendering are performed simultaneously. Even with the parallel computing capabilities of the GPU to accelerate subdivision, it is still impossible to solve the problem that complex models can easily block the rendering thread and cause frame rate fluctuations. Summary of the Invention
[0006] To overcome the problems of poor dynamic adaptability and low computational efficiency of existing mesh subdivision methods, this invention proposes an adaptive mesh subdivision method and a real-time preview method for CAD modeling.
[0007] The technical solution provided by this invention is as follows: A mesh adaptive subdivision method for CAD modeling, comprising the following steps:
[0008] Model data preprocessing involves sorting the vertex coordinates of the model according to their spatial location, so that the coordinates of vertices that are spatially adjacent are stored consecutively in the vertex list. The model's mesh data structure uses a half-edge structure to build adjacency relationships, recording the start point, end point, opposite edge, and adjacent face of each edge.
[0009] Calculate the importance weight ω, calculate the projected area of different grid subdivision regions in the view frustum as the importance weight ω, and allocate computing resources and arrange the subdivision order according to the importance weight ω.
[0010] Mesh subdivision, selecting curvature K i Vertices with curvature greater than the curvature threshold are used as seed vertices. After expanding the initial subdivision region based on the seed vertices and performing mesh subdivision, the vertex coordinates and their indices in the subdivision region are modified, the data of the unchanged region is retained, and the vertex list is updated.
[0011] The vertex coordinates in the model data are sorted according to their spatial location, and the adjacency relationships of vertices, edges, and faces are constructed using a half-edge structure, which enables the rapid calculation of the importance weight ω of the mesh subdivision region. Computational resources are allocated and the subdivision order is arranged based on the projected area of different mesh subdivision regions in the view frustum as the importance weight ω. Subdivision regions with higher preview priority are given priority in computational resource allocation, improving the dynamic adaptability of mesh subdivision, rationally allocating computational resources, and improving computational efficiency. Since the vertex coordinates are sorted according to their spatial location, only the vertex coordinates and their indices of the subdivision region need to be changed during mesh subdivision, while retaining the data of unchanged regions, reducing the amount of computation.
[0012] As a preferred option, the curvature threshold and importance weight ω are set to be negatively correlated, so that the mesh subdivision region is adjusted according to the importance weight ω, that is, according to the importance of the visual preview. This allows for more precise allocation of mesh subdivision regions based on preview requirements, improving the mesh's adaptive subdivision capability, rationally allocating computing resources, and improving computing efficiency.
[0013] Preferably, the model data preprocessing further includes the following steps:
[0014] The model is divided into uniform grids, with each grid storing the indices of the vertices and faces contained within it. By locating the grid, elements within the grid can be traversed and found, reducing computational complexity.
[0015] Preferably, the grid construction steps include:
[0016] Determine the extent of the entire bounding box based on the maximum and minimum values of all vertex coordinates;
[0017] Set the grid size and calculate the number of grid cells;
[0018] Establish a grid coordinate system;
[0019] Associate vertices with their corresponding grids.
[0020] Since the vertex coordinates are sorted according to their spatial location, it is convenient to divide the grid according to the space, thereby improving the efficiency of element search and traversal.
[0021] Preferably, mesh subdivision is terminated when any one of the following three termination conditions is met:
[0022] Termination condition one: The curvature change ΔK of the subdivided region is less than the set threshold.
[0023] Termination condition two: The number of GPU drawing calls exceeds the specified threshold;
[0024] Termination condition three: The rate of change of curvature after subdivision is less than the set threshold.
[0025] A real-time mesh preview method for CAD modeling is provided. Mesh subdivision employs an adaptive mesh subdivision method for CAD modeling, determining the LOD level of different subdivided regions based on an importance weight ω. During mesh subdivision, the vertex coordinates and their indices of each subdivided region are modified once after subdivision. The real-time preview method further includes the following steps:
[0026] Each time the vertex list is updated, the data is cached in the first buffer allocated in the memory buffer;
[0027] The second buffer, created from the memory buffer, exchanges data with the first buffer.
[0028] The second buffer passes the data to the rendering module used to render the mesh, thus completing the rendering and display of the mesh.
[0029] The LOD level and mesh subdivision order of different mesh subdivision regions are determined by the importance weight ω. The near-field region is processed first. After some near-field meshes are processed, the data is updated and stored in the first buffer. The second buffer is kept consistent with the data exchanged with the first buffer. The rendering module can then render in advance by extracting the data from the second buffer. During rendering, other subdivision regions are subdivided simultaneously according to the importance weight ω. Mesh subdivision and rendering are performed synchronously to achieve a real-time preview effect.
[0030] Preferably, the method further includes the following steps: calculating the screen projection of the Hausdorff distance for all LOD levels using the vertex list data of the first buffer as the initial screen projection distance H. s1 According to the initial screen projection distance H s1 Whether the threshold is exceeded to adjust the LOD level division, ensuring that the "worst-case" of the basic LOD level is still within the perception threshold.
[0031] As a preferred option, operations to adjust the LOD level division include reverting to the adjusted LOD model, such as optimizing the low-poly simplification algorithm to reduce the shape deviation between the high-poly and low-poly models.
[0032] Preferably, it checks whether the importance weight ω of the mesh subdivision region under the current view reaches the threshold for LOD level switching. If so, it calls the vertex list data of the first buffer to calculate the screen projection of the Hausdorff distance between the mesh subdivision region under the current view and the adjacent LOD level to be switched to, as the real-time screen projection distance H. s2 If the real-time screen projection distance is H s2 If the value exceeds the set threshold, the number of rendering frames for transition interpolation is increased to control the deformation amplitude. By diluting the deformation perception through a longer gradient, the layer differences are masked, ensuring that the shape differences between adjacent LOD layers are within the limits of human visual perception, thus achieving dynamic adjustment of the spatial switching of LOD layers.
[0033] As a preferred method, a Bézier curve is used to adjust the transition time rhythm when switching between high and low LOD levels. The curve expression is B(t) = P0×(1-t)³ + 3P1×t(1-t)² + 3P2×t²(1-t) + P3×t³, where P0, P1, P2, and P3 are four control points, where:
[0034] P0=(0,0), controls the low-mode end;
[0035] P1 = (0.2, 0.1), is used as the first control point;
[0036] P2 = (0.8, 0.9), used as the second control point;
[0037] P3=(1,1), controls the high-mode end.
[0038] Bézier curves are used to adjust the transition time rhythm of LOD levels, optimizing the transition rhythm from a time dimension so that the deformation process conforms to the human eye's expectation of "natural movement" (slow start, fast middle, slow finish); in conjunction with geometric deformation measurement, within a safe deformation range, rhythm control further masks the traces of level switching.
[0039] An adaptive mesh subdivision system for CAD modeling includes:
[0040] The preprocessing module is used to sort the vertex coordinates of the model data according to their spatial location and to construct the adjacency relationship of the model's mesh data structure using a half-edge structure.
[0041] The importance weight calculation module calculates the projected area of different grid subdivision regions in the view frustum as the importance weight ω;
[0042] The mesh subdivision module is used to select the curvature K. i Vertices with curvature greater than the curvature threshold are used as seed vertices. After expanding the initial subdivision region based on the seed vertices and performing mesh subdivision, the vertex coordinates and their indices in the subdivision region are modified, the data of the unchanged region is retained, and the vertex list is updated.
[0043] A real-time mesh preview system for CAD modeling, comprising the aforementioned adaptive mesh subdivision system for CAD modeling, and further comprising:
[0044] The LOD hierarchy module is used to determine the LOD hierarchy of different grid subdivision regions based on the importance weight ω;
[0045] The first buffer is used to store the initial and updated vertex list data;
[0046] The second buffer is used to exchange data with the first buffer after the data in the first buffer is updated;
[0047] The rendering module is used to extract data from the second buffer and perform mesh rendering.
[0048] A smart terminal includes a processor and a memory. The memory stores a computer program, and the processor is communicatively connected to the memory. The processor executes the adaptive mesh subdivision method for CAD modeling or the real-time mesh preview method for CAD modeling through the computer program.
[0049] A computer-readable storage medium storing program data used to execute the aforementioned adaptive mesh subdivision method for CAD modeling or the aforementioned real-time mesh preview method for CAD modeling.
[0050] Compared with the prior art, the present invention has the following beneficial effects:
[0051] 1. Sort the vertex coordinates in the model data according to their spatial positions, and use a half-edge structure to build the adjacency relationship of vertices, edges and faces. This enables the rapid calculation of the importance weight ω of the mesh subdivision region. Furthermore, when subdividing the mesh, only the vertex coordinates and their indices of the subdivision region need to be changed, while the data of the unchanged region is retained, thus reducing the amount of computation.
[0052] 2. Based on the projection area of different mesh subdivision regions in the view frustum as importance weight ω, computing resources are allocated and the subdivision order is arranged. Subdivision regions with higher preview priority are given priority in computing resources for subdivision, thereby improving the dynamic adaptability of mesh subdivision, rationally allocating computing resources, and improving computing efficiency.
[0053] 3. The curvature threshold is dynamically adjusted according to the importance weight ω, so that the mesh subdivision area is adjusted according to the importance weight ω, that is, according to the importance of the visual preview. This allows for more precise allocation of mesh subdivision areas based on preview requirements, improving the mesh's adaptive subdivision capability, rationally allocating computing resources, and improving computing efficiency.
[0054] 4. The LOD level and mesh subdivision order of different mesh subdivision regions are determined according to the importance weight ω. The near-field region is processed first. After some near-field meshes are processed, the data is updated and stored in the first buffer. The second buffer is kept consistent with the data exchanged with the first buffer. The rendering module can then render in advance by extracting the data from the second buffer. During rendering, other subdivision regions are subdivided simultaneously according to the importance weight ω. Mesh subdivision and rendering are performed synchronously to achieve a real-time preview effect.
[0055] 5. Address the perception issues of LOD transitions from both spatial constraints and temporal rhythm perspectives to enhance visual smoothness. Attached Figure Description
[0056] Figure 1 This is a schematic diagram of the overall process of Embodiment 1 of the present invention;
[0057] Figure 2 This is a schematic diagram of the angle deficit method in the Gaussian curvature calculation in Embodiment 1 of the present invention;
[0058] Figure 3 This is a schematic diagram of a half-side structure according to Embodiment 1 of the present invention;
[0059] Figure 4 This is a schematic diagram of task priority scheduling (based on viewpoint distance) according to Embodiment 1 of the present invention. Detailed Implementation
[0060] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the described embodiments of the present invention without inventive effort are within the scope of protection of the present invention. Unless otherwise defined, the technical or scientific terms used herein should have the ordinary meaning understood by those skilled in the art to which this invention pertains.
[0061] Example 1, see Figure 1 This invention provides a real-time preview method for CAD modeling, including a mesh adaptive subdivision method, the steps of which are as follows: Figure 1 As shown, it includes:
[0062] S1. Import the model file and verify and check it. The imported model data format includes OBJ, FBX, PLY and other formats. Ensure that the data contains vertex coordinates, normal vectors, UV texture coordinates and triangle / quadrilateral patch indices.
[0063] S11, Topology Verification, detects and corrects topology errors such as non-manifold edges and orphaned vertices during import, ensuring the initial mesh meets the "subdivision condition" and preventing distortions or errors in subsequent subdivision. Includes:
[0064] S111, topology check, eliminates problems such as non-manifold topology (e.g., edges shared by 3 or more surfaces, abnormal number of edges connected to vertices), duplicate vertices / edges, self-intersecting surfaces.
[0065] S112, Geometric check, to ensure that the mesh is free from obvious distortion (such as the minimum angle of triangles being too small, or the aspect ratio of quadrilaterals being unbalanced), to avoid the amplification of defects after subdivision.
[0066] S2, Model Data Preprocessing
[0067] S21, Vertex Coordinate Reindexing, spatially sorts the vertex list using Morton Code encoding, that is, it uses Z-Order curves to arrange vertices and sorts the vertex coordinates of the model according to their spatial position, so that the coordinates of vertices with similar spatial positions are stored contiguously in the vertex list, thereby improving the GPU cache hit rate and reducing memory access fragmentation.
[0068] The core of vertex reindexing is to reorganize the vertex storage order through spatial correlation, thereby solving the "fragmentation" problem of GPU memory access. The original vertex list is usually stored in the order of modeling (not spatially contiguous), which can easily lead to cache misses when accessed by the GPU (requiring frequent jumps for addressing). However, Morton code sorting can make the coordinates of spatially adjacent vertices stored contiguously in memory, greatly improving cache utilization.
[0069] The Z-Order curve is a "space-filling curve" that maps 3D spatial coordinates to 1D integers. It works by alternating the binary bits of the X, Y, and Z coordinates to form an integer (i.e., Morton code), ensuring that spatially adjacent points remain adjacent in the 1D sequence. For example, the binary representation of 3D coordinates (x=5, y=3, z=6) is x=101, y=011, z=110. After alternating bits, the Morton code is: 1 0 1 | 0 1 1 | 1 1 0 → binary 101011110 → decimal 350.
[0070] Therefore, the closer the vertices are in space, the smaller the difference in their Morton codes, which allows vertices that are spatially close to each other to be stored contiguously in memory after being sorted.
[0071] S22 uses a half-edge structure to construct adjacency relationships in the model's mesh data structure. For each edge, the starting point, ending point, opposite edge, and adjacent face are recorded, thereby supporting efficient topological traversal (such as curvature calculation and local subdivision) and quickly finding the corresponding points and faces. This solves the problem that the original mesh (which only has vertex coordinates and face indexes) cannot quickly query the neighborhood, and meets the requirement of adaptive mesh subdivision based on curvature. It adopts explicit storage of adjacency relationships (such as edge → face, vertex → edge) to achieve neighborhood traversal of O(1) to O(n).
[0072] The "adjacency relationships" of a mesh (such as vertex-edge, edge-face, face-adjacent face) are the foundation for curvature calculation and local subdivision. However, the original mesh usually only stores "vertex coordinates" and "face-vertex indices". For example, a triangular face only records 3 vertex indices, making it impossible to directly and quickly query the neighborhood. The half-edge structure achieves explicit storage of adjacency relationships (such as edge→face, vertex→edge) through explicit storage of topological information, realizing neighborhood traversal in O(1)~O(n) time.
[0073] Taking a triangular mesh as an example, such as Figure 2 As shown, the construction process of the half-structure includes:
[0074] S221, Initialize basic elements: Read the list of vertex coordinates (v) and the list of faces (F, each face contains 3 vertex indices).
[0075] S222, Generate half-edges and their relationships: For each face F i (The corresponding vertices are v1, v2, v3), generate 3 half-edges HE:
[0076] HE1: origin=v1, target=v2, face=F i ;
[0077] HE2: origin=v2, target=v3, face=F i ;
[0078] HE3: origin=v3, target=v1, face=F i ;
[0079] And set a closed loop relationship for each half, namely: HE1.next=HE2, HE2.next=HE3, HE3.next=HE1.
[0080] S223, establish a twin side.
[0081] For each half-edge HE (origin=u, target=v), find the half-edge HE' with "origin=v, target=u", and set HE.twin=HE' and HE'.twin=HE (if it is a boundary edge, twin is null).
[0082] S224, Associating vertices and faces:
[0083] Each vertex V is associated with a half-edge originating from V (e.g., if HE.origin=v, then v.edge=HE); each face F is associated with a half-edge belonging to it (e.g., if HE.face=F, then F.edge=HE).
[0084] S23 divides the model into uniform grids, with each grid storing the indices of the vertices and faces contained within it. During a query, the grid is located first, then the elements within that grid are traversed, reducing computational complexity. In dynamic curvature calculations, it's often necessary to query vertices or faces within a certain spatial range (e.g., all vertices within 5mm of vertex V). If the entire model is traversed for a single query, the complexity is O(N) (where N is the total number of vertices), which is inefficient. Spatial grid indexing, by dividing the model space into uniform grids, enables "locating the grid first, then querying the elements within that grid," thereby accelerating neighborhood queries.
[0085] The steps for constructing a raster include:
[0086] S231, Calculate the bounding box (AABB): Traverse all vertices, determine the minimum (min_x, min_y, min_z) and maximum (max_x, max_y, max_z) values of x / y / z, define the bounding box range, and form an axis-aligned bounding box (AABB): [min_x, max_x]×[min_y, max_y]×[min_z, max_z].
[0087] S232, Divide the grid into uniform grids, taking vertex grid index as an example, including:
[0088] S2321, set the grid size (cell_size) according to the model accuracy and query requirements (such as dynamic curvature calculation, which commonly uses 0.5~5mm, and needs to balance the number of grids and query accuracy).
[0089] S2322, Calculate the number of grid cells:
[0090] nx = ceil((max_x - min_x) / cell_size)
[0091] The same applies to ny and nz.
[0092] S2323, Establish a grid coordinate system: Each grid cell is represented by an integer (i,j,k), where i∈[0, nx-1],j∈[0, ny-1],k∈[0, nz-1].
[0093] S233, Associate vertices with grid.
[0094] For a vertex v(x,y,z), calculate its corresponding raster coordinates: i = floor((x - min_x) / cell_size)
[0095] j, k In the same way, k = floor((z - min_z) / cell_size).
[0096] Store the vertex indices in a list of grids (i,j,k) (which can be stored using a hash table or a three-dimensional array, such as grid[i][j][k] = [v1, v2, ...]).
[0097] By establishing a half-edge data structure layer to explicitly store adjacency relationships, the basic topology query problem is solved. A spatial acceleration layer based on a raster index is established, overlaying spatial partitioning on top of the data structure to accelerate operations such as dynamic curvature that rely on neighborhood queries. In other words, the half-edge structure ensures high efficiency in topology traversal, while the raster index further optimizes spatial query efficiency; the combination of both supports subsequent subdivision and curvature calculation modules.
[0098] S3, divide the mesh into subdivided regions and select the curvature K. i Vertices with curvature greater than a curvature threshold are used as seed vertices. An initial subdivision region is then expanded based on these seed vertices, including the following steps:
[0099] S31, Select seed vertex, select curvature K i >Curvature threshold K threshold The vertex is used as the seed vertex. Curvature K i =μ + σ, where μ is the mean curvature, σ is the standard deviation, and K is the curvature threshold.threshold The curvature threshold and importance weight ω are set to be negatively correlated, for example, they can be inversely proportional.
[0100] The curvature K of the vertex i Existing curvature calculation methods, such as Gaussian curvature (K=k1*k2), are used to describe the local bending degree of the surface. In a discrete mesh, such as... Figure 3 As shown, the approximate calculation is performed using the Angle Deficit method:
[0101] Vertex V i Gaussian curvature K i Calculated based on the deficit in its neighborhood:
[0102]
[0103] Among them, A mixed (v i ) is the vertex V i The mixed Voronoi area is used for curvature normalization to improve accuracy.
[0104] For non-uniform meshes, the method for calculating the mixed Voronoi area is as follows:
[0105]
[0106] in, It is a triangle T j ={v i ,v j1 ,v j2 The weighted area is assigned to each vertex, and we have:
[0107]
[0108] Where α j ,β j For T j middle and v i Opposite angles.
[0109] The Voronoi area is the area occupied by a single Voronoi cell in a Voronoi graph (also known as a Thiessen polygon). A Voronoi graph is generated from a set of discrete points (called "seed points" or "generators"), each seed point corresponding to a Voronoi cell, where all points within the cell are less distant from the seed point than from any other seed point.
[0110] In mesh processing, Voronoi area is often used to estimate the "weight" of vertices. In curvature calculation, Voronoi area is used to weight and average neighborhood information, thereby improving accuracy.
[0111] S32, Region Expansion: Based on the Breadth-First Search (BFS) algorithm, the seed vertex is quickly expanded to its neighboring area. The expansion relies on the adjacency relationships of the face patches in the half-edge data structure to form an initial subdivided region. The expansion radius R is:
[0112]
[0113] Among them, K max R is the maximum curvature of the current mesh. base Based on the radius.
[0114] Expansion termination condition: The curvature gradient reaches R.
[0115] S4. The LOD (Level of Detail) levels are defined, and the projected area of different mesh subdivision regions in the view frustum is calculated as an importance weight ω. Computational resources are allocated and the subdivision order is arranged according to the importance weight ω. The LOD level and computational resources for different mesh subdivision regions are determined by the importance weight ω. A larger projected area results in a higher allocated LOD and more computational resources, leading to finer triangulation of the mesh subdivision regions.
[0116] In computer graphics, frustum-based importance weights are used to measure the visual importance of subdivided regions (such as objects and terrain tiles) within the camera's view frustum. The core metric is the projected area, which is the area projected onto the near clipping plane (or screen space) of the subdivided region. A larger projected area indicates that the region occupies more pixels in the final rendering, thus requiring higher-precision subdivision or rendering resources.
[0117] The projected area is approximated by the bounding sphere, that is, the subdivided region is represented by the bounding sphere. Since the model's mesh data structure re-adjacency relationships using a half-edge structure, the bounding sphere of the subdivided region can be easily and quickly calculated from the model data. The coordinates of the sphere's center in camera space are P=(P x ,P y ,P z If the radius of the sphere is r, then the formula for the projected area is:
[0118]
[0119] Where θ is the vertical field of view (FOV), a is the aspect ratio, i.e., a = screen height / screen width, and n is the distance to the near clipping plane.
[0120] The projected area is directly used as the importance weight ω to serve as the basis for allocating computing resources, that is:
[0121]
[0122] ω (weight) is proportional to the square of r, meaning that the larger the region, the higher the weight.
[0123] ω (weight) and P z The square is proportional, meaning the closer to the camera, the higher the weight.
[0124] The constant terms a and n are the same for all regions and can be calculated in advance.
[0125] S5, Dynamic Curvature Sensitive Subdivision, performs mesh subdivision, modifies the vertex coordinates and indices of the subdivided regions, retains data in unchanged regions, and updates the vertex list. The steps include:
[0126] S51, only for high curvature regions (curvature threshold > K) threshold The recursive method is used for subdivision, and the subdivision method adopts existing technologies such as the Catmull-Clark subdivision algorithm and the Loop subdivision algorithm. The original mesh is preserved in low curvature areas, reducing the amount of facet generation.
[0127] S52, by interpolating the boundary curves C1(u) and C2(v) onto the surface, the initial subdivision region is further subdivided. Boundary interpolation (Coons surface):
[0128]
[0129] Where P ij These are corner control points used to eliminate stepped discontinuities.
[0130] S53 modifies the vertex coordinates and vertex indices of each subdivided region after subdivision, while retaining the data of unchanged regions. After each update of the vertex list, the data is cached in the first buffer allocated in the memory buffer to ensure rendering pipeline compatibility.
[0131] S54, the subdivision terminates when any one of the following three termination conditions is met:
[0132] Termination condition one: The curvature change ΔK of the subdivided region is less than 0.05, where ΔK is the curvature difference before and after subdivision, i.e., ΔK = ∑∣K new -K old |;
[0133]
[0134] Termination condition two: The number of GPU drawing calls exceeds a specified threshold (e.g., 10,000 times / frame).
[0135]
[0136] Termination condition three: Threshold for rate of change of curvature after subdivision:
[0137]
[0138] S6, use the vertex list data in the first buffer to calculate the screen projection of the Hausdorff distance for all LOD levels as the initial screen projection distance H. s1 According to the initial screen projection distance H s1 If the threshold is exceeded, adjust the LOD level division and update the adjusted data in the first buffer, such as... Figure 4 As shown, the LOD level division is adjusted according to the Hausdorff distance, and the LOD level division is statically pre-adjusted.
[0139] For all preset LOD levels (such as LOD0 and LOD1, LOD1 and LOD2), calculate the maximum Hausdorff distance Hmax in 3D space, and calculate the critical screen projection distance H based on the model's "maximum visible distance" (such as when an object is visible within a range of 1 meter to 100 meters). s1 (H) s1 = Hmax × (pixel density / minimum viewing distance)), which is the initial screen projection distance H. s1 If H s1 If the value exceeds the set threshold (0.5 pixels in this embodiment), the LOD model needs to be adjusted back (e.g., optimizing the low-poly simplification algorithm to reduce the shape deviation between the high-poly and low-poly models) to ensure that the "worst-case" of the basic LOD level is still within the perception threshold.
[0140] Initial screen projection distance H s1 The calculation process includes:
[0141] Calculating the Hausdorff distance: The Hausdorff distance describes the maximum shape difference between two geometric sets, expressed in terms of high-poly LOD. h Hierarchical and low-poly LOD l Taking hierarchical levels as an example, the Hausdorff distance is defined as "LOD". h Any point in the middle to LOD l "nearest distance" and "LOD" l Any point in the middle to LOD h The maximum value of the nearest distance, i.e., the Hausdorff distance H = max (sup) a ∈LOD h inf β ∈LOD l ||ab||, sup β ∈LOD l inf a ∈LODh ||ab|| ).
[0142] Convert to initial screen projection distance H s1 Convert the 3D Hausdorff distance to the screen projection pixel distance, i.e., H. s1 H s1 = H × (screen pixel density / distance from object to viewpoint), in pixels. For example, an object with a 3D deformation of 0.1 meters will have a projection error of 0.1 / (10 × 0.001) = 10 pixels at a distance of 10 meters (pixel density 0.001 m / pixel), which far exceeds the perception threshold.
[0143] S7, in the dynamic LOD scheduling module, dynamically schedules the LOD level and updates the scheduled data in the first buffer.
[0144] S71 schedules the switching of LOD levels spatially through frame interpolation.
[0145] The dynamic LOD scheduling module detects whether the importance weight ω of the mesh subdivision region under the current view has reached the threshold for LOD level switching. If the threshold is reached based on screen-space error (SSE), then the vertex list in the first buffer is called in real time to calculate the screen projection of the Hausdorff distance of the mesh subdivision region under the current view between the current LOD level and the adjacent LOD level to be switched, as the real-time screen projection distance H. s2 If H s2 > 0.5 pixels, temporarily increase the number of transition interpolation frames (e.g., extend from 8 frames to 12 frames) to control the deformation amplitude. By diluting the perceived deformation through a longer gradient, the layer differences are masked, ensuring that the shape differences between adjacent LOD layers are within the limits of human visual perception. H s2 The calculation steps are as follows:
[0146] S711, take two adjacent LOD levels h and LOD l Key feature points (such as corner vertices, sampling points in high curvature regions);
[0147] S712 calculates the 3D distance between feature point pairs, combines it with the distance D from the current object to the viewpoint, and converts it into the real-time screen projection distance H. s2 = Feature point distance D × (screen horizontal resolution / (2 × D × tan (FOV / 2))), where FOV is the field of view angle;
[0148] In this implementation, the real-time screen projection distance H s2 Set the threshold to 0.5 pixels, i.e., H. s2For grid areas larger than 0.5 pixels, the number of transition interpolation frames is increased to limit the shape difference of the LOD level in the spatial dimension and ensure "transitionability" - even if there is slight deformation during the transition process, it cannot be detected by the human eye; it provides a "safe deformation range" for subsequent temporal interpolation to avoid interpolation failure due to excessive differences in the base model.
[0149] S72 adjusts the values of multiple control points of the Bézier curve according to the application scenario, thereby adjusting the transition time rhythm of the LOD level and avoiding the mechanical feel (such as sudden acceleration and deformation of the model) caused by linear interpolation (α changes at a constant speed with time).
[0150] Bézier curves dynamically adjust the rate of change of interpolation weight α to make the transition conform to the human eye's perception of "natural motion" (slow start, fast middle, slow finish).
[0151] Interpolation weight α is a key parameter controlling the LOD blending ratio when switching from LOD. l (Low-poly) to LOD h (For high-order modulo), α∈[0,1]:
[0152] α=0: Fully display LOD l ;
[0153] α=1: Fully display LOD h ;
[0154] α is the intermediate value: hybrid LOD l and LOD h The vertex position (p = (1-α)×p) l + α×p h ), normal (n = (1-α)×n l + α×n h Texture coordinates, etc., enable gradual deformation.
[0155] The linear interpolation α(t) = t (t is the proportion of the transition time, t∈[0,1]) has a constant rate of change (derivative is 1), resulting in an abrupt transition. The Bézier curve adjusts the slope (rate of change) of α(t) by using control points.
[0156] Using typical third-order Bézier curves to mix LOD l and LOD h For example, the settings are as follows:
[0157] The curve expression is B(t) = P0×(1-t)³ + 3P1×t(1-t)² + 3P2×t²(1-t) + P3×t³, where P0, P1, P2, and P3 are four control points, and:
[0158] P0=(0,0): starting point, α=0 (completely low-poly model);
[0159] P1=(0.2, 0.1): The first control point controls the transitional start-up phase. When t=20%, α only reaches 10%, resulting in a slow start-up and reducing the perception of a "sudden start".
[0160] P2=(0.8, 0.9): The second control point controls the mid-transition period. When t=80%, α has reached 90%, and the main deformation is completed rapidly in the intermediate stage.
[0161] P3=(1,1): End point, α=1 (fully high-poly model), slow down the end phase to avoid the abrupt feeling of "sudden stop".
[0162] The derivative of the Bézier curve (the rate of change of α with respect to t) exhibits a trend of "low → high → low", that is:
[0163] Initiation phase (t=0~0.2): The rate of change slowly increases from 0 (e.g., the derivative is approximately 0.75 at t=0), and the model deformation starts gently.
[0164] Mid-term stage (t=0.2~0.8): The rate of change remains high (e.g., peak derivative ≈ 2.5), quickly completing most of the deformation and reducing the total transition time;
[0165] Final stage (t=0.8~1): The rate of change slowly falls from a high level to 0, and the model deformation naturally converges.
[0166] When dealing with fast-moving objects, shorten the transition time (e.g., 4 frames), adjust P1=(0.1,0.3) and P2=(0.9,0.7) to speed up mid-term deformation and prevent objects from moving out of the view before the transition is completed;
[0167] When dealing with static objects in the foreground, extend the transition time (e.g., 16 frames), adjust P1=(0.3,0.05) and P2=(0.7,0.95) to slow down the start and end, and enhance the sense of detail;
[0168] When dealing with transitions in high curvature regions, the rate of change is increased when α approaches 0.5 to quickly pass through highly sensitive regions and reduce the perception of angular deformation.
[0169] Bézier curves are used to adjust the transition time rhythm of the LOD level, optimizing the transition rhythm from the time dimension so that the deformation process conforms to the human eye's expectation of "natural movement" (slow start, fast middle, slow finish).
[0170] In conjunction with geometric deformation measurement, within a safe deformation range, rhythm control further masks the traces of hierarchical switching.
[0171] Steps S71 and S72 are both performed in the dynamic LOD scheduling module, addressing the perception problem of LOD transitions from both spatial constraints and temporal rhythm dimensions, thereby enhancing the visual smoothness of the line.
[0172] Geometric deformation measurement is calculated in two stages, S6 and S71, using Hausdorff distance to ensure that shape differences at the LOD level are within the limits of human visual perception. Timing interpolation controlled by Bézier curves dynamically adjusts the transition rhythm, avoiding a mechanical feel and making the deformation process natural and smooth. The combination of these two methods enables LOD transitions that are imperceptible to the human eye.
[0173] S8, the second buffer opened by the memory buffer exchanges data with the first buffer, and the second buffer passes the data to the rendering module used to render the mesh, thus completing the rendering and display of the mesh.
[0174] The LOD level and mesh subdivision order of different mesh subdivision regions are determined by the importance weight ω. The near-field region is processed first. After some near-field meshes are processed, the data is updated and stored in the first buffer. The second buffer is kept consistent with the data exchanged with the first buffer. The rendering module can then render in advance by extracting the data from the second buffer. During rendering, other subdivision regions are subdivided simultaneously according to the importance weight ω. Mesh subdivision and rendering are performed synchronously to achieve a real-time preview effect.
[0175] Example 2
[0176] An adaptive mesh subdivision system for CAD modeling includes:
[0177] The preprocessing module is used to sort the vertex coordinates of the model data according to their spatial positions and to construct the adjacency relationship of the model's mesh data structure using a half-edge structure, thus implementing step S2 in Example 1.
[0178] The importance weight calculation module calculates the projected area of different mesh subdivision regions in the view frustum as the importance weight ω, thus implementing step S4 in Example 1.
[0179] The mesh subdivision module is used to select the curvature K. i Vertices with curvature greater than the curvature threshold are used as seed vertices. After expanding the initial subdivision region based on the seed vertices and performing mesh subdivision, the vertex coordinates and their indices in the subdivision region are modified, the data of the unchanged region is retained, and the vertex list is updated.
[0180] Example 3
[0181] A real-time mesh preview system for CAD modeling, including the adaptive mesh subdivision system for CAD modeling as described in Embodiment 2, further includes:
[0182] The LOD hierarchy module is used to determine the LOD hierarchy of different grid subdivision regions based on the importance weight ω;
[0183] The dynamic LOD scheduling module is used to implement the dynamic scheduling of LOD levels in steps S6 and S7 of the embodiment.
[0184] The first buffer is used to store the initial and updated vertex list data;
[0185] The second buffer is used to exchange data with the first buffer after the data in the first buffer is updated;
[0186] The rendering module is used to extract data from the second buffer and perform mesh rendering.
[0187] Example 4
[0188] A smart terminal includes a processor and a memory. The memory stores a computer program, and the processor is communicatively connected to the memory. The processor executes the adaptive mesh subdivision method for CAD modeling or the real-time mesh preview method for CAD modeling in Embodiment 1 through the computer program.
[0189] Example 5
[0190] A computer-readable storage medium storing program data, the program data being used to execute an embodiment of an adaptive mesh subdivision method for CAD modeling or a real-time mesh preview method for CAD modeling.
[0191] The preferred embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the present invention is not limited to the specific details of the above embodiments. Within the scope of the technical concept of the present invention, various simple modifications can be made to the technical solution of the present invention, and these simple modifications all fall within the protection scope of the present invention.
Claims
1. A mesh adaptive subdivision method for CAD modeling, characterized in that, Includes the following steps: Model data preprocessing involves sorting the vertex coordinates of the model according to their spatial location, so that the coordinates of vertices that are spatially adjacent are stored consecutively in the vertex list. The model's mesh data structure uses a half-edge structure to build adjacency relationships, recording the start point, end point, opposite edge, and adjacent face of each edge. Divide the grid into subdivided regions and select the curvature K. i Vertices with curvature greater than the curvature threshold are used as seed vertices, and the initial subdivision region is expanded based on the seed vertices. Calculate the importance weight ω, calculate the projected area of different grid subdivision regions in the view frustum as the importance weight ω, and allocate computing resources and arrange the subdivision order according to the importance weight ω; Perform mesh subdivision, modify the vertex coordinates and indices of the subdivided regions, retain the data of the unchanged regions, and update the vertex list.
2. The adaptive mesh subdivision method for CAD modeling according to claim 1, characterized in that, The curvature threshold and importance weight ω are set to be negatively correlated.
3. The adaptive mesh subdivision method for CAD modeling according to claim 1, characterized in that, The model data preprocessing also includes the following steps: The model is divided into uniform grids, and each grid stores the indexes of the vertices and faces contained within the grid. By locating the grid, the elements within the grid can be traversed and searched.
4. The adaptive mesh subdivision method for CAD modeling according to claim 3, characterized in that, The steps for constructing a raster include: Determine the extent of the entire bounding box based on the maximum and minimum values of all vertex coordinates; Set the grid size and calculate the number of grid cells; Establish a grid coordinate system; Associate vertices with their corresponding grids.
5. The adaptive mesh subdivision method for CAD modeling according to any one of claims 1-4, characterized in that, Mesh subdivision terminates when any one of the following three termination conditions is met: Termination condition one: The curvature change ΔK of the subdivided region is less than the set threshold. Termination condition two: The number of GPU rendering calls exceeds the specified threshold; Termination condition three: The rate of change of curvature after subdivision is less than the set threshold.
6. A method for real-time mesh preview in CAD modeling, characterized in that, The mesh subdivision employs the adaptive mesh subdivision method for CAD modeling as described in claims 1-5. The LOD level of different mesh subdivision regions is determined based on the importance weight ω. During mesh subdivision, the vertex coordinates and their indices of each subdivision region are modified once after subdivision. The real-time preview method further includes the following steps: Each time the vertex list is updated, the data is cached in the first buffer allocated in the memory buffer; The second buffer, created from the memory buffer, exchanges data with the first buffer. The second buffer passes the data to the rendering module used to render the mesh, thus completing the rendering and display of the mesh.
7. The method for real-time mesh preview in CAD modeling according to claim 6, characterized in that, It also includes the following steps: The screen projection of the Hausdorff distance for all LOD levels is calculated using the vertex list data in the first buffer as the initial screen projection distance H. s1 According to the initial screen projection distance H s1 If the threshold is exceeded, adjust the LOD level division and update the adjusted data in the first buffer.
8. The method for real-time mesh preview for CAD modeling according to claim 7, characterized in that, Adjusting the LOD (Level of Detail) hierarchy includes reverting to the adjusted LOD model.
9. The method for real-time mesh preview for CAD modeling according to claim 6, 7, or 8, characterized in that, It also includes the following steps: Dynamic scheduling of LOD levels, with the scheduled data updated in the first buffer, includes the following steps: If the importance weight ω of the mesh subdivision region under the current viewpoint reaches the threshold for LOD level switching, then the vertex list data in the first buffer is used to calculate the screen projection of the Hausdorff distance between the mesh subdivision region under the current viewpoint and the adjacent LOD level to be switched to, which is then used as the real-time screen projection distance H. s2 If the real-time screen projection distance is H s2 If the value exceeds the set threshold, the number of rendering frames for transition interpolation will be increased, and the adjusted data will be updated in the first buffer.
10. The method for real-time mesh preview for CAD modeling according to claim 6, 7, or 8, characterized in that, Dynamic scheduling at the LOD level also includes the following steps: Bézier curves are used to adjust the transition time rhythm when switching between high and low LOD levels. The curve expression is B(t) = P0×(1-t)³ + 3P1×t (1-t)² + 3P2×t²(1-t) + P3×t³, where P0, P1, P2, and P3 are four control points. P0=(0,0), controls the low-mode end; P1 = (0.2, 0.1), is used as the first control point; P2 = (0.8, 0.9), used as the second control point; P3=(1,1), controls the high-mode end.
11. A mesh adaptive subdivision system for CAD modeling, characterized in that, include: The preprocessing module is used to sort the vertex coordinates of the model data according to their spatial location and to construct the adjacency relationship of the model's mesh data structure using a half-edge structure. The importance weight calculation module calculates the projected area of different grid subdivision regions in the view frustum as the importance weight ω; The mesh subdivision module is used to select the curvature K. i Vertices with curvature greater than the curvature threshold are used as seed vertices. After expanding the initial subdivision region based on the seed vertices and performing mesh subdivision, the vertex coordinates and their indices in the subdivision region are modified, the data of the unchanged region is retained, and the vertex list is updated.
12. A real-time mesh preview system for CAD modeling, characterized in that, The mesh adaptive subdivision system for CAD modeling as described in claim 11 further includes: The LOD hierarchy module is used to determine the LOD hierarchy of different grid subdivision regions based on the importance weight ω; The first buffer is used to store the initial and updated vertex list data; The second buffer is used to exchange data with the first buffer after the data in the first buffer is updated; The rendering module is used to extract data from the second buffer and perform mesh rendering.
13. A smart terminal, characterized in that, The smart terminal includes a processor and a memory. The memory stores a computer program. The processor is communicatively connected to the memory. The processor executes the adaptive mesh subdivision method for CAD modeling as described in any one of claims 1-5 or the real-time mesh preview method for CAD modeling as described in any one of claims 6-10 through the computer program.
14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores program data that is used to execute the mesh adaptive subdivision method for CAD modeling as described in any one of claims 1-5 or the mesh real-time preview method for CAD modeling as described in any one of claims 6-10.
Citation Information
Patent Citations
Self-adaptive grid subdivision method, device and equipment and storage medium
CN112733318A
Grid adaptive subdivision optimization method and method applied to three-dimensional model rendering
CN117726773A
BIM model plane cutting analysis method based on Cesium
CN119720360A
Method of mesh simplification via ununiform spatial division
US20030112239A1