Three-dimensional model voxelization method and device, electronic equipment and computer storage medium

By granularly partitioning the spatial structure tree of the 3D model and determining the signed distance values ​​layer by layer, the problem of excessive computation and memory consumption in the existing technology is solved, achieving efficient 3D voxelization, which is suitable for parallel processing on modern hardware.

CN121564232APending Publication Date: 2026-02-24BEIJING PIXEL SOFTWARE TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511794798.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-02
Publication Date
2026-02-24

AI Technical Summary

Technical Problem

In existing 3D graphics modeling, voxel-based representation methods consume too much computation and memory under high resolution or real-time requirements, making it difficult to meet the needs of dynamic modification and complex topological changes.

Method used

By obtaining the spatial structure tree of the 3D model, the space of parent nodes with undetermined node states is divided with a preset granularity. The node states are determined layer by layer using signed distance values. By combining the sparse spatial structure tree and the hierarchical JFA distance propagation mechanism, the amount of computation and memory usage are reduced.

Benefits of technology

It significantly improves voxelization efficiency, reduces computational complexity and memory consumption, is suitable for parallel processing on modern hardware, and enhances its applicability to real-time scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121564232A_ABST
    Figure CN121564232A_ABST
Patent Text Reader

Abstract

The invention relates to a three-dimensional reconstruction technology, and provides a three-dimensional model voxelization method and device, electronic equipment and a computer storage medium, and the method comprises the steps: obtaining a space structure tree of a to-be-voxelized three-dimensional model, the space structure tree comprises nodes located at all layers, and a bounding box of the three-dimensional model corresponding to the space of a root node located at the top layer, the space of the child node of any father-child node pair is obtained by dividing the space of the father node of which the node state is undetermined according to the preset granularity; quantifying the position relation between the space of each target leaf node with the undetermined node state and the three-dimensional model to obtain a signed distance value of each target leaf node; based on the signed distance value of each target leaf node, determining signed distance values of leaf nodes with fixed node states in the spatial structure tree layer by layer; and performing voxel surface reconstruction according to the signed distance values of all the leaf nodes to obtain a three-dimensional voxel model. The voxelization efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of three-dimensional reconstruction technology, and more specifically, to a method, apparatus, electronic device, and computer storage medium for three-dimensional model voxelization. Background Technology

[0002] In 3D graphics and modeling, traditional geometric meshes are the primary way to describe object surfaces. However, mesh structures have limitations when handling dynamic modifications, complex topological changes, and large-scale scenes. For example, performing Boolean operations, drilling, or sculpting directly on the mesh leads to complex topological updates and high computational costs, and stability is difficult to guarantee in real-time applications. In contrast, voxel-based representations naturally overcome these shortcomings by approximating or reconstructing the original mesh model using regular 3D voxel grids.

[0003] Currently, commonly used voxelization methods mainly rely on point-by-point sampling or scanning rasterization to divide the 3D space into a regular mesh and determine the interior and exterior of the model point by point to obtain a voxel representation. This method requires traversing the entire 3D mesh, and the computational and memory consumption increases cubically with resolution, making it difficult to meet the requirements of high resolution or real-time performance. Summary of the Invention

[0004] The purpose of this invention is to provide a method, apparatus, electronic device, and computer storage medium for voxelizing three-dimensional models.

[0005] The embodiments of the present invention can be implemented as follows: In a first aspect, the present invention provides a method for voxelizing a three-dimensional model, the method comprising: Obtain the spatial structure tree of the three-dimensional model to be voxelized. The spatial structure tree includes nodes located in each layer. The space of the root node at the top layer corresponds to the bounding box of the three-dimensional model. The space of the child node of any parent-child node pair is obtained by dividing the space of the parent node whose node state is undetermined according to a preset granularity. The node state represents the positional relationship between the space of the node and the three-dimensional model. The spatial relationship between each target leaf node whose node state is undetermined and the three-dimensional model is quantified to obtain the signed distance value of each target leaf node; Based on the signed distance value of each target leaf node, the signed distance values ​​of the leaf nodes with a fixed node state in the spatial structure tree are determined layer by layer. Based on the signed distance values ​​of all the leaf nodes, the voxel surface of the 3D model is reconstructed to obtain the 3D voxel model of the 3D model.

[0006] In an optional implementation, the surface of the 3D model includes multiple geometric facets of preset shapes. The step of quantifying the spatial positional relationship between each target leaf node with an undetermined node state and the 3D model to obtain a signed distance value for each target leaf node includes: For any target leaf node's target space, obtain the target facets that intersect with the target space from among the multiple geometric facets; Calculate the distance between the target space and the target surface; The direction is determined based on the positional relationship between the target space and the target surface; Based on the distance and the direction, determine the signed distance value of the target leaf node corresponding to the target space.

[0007] In an optional implementation, the step of determining the signed distance value of the leaf node with a predetermined node state in the spatial structure tree layer by layer based on the signed distance value of each target leaf node includes: The bottom layer containing the target leaf nodes is taken as the current layer, and the signed distance value of each target leaf node in the current layer is taken as the seed point. Update the signed distance values ​​of the remaining nodes in the current layer based on the seed point of the current layer; Based on the signed distance values ​​of all nodes in the current layer, determine the seed point of the next layer above the current layer; The previous layer of the current layer is taken as the current layer again, and the step of updating the signed distance value of the remaining nodes of the current layer according to the seed point of the current layer is repeated until the signed distance value of the leaf nodes with the state of all nodes is determined.

[0008] In an optional implementation, the step of obtaining the spatial structure tree of the 3D model to be voxelized includes: Set the root node as the current node and the bounding box of the 3D model as the current space; The current space is divided according to the preset granularity to obtain multiple subspaces; Create a node for each of the subspaces described; Each node in the subspace is treated as a child node of the current node, and a parent-child relationship is established between the current node and each node in the subspace. If there is a target child node with an undetermined state among the child nodes of the current node, the subspace of each target child node is taken as the current space one by one, and the step of dividing the current space according to the preset granularity is repeated until the preset condition is met to obtain the space structure tree.

[0009] In an optional implementation, before the step of dividing the current space according to the preset granularity and repeating the step of taking the subspace of each target child node as the current space, and taking the target child node's subspace as the current space until the preset condition is met to obtain the space structure tree, the following steps are included: For any undetermined child node of the current node, determine the positional relationship between the subspace of the undetermined child node and the three-dimensional model; If the positional relationship indicates that the subspace of the undetermined child node is outside the three-dimensional model, or indicates that the subspace of the undetermined child node is inside the three-dimensional model, then the node state of the undetermined child node is determined to be determined; otherwise, the node state of the undetermined child node is determined to be undetermined.

[0010] In an optional implementation, the step of determining the positional relationship between the subspace of the undetermined child node and the three-dimensional model includes: The 3D model is projected and rendered along each of the multiple preset directions to obtain a depth map for each preset direction; If the three-dimensional coordinates of each corner point of the subspace of the undetermined sub-node in the world coordinate system are all within the depth value range of the depth map of the corresponding preset direction, then it is determined that the subspace of the undetermined sub-node is located within the three-dimensional model. If the three-dimensional coordinates of each corner point of the subspace of the undetermined child node in the world coordinate system are all outside the depth value range of the depth map in the corresponding preset direction, then it is determined that the subspace of the undetermined child node is outside the three-dimensional model.

[0011] In an optional implementation, the preset condition is that the node state of each leaf node is fixed or the size of the subspace of the target child node is smaller than a preset size.

[0012] In a second aspect, the present invention provides a three-dimensional model voxelization device, the device comprising: The acquisition module is used to acquire the spatial structure tree of the three-dimensional model to be voxelized. The spatial structure tree includes nodes located in each layer. The space of the root node at the top layer corresponds to the bounding box of the three-dimensional model. The space of the child node of any parent-child node pair is obtained by dividing the space of the parent node whose node state is undetermined according to a preset granularity. The node state represents the positional relationship between the space of the node and the three-dimensional model. The quantization module is used to quantize the spatial relationship between each target leaf node whose node state is undetermined and the three-dimensional model, and obtain the signed distance value of each target leaf node. The determination module is used to determine, layer by layer, the signed distance values ​​of the leaf nodes in the spatial structure tree whose node states are determined, based on the signed distance values ​​of each target leaf node. The reconstruction module is used to reconstruct the voxel surface of the three-dimensional model based on the signed distance values ​​of all the leaf nodes, so as to obtain the three-dimensional voxel model of the three-dimensional model.

[0013] Thirdly, the present invention provides an electronic device including a processor and a memory, the memory being used to store a program, and the processor being used to implement the three-dimensional model voxelization method as described in any of the foregoing embodiments when executing the program.

[0014] Fourthly, the present invention provides a computer storage medium having a computer program stored thereon, which, when executed by a processor, implements the three-dimensional model voxelization method as described in any of the foregoing embodiments.

[0015] Compared with the prior art, the present invention has the following beneficial effects: This invention avoids traversing the entire 3D model space by dividing the space of parent nodes with undetermined node states only according to a preset granularity in the spatial structure tree, which significantly reduces the amount of computation and memory usage. By utilizing the signed distance value of each target leaf node with an undetermined node state, the signed distance value of the leaf nodes with determined node states in the spatial structure tree is determined layer by layer, which reduces the amount of global redundant computation and ultimately improves the voxelization efficiency. Attached Figure Description

[0016] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0017] Figure 1 This is a flowchart illustrating the three-dimensional model voxelization method provided in this embodiment.

[0018] Figure 2 An example diagram of the spatial structure tree provided in this embodiment.

[0019] Figure 3 This is a block diagram illustrating the voxelization device for the three-dimensional model provided in this embodiment.

[0020] Figure 4 This is a block diagram of the electronic device provided in this embodiment.

[0021] Icons: 10-Electronic device; 11-Processor; 12-Memory; 13-Bus; 100-3D model voxelization device; 110-Acquisition module; 120-Quantization module; 130-Determination module; 140-Reconstruction module. Detailed Implementation

[0022] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.

[0023] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.

[0024] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.

[0025] In the description of this invention, it should be noted that if terms such as "upper," "lower," "inner," or "outer" are used to indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, or the orientation or positional relationship in which the product of this invention is usually placed, they are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this invention.

[0026] Furthermore, the terms "first" and "second" are used only to distinguish descriptions and should not be interpreted as indicating or implying relative importance.

[0027] It should be noted that, where there is no conflict, the features in the embodiments of the present invention can be combined with each other.

[0028] To improve voxelization efficiency, one approach is to use SDF (Signed Distance Field) to calculate the signed distance from each voxel to the 3D model surface, and then reconstruct the mesh using methods such as Marching Cubes. In recent years, JFA (Jump Flooding Algorithm) has been introduced into 3D distance field calculation. Its basic idea is to start with a batch of initial seed points and rapidly calculate the distance field through exponential jump-step propagation, significantly improving computational efficiency. While JFA improves the speed of distance field generation, its effectiveness depends on the quality of the initial seed points. If the seed point distribution is insufficient or the deviation is too large, the final distance field will contain errors or artifacts. In large-scale 3D spaces, the propagation steps of JFA still need to be updated on all voxels, resulting in significant storage and computational pressure. Existing methods have limited parallelization capabilities, making it difficult to fully utilize the potential of modern hardware (multi-core CPUs or GPUs), thus affecting the applicability of the algorithms in real-time scenarios.

[0029] In view of this, this embodiment provides a method, apparatus, electronic device, and computer storage medium for voxelization of a three-dimensional model. One of its core improvement ideas is that: based on the hierarchical division of the bounding box of the three-dimensional geometric model according to different resolutions, and only the space where the positional relationship between the node space and the three-dimensional model is undetermined, the computational load is significantly reduced and the computational efficiency is improved. Based on the obtained sparse spatial structure tree, the hierarchical JFA distance propagation mechanism is used to effectively improve the voxelization efficiency. It will be described in detail below.

[0030] Please refer to Figure 1 , Figure 1 This is a flowchart illustrating the voxelization method for a 3D model provided in this embodiment. The method includes the following steps: Step S101: Obtain the spatial structure tree of the three-dimensional model to be voxelized. The spatial structure tree includes nodes located in each layer. The space of the root node at the top layer corresponds to the bounding box of the three-dimensional model. The space of the child node of any parent-child node pair is obtained by dividing the space of the parent node whose node state is undetermined according to a preset granularity. The node state represents the positional relationship between the space of the node and the three-dimensional model.

[0031] In this embodiment, the spatial structure tree is a hierarchical spatial partitioning structure organized in a tree shape. Its top level contains a root node, whose spatial extent completely corresponds to the bounding box of the 3D model. The relationship between any pair of parent and child nodes satisfies the following: only when the parent node's state is determined to be undetermined will its corresponding space be divided into multiple subspaces according to a preset granularity, and corresponding child nodes will be generated; the space of each child node is a subdivision of the parent node's space. The preset granularity can be set according to actual needs. To facilitate concurrent execution of voxelization, an octree is typically used in practice to implement the spatial structure tree. That is, the space of a parent node that needs further subdivision will be divided into 8 subspaces, corresponding to 8 child nodes for a parent node in the spatial structure tree. In this case, the preset granularity is 8. However, it is not necessary to subdivide every node except the root node; only nodes with undetermined states need to be subdivided. In other words, the spatial structure tree is a sparse tree.

[0032] Please refer to Figure 2 , Figure 2 This is an example diagram of the spatial structure tree provided in this embodiment. Figure 2 The spatial structure tree in the example is a sparse octree with four levels. The root node is at the top level (level 1), and it has eight child nodes at level 2. The node circled in black at level 2 has an undetermined state, so it is further subdivided, resulting in eight more child nodes at level 3. The node circled in black at level 3 also has an undetermined state, so it is further subdivided, resulting in eight more child nodes at level 4. Level 4 has two nodes with undetermined states, such as... Figure 2 The nodes of the black circles in the diagram.

[0033] In this embodiment, node states are used to characterize the relative positional relationship between the corresponding space and the 3D model, typically including three cases: internal, external, or across a surface. Undetermined states can be cases where the spatial region overlaps with the model surface. The spatial structure tree can retain necessary details while avoiding over-refinement of large areas clearly located inside or outside the model, thus constructing an adaptive spatial organization.

[0034] Step S102: Quantify the positional relationship between the space and the 3D model of each target leaf node whose node state is undetermined to obtain the signed distance value of each target leaf node.

[0035] In this embodiment, the target leaf node is a node with an undetermined node state. The space corresponding to each target leaf node can be regarded as a local cubic region, which may intersect with the actual surface of the 3D model. By calculating the distance from the voxel point within this space to the nearest surface element and combining it with the inside-outside judgment logic to determine the sign, a signed distance value is generated. The signed distance value not only reflects the Euclidean distance from the spatial position to the surface of the 3D model, but also contains directional information about whether it is located inside or outside the surface, usually encoded in a negative inside and positive outside manner.

[0036] Step S103: Based on the signed distance value of each target leaf node, determine the signed distance value of the leaf nodes with the defined node state in the spatial structure tree layer by layer.

[0037] In this embodiment, a bottom-up, fine-to-coarse reverse hierarchical propagation strategy can be adopted. Using the signed distance values ​​already obtained at the target leaf node, the corresponding distance information of other leaf nodes with fixed states in the spatial structure tree can be gradually derived. This embodiment utilizes a hierarchical propagation mechanism to achieve an effective expansion from local precise information to a global approximate expression, ensuring the overall continuity and consistency of the distance field while controlling computational complexity.

[0038] Step S104: Based on the signed distance values ​​of all leaf nodes, perform voxel surface reconstruction on the 3D model to obtain the 3D voxel model of the 3D model.

[0039] In this embodiment, the leaf node set of the entire spatial structure tree is uniformly processed, and isosurface extraction algorithms suitable for non-uniform or sparse meshes, such as Marching Cubes or Dual Contouring, are invoked to reconstruct an approximate surface of the original 3D model at locations with zero distance values. Since this voxel surface reconstruction process relies heavily on the local geometric gradient and topological information provided by the signed distance values ​​carried by each leaf node, it can accurately capture the curvature features and fine structures of the model surface. This results in a reconstructed 3D voxel model that retains the main shape features of the original 3D model while also possessing regular spatial distribution characteristics.

[0040] It should also be noted that, since different leaf nodes in the spatial structure tree are at different levels, algorithms such as transvoxel can be used to improve the seam problem of different LODs (Level of Detail) caused by ordinary Marching Cubes.

[0041] In this embodiment, the three-dimensional voxel model can be used for physical simulation, Boolean editing, or rendering.

[0042] The method provided in this embodiment divides the space of parent nodes whose node states are uncertain only according to a preset granularity in the spatial structure tree, avoiding traversing the entire space of the 3D model, which significantly reduces the amount of computation and memory usage. By using the signed distance value of each target leaf node whose node state is uncertain, the signed distance value of the leaf nodes whose node state is certain is determined layer by layer in the spatial structure tree, which reduces the amount of global redundant computation and ultimately improves the voxelization efficiency.

[0043] In an optional implementation, to ensure that the signed distance value reflects both distance information and positional relationship, this embodiment provides a method for determining the signed distance value of any target leaf node: First, for the target space of the target leaf node, obtain the target facets that intersect with the target space from multiple geometric facets; In this embodiment, the surface of the 3D model includes multiple geometric facets of preset shapes, such as triangles, quadrilaterals, and polygons. To simplify processing, geometric facets with initial shapes of quadrilaterals and polygons are first converted into triangles for processing. The target leaf node is the surface crossing node of the 3D model. The target facet is a geometric facet that spatially overlaps with the surface of the 3D model within a local space covered by the target space; there can be one or more target facets.

[0044] Secondly, calculate the distance between the target space and the target surface; In this embodiment, as one implementation method, the distance between the target space and the target facet can be determined based on the distance between each corner point of the target space and the target facet. For the target space of a cube, its corner points are the vertices of the cube. Each cube includes 8 corner points. The distance between the target space and the target facet can be the minimum distance between the 8 corner points and the target facet, or the average distance between the 8 corner points and the target facet.

[0045] Third, determine the direction based on the positional relationship between the target space and the target surface; In this embodiment, to enable topological discrimination of distance information, a directionality determination mechanism is introduced. This mechanism uses positive and negative signs to semantically define directions based on distance. Specifically, it can determine whether a sampling point in the target space is located inside or outside the model surface using methods such as ray casting, normal consistency checks, or parity crossing rules. If located outside, the direction is marked positive; if located inside, the direction is marked negative. This direction determination relies on the orientation information of the target surface and its topological connectivity within the closed manifold, ensuring that the sign assignment conforms to the overall model's internal and external definition standards.

[0046] Finally, based on distance and direction, the signed distance value of the target leaf node corresponding to the target space is determined.

[0047] In this embodiment, distance and direction can be combined to form a scalar output with directional attributes, i.e., a signed distance value. For example, if the nearest distance between a corner point in the target space and the surface is d, and it is determined to be outside the 3D model, then its signed distance value is recorded as +d; otherwise, it is recorded as -d.

[0048] It should be noted that the above-mentioned method for handling the signed distance value of the target leaf node can also be used to improve the conventional SDF algorithm. Specifically, in the processing steps of the conventional SDF algorithm, when selecting seed points, instead of selecting seed points from all unit spaces of the bounding box of the entire 3D model, seed points are selected from the unit spaces that intersect with the 3D model from all unit spaces of the bounding box of the entire 3D model, as described above for handling the signed distance value of the target leaf node. On the one hand, this reduces the amount of computation, and on the other hand, it improves the quality of the selected seed points and ensures the accuracy of voxelization.

[0049] It should also be noted that when there are multiple target facets, the method for calculating the distance between the target space and each target facet is the same. In this case, the signed distance value of the target leaf node corresponding to the target space can be the signed distance value with the smallest absolute value among them.

[0050] In this embodiment, for leaf nodes with a defined state, the signed distance can be determined in the same way as for leaf nodes with an undefined state. However, this method requires traversing every leaf node, resulting in low processing efficiency. To improve processing efficiency, this embodiment also provides an implementation method to quickly determine leaf nodes with defined states based on the signed distance values ​​of leaf nodes with undefined states: (1) Take the bottom layer with the target leaf node as the current layer, and take the signed distance value of each target leaf node in the current layer as the seed point; In this embodiment, starting from a known seed point, a distance field filling algorithm suitable for regular or sparse grids, such as the Jump Flooding Algorithm (JFA), is used to perform parallel distance propagation within the current layer to update the signed distance values ​​of the remaining nodes in the current layer.

[0051] (2) Update the signed distance values ​​of the remaining nodes in the current layer based on the seed point of the current layer; In this embodiment, the propagation process follows an exponential step strategy, progressively spreading the distance information of the seed point to neighboring unassigned or optimizable nodes. In each iteration, the result of minimizing the signed distance estimate is retained until the distance values ​​of all nodes within the layer converge and stabilize. The updated result covers all nodes in the current layer, forming a complete and consistent intermediate distance field representation. This embodiment utilizes a seed-driven local propagation mechanism, significantly reducing the computational overhead of traditional global scanning while maintaining accuracy, making it particularly suitable for parallel acceleration processing under modern GPU architectures.

[0052] (3) Determine the seed point of the previous layer based on the signed distance values ​​of all nodes in the current layer; In this embodiment, the set of nodes in the current layer that have completed distance field updates is used to map initial conditions to the next level. The position of each node in the current layer can be matched with its corresponding position in the previous layer where its parent node is located using spatial correspondence, and the distance value at that position is extracted as the initial distance estimate for the corresponding node in the previous layer. For cases where multiple child nodes in the previous layer correspond to the same parent node, a comprehensive seed value can be generated by selecting the minimum absolute distance, weighted average, or maximum confidence. The resulting seed point set serves as the input basis for distance propagation in the previous layer, achieving information enhancement from a fine-grained level to a coarse-grained level.

[0053] (4) Take the previous layer of the current layer as the current layer again, and go to (3) until the signed distance value of the leaf nodes with the state of all nodes is determined.

[0054] In this embodiment, by taking the previous layer as the current layer again and repeatedly performing the distance update operation based on the seed point, a backtracking propagation is achieved layer by layer until all leaf nodes with a fixed state obtain their signed distance values.

[0055] In an optional implementation, to more efficiently construct a spatial structure tree with the required sparsity, this embodiment also provides a method for obtaining the spatial structure tree of the 3D model to be voxelized: First, set the root node as the current node and the bounding box of the 3D model as the current space; Secondly, the current space is divided according to a preset granularity to obtain multiple subspaces; In this embodiment, the preset granularity refers to a regular spatial segmentation strategy. Taking the octree partitioning method as an example, the current space is divided into eight sub-cubes of the same size along the three coordinate axes X, Y, and Z of the three-dimensional spatial coordinate system. This partitioning process can generate a set of non-overlapping sub-regions that collectively fill the original space based on the principle of geometric uniformity. Each sub-region is a subspace, and these subspaces serve as the basic unit for spatial refinement.

[0056] Third, create a node for each subspace; Fourth, treat each node in each subspace as a child node of the current node, and establish a parent-child relationship between the current node and the nodes in each subspace. Fifth, if there are target child nodes with an undetermined state among the child nodes of the current node, take the subspace of each target child node as the current space one by one, and repeat the step of dividing the current space according to the preset granularity until the preset conditions are met to obtain the space structure tree.

[0057] In this embodiment, a child node is only included in the further refined candidate range when its state is determined to be undetermined; child nodes with determined states (completely inside or completely outside) are no longer further split. In this way, the spatial structure tree can adaptively focus on regions with drastic geometric changes, maintaining high resolution while avoiding oversampling of flat or empty areas.

[0058] In an optional implementation, to avoid unnecessary computations due to excessive refinement of the spatial structure tree, the preset condition can be set to ensure that the node state of each leaf node is predetermined or that the size of the subspace of the target child node is smaller than a preset size. The preset size can be determined based on the required accuracy of the actual voxelization; the higher the accuracy requirement, the smaller the preset size should be, and vice versa.

[0059] In an optional implementation, to avoid a significant increase in computational complexity and a significant decrease in voxelization efficiency due to traversing all nodes, this embodiment only performs a finer-grained partitioning of the space for nodes with undetermined states. Therefore, this embodiment also provides an implementation method for determining node states: First, for any undetermined child node of the current node, determine the positional relationship between the subspace of the undetermined child node and the 3D model; Secondly, if the subspace representing the undetermined child node is located outside the 3D model, or if the subspace representing the undetermined child node is located inside the 3D model, then the node state of the undetermined child node is determined to be determined; otherwise, the node state of the undetermined child node is determined to be undetermined.

[0060] In this embodiment, a subspace located within the 3D model means that the entire subspace is surrounded by the 3D model entity and belongs to the material-filled area; a subspace located outside the 3D model means that the subspace is completely within the cavity or background space and is not covered by the model. Furthermore, if a subspace intersects with the model, it means that the subspace crosses the surface boundary of the model, encompassing both the internal and external regions. Only when the state is indeterminate does it mean that its interior still needs further subdivision to accurately describe local geometric features. The purpose of determining the node state as determined or indeterminate is to achieve rapid removal of interfering nodes related to potential blank areas, significantly reducing the spatial scope of subsequent calculations.

[0061] In an optional implementation, to further accurately and quickly determine the positional relationship between the subspace of the undetermined child node and the 3D model, this embodiment also provides a processing method: First, the 3D model is projected and rendered along each of the multiple preset directions to obtain a depth map for each preset direction. In this embodiment, the multiple preset directions can be several orthogonal or approximately orthogonal directions, such as the six directions along the X, Y, and Z axes. More directions can be added on top of these six; the more directions, the higher the accuracy, but the greater the computational load. Each depth map records the distribution of the nearest depth values ​​between the surface of the 3D model and the imaging plane, using that preset direction as the viewing direction (for example, the positive direction of the X-axis can represent the viewing direction from left to right, the positive direction of the Y-axis can represent the viewing direction from bottom to top, and the positive direction of the Z-axis can represent the viewing direction from back to front), forming a two-dimensional array of distance field representations. This depth map reflects the contour boundary information of the 3D model from the viewpoint of the corresponding preset direction.

[0062] It should be noted that the calculation of depth maps in multiple preset directions can be implemented on GPU to support the parallel determination of the states of millions of nodes.

[0063] Secondly, if the three-dimensional coordinates of each corner point of the subspace of the undetermined child node are all within the depth value range of the depth map of the corresponding preset direction in the world coordinate system, then the subspace of the undetermined child node is determined to be within the 3D model. In this embodiment, the depth value range refers to the effective depth range allowed for the corresponding pixel position in the depth map on a projection in a preset direction. It is usually determined by the depth difference between the front and back surfaces of the 3D model. When the projected depth of a corner point falls within this range, it indicates that it is covered by the 3D model entity on the line of sight. If the projected depth of all corner points in a certain direction is within this range, it is preliminarily inferred that the subspace is embedded inside the 3D model.

[0064] Third, if the three-dimensional coordinates of each corner point of the subspace of the undetermined child node are all outside the depth value range of the depth map in the corresponding preset direction, then the subspace of the undetermined child node is determined to be outside the three-dimensional model.

[0065] In this embodiment, if any corner point is outside the depth value range, it means that all corner points are farther than the surface of the 3D model closest to the observer, or in some implementations closer than the back side furthest from the observer, and it can be presumed that they are completely in the external space of the 3D model.

[0066] It should be noted that the second and third steps described above can be executed sequentially or in parallel. This embodiment does not limit the execution order of these two steps. In addition, the determination of whether all corner points are within / outside the depth value range can also be executed in parallel to further improve voxelization efficiency.

[0067] To perform the corresponding steps in the above embodiments and various possible implementations, an implementation method of the three-dimensional model voxelization device 100 is given below. Please refer to... Figure 3 , Figure 3 This is a block diagram of the three-dimensional model voxelization device provided in this embodiment. It should be noted that the basic principle and technical effects of the three-dimensional model voxelization device 100 provided by the present invention are the same as those of the corresponding embodiments described above. For the sake of brevity, some parts of this embodiment are not mentioned.

[0068] The three-dimensional model voxelization device 100 includes an acquisition module 110, a quantization module 120, a determination module 130, and a reconstruction module 140.

[0069] The acquisition module 110 is used to acquire the spatial structure tree of the three-dimensional model to be voxelized. The spatial structure tree includes nodes located in each layer. The space of the root node at the top layer corresponds to the bounding box of the three-dimensional model. The space of the child node of any parent-child node pair is obtained by dividing the space of the parent node whose node state is undetermined according to a preset granularity. The node state represents the positional relationship between the space of the node and the three-dimensional model.

[0070] The quantization module 120 is used to quantize the positional relationship between the space and the 3D model of each target leaf node whose node state is undetermined, and obtain the signed distance value of each target leaf node.

[0071] The determination module 130 is used to determine the signed distance value of the leaf node with a fixed node state in the spatial structure tree layer by layer based on the signed distance value of each target leaf node.

[0072] The reconstruction module 140 is used to reconstruct the voxel surface of the 3D model based on the signed distance values ​​of all leaf nodes, so as to obtain the 3D voxel model of the 3D model.

[0073] In an optional implementation, the surface of the 3D model includes multiple geometric facets of preset shapes, quantization module 120: For any target leaf node in the target space, obtain the target facets that intersect with the target space from among multiple geometric facets; Calculate the distance between the target space and the target surface; The direction is determined based on the positional relationship between the target space and the target surface; Based on distance and direction, determine the signed distance value of the target leaf node corresponding to the target space.

[0074] In an optional implementation, the determining module 130 is specifically used for: The bottom layer containing the target leaf nodes is taken as the current layer, and the signed distance value of each target leaf node in the current layer is taken as the seed point. Update the signed distance values ​​of the remaining nodes in the current layer based on the seed point of the current layer; Determine the seed point of the next layer based on the signed distance values ​​of all nodes in the current layer; The previous layer is re-established as the current layer. The process of updating the signed distance values ​​of the remaining nodes in the current layer based on the seed point of the current layer is repeated until the signed distance values ​​of all leaf nodes with a defined state are determined.

[0075] In an optional implementation, the acquisition module 110 is specifically used for: Set the root node as the current node and the bounding box of the 3D model as the current space; The current space is divided into multiple subspaces according to a preset granularity; Create a node for each subspace; Establish a parent-child relationship between the current node and the nodes in each subspace, treating each node in the subspace as a child node of the current node. If there are target child nodes with an undetermined state among the child nodes of the current node, the subspace of each target child node is taken as the current space one by one, and the step of dividing the current space according to the preset granularity is repeated until the preset condition is met to obtain the space structure tree.

[0076] In an optional implementation, the acquisition module 110 is further configured to: For any undetermined child node of the current node, determine the positional relationship between the subspace of the undetermined child node and the 3D model; If the subspace representing the undetermined child node is located outside the 3D model, or if the subspace representing the undetermined child node is located inside the 3D model, then the node state of the undetermined child node is determined to be determined; otherwise, the node state of the undetermined child node is determined to be undetermined.

[0077] In an optional implementation, when the acquisition module 110 is specifically used to determine the positional relationship between the subspace of the child node to be determined and the 3D model, it is specifically used to: The 3D model is projected and rendered along each of the multiple preset directions to obtain a depth map for each preset direction. If the three-dimensional coordinates of each corner point of the subspace of the undetermined child node are all within the depth value range of the depth map of the corresponding preset direction in the world coordinate system, then the subspace of the undetermined child node is determined to be within the three-dimensional model. If the three-dimensional coordinates of each corner point of the subspace of the undetermined child node are all outside the depth value range of the depth map in the corresponding preset direction, then the subspace of the undetermined child node is determined to be outside the three-dimensional model.

[0078] In an optional implementation, the preset condition in the three-dimensional model voxelization device 100 is that the node state of each leaf node is predetermined or the size of the subspace of the target child node is smaller than a preset size.

[0079] This invention also provides a block diagram of an electronic device 10, which implements the three-dimensional model voxelization method of the aforementioned embodiments. Please refer to... Figure 4 , Figure 4 This is a block diagram of the electronic device 10 provided in this embodiment. The electronic device 10 includes a processor 11, a memory 12 and a bus 13. The processor 11 and the memory 12 are connected through the bus 13.

[0080] Processor 11 can be an integrated circuit chip with signal processing capabilities. In implementation, each step of the three-dimensional model voxelization method described in the above embodiments can be completed by the integrated logic circuits in the hardware of processor 11 or by software instructions. The processor 11 can be a general-purpose processor, including a CPU (Central Processing Unit), NP (Network Processor), etc.; it can also be a DSP (Digital Signal Processor), ASIC (Application Specific Integrated Circuit), FPGA (Field Programmable Logic Gate Array), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0081] The memory 12 is used to store the program for implementing the voxelization method of the three-dimensional model. The program can be a software function module stored in the memory 12 in the form of software or firmware or embedded in the OS (Operating System) of the electronic device 10.

[0082] After receiving the execution instruction, the processor 11 executes the program to implement the three-dimensional model voxelization method in this embodiment.

[0083] This embodiment provides a computer storage medium on which a computer program is stored. When the computer program is executed by a processor, it implements the three-dimensional model voxelization method as described in this embodiment.

[0084] In summary, the embodiments of the present invention provide a method, apparatus, electronic device, and computer storage medium for voxelization of a three-dimensional model. The method includes: obtaining a spatial structure tree of the three-dimensional model to be voxelized, wherein the spatial structure tree includes nodes located at each layer, the space of the root node at the top layer corresponds to the bounding box of the three-dimensional model, the space of the child node of any parent-child node pair is obtained by dividing the space of the parent node whose node state is undetermined according to a preset granularity, and the node state characterizes the positional relationship between the space of the node and the three-dimensional model; quantifying the positional relationship between the space of each target leaf node whose node state is undetermined and the three-dimensional model to obtain a signed distance value of each target leaf node; determining the signed distance values ​​of the leaf nodes whose node states are determined in the spatial structure tree layer by layer based on the signed distance values ​​of each target leaf node; and reconstructing the voxel surface of the three-dimensional model according to the signed distance values ​​of all leaf nodes to obtain a three-dimensional voxel model of the three-dimensional model. Compared with the prior art, this embodiment has at least the following advantages: (1) By dividing the space of the parent node whose node state is uncertain in the spatial structure tree according to the preset granularity, the traversal of the entire three-dimensional model space is avoided, which significantly reduces the amount of computation and memory usage. By using the signed distance value of the target leaf node whose node state is uncertain, the signed distance value of the leaf node whose node state is certain in the spatial structure tree is determined layer by layer, which reduces the global redundant computation and ultimately improves the voxelization efficiency; (2) By using depth projection of different resolutions at different octree levels, the spatial range is quickly pruned at multiple levels, which significantly reduces the number of invalid nodes; (3) By using depth maps of multiple preset directions, the spatial division of the bounding box of the three-dimensional model is reduced. Combined with the sparse octree recursive structure and the hierarchical JFA propagation mechanism, the high parallelism and fast convergence of the entire voxelization process are achieved. Experimental results show that this embodiment can reduce the complexity from O(N³) to O(NlogN); (4) If the SDF difference between nodes in the same layer is lower than the set threshold, the refinement and propagation will stop automatically, thereby saving computation and preventing artifacts; (5) SDF calculation and storage are performed only on the boundary nodes that intersect with the 3D model and their neighborhoods, which significantly reduces memory usage and is suitable for GPU real-time processing; (6) The spatial structure tree is constructed using an octree, and the hierarchical structure based on the octree naturally supports dynamic loading and parallel computation; even when the geometric topology of the 3D model is complex or the scale span is large, high-quality voxel representations can still be generated stably; (7) By combining local triangle distance sampling with hierarchical propagation mechanism, the error and artifacts caused by global propagation of JFA are effectively reduced, ensuring SDF continuity and surface consistency, and the global redundant computation is reduced by propagating the distance field in the leaf nodes that need to determine the signed distance value in each layer; (8) It can be applied to various scenarios such as real-time modeling, terrain editing, physical fragmentation, and 3D printing preprocessing, and has high engineering practical value.

[0085] The above descriptions are merely various embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A method for voxelizing a three-dimensional model, characterized in that, The method includes: Obtain the spatial structure tree of the three-dimensional model to be voxelized. The spatial structure tree includes nodes located in each layer. The space of the root node at the top layer corresponds to the bounding box of the three-dimensional model. The space of the child node of any parent-child node pair is obtained by dividing the space of the parent node whose node state is undetermined according to a preset granularity. The node state represents the positional relationship between the space of the node and the three-dimensional model. The spatial relationship between each target leaf node whose node state is undetermined and the three-dimensional model is quantified to obtain the signed distance value of each target leaf node; Based on the signed distance value of each target leaf node, the signed distance values ​​of the leaf nodes with a fixed node state in the spatial structure tree are determined layer by layer. Based on the signed distance values ​​of all the leaf nodes, the voxel surface of the 3D model is reconstructed to obtain the 3D voxel model of the 3D model.

2. The method according to claim 1, characterized in that, The surface of the 3D model includes multiple geometric facets of preset shapes. The step of quantifying the spatial positional relationship between each target leaf node with an undetermined node state and the 3D model to obtain the signed distance value of each target leaf node includes: For any target leaf node's target space, obtain the target facets that intersect with the target space from among the multiple geometric facets; Calculate the distance between the target space and the target surface; The direction is determined based on the positional relationship between the target space and the target surface; Based on the distance and the direction, determine the signed distance value of the target leaf node corresponding to the target space.

3. The method according to claim 1, characterized in that, The step of determining the signed distance value of the leaf node with a predetermined state in the spatial structure tree layer by layer based on the signed distance value of each target leaf node includes: The bottom layer containing the target leaf nodes is taken as the current layer, and the signed distance value of each target leaf node in the current layer is taken as the seed point. Update the signed distance values ​​of the remaining nodes in the current layer based on the seed point of the current layer; Based on the signed distance values ​​of all nodes in the current layer, determine the seed point of the next layer above the current layer; The previous layer of the current layer is taken as the current layer again, and the step of updating the signed distance value of the remaining nodes of the current layer according to the seed point of the current layer is repeated until the signed distance value of the leaf nodes with the state of all nodes is determined.

4. The method according to claim 1, characterized in that, The step of obtaining the spatial structure tree of the 3D model to be voxelized includes: Set the root node as the current node and the bounding box of the 3D model as the current space; The current space is divided according to the preset granularity to obtain multiple subspaces; Create a node for each of the subspaces described; Each node in the subspace is treated as a child node of the current node, and a parent-child relationship is established between the current node and each node in the subspace. If there is a target child node with an undetermined state among the child nodes of the current node, the subspace of each target child node is taken as the current space one by one, and the step of dividing the current space according to the preset granularity is repeated until the preset condition is met to obtain the space structure tree.

5. The method according to claim 4, characterized in that, Before the step of dividing the current space according to the preset granularity and repeating the step of dividing the current space according to the preset granularity until the preset condition is met to obtain the space structure tree, if there is a target child node with an undetermined state among the child nodes of the current node, the following steps are included: For any undetermined child node of the current node, determine the positional relationship between the subspace of the undetermined child node and the three-dimensional model; If the positional relationship indicates that the subspace of the undetermined child node is outside the three-dimensional model, or indicates that the subspace of the undetermined child node is inside the three-dimensional model, then the node state of the undetermined child node is determined to be determined; otherwise, the node state of the undetermined child node is determined to be undetermined.

6. The method according to claim 5, characterized in that, The step of determining the positional relationship between the subspace of the undetermined child node and the 3D model includes: The 3D model is projected and rendered along each of the multiple preset directions to obtain a depth map for each preset direction; If the three-dimensional coordinates of each corner point of the subspace of the undetermined sub-node in the world coordinate system are all within the depth value range of the depth map of the corresponding preset direction, then it is determined that the subspace of the undetermined sub-node is located within the three-dimensional model. If the three-dimensional coordinates of each corner point of the subspace of the undetermined child node in the world coordinate system are all outside the depth value range of the depth map in the corresponding preset direction, then it is determined that the subspace of the undetermined child node is outside the three-dimensional model.

7. The method according to claim 4, characterized in that, The preset conditions are that the node state of each leaf node is fixed or the size of the subspace of the target child node is smaller than the preset size.

8. A three-dimensional model voxelization device, characterized in that, The device includes: The acquisition module is used to acquire the spatial structure tree of the three-dimensional model to be voxelized. The spatial structure tree includes nodes located in each layer. The space of the root node at the top layer corresponds to the bounding box of the three-dimensional model. The space of the child node of any parent-child node pair is obtained by dividing the space of the parent node whose node state is undetermined according to a preset granularity. The node state represents the positional relationship between the space of the node and the three-dimensional model. The quantization module is used to quantize the spatial relationship between each target leaf node whose node state is undetermined and the three-dimensional model, and obtain the signed distance value of each target leaf node. The determination module is used to determine, layer by layer, the signed distance values ​​of the leaf nodes in the spatial structure tree whose node states are determined, based on the signed distance values ​​of each target leaf node. The reconstruction module is used to reconstruct the voxel surface of the three-dimensional model based on the signed distance values ​​of all the leaf nodes, so as to obtain the three-dimensional voxel model of the three-dimensional model.

9. An electronic device, characterized in that, It includes a processor and a memory, the memory being used to store a program, and the processor being used to implement the three-dimensional model voxelization method as described in any one of claims 1-7 when executing the program.

10. A computer storage medium, characterized in that, It stores a computer program that, when executed by a processor, implements the three-dimensional model voxelization method as described in any one of claims 1-7.