An Adaptive Sampling Method and Device for Distance Field Based on Non-uniform Grid

Through the distance field adaptive sampling method based on non-uniform grid, the sampling point distribution is optimized using the radius of curvature and the partially directed results of the analytical expression, which solves the problems of low sampling efficiency and redundancy in the prior art, and achieves faster convergence and more efficient large-scene distance field construction.

CN117315151BActive Publication Date: 2025-07-18ZHEJIANG UNIV +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202311260863.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-27
Publication Date
2025-07-18
Estimated Expiration
2043-09-27

AI Technical Summary

Technical Problem

In the adaptive sampling of distance field, the existing technology has problems such as slow subdivision convergence speed, obvious redundant sampling, single subdivision mechanism and complex parameter adjustment in distance field, and it has failed to effectively support the construction of distance field in large scenarios.

Method used

The distance field adaptive sampling method based on non-uniform grid is adopted. By generating an initial non-uniform network, the first round of subdivided sampling is guided by using the radius of curvature, and the second round of subdivided sampling is performed if necessary. The subdivided plane is determined based on the partial derivation results of the analytical expression, and the sampling point distribution is optimized.

Benefits of technology

It realizes faster convergence speed, less redundant sampling and simpler parameter adjustment, and the sampling results are closer to global optimality, supporting efficient distance field construction in large scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117315151B_ABST
    Figure CN117315151B_ABST
Patent Text Reader

Abstract

The present invention discloses a distance field adaptive sampling method and device based on non-uniform grids, including: generating an initial non-uniform network for each three-dimensional model to obtain a three-dimensional grid model, and using an octree to manage the data of the three-dimensional grid model; calculating the curvature radii of the vertices of the three-dimensional grid model, and guiding the leaf nodes of the octree to perform the first-round subdivision sampling according to the minimum curvature radius; on the basis of the first-round subdivision sampling, when the deviation of the leaf nodes is higher than the first threshold or the number of corner points of each leaf node is less than the second threshold, screening the leaf nodes with large deviations for the second-round subdivision sampling. During the second-round subdivision sampling, fitting the analytical expression of the implicit function of the leaf node distance field, and determining the subdivision surface and performing subdivision sampling according to the partial derivative results of the analytical expression. This method and device have a faster convergence speed, less redundant sampling, and less manual parameter adjustment. At the same time, by combining multiple subdivision mechanisms, the sampling results are more biased towards the global optimum.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of real-time rendering in computer graphics, and particularly relates to a method and device for adaptive sampling of distance fields based on non-uniform grids. Background Art

[0002] In recent years, with the improvement of hardware level, the real-time rendering ability of computers for virtual worlds has been greatly enhanced compared with the past, and more and more real-time interactions of real and complex simulation calculations are becoming a reality. However, the computing and storage capabilities of computers are ultimately limited at this stage. In order to stack as many types of simulation calculations as possible to obtain a better sense of interactive reality, many simulation calculations still need to reduce their own real-time overhead as much as possible to make time for other types of simulation calculations. For example, in shadow calculation, ambient occlusion calculation, and object collision detection, the time complexity of each algorithm can be decoupled from the scene complexity (the number of triangular patches) by pre-sampling the model grid data at the closest distance and converting it into a signed distance field, and then turning to the signed distance field with smaller and more controllable complexity, greatly reducing the real-time overhead of the algorithm. Essentially, these practices are all about calculating offline as much as possible the reusable part of the computational tasks in the algorithm to avoid repeated calculations during real-time rendering. Further speaking, they are all sampling a certain scalar field (distance field) in three-dimensional space and reconstructing the scalar field through resampling during real-time rendering.

[0003] Regarding sampling, there is a key issue, that is, the distribution of sampling points. The most traditional approach is to evenly distribute the sampling points in space, like a neat dot matrix. However, the drawback of this approach is that its complexity is the cube of N. As the sampling density increases, it will bring exponential growth pressure to storage and computing resources.

[0004] Therefore, more accurate and efficient non-uniform and adaptive sampling of the distance field has become a research hotspot in the field of distance fields. A large part of this work is based on sparse octrees, and the leaf node lattice points on them are used as the final adaptive sampling points for the distance field. Sarah F. Frisken, Ronald N. Perry et al. proposed an adaptive sampling method for the distance field based on distance deviation. Generally speaking, first sample the distance field on the node lattice points, and according to the selected test point set within the node, compare and analyze the deviation between the lattice point distance interpolation result and the real sampling result to determine whether to continue subdivision. H. Samet et al. proposed the "three-color" distance field sampling method. By classifying the octree leaf nodes into three categories: "outside the model surface", "on the model surface", and "inside the model surface", only the leaf nodes in the "on the model surface" category are further subdivided. F. Calakli, G. Taubin et al. proposed to use the vertex density of the model to determine whether to subdivide the leaf nodes. Specifically, judge according to the number of model vertices contained in the leaf node. If it is higher than the preset threshold, it is considered that the model vertices inside are still dense and continue to subdivide; otherwise, stop subdividing. Dan Koschier, Crispin Deul et al. first fit the distance field within each leaf node with a p-degree polynomial, and then compare and analyze the deviation from the fitting result of the (p - 1)-degree polynomial to determine whether to continue subdividing the leaf nodes.

[0005] Although the above methods achieve the purpose of higher-precision and more efficient adaptive sampling to a certain extent, they all have more or less problems such as insufficiently fast subdivision convergence speed, obvious over-subdivision resulting in redundant waste of time and space overhead, single subdivision mechanism making sampling more likely to fall into local optimum, and relatively high requirements for tuning experience for preset parameters. More critically, these methods only focus on the construction of the distance field on a single model and do not consider the construction of the scene distance field in a large scene. Summary of the Invention

[0006] In view of the above, the purpose of the present invention is to provide a non-uniform grid-based adaptive sampling method for the distance field, which has a faster convergence speed, less redundant sampling, and simpler manual tuning. At the same time, by combining multiple subdivision mechanisms, the sampling result is more biased towards the global optimum. In addition, it also provides efficient construction support for the large-scene distance field.

[0007] To achieve the above invention purpose, a non-uniform grid-based adaptive sampling method for the distance field provided by the present invention includes the following steps:

[0008] Generate an initial non-uniform network for each three-dimensional model to obtain a three-dimensional grid model, and use an octree to manage the data of the three-dimensional grid model;

[0009] Calculate the curvature radius of each vertex of the three-dimensional grid model, and guide the leaf nodes of the octree to perform the first-round subdivision sampling based on the minimum curvature radius;

[0010] On the basis of the first-round subdivision sampling, when the deviation of the leaf node is higher than the first threshold or the number of corner points of each leaf node is less than the second threshold, screen the leaf nodes with large deviations for the second-round subdivision sampling. During the second-round subdivision sampling, fit the analytical expression of the implicit function of the leaf node distance field, and determine the subdivision surface and perform subdivision sampling according to the partial derivative results of the analytical expression.

[0011] Preferably, the guiding of the first-round subdivision sampling of the three-dimensional grid model based on the minimum curvature radius includes:

[0012] Statistically calculate the minimum curvature radius of the vertices included in each leaf node in the octree corresponding to the three-dimensional grid model. When the self-size of the leaf node is greater than half of the minimum curvature radius, perform the first-round subdivision sampling on the leaf node, otherwise stop the subdivision.

[0013] Preferably, the process of defining the leaf node deviation is as follows: At the midpoints of the twelve edges, the centers of the six faces, and the center of the leaf node, perform trilinear interpolation based on the distances of the eight vertices, and take the average difference between the interpolation result and the true distance sampling result as the leaf node deviation.

[0014] Preferably, determining the position of the subdivision surface and performing subdivision sampling according to the partial derivative results of the analytical expression includes:

[0015] For each leaf node, in each subdivision axis direction, evenly divide the leaf node range into N segments along the direction perpendicular to the subdivision axis to obtain N - 1 cutting surfaces. For each cutting surface, uniformly select N points on it to calculate the first-order partial derivative of the analytical expression of the implicit function of the distance field, obtain the change rate of the distance implicit function at each point, and take the average value of the change rates of all points as the average distance change rate of each cutting surface. Calculate the average distance change rates of the left and right parts of the leaf node range cut by each cutting surface along the subdivision axis direction, and screen the cutting surface corresponding to the largest difference between the average distance change rates of the left and right parts as the actual subdivision surface.

[0016] Preferably, the calculation of the average distance change rates of the left and right parts of the leaf node range cut by each cutting surface along the subdivision axis includes:

[0017] For the current cutting surface with the serial number m, the average distance change rate of its left part is equal to the average value of the average distance change rates of the cutting surfaces with serial numbers 1 to m - 1, and the average distance change rate of its right part is equal to the average value of the average distance change rates of the cutting surfaces with serial numbers m + 1 to N - 1.

[0018] Preferably, the method further includes: after the subdivision sampling is completed, sampling is recycled as needed and the storage space is compressed, wherein recycling sampling as needed includes:

[0019] Starting from the maximum depth of the octree corresponding to the three-dimensional grid model, progressing upward by n levels depth by depth, and merging all leaf nodes with exactly the current progression depth at each progression to achieve recycling sampling;

[0020] Or, starting from the maximum depth of the octree corresponding to the three-dimensional grid model, progressing upward by n levels depth by depth. At each progression, only merge the leaf nodes with exactly the current progression depth and belonging to perfect octree subtrees in the original octree, and skip the leaf nodes belonging to the original non-perfect octree subtrees without merging.

[0021] Preferably, recycling sampling as needed includes:

[0022] Determine that some vertices in the three-dimensional grid model are the subdivision key set. Starting from the maximum depth of the octree, for any leaf node with the maximum depth, calculate the distance set from the vertex p of the leaf node to the K closest subdivision keys to this vertex P, and calculate the weighted average of the distance set of vertex P to obtain the final distance D(P) of the leaf node. When the final distance of any vertex on the leaf node does not satisfy D(P) < (H / 2 L ), then recycle and cancel this leaf node, where H is the diagonal length of the scene bounding box and L is the depth of the leaf node.

[0023] Preferably, the method further includes: constructing a global distance sampling field of the world space from bottom to top according to the spatial distance sampling fields of each three-dimensional grid model, specifically including:

[0024] Divide the scene into an initial grid set of a certain granularity size;

[0025] Taking a subset of grids composed of multiple grids as a unit, sample the model distance field in the scene and allocate storage space at each grid point of the subset of grids. When sampling, solve the distance from each grid point Q to all model instances. For each model instance, if it is determined that the grid point Q is outside the instance bounding box, then solve the closest distance from the grid point P to the instance bounding box. If it is determined that the grid point Q is inside the instance bounding box, then resample the local distance field of the three-dimensional model corresponding to the instance. Based on this, the closest distance sampling value from the grid point Q to the scene is the minimum value from the grid point P to all model instances. After sampling, detect whether the deviation e between the respective distance sampling values of all inner grid points and the interpolation of all outermost grid points in the subset of grids satisfies e < d*s. When it is satisfied, merge the subset of grids into a large grid, where d is the diagonal length of the scene bounding box and s is the scaling ratio.

[0026] To achieve the above-mentioned invention object, the embodiment further provides a distance field adaptive sampling device based on a non-uniform grid, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the above-mentioned distance field adaptive sampling method based on a non-uniform grid is implemented.

[0027] To achieve the above-mentioned invention object, the present invention further provides an image rendering method, including the following steps:

[0028] Perform adaptive sampling of the distance field by using the above-mentioned distance field adaptive sampling method based on a non-uniform grid;

[0029] Perform image rendering based on the adaptive sampling result.

[0030] Compared with the prior art, the beneficial effects of the present invention at least include:

[0031] Guided by the curvature radius of each vertex, the first-round subdivision sampling is carried out. On the basis of the first-round subdivision sampling, when the leaf node deviation is higher than the first threshold or the number of corner points of each leaf node is less than the second threshold, the leaf nodes with deviation higher than the first threshold are selected for the second-round subdivision sampling. And during the second-round subdivision sampling, the analytical expression of the implicit function of the leaf node distance field is fitted, and the subdivision surface is determined and the subdivision sampling is carried out according to the partial derivative result of the analytical expression. In this way, higher sampling efficiency, better reconstruction quality can be achieved for the distance field, and the local distance field of the model and the global distance field of the scene can be jointly considered, making it possible to use a more refined local distance field in the case of high-precision requirements (such as for nearby objects) and a more efficient global distance field in the case of low-precision requirements (such as for distant objects), which is a new application method of the distance field. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0033] Figure 1 is the flowchart of the distance field adaptive sampling method based on a non-uniform grid provided by the embodiment;

[0034] Figure 2 is another flowchart of the distance field adaptive sampling method based on a non-uniform grid provided by the embodiment;

[0035] Figure 3 is the flowchart of an image rendering method provided by the embodiment. Specific Embodiments

[0036] To make the objectives, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and do not limit the protection scope of the present invention.

[0037] The inventive concept of the present invention is: to solve the technical problems of low efficiency and high spatio-temporal overhead in the existing uniform sampling method for distance fields, the embodiments of the present invention provide a distance field adaptive sampling method based on non-uniform grids, which combines heuristic rules and mathematical statistics rules to achieve the purpose of adaptively sampling the distance field in a targeted, efficient and spatio-temporal overhead-friendly manner.

[0038] As Figure 1 shown, the distance field adaptive sampling method based on non-uniform grids provided by the embodiment includes the following steps:

[0039] S1. Generate an initial non-uniform network for each three-dimensional model to obtain a three-dimensional grid model, and use an octree to manage the data of the three-dimensional grid model.

[0040] In the embodiment, the bounding box of the object three-dimensional model is selected as the construction range of the non-uniform grid, and the local distance field of the non-uniform grid is constructed within the construction range to obtain a three-dimensional grid model. An octree is used as the implemented data structure. When creating, the initial depth is customarily set to k, where k can be arbitrarily selected but is usually 1, that is, initially there are only eight leaf nodes, and each leaf node corresponds to a part of the three-dimensional grid model. The corner points of this part are used as the corner points of the leaf node, and each leaf node contains multiple grids. The hierarchical structure attribute of the octree enables the adaptive sampling of the distance field to have a multi-level smooth LOD transition.

[0041] S2. Calculate the curvature radius of each vertex of the three-dimensional grid model, and guide the first-round subdivision sampling of the leaf nodes of the octree based on the minimum curvature radius.

[0042] For the model, areas with rich details require a higher sampling frequency, and areas with rich model details often have a larger curvature. However, whether the details are rich or not is a subjective result observed by the human eye and is difficult to be used as a guide for mesh subdivision. Therefore, in this embodiment, the positive correlation between the model detail abundance and the curvature magnitude is utilized to further subdivide the octree based on the curvature magnitude at each location of the model. Specifically, first, the curvature of the vertices contained in each leaf node of the octree corresponding to the three-dimensional mesh model is calculated. This process can refer to the article Rusinkiewicz, Szymon. "Estimating curvatures and their derivatives on triangle meshes." Proceedings. 2nd International Symposium on 3D Data Processing, Visualization and Transmission, 2004. 3DPVT 2004.. IEEE, 2004.. Then, take the reciprocal of the curvature radius as the curvature radius. For leaf node O, the minimum curvature radius r of the vertices contained in each leaf node O is statistically calculated. When the self-size of leaf node O is greater than half of the minimum curvature radius, the first-round subdivision sampling is performed on leaf node O; otherwise, the subdivision is stopped. Among them, the self-size of leaf node O is the longest diameter of the spatial shape corresponding to the page node. For example, when the spatial shape corresponding to the leaf node is a cube, the self-size of leaf node O is the diagonal length of the cube. The specific subdivision process can refer to the article Tang, Yizhi, and Jieqing Feng. "Multi-scale surface reconstruction based on a curvature-adaptive signed distance field." Computers & Graphics 70(2018):28-38.

[0043] S3. On the basis of the first-round subdivision sampling, when the leaf node deviation is higher than the first threshold or the number of corner points of each leaf node is less than the second threshold, the leaf nodes with large deviations are screened for the second-round subdivision sampling. During the second-round subdivision sampling, the analytical expression of the implicit function of the leaf node distance field is fitted, and the subdivision surface is determined and the subdivision sampling is performed according to the partial derivative result of the analytical expression.

[0044] In the embodiment, for the purpose of controlling the scale of sampling points and thus controlling the spatio-temporal overhead, the termination exit condition for the second-round subdivision needs to be specified. In the embodiment, the process of defining the leaf node deviation is as follows: at the midpoints of the twelve edges, the centers of the six faces, and the center of the leaf node, trilinear interpolation is performed based on the distances of the eight vertices, and the average difference between the interpolation result and the true distance sampling result is used as the leaf node deviation. If the largest leaf node deviation in the leaf node set is less than or equal to the first threshold, it is considered that anywhere in the model space, interpolation of the lattice sampling result can already obtain a result close enough to the true value, and the second-round subdivision sampling is exited. Otherwise, when the leaf node deviation is higher than the first threshold, the second-round subdivision sampling is performed. Among them, the first threshold can be set to any ratio of the size of the model bounding box. For example, one-thousandth of the bounding box size is taken.

[0045] Or if, although there is still a great need for further subdivision of the current leaf node list, the required storage space has reached the preset upper limit of the distance field of a single model, that is, the number of corner points of each leaf node is greater than or equal to the second threshold, then the remaining leaf nodes are also stopped from being further subdivided, and the second-round subdivision sampling is exited. Otherwise, when the number of corner points of each leaf node is less than the second threshold, the second-round subdivision sampling is performed.

[0046] The second-round subdivision sampling is to check and make up for the deficiencies of the first-round subdivision sampling. As Figure 2 shown, the second-round subdivision sampling is an iterative process. A priority queue is constructed according to the leaf node deviation from large to small. Each time, the leaf node with the largest leaf node deviation is dequeued for subdivision, and the child leaf nodes are enqueued. After each round of iteration, it is judged whether the current leaf node deviation is higher than the first threshold or the number of corner points of each leaf node is less than the second threshold. When it is not satisfied, the iteration ends. The reason for subdivision based on deviation is that if the deviation between the linear interpolation result and the true result is larger, the more valuable the subdivision is. On the contrary, if the deviation is extremely small, it is very likely that the linear interpolation can already well fit the distance field near the leaf node o, and the benefit of further subdivision is extremely low.

[0047] In the embodiment, in order to accelerate the convergence rate of the interpolation deviation, the present invention innovatively proposes a non-uniform cutting plane mechanism. In the usual node subdivision method, subdivision is performed at the center of each dimension of the node. In the non-uniform cutting plane mechanism, an orthogonal basis function set is used to fit the distance field within the leaf node range to obtain an approximate analytical form of the distance field implicit function. For each leaf node, the leaf node range is evenly divided into N (for example, N is taken as 16) segments along each subdivision axis to obtain N-1 cutting planes. For each cutting plane, N points are uniformly selected on it to calculate the first-order partial derivative of the analytical expression of the distance field implicit function, and the change rate of the distance implicit function at each point is obtained. The average value of the change rates of all points is used as the average distance change rate of each cutting plane. Subsequently, for each cutting plane, calculate the average distance change rates of the left and right parts of the leaf node range divided by the cutting plane along the subdivision axis direction, and select the cutting plane corresponding to the largest difference between the average distance change rates of the left and right parts as the actual subdivision plane.

[0048] In the embodiment, calculating the average distance change rates of the left and right parts of the leaf node range divided by each cutting plane along the subdivision axis includes: for the current cutting plane with the serial number m, the average distance change rate of its left part is equal to the average value of the average distance change rates of the cutting planes with the serial numbers from 1 to m-1, and the average distance change rate of its right part is equal to the average value of the average distance change rates of the cutting planes with the serial numbers from m+1 to N-1.

[0049] In the embodiment, the subdivision axes can be 3, namely X, Y, and Z. For each subdivision axis, the above process is adopted. Then, the subdivision planes that need to be subdivided and sampled are determined on each subdivision axis. In this way, the cutting method of each leaf node in one subdivision axis dimension is extended from only cutting in the middle to being able to cut along one of the N-1 equally spaced cutting planes. Essentially, the non-uniform subdivision plane divides the node range into two parts with a more gentle and a more drastic change in the distance field by means of the analytical fitting expression of the local distance field for node subdivision. In this way, the more gentle part can reach the deviation convergence faster than the original two-two equal cutting mechanism and stop subdivision as early as possible, while the more drastic part can get more subdivision opportunities, ultimately accelerating the convergence rate of the entire non-uniform grid at the level of the node cutting method.

[0050] S4. After the subdivision sampling is completed, recycle the sampling as needed and compress the storage space.

[0051] In the embodiment, if it is desired to compress the storage space occupied by the final sampling result of the three-dimensional grid model, after the subdivision sampling is completed, the sampling is also recycled as needed and the storage space is compressed. The embodiment provides three ways to recycle the sampling quantity, so as to achieve the purpose of compressing the storage space.

[0052] The first recycling method is as follows: starting from the maximum depth d of the octree corresponding to the three-dimensional grid model, progressing upward by depth for n times. Each time, all leaf nodes with exactly the current progressive depth are merged to achieve recycling sampling. This method has the greatest spatial recycling intensity, and n is a user-specified setting.

[0053] The second recycling method is as follows: starting from the maximum depth d of the octree corresponding to the three-dimensional grid model, only the leaf nodes that originally belonged to perfect octree subtrees and have a depth of d are merged, and the leaf nodes that belong to the non-perfect octree subtrees with a depth of d are skipped without merging. This method is relatively conservative. Although the recycling intensity decreases, it maximally retains the original sparse structure of the original octree, thus better retaining the sampling quality.

[0054] The third recycling method is based on the sampling recycling mechanism of the subdivision key set, specifically including: if the user manually specifies an important part of the model, which is non-compromisable in spatial recycling, then the vertices of this important part are defined as the subdivision key set. Based on the determined subdivision key set, starting from the maximum depth d of the octree, for any leaf node with a depth of d, calculate the distance set from the vertex p of the leaf node to the K nearest subdivision keys to this vertex P, and obtain the final distance D(P) of the leaf node by taking the weighted average of the distance set of vertex P. When the final distance of any vertex on the leaf node does not satisfy D(P) < (H / 2 L ), then the leaf node is recycled and cancelled, where H is the diagonal length of the scene bounding box and L is the depth of the leaf node. This method will maximally retain the important parts of the model specified by the user during the recycling process.

[0055] The case of the user-specified important area cited in this embodiment can also be extended to other situations. For example, the important parts of the model can be automatically specified through some heuristic algorithms, and the subdivision key set can be automatically generated based on the important parts as the input of the third recycling method.

[0056] S5. According to the spatial distance sampling fields of each three-dimensional grid model, construct the global distance sampling field of the world space from bottom to top.

[0057] Distance field adaptive sampling can be applied to both the local model space and extended to the global world space. For a scene with a small number of model instances, it is sufficient to construct the local distance field of the model space according to the above steps. However, for a large scene with a huge number of model instances, traversing all local distance fields on the GPU for resampling will incur a significant time overhead. The global distance field is thus born. It transforms the resampling of traversing all local distance fields of all instances into only resampling a single global distance field, greatly reducing the resampling time overhead. Among them, reducing the number of accesses to video memory is particularly crucial. To obtain a high-quality global distance field in a large scene, a practical choice is to rely on non-uniform sampling because uniform sampling will bring unacceptable storage overhead.

[0058] In the embodiment, first, the scene is divided into an initial grid set with a certain granularity. For example, taking a large scene with a length, width, and height of 10 km, 10 km, and 1 km respectively and containing 10,000 model instances as an example, first conceptually (without actually allocating storage space), the scene is divided into an initial grid set with a granularity of 0.25 m.

[0059] Taking a subset of grids composed of multiple grids as a unit, for example, taking a 2*2*2 grid subset as a unit, sample the model distance field in the scene and allocate storage space at each grid point of the grid subset (for example, a total of 27 grid points). When sampling, solve the distance from each grid point Q to all model instances. For each model instance, if the grid point Q is outside the instance bounding box, then solve the nearest distance from the grid point P to the instance bounding box. If the grid point Q is inside the instance bounding box, then resample the local distance field of the corresponding 3D model of the instance. Based on this, the nearest distance sampling value from the grid point Q to the scene is the minimum value from the grid point P to all model instances. After sampling, detect whether the deviation e between the respective distance sampling values at all inner grid points (for example, 19 inner grid points) of the grid subset and the interpolation of all outermost grid points (for example, 8 outer grid points) satisfies e < d*s, where d is the diagonal length of the scene bounding box and s is the scaling ratio with a value range of (0, 1]. The smaller the value, the higher the accuracy of the finally generated global distance field and the greater the corresponding storage overhead.

[0060] S5 is an iterative process. After merging the grid subset into a large grid, seek opportunities to continue merging with adjacent grid subsets, and the entire process is iteratively carried out from high to low along the tree height.

[0061] Based on the same inventive concept, the embodiment also provides a distance field adaptive sampling device based on a non-uniform grid, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the above-mentioned distance field adaptive sampling method based on a non-uniform grid, including the following steps:

[0062] S1, generate an initial non-uniform network for each 3D model to obtain a 3D grid model, and use an octree to manage the data of the 3D grid model;

[0063] S2, calculate the curvature radius of each vertex of the 3D grid model, and guide the leaf nodes of the octree to perform the first round of subdivision sampling according to the minimum curvature radius;

[0064] S3. On the basis of the first-round sub-sampling, when the deviation of a leaf node is higher than the first threshold or the number of corner points of each leaf node is less than the second threshold, select the leaf nodes with large deviations for the second-round sub-sampling. During the second-round sub-sampling, fit the analytical expression of the implicit function of the leaf node distance field, and determine the sub-division surface and perform sub-sampling according to the partial derivative results of the analytical expression;

[0065] S4. After the sub-sampling is completed, recycle the samples as needed and compress the storage space;

[0066] S5. According to the spatial distance sampling fields of each three-dimensional grid model, construct the global distance sampling field of the world space from bottom to top.

[0067] In practical applications, the computer memory can be a volatile memory near the end, such as RAM, or a non-volatile memory, such as ROM, FLASH, floppy disk, mechanical hard disk, etc., or a remote storage cloud. The computer processor can be a central processing unit (CPU), a microprocessor (MPU), a digital signal processor (DSP), or a field programmable gate array (FPGA), that is, the steps of adaptive sampling of the distance field based on the non-uniform grid can be implemented through these processors.

[0068] As Figure 3 shown, the embodiment also provides an image rendering method, including the following steps:

[0069] S210. Perform adaptive sampling of the distance field by using S110 - S150 in the above-mentioned adaptive sampling method of the distance field based on the non-uniform grid;

[0070] S220. Perform image rendering based on the adaptive sampling results.

[0071] For the image rendering method provided by the embodiment, by using the adaptive sampling method of the distance field based on the non-uniform grid, the obtained sampling results are more biased towards the global optimum, and the image quality rendered based on the sampling results is higher.

[0072] The above specific embodiments have detailed the technical solutions and beneficial effects of the present invention. It should be understood that the above is only the most preferred embodiment of the present invention and is not used to limit the present invention. Any modifications, supplements, equivalent replacements, etc. made within the scope of the principles of the present invention should be included in the protection scope of the present invention.

Claims

1. An image rendering method based on adaptive sampling of distance fields on non-uniform grids, characterized in that, The method includes the following steps: Generate an initial non-uniform network for each 3D model in image rendering to obtain a 3D mesh model, and use an octree to manage the data of the 3D mesh model; Calculate the curvature radius of each vertex of the 3D mesh model, and guide the leaf nodes of the octree to perform the first round of subdivision sampling based on the minimum curvature radius; On the basis of the first round of subdivision sampling, when the deviation of the leaf node is higher than the first threshold or the number of corner points of each leaf node is less than the second threshold, screen the leaf nodes with large deviations for the second round of subdivision sampling. During the second round of subdivision sampling, fit the analytical expression of the implicit function of the leaf node distance field, and determine the subdivision surface and perform subdivision sampling according to the partial derivative results of the analytical expression. Specifically, for each leaf node, divide the leaf node range along each subdivision axis to obtain multiple cutting surfaces, calculate the average rate of change of the distance of each cutting surface and the average rate of change of the distance of the left and right parts after being cut according to the partial derivative results of the analytical expression corresponding to each cutting surface, and screen the cutting surface corresponding to the largest difference in the average rate of change of the distance of the left and right parts after being cut as the actual subdivision surface; Perform image rendering based on the adaptive sampling results.

2. The image rendering method based on adaptive sampling of distance field with non-uniform grid according to claim 1, wherein The first round of subdivision sampling of the 3D mesh model guided by the minimum curvature radius includes: Statistically calculate the minimum curvature radius of the vertices contained in each leaf node of the octree corresponding to the 3D mesh model. When the self-size of the leaf node is greater than half of the minimum curvature radius, perform the first round of subdivision sampling on the leaf node, otherwise stop subdivision.

3. The image rendering method based on distance field adaptive sampling of non-uniform grids according to claim 1, characterized in that, The process of defining the leaf node deviation is as follows: At the midpoints of the twelve edges, the centers of the six faces, and the center of the leaf node, perform trilinear interpolation based on the distances of the eight vertices, and take the average difference between the interpolation result and the actual distance sampling result as the leaf node deviation.

4. The image rendering method based on distance field adaptive sampling of non-uniform grids according to claim 1, wherein Determining the subdivision surface and performing subdivision sampling according to the partial derivative results of the analytical expression includes: For each leaf node, in each subdivision axis direction, evenly divide the leaf node range into N segments along the direction perpendicular to the subdivision axis to obtain N - 1 cutting surfaces. For each cutting surface, uniformly select N points on it to calculate the first-order partial derivative of the analytical expression of the implicit function of the distance field, obtain the rate of change of the distance implicit function at each point, and take the average value of the rates of change of all points as the average rate of change of the distance of each cutting surface. Calculate the average rate of change of the distance of the left and right parts of the leaf node range cut along the subdivision axis by each cutting surface, and screen the cutting surface corresponding to the largest difference in the average rate of change of the distance of the left and right parts as the actual subdivision surface.

5. The image rendering method based on distance field adaptive sampling of non-uniform grids according to claim 4, characterized in that Calculating the average rate of change of the distance of the left and right parts of the leaf node range cut along the subdivision axis by each cutting surface includes: For the current cutting surface with the serial number m, the average rate of change of the distance of its left part is equal to the average value of the average rates of change of the cutting surfaces with the serial numbers from 1 to m - 1, and the average rate of change of the distance of its right part is equal to the average value of the average rates of change of the cutting surfaces with the serial numbers from m + 1 to N - 1.

6. The image rendering method based on distance field adaptive sampling of non-uniform grids according to claim 1, characterized in that The method further includes: After the subdivision sampling is completed, recycle the sampling as needed and compress the storage space. Among them, recycling the sampling as needed includes: Starting from the maximum depth of the octree corresponding to the three-dimensional grid model, progress upwards by depth for n times. Each time, merge all leaf nodes with exactly the current progressive depth to achieve recycling sampling. Or, starting from the maximum depth of the octree corresponding to the three-dimensional grid model, progress upwards by depth for n times. Each time, only merge the leaf nodes with exactly the current progressive depth and belonging to perfect octree subtrees in the original octree, and skip the leaf nodes belonging to the original non-perfect octree subtrees without merging.

7. The image rendering method based on distance field adaptive sampling of non-uniform grids according to claim 1, characterized in that The on-demand recycling sampling includes: Determine that some vertices in the three-dimensional mesh model are the key subdivision set. Starting from the maximum depth of the octree, for any leaf node with the maximum depth, calculate the distance set from the vertex p of the leaf node to the K nearest key subdivision points to the vertex P. Calculate the weighted average of the distance set of the vertex P to obtain the final distance D(P) of the leaf node. When the final distance of no vertex on the leaf node satisfies D(P) < (H / 2 L ), then recycle and cancel the leaf node, where H is the length of the diagonal of the scene bounding box and L is the depth of the leaf node.

8. The image rendering method based on distance field adaptive sampling of non-uniform grids according to claim 1, wherein The method further includes: constructing a global distance sampling field of the world space from bottom to top according to the spatial distance sampling fields of each three-dimensional grid model, specifically including: Divide the scene into an initial grid set of a certain granularity size; Taking a subset of grids composed of multiple grids as a unit, sample the model distance field in the scene and allocate storage space at each grid point of the subset of grids. When sampling, solve the distance from each grid point Q to all model instances. For each model instance, if the grid point Q is outside the instance bounding box, then solve the closest distance from the grid point P to the instance bounding box. If the grid point Q is inside the instance bounding box, then resample the local distance field of the three-dimensional model corresponding to the instance. Based on this, the closest distance sampling value from the grid point Q to the scene is the minimum value of the grid point P to all model instances. After sampling, detect whether the deviation e between the respective distance sampling values of all inner grid points of the subset of grids and the interpolation of all outermost grid points satisfies e < d * s. When it is satisfied, merge the subset of grids into a large grid, where d is the diagonal length of the scene bounding box and s is the scaling ratio.

9. A scene rendering device based on adaptive sampling of distance fields on non-uniform grids, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the image rendering method of distance field adaptive sampling based on non-uniform grids according to any one of claims 1-8.

Citation Information

Patent Citations

  • Hybrid Adaptively Sampled Distance Fields

    US20130185028A1