A three-dimensional model rendering method, device, storage medium and electronic equipment

By determining the positional relationship between voxels and 3D models using directed distance functions and spread functions, efficient rendering of complex 3D models is achieved, solving the problem in existing technologies that cannot effectively handle implicit functions that cannot be constructed using traditional mathematical expressions.

CN119478194BActive Publication Date: 2026-02-17ZHEJIANG LAB
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510051293.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-13
Publication Date
2026-02-17
Estimated Expiration
2045-01-13

AI Technical Summary

Technical Problem

Existing technologies struggle to efficiently render 3D models with complex geometric transformations and topological changes, especially implicit functions that cannot be constructed using traditional mathematical expressions, such as implicit functions based on octrees or neural networks.

Method used

The positional relationship between each voxel and the 3D model in the rendering space is determined by using a directed distance function. The rendering space is divided into block spaces and the position of the voxel and the model is determined by using a directed distance calculation function. The rendering is then performed by calling different directed distance functions in combination with extended functions.

Benefits of technology

It achieves efficient rendering of any 3D model, including models that cannot be expressed using traditional mathematical formulas, and solves the problem of rendering complex free bodies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119478194B_ABST
    Figure CN119478194B_ABST
Patent Text Reader

Abstract

The specification discloses a three-dimensional model rendering method, device, storage medium and electronic equipment. In the three-dimensional model rendering method provided in the specification, a three-dimensional model to be rendered and a rendering space in which the three-dimensional model is located are acquired; a directed distance function is constructed according to the three-dimensional model; a position relationship between each voxel contained in the rendering space and the three-dimensional model is determined by using the directed distance function; and the three-dimensional model is rendered according to the position relationship of each voxel. The three-dimensional model rendering method provided in the specification can be used to render any three-dimensional model, the position relationship between each voxel and the three-dimensional model can be determined by using the directed distance function, and finally the rendering is completed according to the determined position relationship. The method can not only realize the rendering of a conventional three-dimensional model, but also realize the efficient rendering of a three-dimensional model that cannot be expressed by a traditional mathematical formula, and effectively solves the problem that a complex free body is difficult to render.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present specification relates to the technical field of computer technology, and particularly relates to a three-dimensional model rendering method and device, a storage medium and an electronic device. BACKGROUND

[0002] In the field of computer graphics, traditional three-dimensional (3-Dimensional, 3D) model representation methods mainly rely on explicit surfaces such as triangular meshes or NURBS surfaces. These methods are relatively efficient in handling simple geometries and regular topologies, but their limitations become particularly apparent when faced with complex geometric transformations, high-precision geometric operations, and complex topological changes. For example, these methods have difficulty accurately representing and processing 3D models with complex internal structures or irregular topologies.

[0003] Implicit surface rendering methods define shapes through mathematical functions, providing a more flexible and accurate geometric representation means. These methods can handle complex topological changes and represent 3D shapes in a more continuous and smooth manner. However, the efficiency and accuracy of implicit surface rendering methods are limited by algorithms, especially when dealing with complex mathematical expressions and performing efficient Boolean operations.

[0004] However, for implicit functions that cannot be constructed with traditional mathematical expressions, such as implicit functions constructed based on octrees or neural networks, existing technologies still cannot effectively handle them.

[0005] Therefore, how to implement simple and efficient rendering of three-dimensional models of any construction is a problem to be solved. SUMMARY

[0006] The present specification provides a three-dimensional model rendering method and device, a storage medium and an electronic device to at least partially solve the above problems existing in the prior art.

[0007] The present specification adopts the following technical solutions:

[0008] The present specification provides a three-dimensional model rendering method, comprising:

[0009] Obtaining a three-dimensional model to be rendered, and a rendering space in which the three-dimensional model is located;

[0010] Constructing a directed distance function according to the three-dimensional model;

[0011] Determining the positional relationship between each voxel contained in the rendering space and the three-dimensional model using the directed distance function;

[0012] Rendering the three-dimensional model according to the positional relationship of each voxel.

[0013] Optionally, the position relationship between each voxel contained in the rendering space and the three-dimensional model is determined by using the directed distance function, and specifically includes:

[0014] The rendering space is divided according to a preset rule to obtain a plurality of sub-block spaces;

[0015] For each sub-block space, the position relationship between the sub-block space and the three-dimensional model is determined by using the directed distance calculation function.

[0016] The position relationship between each voxel contained in the sub-block space and the three-dimensional model is determined according to the position relationship between the sub-block space and the three-dimensional model.

[0017] Optionally, the position relationship between each voxel contained in the sub-block space and the three-dimensional model is determined according to the position relationship between the sub-block space and the three-dimensional model, and specifically includes:

[0018] In response to the fact that the sub-block space is entirely inside the three-dimensional model, it is determined that each voxel contained in the sub-block space is inside the three-dimensional model.

[0019] In response to the fact that the sub-block space is entirely outside the three-dimensional model, it is determined that each voxel contained in the sub-block space is outside the three-dimensional model.

[0020] In response to the fact that the sub-block space is neither entirely inside the three-dimensional model nor entirely outside the three-dimensional model, it is determined that the position relationship between the sub-block space and the three-dimensional model is undetermined.

[0021] Optionally, after it is determined that the relationship between the sub-block space and the three-dimensional model is undetermined, the method further includes:

[0022] The sub-block space is continuously divided, and the position relationship between the divided space and the three-dimensional model is determined until the relationship between the divided space and the three-dimensional model is not undetermined or the divided space is a single voxel.

[0023] Optionally, the directed distance function at least includes a point directed distance calculation function, an interval directed distance calculation function, and a derivative calculation function.

[0024] Optionally, the position relationship between each voxel contained in the rendering space and the three-dimensional model is determined by using the directed distance function, and specifically includes:

[0025] The directed distance function is called by using a pre-constructed extension function to determine the position relationship between each voxel contained in the rendering space and the three-dimensional model, wherein the extension function is used to determine the directed distance function that needs to be called.

[0026] Optionally, a directed distance function is constructed according to the three-dimensional model, specifically comprising:

[0027] It is judged whether the contour of the three-dimensional model can be expressed by a mathematical formula;

[0028] In response to the contour of the three-dimensional model being unable to be expressed by a mathematical formula, a directed distance function is constructed according to the three-dimensional model;

[0029] The position relationship between each voxel contained in the rendering space and the three-dimensional model is determined by using the directed distance function, specifically comprising:

[0030] In response to the contour of the three-dimensional model being able to be expressed by a mathematical formula, the position relationship between each voxel contained in the rendering space and the three-dimensional model is determined according to the mathematical formula expressing the contour of the three-dimensional model;

[0031] In response to the contour of the three-dimensional model being unable to be expressed by a mathematical formula, the position relationship between each voxel contained in the rendering space and the three-dimensional model is determined by using the directed distance function.

[0032] The present specification provides a three-dimensional model rendering device, the device comprising:

[0033] An acquisition module is configured to acquire a three-dimensional model to be rendered and a rendering space in which the three-dimensional model is located;

[0034] A construction module is configured to construct a directed distance function according to the three-dimensional model;

[0035] A determination module is configured to determine the position relationship between each voxel contained in the rendering space and the three-dimensional model by using the directed distance function;

[0036] A rendering module is configured to render the voxels according to the position relationship.

[0037] The present specification provides a computer readable storage medium, the storage medium storing a computer program, the computer program being executed by a processor to implement the three-dimensional model rendering method.

[0038] The present specification provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, the processor implementing the three-dimensional model rendering method when executing the program.

[0039] The above at least one technical solution adopted by the present specification can achieve the following beneficial effects:

[0040] In the three-dimensional model rendering method provided in the specification, a three-dimensional model to be rendered and a rendering space in which the three-dimensional model is located are obtained; a directed distance function is constructed according to the three-dimensional model; the position relationship between each voxel contained in the rendering space and the three-dimensional model is determined by using the directed distance function; and the three-dimensional model is rendered according to the position relationship of each voxel.

[0041] When any three-dimensional model is rendered by using the three-dimensional model rendering method provided in the specification, the position relationship between each voxel and the three-dimensional model can be determined by using the directed distance function, and the rendering is finally completed according to the determined position relationship. By using the method, not only the rendering of a conventional three-dimensional model can be realized, but also the efficient rendering of a three-dimensional model that cannot be expressed by a traditional mathematical formula can be realized, and the problem that a complex free body is difficult to render is effectively solved. BRIEF DESCRIPTION OF DRAWINGS

[0042] The accompanying drawings, which are included to provide a further understanding of the specification, constitute a part of the specification, the illustrative embodiments of the specification and the description thereof serve to explain the specification, and do not constitute an improper limitation on the specification. In the drawings:

[0043] Figure 1 It is a flowchart of a three-dimensional model rendering method provided in the specification;

[0044] Figure 2 It is a code diagram of a feasible extension function provided in the specification;

[0045] Figure 3 It is a specific way diagram of determining the position relationship between a voxel and a three-dimensional model provided in the specification;

[0046] Figure 4 It is a characteristic diagram of an extension function provided in the specification when it is actually applied;

[0047] Figure 5 It is a diagram of an operation instruction tape provided in the specification;

[0048] Figure 6 It is a clause structure diagram of an extension function provided in the specification;

[0049] Figure 7 It is a process diagram of constructing an operation instruction tape provided in the specification;

[0050] Figure 8 It is a diagram of a large-scale array cell three-dimensional model provided in the specification;

[0051] Figure 9 It is a diagram of a three-dimensional model rendering device provided in the specification;

[0052] Figure 10 The electronic device schematic diagram corresponding to Figure 1 is provided in the present specification. DETAILED DESCRIPTION

[0053] For the purpose, technical solutions and advantages of the present specification, the technical solutions of the present specification will be described in detail below in combination with specific embodiments of the present specification and corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present specification, not all embodiments. Based on the embodiments in the present specification, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the scope of the present application.

[0054] The technical solutions provided by the embodiments of the present specification will be described in detail below in combination with the drawings.

[0055] Figure 1 The flowchart of the three-dimensional model rendering method in the present specification, specifically comprising the following steps:

[0056] S100: obtaining a three-dimensional model to be rendered, and a rendering space where the three-dimensional model is located.

[0057] All steps in the three-dimensional model rendering method provided in the present specification can be realized by any electronic device with computing function, such as terminal, server and the like.

[0058] The present method is mainly used for rendering three-dimensional models of any structure, especially three-dimensional models that cannot be expressed by conventional mathematical formula. Therefore, in the present specification, the rendering of three-dimensional models that cannot be expressed by conventional mathematical formula is mainly explained.

[0059] Three-dimensional model rendering, also known as 3D rendering, refers to the process of converting a three-dimensional computer model into a two-dimensional image. Generally, when rendering a three-dimensional model, in addition to obtaining the information of the three-dimensional model to be rendered, the information of the space around the three-dimensional model also needs to be determined. Based on this, in this step, the three-dimensional model to be rendered is first obtained, and the rendering space where the three-dimensional model is located is also obtained. Among them, the rendering space is divided into an arbitrary space containing the three-dimensional model. Usually, only one three-dimensional model is rendered in a rendering task, i.e. the rendering space only contains the three-dimensional model to be rendered, so as to avoid the mutual influence between different three-dimensional models.

[0060] S102: constructing a directed distance function according to the three-dimensional model.

[0061] After the three-dimensional model to be rendered is acquired in step S100, a signed distance function can be constructed according to the structure of the three-dimensional model in this step. The signed distance function (SDF) is a commonly used mathematical function for describing the boundary of a geometric shape and the signed distance between the geometric shape and a certain point. For a given point, the value of the signed distance function represents the nearest distance from the point to the geometric shape, depending on whether the point is inside or outside the geometric shape. Inside the geometric shape, the value of the signed distance function is negative; outside the geometric shape, the value of the signed distance function is positive; and the value of the signed distance function of a point on the boundary of the geometric shape is zero. Common signed distance functions include implicit functions such as polynomial functions, trigonometric functions, and discrete representations based on voxel grids or point clouds.

[0062] The method can process implicit functions constructed by mathematical expressions and implicit functions constructed by other non-traditional methods such as octrees and neural networks by supporting the rendering of three-dimensional models with arbitrary signed distance functions, greatly expanding the range of renderable objects. At present, the method for constructing a signed distance function for a complex structure free body is relatively mature, and the signed distance functions constructed for different three-dimensional models are different, which will not be described in detail in this specification.

[0063] S104: Determine the positional relationship between each voxel contained in the rendering space and the three-dimensional model using the signed distance function.

[0064] The rendering of the three-dimensional model is actually the rendering of the voxels in the rendering space. After the signed distance function for the three-dimensional model is constructed in step S102, the positional relationship between each voxel contained in the rendering space and the three-dimensional model that needs to be rendered can be determined using the constructed signed distance function in this step. As introduced in step S102, the signed distance function can determine the signed distance from a point to the surface of the three-dimensional model. When the determined signed distance is negative, it indicates that the point is inside the three-dimensional model; if the signed distance is positive, it indicates that the point is outside the three-dimensional model; and if the signed distance is 0, it indicates that the point is on the surface of the three-dimensional model.

[0065] However, it needs to be considered that a rendering space contains a large number of voxels, so when rendering, the interval division method can be used to reduce the number of times the positional relationship between the voxels and the three-dimensional model needs to be calculated. Specifically, the rendering space can be divided according to a preset rule to obtain a plurality of sub-block spaces; for each sub-block space, the positional relationship between the sub-block space and the three-dimensional model is determined using the signed distance calculation function; and the positional relationship between each voxel contained in the sub-block space and the three-dimensional model is determined according to the positional relationship between the sub-block space and the three-dimensional model.

[0066] In the process of dividing the rendering space, various pre-set rules can be adopted for the division, such as division according to fixed space size or selected position, etc. The number and size of the divided block spaces can be set according to requirements, and the present specification does not make specific limitations thereon. After the block spaces are divided, for each block space, the positional relationship between all the voxels contained in the block space and the three-dimensional model can be directly determined by determining the positional relationship between the block space and the three-dimensional model.

[0067] Specifically, in response to the block space being entirely inside the three-dimensional model, it can be determined that each voxel contained in the block space is inside the three-dimensional model; in response to the block space being entirely outside the three-dimensional model, it can be determined that each voxel contained in the block space is outside the three-dimensional model; and in response to the block space not being entirely inside the three-dimensional model nor entirely outside the three-dimensional model, it can be determined that the positional relationship between the block space and the three-dimensional model is undetermined.

[0068] Generally, the relationship between a block space and a three-dimensional model can be popularly divided into three types: the block space is inside the three-dimensional model, the block space is outside the three-dimensional model, and neither of the above two cases, i.e. undetermined. Among them, the first two cases are relatively easy to understand and judge. When it is determined that a block space is entirely inside a three-dimensional model, it can be determined that all the voxels in the block space are inside the three-dimensional model; the same is true when the inside is replaced by outside in the above case.

[0069] As for the last case, i.e. undetermined, it indicates that it cannot be determined whether the block space is entirely inside or outside the three-dimensional model. At this time, the possible situation is that part of the block space is inside the three-dimensional model and part of it is outside the three-dimensional model. For this case, it cannot be directly and simply determined that each voxel of the block space is in a specific situation. Therefore, the block space with an unclear relationship can be further divided. Specifically, the block space can be continuously divided, and the positional relationship between the divided space and the three-dimensional model can be determined until the relationship between the divided space and the three-dimensional model is not undetermined or the divided space is a single voxel.

[0070] For the sub-block space which cannot be determined whether it is completely inside or outside the three-dimensional model, the sub-block space can be further divided to obtain smaller divided spaces. For each smaller space, the position relationship between the smaller space and the three-dimensional model can be determined by using the directed distance function. If the position relationship between the smaller space and the three-dimensional model can be determined as being completely inside or outside, the position relationship between all voxels in the smaller space and the three-dimensional model can be determined. If the position relationship between the smaller space and the three-dimensional model still cannot be determined, the smaller space is further divided and the position relationship is determined, and the process is repeated until the position relationship between all divided spaces and the three-dimensional model can be determined as being completely inside or outside, or the finally divided space is a single voxel. For the single voxel, the position relationship between the single voxel and the three-dimensional model can be definitely determined as being inside, outside or on the surface of the three-dimensional model.

[0071] For a single voxel, the position relationship between the single voxel and the three-dimensional model can be easily determined by using the directed distance function. For a sub-block space, the position relationship between the sub-block space and the three-dimensional model can also be determined by using the directed distance function. Specifically, the position relationship between the entire sub-block space and the three-dimensional model can be determined by determining the position relationship between each corner point of the sub-block space and the three-dimensional model. When all corner points of a sub-block space are inside or outside the three-dimensional model, the sub-block space is also inside or outside the three-dimensional model accordingly. When all corner points of a sub-block space satisfy at least any two of the following three conditions: some corner points are inside the three-dimensional model, some corner points are outside the three-dimensional model, and some corner points are on the surface of the three-dimensional model, the position relationship between the sub-block space and the three-dimensional model can be determined as pending. The selection of the corner points can be based on the specific conditions of the sub-block space, and only needs to ensure that the closed space formed by the selected corner points can fully cover the sub-block space.

[0072] Based on the above method, in the three-dimensional model rendering method provided in the specification, the directed distance function can include at least three types: point directed distance calculation function, interval directed distance calculation function, and derivative calculation function. The point directed distance calculation function is the same as the ordinary directed distance function, which is used to calculate the directed distance from a point to the three-dimensional model. The interval directed distance calculation function is used to calculate the directed distance from an interval to the three-dimensional model based on the above method. The derivative calculation function is used to output the normal map as part of the rendering result.

[0073] Since different directed distance functions are used for different cases, in the method, an extension function for calling different directed distance functions can also be additionally constructed. Thus, when judging the positional relationship between the voxels and the three-dimensional model, the pre-constructed extension function can be specifically used to call the directed distance function to determine the positional relationship between each voxel contained in the rendering space and the three-dimensional model, wherein the extension function is used to determine the directed distance function to be called.

[0074] In the method, the extension function is used to determine which directed distance function needs to be called according to the input. For example, when the input is the point coordinates of a single voxel, the point directed distance extreme function can be called; when the input is a range of coordinates, the interval directed distance calculation function can be called. In the case of using the extension function, each directed distance function can be used as an interface function of the extension function. Figure 2 A code schematic diagram of a feasible extension function provided in the specification is shown in Figure 2 As shown, the specification provides executable extension function codes for two different running environments, i.e., a central processing unit (CPU) and a graphics processing unit (GPU). The two versions of codes can achieve the same function and are essentially the same, except that the definition of the input parameters and the return value needs to be adapted to the corresponding unit, and the kernel function running on the GPU has some limitation requirements.

[0075] S106: rendering the voxels according to the positional relationship.

[0076] After the positional relationship between each voxel in the rendering space and the three-dimensional model is determined, the voxels in the rendering space can be rendered according to the positional relationship between the voxels and the three-dimensional model. The output of the rendering can be set according to specific requirements, which can include but is not limited to a height map, a normal map, etc., and the specification does not make specific limitations.

[0077] When any three-dimensional model is rendered by using the three-dimensional model rendering method provided in the specification, the positional relationship between each voxel and the three-dimensional model can be determined by using the directed distance function, and the rendering can be finally completed according to the determined positional relationship. By using the method, not only the rendering of a conventional three-dimensional model can be achieved, but also the efficient rendering of a three-dimensional model that cannot be expressed by a traditional mathematical formula can be achieved, and the problem of difficult rendering of a complex free body is effectively solved.

[0078] Additionally, the above description of the present specification mainly takes a three-dimensional model that cannot be expressed by a traditional mathematical formula as an example, and the present method can also complete efficient rendering for a three-dimensional model that can be expressed by a traditional mathematical formula. Specifically, when a three-dimensional model that needs to be rendered is received, it can be first determined whether the contour of the three-dimensional model can be expressed by a mathematical formula; in response to the contour of the three-dimensional model being unable to be expressed by a mathematical formula, a directed distance function is constructed according to the three-dimensional model; thus, when the relationship between a voxel and the three-dimensional model is determined, in response to the contour of the three-dimensional model being able to be expressed by a mathematical formula, the positional relationship between each voxel contained in the rendering space and the three-dimensional model is determined according to a mathematical formula expressing the contour of the three-dimensional model; and in response to the contour of the three-dimensional model being unable to be expressed by a mathematical formula, the positional relationship between each voxel contained in the rendering space and the three-dimensional model is determined by using the directed distance function.

[0079] If the contour of the three-dimensional model can be expressed by a mathematical formula, then the positional relationship between any point in the rendering space and the three-dimensional model can be directly determined without constructing a directed distance function, but directly using the mathematical expression of the three-dimensional model.

[0080] In combination with the two cases that the three-dimensional model can be expressed by a mathematical formula and cannot be expressed by a mathematical formula, the present specification provides a specific embodiment for reference when executed. Figure 3 A specific way of determining the positional relationship between a voxel and a three-dimensional model provided by the present specification is shown in FIG. 1. Figure 3 As shown in FIG. 1, based on the two cases that the three-dimensional model cannot be expressed by a mathematical formula and can be expressed by a mathematical formula, Figure 3 is divided into two parts in the form of a mathematical tree. The upper half is to calculate the distance by using the extend function to call the directed distance function, and the lower half is to calculate the distance by using the mathematical expression of the three-dimensional model. The inputs of the two parts are the same, which are the three-dimensional coordinates of the voxel whose distance from the three-dimensional model needs to be determined, i.e., (X, Y, Z). In actual application, the upper half and the lower half are usually not used at the same time. When the three-dimensional model can be expressed by a mathematical formula, the lower half can be directly used; and when the three-dimensional model cannot be expressed by a mathematical formula, the directed distance function of the upper half is used.

[0081] Figure 4 The characteristics of the extend function provided by the present specification in actual application are shown in FIG. 2. Figure 4 As shown in FIG. 2, the use of the extend function depends on the variable leaf nodes X, Y, and Z. In order not to destroy the overall tree structure, the operation needs to store the slots of inputs X, Y, and Z additionally, and needs a slot to store OUT. Meanwhile, in order to calculate the directed distance function, the context function bound by the extend function can also need to depend on additional data fields, so a pointer to store the data object is also needed.

[0082] When the extended function is used, it is determined according to the input coordinates which directional distance function is called. For example, when the input coordinates are single voxel coordinates, the extended function calls the point directional distance calculation function and the derivative calculation function; when the input coordinates are a range of interval coordinates, the extended function calls the interval directional distance calculation function. When the distance between the voxel and the three-dimensional model is determined according to the mathematical formula, the formula for determining the distance according to the mathematical formula is expanded into a step-by-step mathematical tree as shown in the following formula. Figure 3 Figure 3 The mathematical formula is shown when the three-dimensional model is a hollow sphere, the inner radius of the hollow sphere is 0.5, and the outer radius is 1. In the mathematical tree, LHS represents the left operand, RHS represents the right operand, SQUARE represents the square operation, ADD represents the addition operation, SQRT represents the square root operation, SUB represents the subtraction operation, and MAX represents the maximum value. The lower part of the mathematical tree can be expressed as the following formula.

[0083]

[0084] Through the above formula, the specific distance between the voxel and the hollow sphere three-dimensional model can be determined, and the positional relationship can be determined. Of course, the above embodiment is only an example when the three-dimensional model is a hollow sphere, and for a three-dimensional model constructed by other mathematical formulas, the specific formula for determining the distance between the voxel and the three-dimensional model will also change.

[0085] Additionally, in actual application, the constructed mathematical tree can be converted into an executable operation instruction tape. Figure 5 A schematic diagram of an operation instruction tape provided in the present specification is shown in the following figure. Figure 5 The instructions on the operation instruction tape are based on Figure 4 the lower part of the mathematical tree in the embodiment. Each row in the operation instruction tape represents an operation instruction, wherein opcode represents the operation performed, lhs represents the left operand, rhs represents the right operand, out represents the output, and slot represents the slot of the operation.

[0086] In addition, the present specification also provides a clause structure design of the extended function in application. Figure 6 A clause structure schematic diagram of the extended function provided in the present specification is shown in the following figure. Figure 6 The extended operation uses two clauses, the first clause records the storage slots of the input X, Y, and Z and the storage slot of the output result; and the second clause records the memory address of the data object relied on by the called context function. In combination with the clause structure of the extended function, the present specification also provides a process schematic diagram of constructing an operation instruction tape. ​

[0087] Figure 7 A process diagram for constructing an operation instruction band is provided in the present specification, as shown in Figure 7 The construction of the operation instruction band can be performed according to the following steps:

[0088] 1. Traverse the nodes on the tree, use the map to record the relationship that each node's data is last referenced by other nodes, and record the ID of the last Extend node;

[0089] 2. Assign three storage slots to the variables X, Y, and Z from the free slot pool, assemble the initial Clause, name it START, set the OPCODE field to empty, fill the OUT, LHS, and RHS fields with the storage slots corresponding to X, Y, and Z, respectively, and update the reference relationship of X, Y, and Z in the map to the ID of the last Extend node;

[0090] 3. Traverse the nodes on the tree again, assemble the Clause according to the current operation of the node, if it is an Extend node, assemble the first Clause, fill the 3rd, 4th, and 5th byte positions with the slot numbers where X, Y, and Z are located;

[0091] 4. Get the data bound to the node, construct the second Clause, store the data in the Extend node that is dependent on the context method running on the GPU, allocate memory space on the GPU, deep copy from the CPU to the GPU, and store the pointer address on the GPU in the 8-byte space of the second Clause;

[0092] 5. Based on the last reference relationship in the map, determine whether the left and right operands LHS / RHS of the current calculation operation are last referenced, if so, whether the slot where the left and right operands are located is added to the free slot pool;

[0093] 6. Assign a new storage slot to the calculation result OUT of the current operation from the free slot pool;

[0094] 7. Add the assembled Clause to the instruction band list.

[0095] The construction of the operation instruction band can be completed through the above steps.

[0096] Additionally, the present specification provides an embodiment for rendering a complex periodic repeating large-scale array cell three-dimensional model that cannot be expressed by a mathematical formula. Figure 8 A large-scale array cell three-dimensional model is provided in the present specification, and the rendering of the three-dimensional model can be implemented according to the following code:

[0097] struct CylinderSdfDeviceOracle : public BaseDeviceOracle

[0098] {

[0099] public:

[0100] typedef float (CylinderSdfDeviceOracle::*FunctionPointer)(float,float, float);

[0101] __device__ CylinderSdfDeviceOracle()

[0102] {

[0103] func =&CylinderSdfDeviceOracle::sdf;

[0104] }; / / Add a constructor without parameters

[0105] __device__ CylinderSdfDeviceOracle(FunctionPointer f)

[0106] {

[0107] func = f;

[0108] };

[0109] __device__ CylinderSdfDeviceOracle(CadModelCommonParam other)

[0110] {

[0111] cadModelCommonParam.radius = other.radius;

[0112] cadModelCommonParam.thinkness = other.thinkness;

[0113] for (int i = 0; i<other.num_points; i++)

[0114] {

[0115] cadModelCommonParam.points[i] = other.points[i]; / / simple copy

[0116] }

[0117] };

[0118] __device__ float sdf(float a, float b, float c)

[0119] {

[0120] vec3 p;

[0121] p.x = a;

[0122] p.y = b;

[0123] p.z = c;

[0124] float result = computeCylinderSdf(cadModelCommonParam.size,cadModelCommonParam.points, p, cadModelCommonParam.radius);

[0125] return result;

[0126] };

[0127] __device__ inline float my_fmod(float x, float y) {

[0128] return x - y * floorf(x / y);

[0129] }

[0130] __device__ inline float computeCylinderSdf(const float *size,constvec3 *points,const vec3 p, float r) {

[0131] float x_size=size[0];

[0132] float y_size=size[1];

[0133] float z_size=size[2];

[0134] vec3 modifiedP = p;

[0135] if(x_size<99999){

[0136] modifiedP.x = my_fmod(fabs(p.x + x_size / 2), x_size) - x_size / 2;

[0137] modifiedP.y = my_fmod(fabs(p.y + y_size / 2), y_size) - y_size / 2; / / y coordinate periodicity

[0138] modifiedP.z = my_fmod(fabs(p.z + z_size / 2), z_size) - z_size / 2; / / z coordinate periodicity

[0139] }

[0140] vec3 a = points[0];

[0141] vec3 b = points[1];

[0142] vec3 ba = vec3Subtract(b, a);

[0143] vec3 pa = vec3Subtract(modifiedP, a);

[0144] float baba = vec3Dot(ba, ba);

[0145] float paba = vec3Dot(pa, ba);

[0146] float x = vec3Length(vec3Scale(pa, baba) - vec3Scale(ba, paba)) - r *baba;

[0147] float y = fabsf(paba - baba * 0.5f) - baba * 0.5f;

[0148] float x2 = x * x;

[0149] float y2 = y * y * baba;

[0150] float d = (fmaxf(x, y)<0.0f) ? -fminf(x2, y2) : ((x>0.0f) ? x2 :0.0f) + ((y>0.0f) ? y2 : 0.0f);

[0151] return sign(d) * sqrtf(fabsf(d)) / baba;

[0152] / / return 1.0f;

[0153] }

[0154] __device__ inline float2 evalPoint(const float2&x, const float2&y,const float2&z) override

[0155] {

[0156] / / Extract float values ​​from float2

[0157] float x0 = xx; / / Here it is assumed that the x component of x is used as the value of x0.

[0158] float y0 = yx; / / Here we assume that the x component of y is used as the value of y0.

[0159] float z0 = zx; / / Here we assume that the x component of z is used as the value of z0.

[0160] / / Call func and store the result in result.

[0161] float result0 = (this->*func)(x0, y0, z0);

[0162] / / printf("result0 is %f\n", result0);

[0163] float x1 = xy; / / Here we assume that the x component of x is used as the value of x1.

[0164] float y1 = yy; / / Here we assume that the y component of y is used as the value of y1.

[0165] float z1 = z.y; / / Here we assume that the y component of z is used as the z1 value

[0166] float result1 = (this->*func)(x1, y1, z1);

[0167] / / printf("result1 is %f\n", result1);

[0168] / / Implement the specific logic

[0169] return make_float2(result0, result1); / / Example return value

[0170] };

[0171] __device__ inline Interval evalInterval(const Interval&x, constInterval&y, const Interval&z) override {

[0172] vec3 lower = {x.lower(),y.lower(),z.lower()};

[0173] vec3 upper = {x.upper(),y.upper(),z.upper()};

[0174] / / Switch to interval calculation

[0175] Interval interval = evalCylinderInterval(cadModelCommonParam.size,cadModelCommonParam.

[0176] points,lower,upper,cadModelCommonParam.radius);

[0177] return interval;

[0178] };

[0179] __device__ inline float signedDistanceToCylinder(const vec3&point,const vec3&p0, const vec3&p1, float r)

[0180] {

[0181] vec3 ab = p1 - p0;

[0182] vec3 ap = point - p0;

[0183] float abLength = ab.length();

[0184] vec3 abUnit = ab / abLength;

[0185] float t = dot(ap, abUnit);

[0186] if (t<0.0f)

[0187] t = 0.0f;

[0188] else if (t>abLength)

[0189] t = abLength;

[0190] vec3 p = p0 + abUnit * t;

[0191] vec3 pp = point - p;

[0192] float distSq = dot(pp, pp);

[0193] float dist = sqrtf(distSq);

[0194] return dist - r;

[0195] }

[0196] __device__ inline float distanceFromFaceToLine(const vec3&faceNormal,const vec3&facePoint, const vec3&p0, const vec3&p1, float r)

[0197] {

[0198] vec3 ab = p1 - p0;

[0199] vec3 p0_to_facePoint = facePoint - p0;

[0200] float t = dot(p0_to_facePoint, ab) / dot(ab, ab);

[0201] t = clamp(t, 0.0f, 1.0f); / / Limit t to the range of 0 to 1

[0202] vec3 p = p0 + ab * t;

[0203] vec3 facePoint_to_p = facePoint - p;

[0204] return facePoint_to_p.length() - r;

[0205] }

[0206] __device__ inline Interval evalCylinderInterval(const float *size,const vec3 *points, const vec3&lower0, const vec3&upper0, float r)

[0207] {

[0208] float x_size = size[0];

[0209] float y_size = size[1];

[0210] float z_size = size[2];

[0211] vec3 lower = lower0;

[0212] / / todo Check if upper0 and lower0 are in the same period. If any of x, y, or z is not in the same period, return `return Interval(-1, 1);`

[0213] if ( floorf((upper0.x + x_size / 2) / x_size)!= floorf((lower0.y + x_size / 2) / x_size) ) {

[0214] return Interval(-MAX_SIZE, MAX_SIZE);

[0215] }

[0216] if ( floorf((upper0.y + y_size / 2) / y_size)!= floorf((lower0.y + y_size / 2) / y_size) ) {

[0217] return Interval(-MAX_SIZE, MAX_SIZE);

[0218] }

[0219] if ( floorf((upper0.z + z_size / 2) / z_size)!= floorf((lower0.z + z_size / 2) / z_size) ) {

[0220] return Interval(-MAX_SIZE, MAX_SIZE);

[0221] }

[0222] lower.x = my_fmod(fabs(lower0.x + x_size / 2), x_size) - x_size / 2;

[0223] lower.y = my_fmod(fabs(lower0.y + y_size / 2), y_size) - y_size / 2; / / periodicity in y coordinate

[0224] lower.z = my_fmod(fabs(lower0.z + z_size / 2), z_size) - z_size / 2; / / periodicity in z coordinate

[0225] vec3 upper = upper0;

[0226] upper.x = my_fmod(fabs(upper0.x + x_size / 2), x_size) - x_size / 2;

[0227] upper.y = my_fmod(fabs(upper0.y + y_size / 2), y_size) - y_size / 2; / / Periodicity of the y-coordinate

[0228] upper.z = my_fmod(fabs(upper0.z + z_size / 2), z_size) - z_size / 2; / / Periodicity of the z-coordinate

[0229] vec3 p0 = points[0];

[0230] vec3 p1 = points[1];

[0231] vec3 axis = p1 - p0;

[0232] float axisLength = axis.length();

[0233] vec3 axisUnit = axis / axisLength;

[0234] / / Calculate the shortest distance from each face of the bounding box to the axis of the cylinder

[0235] float minDistance = FLT_MAX;

[0236] vec3 facePoints[6] = {

[0237] lower, upper, / / two diagonal vertices

[0238] vec3(lower.x, lower.y, upper.z), vec3(lower.x, upper.y, lower.z), / / Four side vertices

[0239] vec3(upper.x, lower.y, lower.z), vec3(upper.x, upper.y, upper.z)};

[0240] vec3 faceNormals[6] = {

[0241] vec3(1, 0, 0), vec3(-1, 0, 0), vec3(0, 1, 0), vec3(0, -1, 0), vec3(0,0, 1), vec3(0, 0, -1)};

[0242] for (int i = 0; i<6; ++i)

[0243] {

[0244] float dist = distanceFromFaceToLine(faceNormals[i], facePoints[i],p0, p1, r);

[0245] minDistance = fminf(minDistance, dist);

[0246] }

[0247] / / Check if the boundary box intersects with the cylinder

[0248] bool intersects = (minDistance<0.0f);

[0249] if (!intersects) {

[0250] / / printf("Interval outside of valid interval is skipped");

[0251] return Interval(minDistance, MAX_SIZE); / / Ensures the bounding box does not intersect the cylinder

[0252] }

[0253] return Interval(-MAX_SIZE, MAX_SIZE);

[0254] }

[0255] __device__ inline float distanceToLine(const vec3&p, const vec3&a,const vec3&b)

[0256] {

[0257] vec3 ap = p - a;

[0258] vec3 ab = b - a;

[0259] vec3 abp = ap - ab * dot(ap, ab) / dot(ab, ab);

[0260] return abp.length();

[0261] }

[0262] __device__ inline float clamp(float value, float min, float max)

[0263] {

[0264] return fmaxf(min, fminf(max, value));

[0265] }

[0266] __device__ inline float dot(const vec3&a, const vec3&b)

[0267] {

[0268] return ax * bx + ay * by + az * bz;

[0269] }

[0270] __device__ inline Deriv evalDerivs(const Deriv&x,const Deriv&y,constDeriv&z) override {

[0271] const float EPSILON = 1e-4;

[0272] / / const float EPSILON = 1e-12; / / Defines a small epsilon value for calculating the derivative.

[0273] float center, dx, dy, dz;

[0274] center = (this->*func)(x.value(),y.value(), z.value());

[0275] dx = (this->*func)(x.value()+EPSILON,y.value(),z.value());

[0276] dy = (this->*func)(x.value(),y.value()+EPSILON,z.value());

[0277] dz = (this->*func)(x.value(),y.value(), z.value()+EPSILON);

[0278] / / Implement detailed logic

[0279] / / return Deriv(center,dx,dy,dz); / /

[0280] / / return Deriv(center,dx,dy,dz); / /

[0281] / / printf("Derv x:%f,y:%f,z:%f,value:%f",x.value(),y.value(),z.value(),center);

[0282] return Deriv(center,(dx-center) / EPSILON,(dy-center) / EPSILON,(dz-center) / EPSILON);

[0283] };

[0284] FunctionPointer func;

[0285] CadModelCommonParam cadModelCommonParam;

[0286] };

[0287] For other embodiments, the rendering of a three-dimensional model using the method can be implemented according to the same idea, and the present specification will not be repeated here.

[0288] The above is the three-dimensional model rendering method provided by the present specification, based on the same idea, the present specification also provides a corresponding three-dimensional model rendering device, as shown in Figure 9 .

[0289] Figure 9 A three-dimensional model rendering device provided by the present specification is shown in the schematic diagram, which specifically comprises:

[0290] The acquisition module 200 is configured to acquire a three-dimensional model to be rendered and a rendering space in which the three-dimensional model is located.

[0291] The construction module 202 is configured to construct a directed distance function according to the three-dimensional model.

[0292] The determination module 204 is configured to determine a positional relationship between each voxel contained in the rendering space and the three-dimensional model by using the directed distance function.

[0293] The rendering module 206 is configured to render the voxels according to the positional relationship.

[0294] Optionally, the determination module 204 is specifically configured to divide the rendering space according to a preset rule to obtain a plurality of sub-block spaces; for each sub-block space, determine a positional relationship between the sub-block space and the three-dimensional model by using the directed distance function; and determine a positional relationship between each voxel contained in the sub-block space and the three-dimensional model according to the positional relationship between the sub-block space and the three-dimensional model.

[0295] Optionally, the determination module 204 is specifically configured to, in response to the sub-block space being entirely inside the three-dimensional model, determine that each voxel contained in the sub-block space is inside the three-dimensional model; in response to the sub-block space being entirely outside the three-dimensional model, determine that each voxel contained in the sub-block space is outside the three-dimensional model; and in response to the sub-block space not being entirely inside the three-dimensional model and not being entirely outside the three-dimensional model, determine that the positional relationship between the sub-block space and the three-dimensional model is undetermined.

[0296] Optionally, the determination module 204 is further configured to continuously divide the sub-block space and determine a positional relationship between a divided space and the three-dimensional model until the positional relationship between the divided space and the three-dimensional model is not undetermined or the divided space is a single voxel.

[0297] Optionally, the directed distance function at least includes a point directed distance calculation function, an interval directed distance calculation function and a derivative calculation function.

[0298] Optionally, the determination module 204 is specifically configured to call the directed distance function by using a pre-constructed extension function to determine the positional relationship between each voxel contained in the rendering space and the three-dimensional model, wherein the extension function is used to determine the directed distance function to be called.

[0299] Optionally, the construction module 202 is specifically configured to determine whether the contour of the three-dimensional model can be expressed by a mathematical formula; and in response to the contour of the three-dimensional model being unable to be expressed by a mathematical formula, construct a directed distance function according to the three-dimensional model.

[0300] The determination module 204 is specifically configured to determine the positional relationship between each voxel contained in the rendering space and the three-dimensional model according to a mathematical formula expressing the contour of the three-dimensional model in response to the contour of the three-dimensional model being able to be expressed by a mathematical formula; and in response to the contour of the three-dimensional model being unable to be expressed by a mathematical formula, determine the positional relationship between each voxel contained in the rendering space and the three-dimensional model by using the directed distance function.

[0301] The present specification also provides a computer readable storage medium storing a computer program, and the computer program is used to execute the above Figure 1 The three-dimensional model rendering method.

[0302] The present specification also provides an electronic device. Figure 10 The schematic structural diagram of the electronic device is shown. As Figure 10 At the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory and a non-volatile memory, and of course, other hardware required by the business. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs to implement the above Figure 1 The three-dimensional model rendering method. Of course, in addition to the software implementation, the present specification does not exclude other implementation manners, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or a logic device.

[0303] For the sake of brevity, conventional techniques and technologies related to semiconductor circuits can not be described in detail herein. Work implementing embodiments described herein can employ any of a number of semiconductor circuit technologies, including but not limited to: bipolar, field effect, and / or other types of integrated circuitry. It is to be understood that the implementing system, apparatus, and / or device can be one integrated circuit. However, for ease of illustration and understanding, portions of the implementing system, apparatus, and / or device can instead be illustrated and described as multiple discrete components, which can actually be integrated together within a common integrated circuit package. Alternatively, the implementing system, apparatus, and / or device can be implemented by discrete components that are distributed across multiple integrated circuit packages.

[0304] The controller can be implemented in any suitable way, for example, the controller can take the form of a microprocessor or processor and a computer readable medium storing computer readable program code, such as software or firmware, executable by the (micro)processor, logic gates, switches, an application specific integrated circuit (ASIC), a programmable logic controller and an embedded microcontroller, examples of which include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20 and Silicone Labs C8051F320, the memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also know that, in addition to implementing the controller in pure computer readable program code, it is also possible to implement the controller in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers and embedded microcontrollers, etc. to perform the same functions by logically programming the method steps. Such a controller can therefore be considered as a hardware component, and the means included therein for performing various functions can also be considered as structures within the hardware component. Alternatively, the means for performing various functions can even be considered as both a software module implementing the method and a structure within the hardware component.

[0305] The systems, apparatuses, modules or units illustrated by the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer can be a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0306] For the sake of description, the above apparatuses are described in various units by functions respectively. Of course, the functions of each unit can be implemented in one or more software and / or hardware in implementing the present specification.

[0307] Those skilled in the art will understand that the embodiments of the present application can be provided as a method, a system or a computer program product. Therefore, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0308] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flowcharts and / or blocks Figure 1 means for functionally implementing the steps listed in the flowchart block or blocks.

[0309] These computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture including instructions which implement the function specified in the flowchart block or blocks. Figure 1 one or more flowcharts and / or blocks Figure 1 means for functionally implementing the steps listed in the flowchart block or blocks.

[0310] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flowcharts and / or blocks Figure 1 means for functionally implementing the steps listed in the flowchart block or blocks.

[0311] In one typical configuration, the computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.

[0312] The memory can include non-persistent memory and / or persistent memory, such as flash memory, read-only memory (ROM), and / or volatile or non-volatile random access memory (RAM), among others. The memory is an example of computer readable media.

[0313] Computer-readable media includes permanent and non-permanent, movable and non-movable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible to a computing device. According to the definition herein, computer-readable media does not include transitory media such as modulated data signals and carriers.

[0314] It should also be noted that the terms "comprising", "containing", or any other variant thereof are intended to cover non-exclusive inclusion, such that a process, method, article or apparatus that comprises a list of elements does not only include those elements, but can also include other elements not expressly listed or inherent to such process, method, article or apparatus. Without more limitations, the element defined by the statement "comprising a" does not exclude the presence of additional identical elements in the process, method, article or apparatus that includes the element.

[0315] Those skilled in the art will appreciate that embodiments of the present specification can be provided as methods, systems or computer program products. Therefore, the present specification can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Moreover, the present specification can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage devices, etc.) containing computer-usable program code.

[0316] The present specification can be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The present specification can also be practiced in distributed computing environments where tasks are performed by remote processing devices that are connected through a communication network. In a distributed computing environment, program modules can be located in both local and remote computer storage media including storage devices.

[0317] The various embodiments described in this specification are described using a numbering of embodiments approach: these are each individually integrated contributions pertaining to different aspects of the description. For each embodiment, the description focuses on the differences from the other embodiments. In particular, the description of the system embodiments is relatively brief, as the system embodiments are largely analogous to the method embodiments. The relevant parts of the description of the method embodiments are therefore referred to.

[0318] The above description is embodied in the form of examples of the description, and is not intended to limit the description. For those skilled in the art, the description can have various modifications and changes. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the description shall be included in the scope of the claims of the present application.

Claims

1. A method for rendering a three-dimensional model, characterized in that, include: Obtain the 3D model to be rendered, and the rendering space in which the 3D model is located; Construct a directed distance function based on the aforementioned 3D model; The positional relationship between each voxel contained in the rendering space and the three-dimensional model is determined by the directed distance function. The three-dimensional model is rendered using each voxel according to the positional relationship; Specifically, determining the positional relationship between each voxel in the rendering space and the 3D model using the directed distance function includes: The directed distance function is called using a pre-built extension function to determine the positional relationship between each voxel contained in the rendering space and the 3D model. The extension function is used to determine the directed distance function to be called. The directed distance function includes at least a point directed distance calculation function, an interval directed distance calculation function, and a derivative calculation function; The directed distance function is called using a pre-built extended function to determine the positional relationship between each voxel in the rendering space and the 3D model, specifically including: The directed distance function is called using a pre-built extension function, and a mathematical tree is constructed based on the extension function to determine the positional relationship between each voxel and the 3D model. Traverse the nodes on the mathematical tree and record the last time the data of each node was referenced by other nodes; Based on the correspondence, an operation instruction band is constructed according to the mathematical tree using a dual-structure approach. The first structure in the dual-structure is used to store the body coordinates and is updated based on the correspondence. The second structure in the dual-structure is used to store the pointer address on the GPU of the data that the extension function depends on when calling the directed distance function. The positional relationship between each voxel and the three-dimensional model is determined based on the constructed operation instruction band.

2. The method as described in claim 1, characterized in that, The directed distance function is used to determine the positional relationship between each voxel in the rendering space and the 3D model, specifically including: The rendering space is divided according to preset rules to obtain several block spaces; For each segmented space, the directed distance calculation function is used to determine the positional relationship between the segmented space and the three-dimensional model; The positional relationship between each voxel contained in the block space and the three-dimensional model is determined based on the positional relationship between the block space and the three-dimensional model.

3. The method as described in claim 2, characterized in that, The positional relationship between each voxel contained in the segmented space and the 3D model is determined based on the positional relationship between the segmented space and the 3D model, specifically including: In response to the fact that the entire segmented space is inside the three-dimensional model, it is determined that each voxel contained in the segmented space is inside the three-dimensional model. In response to the fact that the entire block space is outside the three-dimensional model, it is determined that each voxel contained in the block space is outside the three-dimensional model; In response to the fact that the segmented space is not entirely inside the 3D model, nor entirely outside the 3D model, the positional relationship between the segmented space and the 3D model is determined as undetermined.

4. The method as described in claim 3, characterized in that, After determining that the relationship between the partitioned space and the three-dimensional model is undetermined, the method further includes: The space is continuously divided into blocks, and the positional relationship between the divided space and the three-dimensional model is determined until the relationship between the divided space and the three-dimensional model is not pending or the divided space is a single voxel.

5. The method as described in claim 1, characterized in that, Constructing a directed distance function based on the aforementioned 3D model specifically includes: Determine whether the outline of the three-dimensional model can be expressed mathematically; Since the contour of the three-dimensional model cannot be expressed mathematically, a directed distance function is constructed based on the three-dimensional model. The directed distance function is used to determine the positional relationship between each voxel in the rendering space and the 3D model, specifically including: In response to the fact that the outline of the three-dimensional model can be expressed by a mathematical formula, the positional relationship between each voxel contained in the rendering space and the three-dimensional model is determined according to the mathematical formula expressing the outline of the three-dimensional model. Since the outline of the three-dimensional model cannot be expressed mathematically, the directed distance function is used to determine the positional relationship between each voxel in the rendering space and the three-dimensional model.

6. A three-dimensional model rendering device, characterized in that, include: The acquisition module is used to acquire the 3D model to be rendered, and the rendering space where the 3D model is located; The construction module is used to construct a directed distance function based on the 3D model; The determination module is used to determine the positional relationship between each voxel contained in the rendering space and the three-dimensional model using the directed distance function; A rendering module is used to render each voxel according to the positional relationship; Specifically, the determining module is used to call the directed distance function using a pre-built extension function to determine the positional relationship between each voxel contained in the rendering space and the 3D model, wherein the extension function is used to determine the directed distance function to be called; The directed distance function includes at least a point directed distance calculation function, an interval directed distance calculation function, and a derivative calculation function; The determining module is specifically used to call the directed distance function using a pre-built extension function, and construct a mathematical tree based on the extension function to determine the positional relationship between each voxel and the 3D model; traverse the nodes on the mathematical tree and record the last time the data of each node was referenced by other nodes; based on the correspondence, construct an operation instruction band based on the mathematical tree using a dual-structure approach, wherein the first structure in the dual-structure is used to store voxel coordinates and update them based on the correspondence, and the second structure in the dual-structure is used to store the pointer address on the GPU of the data that the extension function depends on when calling the directed distance function; and determine the positional relationship between each voxel and the 3D model based on the constructed operation instruction band.

7. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the method described in any one of claims 1 to 5.

8. An electronic device 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 program, it implements the method described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • System and method for hierarchical implicit representation of three-dimensional modeled octree

    CN116490899A

  • Reconstruction method, device and equipment of three-dimensional entity model, medium and program product

    CN117409144A