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

By generating operation instruction sequences and calculating directed distances using GPU, the problem of inefficient computing in traditional rendering methods is solved, and the rendering efficiency of three-dimensional models is improved.

CN119478195BActive Publication Date: 2025-04-18ZHEJIANG LAB
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510051294.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-13
Publication Date
2025-04-18
Estimated Expiration
2045-01-13

AI Technical Summary

Technical Problem

When traditional implicit surface rendering methods deal with complex three-dimensional models, the calculation time of directed distance between each voxel and an implicit surface is long, resulting in low rendering efficiency.

Method used

By determining the implicit function of the model to be rendered, a sequence of operation instructions is generated for calculating directed distances, and the graphics processor GPU is used to perform calculations to optimize the rendering process.

Benefits of technology

The efficiency of calculating directed distances is improved, thereby improving the rendering efficiency of the three-dimensional model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119478195B_ABST
    Figure CN119478195B_ABST
Patent Text Reader

Abstract

The present specification discloses a rendering method, device, storage medium and electronic device for a three-dimensional model, the method comprising: first determining an implicit function corresponding to the model to be rendered. Based on the implicit function, determining the calculation logic for calculating the directed distance from each voxel in the rendering space corresponding to the model to be rendered to the model to be rendered. Then generating an operation instruction sequence for implementing the calculation logic. Determine the directed distance from each voxel to the model to be rendered according to the operation instruction sequence through a graphics processor (GPU). Determine the observation angle corresponding to the model to be rendered, and render the model to be rendered according to the observation angle and each directed distance to obtain a rendered image corresponding to the observation angle. By first generating an operation instruction sequence for implementing the calculation logic, and then having the GPU calculate the directed distance from each voxel to the model to be rendered according to the operation instruction sequence, the calculation efficiency is improved, thereby improving the rendering efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method, device, storage medium and electronic device for rendering a three-dimensional model. Background Art

[0002] With the continuous development of science and technology, rendering technology is being used more and more widely, especially implicit surface rendering methods.

[0003] Traditional implicit surface rendering methods usually use implicit functions to determine the signed distance from each voxel in the three-dimensional space where the three-dimensional model is located to the implicit surface (i.e., the surface of the three-dimensional model), and then use rendering technology to render the three-dimensional model according to the signed distance corresponding to each voxel and the pre-set observation angle to obtain a two-dimensional image that can be observed under the observation angle. However, the three-dimensional model may be relatively complex, resulting in the implicit function corresponding to the three-dimensional model being relatively complex, which in turn leads to a long time to determine the signed distance from each voxel to the implicit surface, thereby reducing the rendering efficiency. Therefore, how to render the three-dimensional model to improve rendering efficiency is a very important issue.

[0004] Based on this, this specification provides a method for rendering a three-dimensional model. Summary of the invention

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

[0006] This manual adopts the following technical solutions:

[0007] This specification provides a method for rendering a three-dimensional model, including:

[0008] Determine an implicit function corresponding to the model to be rendered; wherein the model to be rendered is a closed three-dimensional model;

[0009] Based on the implicit function, determining a calculation logic for calculating a directed distance from each voxel in the to-be-rendered space corresponding to the to-be-rendered model to the to-be-rendered model;

[0010] generating a sequence of operation instructions for implementing the computing logic;

[0011] Determine the directed distance from each voxel to the model to be rendered according to the operation instruction sequence by means of a graphics processing unit (GPU);

[0012] An observation angle corresponding to the model to be rendered is determined, and the model to be rendered is rendered according to the observation angle and each directed distance to obtain a rendered image corresponding to the observation angle.

[0013] Optionally, generating an operation instruction sequence for implementing the computing logic specifically includes:

[0014] According to the calculation logic, a preset construction algorithm is used to construct a mathematical tree corresponding to the model to be rendered; wherein the nodes in the mathematical tree include operation information;

[0015] Determine a node sequence corresponding to the mathematical tree;

[0016] For each node in the node sequence, determine the operation information included in the node;

[0017] Generate an operation instruction corresponding to the node according to the operation information;

[0018] The operation instructions corresponding to each node are generated into an operation instruction sequence corresponding to the model to be rendered according to the order of the node sequence.

[0019] Optionally, the operation information includes initial data and operation type;

[0020] Generate an operation instruction corresponding to the node according to the operation information, specifically including:

[0021] When the node is a node of the first type in the mathematical tree, determining a slot identifier corresponding to initial data included in the node;

[0022] An operation instruction corresponding to the node is generated according to the slot identifier and the operation type; wherein the slot identifier is a unique identifier corresponding to a slot used to store data.

[0023] Optionally, the operation information includes an operation type;

[0024] Generate an operation instruction corresponding to the node according to the operation information, specifically including:

[0025] When the node is a node of the second type in the mathematical tree, determining a child node corresponding to the node;

[0026] Determine the slot identifier corresponding to the calculation result output by the subnode and use it as the input identifier; wherein the slot identifier is a unique identifier corresponding to the slot used to store data;

[0027] Determine the slot identifier corresponding to the calculation result output by the node and use it as the output identifier;

[0028] An operation type in the operation information included in the node is determined, and an operation instruction corresponding to the node is generated according to the determined operation type, the input identifier, and the output identifier.

[0029] Optionally, determining a slot identifier corresponding to a calculation result output by the node and using the slot identifier as the output identifier specifically includes:

[0030] Determine a calling relationship between the child node and other nodes in the mathematical tree except the child node;

[0031] According to the calling relationship, determining whether the current child node has reached the calling end condition;

[0032] If yes, place the input identifier into a preset free slot identifier set, and determine the slot identifier corresponding to the calculation result output by the node from the free slot identifier set after placement, and use it as the output identifier;

[0033] If not, the input identifier is not placed in a preset free slot identifier set, and the slot identifier corresponding to the calculation result output by the node is determined from the free slot identifier set and used as the output identifier.

[0034] Optionally, determining the directed distance from each voxel to the model to be rendered according to the operation instruction sequence by a graphics processor GPU specifically includes:

[0035] Dividing the space to be rendered to obtain a plurality of first intervals of a first size;

[0036] Determine the interval ranges corresponding to the first intervals respectively;

[0037] For each first interval, a GPU thread corresponding to the first interval in a graphics processor GPU performs interval calculation according to an interval range corresponding to the first interval and according to the operation instruction sequence to obtain a range value of a directed distance from the first interval to the model to be rendered;

[0038] According to the range value of the directed distance corresponding to the first interval, the directed distance between the voxels included in the first interval and the model to be rendered is determined.

[0039] Optionally, the operation instruction includes an operation type and a slot identifier, where the slot identifier is a unique identifier corresponding to a slot for storing data, and the slot identifier includes an input identifier and an output identifier;

[0040] The method further comprises:

[0041] Starting from the end of the operation instruction sequence, for each operation instruction in the operation instruction sequence, when the operation instruction is at the end of the operation instruction sequence, marking the output identifier in the operation instruction as a target type;

[0042] When the operation instruction is not at the end of the operation instruction sequence, determine whether the operation type of the operation instruction is a specified type; if so, determine the contribution corresponding to the input identifier in the operation instruction according to the range value of the directed distance corresponding to each of the first intervals, and according to the contribution, use the input identifier corresponding to the maximum contribution as the target identifier, and mark the target identifier as the target type, determine the node included in the mathematical tree that uses the data stored in the slot corresponding to the target identifier as the output calculation result, and mark the output identifier in the operation instruction corresponding to all child nodes of the determined node as the target type; if not, mark the output identifier in the operation instruction as the target type;

[0043] Determine the operation instructions whose output identification marks them as the target type in the operation instruction sequence, and construct an optimized instruction sequence including the determined operation instructions.

[0044] This specification provides a three-dimensional model rendering device, including:

[0045] A determination module, used to determine an implicit function corresponding to a model to be rendered; wherein the model to be rendered is a closed three-dimensional model;

[0046] A construction module, used for determining, based on the implicit function, a calculation logic for calculating a directed distance from each voxel in the to-be-rendered space corresponding to the to-be-rendered model to the to-be-rendered model;

[0047] A generating module, used for generating an operation instruction sequence for implementing the computing logic;

[0048] A processing module, used for determining the directed distance from each voxel to the model to be rendered according to the operation instruction sequence through a graphics processing unit GPU;

[0049] The rendering module is used to determine the observation angle corresponding to the model to be rendered, and render the model to be rendered according to the observation angle and each directed distance to obtain a rendered image corresponding to the observation angle.

[0050] This specification provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned three-dimensional model rendering method is implemented.

[0051] This specification provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned three-dimensional model rendering method when executing the program.

[0052] At least one of the above technical solutions adopted in this specification can achieve the following beneficial effects:

[0053] The rendering method of a three-dimensional model provided in this specification determines an implicit function corresponding to the model to be rendered, and based on the implicit function, determines a calculation logic for calculating the directed distance from each voxel in the to-be-rendered space corresponding to the model to be rendered to the model to be rendered. Then, an operation instruction sequence for implementing the calculation logic is generated. Through a graphics processor GPU, according to the operation instruction sequence, the directed distance from each voxel to the model to be rendered is determined. The observation angle corresponding to the model to be rendered is determined, and the model to be rendered is rendered according to the observation angle and each directed distance to obtain a rendered image corresponding to the observation angle.

[0054] It can be seen from the above method that when rendering a three-dimensional model, the present application first determines the implicit function corresponding to the model to be rendered. Based on the implicit function, determine the calculation logic for calculating the directed distance from each voxel in the to-be-rendered space corresponding to the model to be rendered to the model to be rendered. Then generate an operation instruction sequence for implementing the calculation logic. Through the graphics processing unit GPU, according to the operation instruction sequence, determine the directed distance from each voxel to the model to be rendered. Determine the observation angle corresponding to the model to be rendered, and render the model to be rendered according to the observation angle and each directed distance, and obtain a rendered image corresponding to the observation angle. By first generating an operation instruction sequence for implementing the calculation logic, and then having the GPU calculate the directed distance from each voxel to the model to be rendered according to the operation instruction sequence, the calculation efficiency is improved, thereby improving the rendering efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] The drawings described herein are used to provide a further understanding of this specification and constitute a part of this specification. The illustrative embodiments and descriptions of this specification are used to explain this specification and do not constitute an improper limitation on this specification. In the drawings:

[0056] Figure 1 This is a flowchart of a regional service ecological analysis method provided in this manual;

[0057] Figure 2 A schematic diagram of a mathematical tree provided in this specification;

[0058] Figure 3 A schematic diagram of the structure of an operation instruction provided in this specification;

[0059] Figure 4 A schematic diagram of an operation instruction sequence provided in this specification;

[0060] Figure 5 A schematic diagram of a process for determining an output identifier provided in this specification;

[0061] Figure 6 A schematic diagram of another operation instruction sequence provided in this specification;

[0062] Figure 7 A schematic diagram of a process for optimizing an operation instruction sequence provided in this specification;

[0063] Figure 8 A schematic diagram of a three-dimensional model rendering device provided in this specification;

[0064] Fig. 9 A method corresponding to the Figure 1 Schematic diagram of the structure of an electronic device. DETAILED DESCRIPTION

[0065] In order to make the purpose, technical solutions and advantages of this specification more clear, the technical solutions of this specification will be clearly and completely described below in combination with the specific embodiments of this specification and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this specification.

[0066] The present specification provides a method, device, storage medium and electronic device for rendering a three-dimensional model. The technical solutions provided by each embodiment of the present specification are described in detail below in conjunction with the accompanying drawings.

[0067] Figure 1 A flowchart of a method for rendering a three-dimensional model provided in this specification includes the following steps:

[0068] S100: Determine an implicit function corresponding to a model to be rendered; wherein the model to be rendered is a closed three-dimensional model.

[0069] In this specification, the device for rendering the three-dimensional model can first determine the implicit function corresponding to the model to be rendered. The device for rendering the three-dimensional model can be a server or an electronic device such as a desktop computer or a laptop computer. For ease of description, the following only takes the server as the execution subject to illustrate the rendering method of the three-dimensional model provided in this specification.

[0070] The above-mentioned model to be rendered is a closed three-dimensional model, and the model to be rendered can be a standard model or obtained by splicing standard models (i.e., Boolean operation), and the standard model can be a model represented by an explicit mathematical expression. The model to be rendered can be a three-dimensional model in any rendering scene, for example, the model to be rendered can be a three-dimensional model corresponding to the terrain or building that needs to be rendered in the game scene, and the three-dimensional model corresponding to the terrain or building can be a model represented by an explicit mathematical expression, or a model obtained by splicing several models represented by explicit mathematical expressions. For another example, the model to be rendered can also be a three-dimensional model required to be rendered in a virtual reality (VR) / augmented reality (AR) scene.

[0071] In this specification, the above-mentioned model to be rendered has a corresponding implicit function, which can be a closed form implicit function expression. The function in the implicit function is a mathematical function, which is in the form of an explicit mathematical expression. The implicit function can be expressed as 0, in this case, the implicit function represents the set of all points inside the model to be rendered. Of course, the implicit function can also be expressed as 0, at this time, the implicit function represents the set of all points on the surface of the model to be rendered, that is, the implicit function at this time represents the surface of the model to be rendered. is a mathematical function, and the mathematical function is also in the form of an explicit mathematical expression. For example, the above mathematical function can be expressed as follows:

[0072]

[0073] The mathematical function is the function corresponding to a sphere with a radius of R, and the implicit function is When , the implicit function is represented by the surface of a sphere with radius R.

[0074] In this specification, when determining the implicit function corresponding to the model to be rendered, the server may first determine the model to be rendered, and then use a preset function extraction algorithm to extract functions from the model to be rendered to obtain the implicit function corresponding to the model to be rendered.

[0075] S102: Based on the implicit function, determine a calculation logic for calculating a directed distance from each voxel in the to-be-rendered space corresponding to the to-be-rendered model to the to-be-rendered model.

[0076] In this specification, the server may determine the calculation logic for calculating the signed distance from each voxel in the space to be rendered corresponding to the model to be rendered to the model to be rendered based on the implicit function. The calculation logic is used to calculate the signed distance from each voxel in the space to be rendered corresponding to the model to be rendered to the model to be rendered, and the calculation logic may be determined based on the mathematical function in the implicit function. In fact, the calculation logic is the calculation logic corresponding to the mathematical function in the implicit function, that is, the calculation order corresponding to the mathematical function, and based on the three-dimensional coordinates of each voxel in the space to be rendered, the function value calculated by the mathematical function can be expressed as the signed distance from each voxel to the model to be rendered. The above calculation logic may be pre-written by the user, or may be generated using a logic generation algorithm, that is, the calculation logic for calculating the signed distance from each voxel in the space to be rendered corresponding to the model to be rendered to the model to be rendered may be generated based on the mathematical function in the implicit function and the logic generation algorithm. The signed distance represents the nearest vertical distance from any voxel in the space to be rendered to the surface of the model to be rendered.

[0077] S104: Generate an operation instruction sequence for implementing the computing logic.

[0078] In this specification, the server may generate an operation instruction sequence for implementing the computing logic. The operation instruction sequence may be in the form of a list, and the operation instruction sequence may include a number of operation instructions, which are instructions that can be run or executed on a graphics processing unit (GPU), that is, the operation instruction can be run or executed by the GPU. The operation instruction may include an operation type and may also include a slot identifier. The operation type may be a mathematical operation type, that is, a mathematical operation type, such as addition, subtraction, multiplication, division, intersection (i.e., min), and union (i.e., max). The slot identifier is a unique identifier corresponding to a slot for storing data, the slot is a storage space, and the slot is pre-built, and each slot has a corresponding identifier, i.e., a slot identifier. Specifically, the server may generate an operation instruction sequence for implementing the computing logic based on the above-mentioned computing logic using a preset instruction generation algorithm. The instruction generation algorithm is preset.

[0079] In this specification, the server may also construct a mathematical tree corresponding to the model to be rendered using a pre-set construction algorithm according to the calculation logic. Then, according to the mathematical tree, determine the sequence of operation instructions for implementing the calculation logic. Among them, the construction algorithm may be pre-set, and the construction algorithm is used to generate the mathematical tree corresponding to the calculation logic. The mathematical tree includes a number of nodes, and the nodes in the mathematical tree include operation information, and the operation information may include an operation type. The operation type is consistent with the definition of the operation type included in the above-mentioned operation instruction, and will not be repeated here. Of course, the operation information may also include initial data, which is a variable, namely x, y and z, and the variable is the three-dimensional coordinate of the voxel in the space to be rendered. The three-dimensional coordinates of the voxel are different, and the value corresponding to the variable is also different. And, when the operation information included in the node includes initial data, it means that the node at this time is a node of the first type, and the first type is pre-set, and the node of the first type is a node including initial data, that is, an input node. In addition, the operation information may also include a constant, and the node including the constant is a node of the third type, that is, a constant node, and the third type is pre-set.

[0080] The above mathematical tree can be expressed as Figure 2 As shown, Figure 2 is a schematic diagram of a mathematical tree provided in this specification, Figure 2 The mathematical tree shown is based on This mathematical function is constructed by the calculation logic. Figure 2 The first type of node (i.e., input node) in the mathematical tree shown includes the operation information as initial data, i.e., x, y, z, Figure 2 The third type of node (i.e., constant node) in the mathematical tree shown includes operation information that is a constant. Figure 2 In the mathematical tree shown, the operation information of other nodes (i.e., nodes of the second type) except the nodes of the first type and the nodes of the third type is the operation type, i.e., square, addition, square root, subtraction, and maximum value. That is, Figure 2 The nodes marked as "square 1", "square 2" and "square 3" include the operation type of square, the nodes marked as "addition 1" and "addition 2" include the operation type of addition, the node marked as "square root" includes the operation type of square root, the nodes marked as "subtraction 1" and "subtraction 2" include the operation type of subtraction, and the node marked as "intersection (max)" includes the operation type of maximum value. The nodes marked as "0.5f" and "1.0f" (i.e., constant nodes) include the operation information of constants, i.e., 0.5f and 1.0f. Figure 2 The root node of the mathematical tree shown is labeled "intersection(max)", and the input nodes are labeled "x", "y", and "z" respectively. Figure 2The operation information of the nodes in the mathematical tree shown may also include constants, namely constant nodes marked as "0.5f" and "0.1f". Figure 2 The operation information of the nodes in the illustrated mathematical tree may also include operation types, ie nodes marked as “addition”, “subtraction”, “square” and “square root”, ie nodes of the second type, which are preset. Figure 2 The node marked as "left" in the table indicates that for its parent node, the node marked as "left" is the left child node, and the node marked as "right" indicates that for its parent node, the node marked as "right" is the right child node. However, for nodes marked as both "left" and "right", this type of node has multiple parent nodes. For different parent nodes, the node can be a left child node or a right child node. It should be noted that Figure 2 The mathematical tree shown is only an example. The mathematical tree in this specification may also have other structures. As for the structure of the mathematical tree, it mainly depends on the calculation logic of the model to be rendered, and will not be described in detail here.

[0081] When determining the sequence of operation instructions for realizing the calculation logic according to the mathematical tree, the server can use the instruction generation algorithm according to the mathematical tree to determine the sequence of operation instructions for realizing the calculation logic. In addition, the server also determines the node sequence corresponding to the mathematical tree, and determines the operation information included in the node for each node in the node sequence in turn. According to the operation information, the operation instruction corresponding to the node is generated. Then, the operation instruction corresponding to each node is generated according to the order of the node sequence to generate the operation instruction sequence corresponding to the model to be rendered. Among them, the above-mentioned node sequence is a sequence obtained after traversing the nodes in the mathematical tree. The server can start from the input node in the mathematical tree and traverse the nodes in the mathematical number according to the calculation logic to obtain the node sequence corresponding to the mathematical tree. The order of the nodes in the node sequence is actually the calculation order of the above-mentioned mathematical function, that is, the calculation order of various mathematical operations in the mathematical function. Moreover, the order of each operation instruction in the above-mentioned operation instruction sequence corresponds to the order of each node in the node sequence one by one, and at the same time, the order of each operation instruction is also the calculation order of various mathematical operations in the mathematical function. It should be noted that the server does not need to generate operation instructions corresponding to the third type of nodes (ie, constant nodes) in the above mathematical tree. The operation information, ie, constants, included in the constant nodes can be directly stored in the constant bits in the operation instructions.

[0082] When generating the operation instruction corresponding to the node according to the operation information, the server may generate the operation instruction corresponding to the node according to the operation information using an instruction generation algorithm. The operation instruction may include an operation type and a slot identifier, and the slot identifier may include an input identifier and an output identifier. There are generally two input identifiers, namely a left input identifier and a right input identifier. In addition, the operation instruction may also include a constant bit or other bits.

[0083] The above operation type indicates the type of mathematical operation corresponding to the operation instruction, and the slot identifier indicates the identifier of the slot corresponding to the data involved in the operation instruction. The input identifier indicates the identifier of the slot corresponding to the input data of the operation instruction, and the input data is the data required to execute the operation instruction, that is, the identifier of the slot storing the calculation result output by the child node corresponding to the node. Since there are generally two input identifiers, namely the left input identifier and the right input identifier, the left input identifier is the identifier of the slot storing the calculation result output by the left child node corresponding to the node, and the right input identifier is the identifier of the slot storing the calculation result output by the right child node corresponding to the node. The output identifier indicates the identifier of the slot corresponding to the output data of the operation instruction, and the output data is the calculation result obtained after executing the operation instruction, that is, the calculation result output by the node corresponding to the operation instruction. The constant bit is used to store constants, and the other bits are used to store other instructions, such as connection instructions or jump instructions. The length of the operation type, output identifier, left input identifier and right input identifier in the above operation instruction can be a preset length, which can be 1 byte. The length of the constant bit or other bit can also be a preset length, which can be 4 bytes. Of course, the operation type, output identifier, left input identifier, right input identifier, constant bit or other bit length can also be other preset values, which are not specifically limited in this specification.

[0084] Specifically, the structure of the operation instruction can be as follows: Figure 3 As shown, Figure 3 is a schematic diagram of the structure of an operation instruction provided in this specification, Figure 3 The operation instructions shown include the operation type (i.e. Figure 3 "OPCODE (operator)"), output identifier (i.e. Figure 3 "OUT" in the left output label (i.e. Figure 3 "LHS (left side)") in the right output identifier (i.e. Figure 3 The "RHS (right side)" in Figure 3 It should be noted that Figure 3 The structure of the operation instruction shown is only an example, and this specification does not make any specific restrictions on what the operation instruction specifically includes.

[0085] In this specification, when the operation instruction corresponding to the node is generated according to the operation information, when the node is a node of the first type in the mathematical tree, the server can determine the slot identifier corresponding to the initial data included in the node. Generate the operation instruction corresponding to the node according to the slot identifier and the operation type. Among them, the first type of node mentioned above is an input node, and the slot identifier is a unique identifier corresponding to the slot used to store data. The operation type, left input identifier and right input identifier in the operation instruction corresponding to the first type of node can all be empty, and the output identifier is the identifier corresponding to the slot storing the initial data. The output identifier can be randomly determined by the server from the identifiers corresponding to several pre-divided slots. The operation instruction corresponding to the first type of node actually stores the initial data in the corresponding slot, so the output identifier in the operation instruction is the identifier of the slot used to store the initial data. When the operation instruction corresponding to the node is generated according to the slot identifier and the operation type, the server can generate the operation instruction corresponding to the node including the slot identifier and the operation type according to the structure of the operation instruction. The structure of the operation instruction can be pre-set, specifically as mentioned above. Figure 3 As shown, no further details are given here. Of course, the server can also use a preset instruction generation algorithm to generate an operation instruction corresponding to the node according to the slot identifier and the operation type. It should be noted that the above instruction generation algorithm is used to generate an operation instruction of a preset structure or format based on the data to be generated. The data to be generated can be the above calculation logic, mathematical tree, operation information, etc. The structure or format is the structure or format of the operation instruction.

[0086] In addition, since there may be several nodes of the first type in the mathematical tree, or there may be several initial data, or there may be several variables in the above mathematical function, in order to save the execution time of the operation instruction and improve the execution efficiency of the operation instruction, the server may generate an operation instruction based on the operation information included in each node of the first type, and the operation instruction has a corresponding relationship with each node of the first type. Specifically, the server may determine the slot identifier corresponding to the initial data respectively included in each node of the first type in the mathematical tree, and then determine the operation type respectively included in each node of the first type in the mathematical tree. Afterwards, according to each operation type and each slot identifier, the operation instruction corresponding to each node of the first type is generated. Among them, since the operation instruction is generated based on the operation information included in each node of the first type, the operation instruction can actually be a set of sub-instructions corresponding to each node of the first type, that is, the operation instruction corresponding to each node of the first type includes several sub-instructions, and the number of sub-instructions is the same as the number of leaf nodes. The sub-instruction is generated based on the operation information included in the leaf node, and the generation method of the sub-instruction is similar to the generation method of the above-mentioned operation instruction, which will not be repeated here. It should be noted that the structure of the sub-instruction is consistent with the structure of the above-mentioned operation instruction, except that the above-mentioned operation instruction may include a single sub-instruction or multiple sub-instructions.

[0087] In this specification, except that the operation instructions corresponding to each node of the first type may include multiple sub-instructions, the operation instructions corresponding to other nodes in the mathematical tree all include a single sub-instruction. For the sake of convenience, the following description is given by taking the operation instructions as an example. Based on this, when the operation instructions corresponding to the node are generated according to the operation information, when the node is a node of the second type in the mathematical tree, the server can determine the slot identifier corresponding to the calculation result output by the sub-node corresponding to the node, and use it as the input identifier. The server then determines the slot identifier corresponding to the calculation result output by the node, and uses it as the output identifier. Determine the operation type in the operation information included in the node, and generate the operation instruction corresponding to the node according to the determined operation type, input identifier and output identifier.

[0088] Among them, the node of the second type is a node including an operation type, and the operation type is a mathematical operation type, i.e., square, addition, square root, subtraction, maximum value, etc. The second type is pre-set. The slot identifier is a unique identifier corresponding to the slot for storing data. The input identifier is an output identifier in the operation instruction corresponding to the child node. When the child node is a node of the first type, the input identifier is an identifier of the slot storing the initial data corresponding to the node of the first type. When the child node is a node of the second type, the input identifier is an identifier of the slot corresponding to the calculation result output by the child node, i.e., a slot identifier corresponding to the calculation result output by the child node. The process of generating the operation instruction corresponding to the node according to the determined operation type, input identifier and output identifier is similar to the process of generating the operation instruction corresponding to the node according to the slot identifier and operation type, and will not be repeated here.

[0089] When determining the slot identifier corresponding to the calculation result output by the node and using it as the output identifier, the server can randomly determine an identifier corresponding to a slot from the identifiers corresponding to the pre-divided slots, and use it as the slot identifier corresponding to the calculation result output by the node, that is, the output identifier. In addition, the server can also randomly determine a slot identifier from a pre-set set of free slot identifiers, and use it as the slot identifier corresponding to the calculation result output by the node, that is, the output identifier. The free slot identifier set is the identifier corresponding to some of the pre-divided slots, and the number of slot identifiers in the free slot identifier set is not greater than the number of pre-divided slots. As for which pre-divided slot identifiers are included in the free slot identifier set, it can be randomly determined by the server. In addition, the output identifier in the operation instruction corresponding to the first type of node can also be randomly determined from the free slot identifier set, and the specific process will not be repeated here.

[0090] In this specification, in order to avoid the reuse of a pre-allocated slot or the reuse of a slot identifier in a set of free slot identifiers, the server may randomly determine a slot identifier and then delete the randomly determined slot identifier from the identifiers corresponding to several pre-allocated slots or the set of free slot identifiers.

[0091] Based on this, since the slot identifier will be deleted from the identifiers corresponding to the pre-divided slots or the free slot identifier set after the slot identifier is determined, it is necessary to determine whether there are any identifiers in the identifiers corresponding to the pre-divided slots or the free slot identifier set when the output identifier is randomly determined. Therefore, taking the determination of the output identifier from the free slot identifier set as an example, the free slot identifier set may be empty. Therefore, when determining the slot identifier corresponding to the calculation result output by the node and using it as the output identifier, the server can first determine whether the pre-set free slot identifier set is empty. If so, the server can randomly determine a slot identifier from other slot identifier sets and use it as the slot identifier corresponding to the calculation result output by the node, that is, the output identifier. If not, the server can randomly determine a slot identifier from the pre-set free slot identifier set and use it as the slot identifier corresponding to the calculation result output by the node, that is, the output identifier.

[0092] Among them, the above-mentioned other slot identification set is a set of identifiers corresponding to the above-mentioned pre-divided slots except the identifiers in the above-mentioned pre-set free slot identification set, and the union of the above-mentioned other slot identification set and the above-mentioned pre-set free slot identification set is the identifier of the above-mentioned pre-divided slots, that is, the identifier of the above-mentioned pre-divided slots can be composed of the identifiers in the other slot identification set and the identifiers in the above-mentioned pre-set free slot identification set. It should be noted that the server first divides a number of slots and sets an identifier for each slot, and then divides the identifier corresponding to each slot to obtain the free slot identification set and the other slot identification set.

[0093] In addition, if all the identifiers corresponding to the above-mentioned pre-divided slots are used, that is, when determining the slot identifier corresponding to the calculation result output by the node and using it as the output identifier, the identifiers corresponding to the above-mentioned pre-divided slots are all determined as output identifiers, the server can continue to divide the slots, set the identifiers corresponding to the divided slots, and use them as the slot identifiers corresponding to the calculation result output by the node, that is, the output identifier.

[0094] In this specification, each node in the mathematical tree has a corresponding operation instruction, and the operation instruction sequence is composed of the operation instructions corresponding to each node, and the order of each operation instruction in the operation instruction sequence is the same as the order of the node sequence. It should be noted that if there is a constant node in the mathematical tree, the constant node has no corresponding operation instruction, and the operation instruction sequence does not have an operation instruction corresponding to the constant node. In addition, in order to improve the execution efficiency of the operation instruction sequence, each of the above-mentioned first type nodes can correspond to an operation instruction, and the operation instruction can be composed of a number of sub-instructions, the operation type, left input identifier, right input identifier and constant bit in the sub-instruction can all be empty, and the output identifier is an identifier corresponding to the slot for storing the initial data included in the first type of node.

[0095] The specific operation instruction sequence can be as follows Figure 4 As shown, Figure 4 A schematic diagram of an operation instruction sequence provided in this specification. Figure 4 The operation instruction sequence shown is based on Figure 2 The mathematical tree shown generates, Figure 4 The structures of the operation instructions in the operation instruction sequence shown are the same as Figure 3 The structures of the operation instructions shown are the same. Figure 4 The operation instruction sequence in includes operation instructions 1 to 10, wherein operation instruction 1 includes sub-instructions 1 to 3. Figure 4 The "unset" in means empty. Figure 4 The meaning of each position in the operation instruction is shown in the figure, namely "OPCODE (operator), OUT (output), LHS (left side), RHS (right side), IMM (constant)". Figure 4 Slot 0~2 in the command are slot identifiers, and are sub-instructions 1. Figure 2 The operation instruction corresponding to the node marked with "x" in the figure, sub-instruction 2 is Figure 2 The operation instruction corresponding to the node marked as "y" in the figure, sub-instruction 3 is Figure 2 Operation instruction 2 is the parent node of the node marked with "x" (i.e. Figure 2 The operation instruction corresponding to the node marked as "square 1" in the figure, and the operation instruction 3 is the parent node of the node marked as "y" (i.e. Figure 2 Operation instruction 4 is the parent node of the node corresponding to operation instruction 2 and the node corresponding to operation instruction 3 (i.e. Figure 2 The other operation instructions 4 to 10 are also respectively Figure 2 The nodes in the mathematical tree shown correspond to each other, so we will not repeat them here. The operation type and left input identifier (i.e. Figure 4 "LHS (left side)"), right input mark (i.e. Figure 4 "RHS (right side)") and constant bits (i.e. Figure 4 "IMM (constant)") is empty, and the output identifier is "slot0". The other sub-instructions 1~2 are similar to sub-instruction 1 in content, as shown below Figure 4 The operation type in operation instruction 2 is "square", the left input identifier is "slot0", the right input identifier and the constant bit are empty, and the output identifier is "slot0". Operation instructions 3 and 5 are similar to operation instruction 2 in content. Figure 4 The operation type in operation instruction 4 is "addition", the left input is marked as "slot0", the right input is marked as "slot1", the constant bit is empty, and the output is marked as "slot1". The other operation instructions 6~7 and operation instruction 10 are similar to the content of operation instruction 4. Figure 4 As shown, no further details will be given here. The operation type in operation instruction 8 is "subtraction", the left input mark is empty, the right input mark is "slot2", the constant bit is "0.5f", and the output mark is "slot1". The operation type in operation instruction 9 is "subtraction", the left input mark is "slot2", the right input mark is empty, the constant bit is "1.0f", and the output mark is "slot2". It should be noted that Figure 4 The operation instruction sequence shown is only an example, and this description does not limit the specific content of the operation instructions in the operation instruction sequence.

[0096] S106: Determine the directed distance from each voxel to the model to be rendered according to the operation instruction sequence through a graphics processor GPU.

[0097] In this specification, the server can determine the directed distance of each voxel to the model to be rendered through the graphics processing unit GPU according to the operation instruction sequence. Specifically, the server can determine the three-dimensional coordinates of each voxel in the model to be rendered in the space to be rendered, and then determine the directed distance of the voxel to the model to be rendered through the graphics processing unit GPU according to the three-dimensional coordinates of the voxel according to the operation instruction sequence. Among them, the space to be rendered is the three-dimensional space where the model to be rendered is located, and it can also be a space to be rendered that is pre-set based on the size of the model to be rendered, and the size of the space to be rendered is pre-set. It should be noted that the size or resolution of the space to be rendered is pre-set, and this specification does not specifically limit the specific size or resolution.

[0098] When determining the directed distance from the voxel to the model to be rendered according to the three-dimensional coordinates of the voxel and the sequence of operation instructions, the server can execute the operation instructions in the sequence of operation instructions in sequence according to the three-dimensional coordinates of the voxel, and use the execution result of the last operation instruction in the sequence of operation instructions as the directed distance from the voxel to the model to be rendered. It should be noted that the execution method of each operation instruction is to perform a mathematical operation corresponding to the operation type on the data stored in the slot corresponding to the left input identifier and the data stored in the slot corresponding to the right input identifier to obtain a calculation result, and then store the calculation result in the operation corresponding to the output identifier. If only one of the left input identifier and the right input identifier in the operation instruction is empty, the data stored in the constant bit is used as the data corresponding to the empty input identifier, and then the calculation is performed according to the above execution method. If the operation type, left input identifier, right input identifier and constant bit in the operation instruction are all empty, it means that the operation instruction is a sub-instruction, that is, the operation instruction corresponding to the first type of node, and any value in the three-dimensional coordinates of the voxel (that is, any one of the values ​​corresponding to x, y, and z) is directly stored in the slot corresponding to the output identifier. There are generally three sub-instructions of this type, and the three sub-instructions are used to store the numerical values ​​corresponding to x, y, and z respectively, that is, one sub-instruction is used to store the numerical value corresponding to the x coordinate in the three-dimensional coordinates into the slot corresponding to the output identifier, and one sub-instruction is used to store the numerical value corresponding to the y coordinate in the three-dimensional coordinates into the slot corresponding to the output identifier, and another sub-instruction is used to store the numerical value corresponding to the z coordinate in the three-dimensional coordinates into the slot corresponding to the output identifier.

[0099] In addition, in order to improve the calculation efficiency of the directed distance, each GPU thread in the GPU can calculate the directed distance from each voxel to the model to be rendered, so as to calculate the directed distance from each voxel to the model to be rendered in parallel, thereby saving calculation time. Therefore, the server can determine the three-dimensional coordinates of each voxel in the model to be rendered in the space to be rendered, and then determine the directed distance from the voxel to the model to be rendered according to the three-dimensional coordinates of the voxel and the sequence of operation instructions through the GPU thread corresponding to the voxel in the graphics processing unit GPU. Among them, the graphics processing unit GPU includes several GPU threads, and each GPU thread has a corresponding relationship with each voxel, that is, the server can assign the corresponding GPU thread to each voxel, so that the assigned GPU thread can calculate the directed distance from the voxel to the model to be rendered.

[0100] In this specification, in order to quickly calculate the directed distance from each voxel in the space to be rendered to the model to be rendered, the server may divide the space to be rendered, and then determine the range value of the directed distance from the divided interval to the model to be rendered based on the interval range corresponding to the divided interval, thereby obtaining the directed distance from each voxel in the space to be rendered to the model to be rendered. Specifically, in the above step S106, when the directed distance from each voxel to the model to be rendered is determined by the graphics processor GPU according to the operation instruction sequence, the server may divide the space to be rendered to obtain several first intervals of a first size. Determine the interval range corresponding to each first interval. Then, for each first interval, the graphics processor GPU performs interval calculation according to the interval range corresponding to the first interval and the operation instruction sequence to obtain the range value of the directed distance from the first interval to the model to be rendered, and then determines the directed distance from the voxel included in the first interval to the model to be rendered according to the range value of the directed distance corresponding to the first interval.

[0101] The first size is a preset size, and the interval range corresponding to the first interval can be determined according to the three-dimensional coordinates corresponding to each voxel in the first interval, and the three-dimensional coordinates of all voxels in the first interval are within the interval range. The interval range can be expressed as [(minimum x coordinate, minimum y coordinate, minimum z coordinate), (maximum x coordinate, maximum y coordinate, maximum z coordinate)], wherein the minimum x coordinate, the minimum y coordinate, and the minimum z coordinate are respectively the minimum value of the x coordinate, the minimum value of the y coordinate, and the minimum value of the z coordinate in the three-dimensional coordinates of all voxels in the first interval, and the maximum x coordinate, the maximum y coordinate, and the maximum z coordinate are respectively the maximum value of the x coordinate, the maximum value of the y coordinate, and the maximum value of the z coordinate in the three-dimensional coordinates of all voxels in the first interval. It should be noted that the operation instruction sequence in this specification can calculate the directed distance from a single voxel to the model to be rendered, and can also calculate the range value of the directed distance from a certain interval to the model to be rendered, that is, based on the interval range, the interval calculation is performed according to the operation instruction sequence to obtain the range value of the directed distance from the interval to the model to be rendered, and the interval calculation includes interval addition, interval subtraction, interval multiplication, interval division, interval intersection and interval union, etc. The range value of the directed distance can be expressed as [minimum directed distance value, maximum directed distance value].

[0102] In addition, after obtaining the interval ranges corresponding to each first interval, the server can also perform interval calculations for each first interval according to the interval range corresponding to the first interval and the operation instruction sequence through the GPU thread corresponding to the first interval in the graphics processing unit GPU, so as to obtain the range value of the directed distance from the first interval to the model to be rendered, and then determine the directed distance from the voxels included in the first interval to the model to be rendered according to the range value of the directed distance corresponding to the first interval.

[0103] In this specification, when the minimum directed distance value and the maximum directed distance value in the directed distance range value corresponding to the above-mentioned first interval are both greater than 0, it means that the first interval is outside the model to be rendered, and when the minimum directed distance value and the maximum directed distance value of the first interval are both less than 0, it means that the first interval is inside the model to be rendered, but when the directed distance range value of the first interval includes 0, that is, the maximum directed distance value is greater than 0, and the minimum directed distance value is less than 0, it means that part of the first interval is outside the model to be rendered, and the other part is inside the model to be rendered. When the minimum directed distance value and the maximum directed distance value of the first interval are both equal to 0, it means that the first interval is on the surface of the model to be rendered.

[0104] Based on this, for the case where the first interval is not completely inside, outside or on the surface of the model to be rendered, the server can continue to calculate the directed distance of each voxel in the first interval of this type to the model to be rendered. However, for the case where the first interval is completely inside or outside the model to be rendered, the server can directly use the directed distance range value corresponding to the first interval as the directed distance corresponding to the voxel in the first interval. It should be noted that at this time, all voxels in the first interval can be regarded as a whole, and the range value of the directed distance corresponding to the first interval can be directly used as the range value of the directed distance of this whole, that is, the directed distance of the voxel corresponding to the first interval. Therefore, when determining the directed distance of the voxel included in the first interval to the model to be rendered according to the range value of the directed distance corresponding to the first interval, the server can determine whether the first interval meets the first condition according to the range value of the directed distance from the first interval to the model to be rendered. If so, for each voxel in the first interval, the graphics processor GPU is used to determine the directed distance of the voxel to the model to be rendered according to the three-dimensional coordinates of the voxel in the space to be rendered and the operation instruction sequence. If not, the range value of the directed distance from the first interval to the model to be rendered is used as the directed distance from the voxel included in the first interval to the model to be rendered. The first condition is that the maximum directed distance value in the range value of the directed distance corresponding to the interval is greater than 0, and the minimum directed distance value is less than 0, or the range value of the directed distance corresponding to the interval includes 0.

[0105] In addition, in order to calculate quickly, the server can also determine whether the first interval meets the first condition based on the range value of the directed distance from the first interval to the model to be rendered. If so, the first interval is used as the interval to be divided, and the interval to be divided is divided to obtain a plurality of second intervals of the second size. For each second interval corresponding to the first interval, the graphics processor GPU is used to perform interval calculation according to the interval range corresponding to the second interval and the operation instruction sequence to obtain the range value of the directed distance from the second interval to the model to be rendered, and then the directed distance from the voxel included in the second interval to the model to be rendered is determined based on the range value of the directed distance corresponding to the second interval. If not, the range value of the directed distance from the first interval to the model to be rendered is used as the directed distance from the voxel included in the first interval to the model to be rendered. Wherein, the second size is pre-set, and the second size is smaller than the first size. The above process of performing interval calculation according to the interval range corresponding to the second interval and the operation instruction sequence to obtain the range value of the directed distance from the second interval to the model to be rendered, and then determining the directed distance from the voxels included in the second interval to the model to be rendered according to the range value of the directed distance corresponding to the second interval is similar to the above process of performing interval calculation according to the interval range corresponding to the first interval and the operation instruction sequence to obtain the range value of the directed distance from the first interval to the model to be rendered, and determining the directed distance from the voxels included in the first interval to the model to be rendered according to the range value of the directed distance corresponding to the first interval, and will not be repeated here.

[0106] In addition, when determining the directed distance from the voxels included in the second interval to the model to be rendered according to the range value of the directed distance corresponding to the second interval, if the second interval also satisfies the first condition, the server can continue to re-use the second interval that satisfies the first condition as the interval to be divided, and continue to divide the re-determined interval to be divided to obtain a plurality of third intervals of the third size, and continue to perform interval calculation according to the interval range corresponding to the third interval and the operation instruction sequence for each third interval corresponding to the second interval through the graphics processor GPU to obtain the range value of the directed distance from the third interval to the model to be rendered, and then determine the directed distance from the voxels included in the third interval to the model to be rendered according to the range value of the directed distance corresponding to the third interval. If not, the range value of the directed distance from the second interval to the model to be rendered is used as the directed distance from the voxels included in the second interval to the model to be rendered. Wherein, the third size is pre-set, and the third size is smaller than the second size.

[0107] It should be noted that the size used each time the interval is divided is always smaller than the size used in the last interval division, that is, the size used in the current interval division is smaller than the size used in the last interval division. The number of interval divisions mentioned above can be preset, or the server can preset the end condition of the interval division, and the end condition of the interval division can be that the size of the currently divided interval reaches the size threshold, so when the currently divided interval reaches the size threshold, or the number of times the current interval is divided reaches the number threshold, and the currently divided interval also meets the first condition, the server can directly calculate the directed distance of each voxel included in the currently divided interval to the model to be rendered. Based on this, taking the currently divided interval as the second interval as an example, after obtaining several second intervals of the second size, the server can determine whether the number of times the current interval is divided reaches the number threshold, or it can also determine whether the second interval meets the end condition of the interval division. If so, the server can directly determine the directed distance of the voxel included in the second interval to the model to be rendered according to the three-dimensional coordinates corresponding to the voxel included in the second interval according to the operation instruction sequence for each second interval through the graphics processor GPU. If not, the server can perform interval calculation for each second interval corresponding to the first interval through the graphics processor GPU, according to the interval range corresponding to the second interval, and according to the operation instruction sequence to obtain the range value of the directed distance from the second interval to the model to be rendered, and then determine the directed distance from the voxels included in the second interval to the model to be rendered according to the range value of the directed distance corresponding to the second interval.

[0108] S108: Determine the observation angle corresponding to the model to be rendered, and render the model to be rendered according to the observation angle and each directed distance to obtain a rendered image corresponding to the observation angle.

[0109] In this specification, the server can determine the observation angle corresponding to the model to be rendered, and render the model to be rendered according to the observation angle and each directed distance to obtain a rendered image corresponding to the observation angle. Among them, the observation angle includes the observation position, depression angle, elevation angle, etc., and the observation angle can be a preset angle. When the model to be rendered is rendered according to the observation angle and each directed distance to obtain a rendered image corresponding to the observation angle, the server can use a preset rendering technology according to the observation angle and each directed distance to render the model to be rendered to obtain a rendered image corresponding to the observation angle. The rendering technology can be any existing technology, and can also be a preset rendering algorithm or rendering model, and this specification does not make any specific limitations.

[0110] It can be seen from the above method that when rendering a three-dimensional model, the server can first determine the implicit function corresponding to the model to be rendered. Based on the implicit function, determine the calculation logic for calculating the directed distance from each voxel in the to-be-rendered space corresponding to the model to be rendered to the model to be rendered. Then generate a sequence of operation instructions for implementing the calculation logic. Through the graphics processor GPU, according to the sequence of operation instructions, determine the directed distance from each voxel to the model to be rendered. Determine the observation angle corresponding to the model to be rendered, and render the model to be rendered according to the observation angle and each directed distance to obtain a rendered image corresponding to the observation angle. By first generating a sequence of operation instructions for implementing the calculation logic, and then having the GPU calculate the directed distance from each voxel to the model to be rendered according to the sequence of operation instructions, the calculation efficiency is improved, thereby improving the rendering efficiency.

[0111] Furthermore, the GPU thread in the GPU can calculate the directed distance from each voxel in the space to be rendered to the model to be rendered in parallel according to the operation instruction sequence, which significantly improves the efficiency of calculating the directed distance, thereby improving the rendering efficiency.

[0112] Furthermore, the space to be rendered can be divided to obtain several first intervals, and then based on the interval range of each first interval, interval calculation is performed according to the operation instruction sequence to obtain the directed distance from each voxel in the space to be rendered to the model to be rendered, thereby speeding up the efficiency of calculating the directed distance and improving the efficiency and accuracy of rendering.

[0113] In this specification, in order to save storage space and optimize memory usage, the server can release the slot corresponding to the data after the last use of the data to store other data. Therefore, when the slot identifier corresponding to the calculation result output by the node is determined in the above step S104 and used as the output identifier, Figure 5 As shown, Figure 5 A schematic diagram of a process for determining an output identifier provided in this specification, the server can determine the calling relationship between a child node and other nodes in a mathematical tree except the child node. According to the calling relationship, it is determined whether the current child node has reached the calling end condition. If so, the input identifier is placed in a pre-set free slot identifier set, and the slot identifier corresponding to the calculation result output by the node is determined from the free slot identifier set after placement, and used as the output identifier. If not, the input identifier is not placed in a pre-set free slot identifier set, and the slot identifier corresponding to the calculation result output by the node is determined from the free slot identifier set, and used as the output identifier.

[0114] Among them, the call relationship refers to the relationship between a child node and the parent node of the child node. When the child node has a parent node, there is a call relationship between the child node and its parent node. The child node has as many call relationships as the number of parent nodes it has. The above-mentioned call end condition refers to the fact that all parent nodes of the child node currently have corresponding operation instructions, that is, the operation instructions corresponding to all parent nodes of the child node have been generated. When there is any parent node of the child node that has not generated a corresponding operation instruction, it means that the child node has not yet reached the call end condition. At this time, the slot identifier corresponding to the calculation result output by the child node cannot be released, that is, the input identifier cannot be placed in the free slot identifier set. The server can directly randomly determine a slot identifier from the free slot identifier set and use it as the slot identifier corresponding to the calculation result output by the node, that is, the output identifier. When all the parent nodes of the child node have generated corresponding operation instructions, it means that the child node has reached the call end condition. At this time, the slot identifier corresponding to the calculation result output by the child node can be released, that is, the input identifier can be placed in the free slot identifier set. The server can randomly determine a slot identifier from the free slot identifier set after placement, and use it as the slot identifier corresponding to the calculation result output by the node, that is, the output identifier.

[0115] When determining the calling relationship between the child node and other nodes in the mathematical tree except the child node, the server can determine the calling relationship between the child node and other nodes in the mathematical tree except the child node from a pre-recorded calling relationship table. The calling relationship table is pre-recorded, that is, the server can simultaneously record the calling relationship between each node in the mathematical tree when generating the node sequence, and generate the calling relationship table. The calling relationship table includes the calling relationship between each node in the mathematical tree.

[0116] In this specification, the above-mentioned operation instruction sequence may also include an end instruction, which has no corresponding relationship with any node in the mathematical tree. The end instruction is used to indicate the end of the calculation. The operation type, left input identifier, right input identifier and constant bit in the end instruction are all empty, and the output identifier is the output identifier in the operation instruction corresponding to the root node in the above-mentioned mathematical tree. Specifically, Figure 6 As shown, Figure 6 is a schematic diagram of another operation instruction sequence provided in this specification, Figure 6 The operation instructions 1 to 10 shown are Figure 4 The operation instructions 1 to 10 in the operation instruction sequence shown are consistent, and Figure 6 The operation instruction 11 in the operation instruction is an end instruction, and the output identifier of the operation instruction 11 is consistent with the output identifier in the operation instruction 10, that is, "slot2".

[0117] In this specification, in order to improve the efficiency of calculation, the server can divide the above operation instruction sequence, and then calculate the directed distance from the voxel to the model to be rendered based on the optimized operation instruction sequence. Therefore, the operation instruction includes the operation type and the slot identifier, the slot identifier is a unique identifier corresponding to the slot for storing data, and the slot identifier includes an input identifier and an output identifier, and after the range value of the directed distance from each first interval to the model to be rendered is obtained in the above step S106, as Figure 7 As shown, Figure 7 A schematic diagram of a process of optimizing an operation instruction sequence provided in this specification, the server can also start from the end of the operation instruction sequence, and for each operation instruction in the operation instruction sequence, when the operation instruction is located at the end of the operation instruction sequence, mark the output identifier in the operation instruction as the target type. When the operation instruction is not located at the end of the operation instruction sequence, determine whether the operation type of the operation instruction is a specified type. If so, the server can determine the contribution corresponding to the input identifier in the operation instruction according to the range value of the directed distance corresponding to each first interval, and according to the contribution, use the input identifier corresponding to the maximum contribution as the target identifier, and mark the target identifier as the first type, determine the node in the mathematical tree included in the node with the data stored in the slot corresponding to the target identifier as the output calculation result, and mark the output identifier in the operation instruction corresponding to all the child nodes of the determined node as the target type. If not, mark the output identifier in the operation instruction as the target type. Afterwards, determine the operation instruction whose output identifier is marked as the target type in the operation instruction sequence, and construct an optimized instruction sequence including the determined operation instruction.

[0118] Among them, the above process of starting from the end of the operation instruction sequence and sequentially targeting each operation instruction in the operation instruction sequence is actually a reverse traversal of the operation instruction sequence. The above target type is preset, and the target type can be "active". When the output identifier is marked as the target type, it means that the operation instruction corresponding to the output identifier is an instruction that does not need to be optimized, and the operation instruction is in the optimized instruction sequence. However, when the output identifier is not marked as the target type, it means that the operation instruction corresponding to the output identifier is an instruction that needs to be optimized, and the operation instruction is not in the optimized instruction sequence. The above optimized instruction sequence is an instruction sequence obtained after optimizing the above operation instruction sequence. The optimized instruction sequence includes some or all of the operation instructions in the above operation instruction sequence. The above specified type is preset, and the instruction type is intersection (max) or union (min). The contribution degree represents the degree of influence of the data stored in the slot corresponding to the input identifier corresponding to the node on the calculation result output by the node. The contribution degree can be determined based on the data stored in the slot corresponding to the input identifier corresponding to the node and the calculation result output by the node.

[0119] Specifically, when determining the contribution corresponding to the input identifier in the operation instruction according to the range value of the directed distance corresponding to each first interval, the server can determine the range value of the directed distance corresponding to the first interval for each first interval, and use it as the initial distance. Determine two input identifiers in the operation instruction, and use them as the first input identifier and the second input identifier. Set the first input identifier in the operation instruction to be empty to update the operation instruction sequence to obtain the first operation instruction sequence, that is, clear the first input identifier in the operation instruction to update the operation instruction sequence to obtain the first operation instruction sequence. According to the interval range corresponding to the first interval, according to the first operation instruction sequence, determine the range value of the directed distance corresponding to the first interval, and use it as the first distance. Similarly, the server can also set the second input identifier in the operation instruction to be empty, update the operation instruction sequence, and obtain the second operation instruction sequence, that is, clear the second input identifier in the operation instruction to update the operation instruction sequence, and obtain the second operation instruction sequence. According to the interval range corresponding to the first interval, according to the second operation instruction sequence, determine the range value of the directed distance corresponding to the first interval, and use it as the second distance. Determine the first difference between the first distance and the initial distance. Determine the second difference between the second distance and the initial distance. According to the first difference corresponding to each first interval, determine the contribution corresponding to the first input identifier in the operation instruction. According to the second difference corresponding to each first interval, determine the contribution corresponding to the second input identifier in the operation instruction. Among them, the above-mentioned first difference may be the absolute value of the difference between the first distance and the initial distance, and the second difference may be the absolute value of the difference between the second distance and the initial distance. The above-mentioned contribution may be the average value of the differences corresponding to each interval, that is, the server may use the average value of the first differences corresponding to each first interval as the contribution corresponding to the first input identifier in the operation instruction, and use the average value of the second differences corresponding to each first interval as the contribution corresponding to the second input identifier in the operation instruction.

[0120] The above target identifier is the input identifier corresponding to the maximum contribution, and the output identifier in the operation instruction corresponding to the node whose calculation result is the data stored in the slot corresponding to the target identifier as the output is the above target identifier. All child nodes of the determined node include the child nodes of the determined node itself and the nodes with the child nodes as parent nodes. The output identifiers of the operation instructions in the above optimization instruction sequence are all marked as the first type.

[0121] In this specification, after obtaining the optimization instruction sequence, the server can also perform interval calculation on each second interval according to the optimization instruction sequence, so as to continue to calculate the directed distance from the voxel in the subdivided second interval to the model to be rendered through the optimization instruction sequence, thereby optimizing the rendering process. Specifically, when determining the directed distance from the voxel included in the first interval to the model to be rendered according to the range value of the directed distance corresponding to the first interval, the server can determine whether the first interval meets the first condition according to the range value of the directed distance from the first interval to the model to be rendered, and if so, use the first interval as the interval to be divided. Divide the interval to be divided to obtain a plurality of second intervals of a second size. For each second interval, through the GPU thread corresponding to the second interval, according to the interval range corresponding to the second interval, perform interval calculation according to the optimization instruction sequence to obtain the range value of the directed distance from the second interval to the model to be rendered, and then determine the directed distance from the voxel included in the second interval to the model to be rendered according to the range value of the directed distance corresponding to the second interval. If not, the range value of the directed distance from the first interval to the model to be rendered is used as the directed distance from the voxels included in the first interval to the model to be rendered. Of course, the server can also replace the operation instruction sequence used in the process of performing interval calculation on other intervals (i.e., the second interval and the third interval) except for calculating the first interval with the optimization instruction sequence, and the specific process is not repeated here. It should be noted that the above-mentioned optimization instruction sequence is only used in the process of interval calculation, and the calculation of a single voxel is still calculated using the above-mentioned operation instruction sequence.

[0122] In this specification, the above-mentioned model to be rendered complies with C0 continuity, which is also called position continuity, which means that the positions of two curves or two surfaces at the connection point are continuous, that is, they intersect at this point but do not necessarily have the same tangent direction or curvature. In addition, the above-mentioned model to be rendered can also be a large model obtained by splicing several models that can be represented by explicit mathematical expressions, that is, constructive solid geometry, and the large model can be represented by explicit mathematical expressions, that is, unambiguous entity representation. The mathematical function in the implicit function corresponding to the large model includes several mathematical operations, that is, the operation instruction sequence corresponding to the large model may include several operation instructions.

[0123] The above are one or more implementation methods of this specification. Based on the same idea, this specification also provides a corresponding three-dimensional model rendering device, such as Figure 8 shown.

[0124] Figure 8 A schematic diagram of a three-dimensional model rendering device provided in this specification includes:

[0125] A determination module, used to determine an implicit function corresponding to a model to be rendered; wherein the model to be rendered is a closed three-dimensional model;

[0126] A construction module, used for determining, based on the implicit function, a calculation logic for calculating a directed distance from each voxel in the to-be-rendered space corresponding to the to-be-rendered model to the to-be-rendered model;

[0127] A generating module, used for generating an operation instruction sequence for implementing the computing logic;

[0128] A processing module, used for determining the directed distance from each voxel to the model to be rendered according to the operation instruction sequence through a graphics processing unit GPU;

[0129] The rendering module is used to determine the observation angle corresponding to the model to be rendered, and render the model to be rendered according to the observation angle and each directed distance to obtain a rendered image corresponding to the observation angle.

[0130] Optionally, the generation module 204 is specifically used to construct a mathematical tree corresponding to the model to be rendered according to the calculation logic and using a preset construction algorithm; wherein the nodes in the mathematical tree include operation information; determine a node sequence corresponding to the mathematical tree; determine the operation information included in each node in the node sequence in turn; generate an operation instruction corresponding to the node according to the operation information; and generate an operation instruction sequence corresponding to the model to be rendered according to the order of the node sequence.

[0131] Optionally, the operation information includes initial data and operation type;

[0132] The generation module 204 is specifically used to, when the node is a node of the first type in the mathematical tree, determine the slot identifier corresponding to the initial data included in the node; generate an operation instruction corresponding to the node according to the slot identifier and the operation type; wherein the slot identifier is a unique identifier corresponding to the slot used to store data.

[0133] Optionally, the operation information includes an operation type;

[0134] The generation module 204 is specifically used to, when the node is a node of the second type in the mathematical tree, determine the child node corresponding to the node; determine the slot identifier corresponding to the calculation result output by the child node and use it as an input identifier; wherein the slot identifier is a unique identifier corresponding to the slot used to store data; determine the slot identifier corresponding to the calculation result output by the node and use it as an output identifier; determine the operation type in the operation information included in the node, and generate the operation instruction corresponding to the node according to the determined operation type, the input identifier and the output identifier.

[0135] Optionally, the generation module 204 is specifically used to determine the calling relationship between the child node and other nodes in the mathematical tree except the child node; based on the calling relationship, determine whether the current child node meets the calling end condition; if so, place the input identifier into a pre-set free slot identifier set, and determine the slot identifier corresponding to the calculation result output by the node from the free slot identifier set after placement, and use it as the output identifier; if not, do not place the input identifier into the pre-set free slot identifier set, and determine the slot identifier corresponding to the calculation result output by the node from the free slot identifier set, and use it as the output identifier.

[0136] Optionally, the processing module 206 is specifically used to divide the space to be rendered to obtain several first intervals of a first size; determine the interval range corresponding to each first interval; for each first interval, through the GPU thread corresponding to the first interval in the graphics processor GPU, according to the interval range corresponding to the first interval, perform interval calculation according to the operation instruction sequence to obtain the range value of the directed distance from the first interval to the model to be rendered; according to the range value of the directed distance corresponding to the first interval, determine the directed distance from the voxel included in the first interval to the model to be rendered.

[0137] Optionally, the operation instruction includes an operation type and a slot identifier, where the slot identifier is a unique identifier corresponding to a slot for storing data, and the slot identifier includes an input identifier and an output identifier;

[0138] The device also includes:

[0139] The optimization module 210 is used to start from the end of the operation instruction sequence, and for each operation instruction in the operation instruction sequence in turn, when the operation instruction is at the end of the operation instruction sequence, mark the output identifier in the operation instruction as the target type; when the operation instruction is not at the end of the operation instruction sequence, determine whether the operation type of the operation instruction is the specified type; if so, determine the contribution corresponding to the input identifier in the operation instruction according to the range value of the directed distance corresponding to each of the first intervals, and according to the contribution, use the input identifier corresponding to the maximum contribution as the target identifier, and mark the target identifier as the target type, determine the node included in the mathematical tree that uses the data stored in the slot corresponding to the target identifier as the output calculation result, and mark the output identifier in the operation instruction corresponding to all child nodes of the determined node as the target type; if not, mark the output identifier in the operation instruction as the target type; determine the operation instruction with the output identifier marked as the target type in the operation instruction sequence, and construct an optimized instruction sequence including the determined operation instruction.

[0140] This specification also provides a computer-readable storage medium, which stores a computer program, which can be used to execute the above Figure 1 A rendering method of a three-dimensional model is provided.

[0141] This manual also provides Fig. 9 The one shown corresponds to Figure 1 A schematic diagram of the electronic device. Fig. 9 As shown, at the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and may also include other hardware required for the business. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to achieve the above Figure 1 The rendering method of the three-dimensional model.

[0142] Of course, in addition to software implementation, this specification does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is to say, the executor of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0143] In the 1990s, it was very clear whether the improvement of a technology was hardware improvement (for example, improvement of the circuit structure of diodes, transistors, switches, etc.) or software improvement (improvement of the method flow). However, with the development of technology, many improvements of the method flow today can be regarded as direct improvements of the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that the improvement of a method flow cannot be implemented with hardware entity modules. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask chip manufacturers to design and make dedicated integrated circuit chips. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one kind of HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages ​​and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.

[0144] The controller may be implemented in any suitable manner, for example, the controller may take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (e.g., software or firmware) executable by the (micro)processor, a logic gate, a switch, 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, and the memory controller may also be implemented as part of the control logic of the memory. It is also known to those skilled in the art that, in addition to implementing the controller in a purely computer-readable program code manner, the controller may be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, such a controller may be considered as a hardware component, and the devices for implementing various functions included therein may also be considered as structures within the hardware component. Or even, the devices for implementing various functions may be considered as both software modules for implementing the method and structures within the hardware component.

[0145] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, 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.

[0146] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0147] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this specification may 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.

[0148] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0149] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0150] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0151] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0152] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0153] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. 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 technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0154] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0155] It should be understood by those skilled in the art that the embodiments of this specification may be provided as methods, systems or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, this specification may 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.

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

[0157] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0158] The above description is only an embodiment of the present specification and is not intended to limit the present specification. For those skilled in the art, the present specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification shall be included in the scope of the claims of the present specification.

Claims

1. A method for rendering a three-dimensional model, characterized in that: include: Determine an implicit function corresponding to the model to be rendered; wherein the model to be rendered is a closed three-dimensional model; Based on the implicit function, determining a calculation logic for calculating a directed distance from each voxel in the to-be-rendered space corresponding to the to-be-rendered model to the to-be-rendered model; generating a sequence of operation instructions for implementing the computing logic; Determine the directed distance from each voxel to the model to be rendered according to the operation instruction sequence by means of a graphics processing unit (GPU); Determining an observation angle corresponding to the model to be rendered, and rendering the model to be rendered according to the observation angle and each directed distance to obtain a rendered image corresponding to the observation angle; The step of generating an operation instruction sequence for implementing the computing logic specifically includes: According to the calculation logic, a preset construction algorithm is used to construct a mathematical tree corresponding to the model to be rendered; wherein the nodes in the mathematical tree include operation information; Determine a node sequence corresponding to the mathematical tree; For each node in the node sequence, determine the operation information included in the node; Generate an operation instruction corresponding to the node according to the operation information; The operation instructions corresponding to each node are generated into an operation instruction sequence corresponding to the model to be rendered according to the order of the node sequence; Wherein, the operation information includes initial data and operation type; Generate an operation instruction corresponding to the node according to the operation information, specifically including: When the node is a node of the first type in the mathematical tree, determining a slot identifier corresponding to initial data included in the node; Generate an operation instruction corresponding to the node according to the slot identifier and the operation type; wherein the slot identifier is a unique identifier corresponding to the slot used to store data; Generate an operation instruction corresponding to the node according to the operation information, specifically including: When the node is a node of the second type in the mathematical tree, determining a child node corresponding to the node; Determine the slot identifier corresponding to the calculation result output by the subnode and use it as the input identifier; wherein the slot identifier is a unique identifier corresponding to the slot used to store data; Determine the slot identifier corresponding to the calculation result output by the node and use it as the output identifier; Determine the operation type in the operation information included in the node, and generate an operation instruction corresponding to the node according to the determined operation type, the input identifier and the output identifier; Determine the slot identifier corresponding to the calculation result output by the node and use it as the output identifier, including: Determine a calling relationship between the child node and other nodes in the mathematical tree except the child node; According to the calling relationship, determining whether the current child node has reached the calling end condition; If yes, place the input identifier into a preset free slot identifier set, and determine the slot identifier corresponding to the calculation result output by the node from the free slot identifier set after placement, and use it as the output identifier; If not, the input identifier is not placed into a preset free slot identifier set, and a slot identifier corresponding to the calculation result output by the node is determined from the free slot identifier set and used as the output identifier; Determining the directed distance from each voxel to the model to be rendered according to the operation instruction sequence through a graphics processor GPU, specifically including: Dividing the space to be rendered to obtain a plurality of first intervals of a first size; Determine the interval ranges corresponding to the first intervals respectively; For each first interval, a GPU thread corresponding to the first interval in a graphics processor GPU performs interval calculation according to an interval range corresponding to the first interval and according to the operation instruction sequence to obtain a range value of a directed distance from the first interval to the model to be rendered; According to the range value of the directed distance corresponding to the first interval, the directed distance between the voxels included in the first interval and the model to be rendered is determined.

2. The method according to claim 1, characterized in that The operation instruction includes an operation type and a slot identifier, wherein the slot identifier is a unique identifier corresponding to a slot for storing data, and the slot identifier includes an input identifier and an output identifier; The method further comprises: Starting from the end of the operation instruction sequence, for each operation instruction in the operation instruction sequence, when the operation instruction is at the end of the operation instruction sequence, marking the output identifier in the operation instruction as a target type; When the operation instruction is not at the end of the operation instruction sequence, determine whether the operation type of the operation instruction is a specified type; if so, determine the contribution corresponding to the input identifier in the operation instruction according to the range value of the directed distance corresponding to each of the first intervals, and according to the contribution, use the input identifier corresponding to the maximum contribution as the target identifier, and mark the target identifier as the target type, determine the node included in the mathematical tree that uses the data stored in the slot corresponding to the target identifier as the output calculation result, and mark the output identifier in the operation instruction corresponding to all child nodes of the determined node as the target type; if not, mark the output identifier in the operation instruction as the target type; Determine the operation instructions whose output identification marks them as the target type in the operation instruction sequence, and construct an optimized instruction sequence including the determined operation instructions.

3. A 3D model rendering device, characterized in that: include: A determination module, used to determine an implicit function corresponding to a model to be rendered; wherein the model to be rendered is a closed three-dimensional model; A construction module, used for determining, based on the implicit function, a calculation logic for calculating a directed distance from each voxel in the to-be-rendered space corresponding to the to-be-rendered model to the to-be-rendered model; A generating module, used for generating an operation instruction sequence for implementing the computing logic; A processing module, used for determining the directed distance from each voxel to the model to be rendered according to the operation instruction sequence through a graphics processing unit GPU; A rendering module, used to determine the observation angle corresponding to the model to be rendered, and render the model to be rendered according to the observation angle and each directed distance to obtain a rendered image corresponding to the observation angle; The generation module is specifically used to construct a mathematical tree corresponding to the model to be rendered according to the calculation logic and a preset construction algorithm; wherein the nodes in the mathematical tree include operation information; determine a node sequence corresponding to the mathematical tree; determine the operation information included in each node in the node sequence in turn; generate an operation instruction corresponding to the node according to the operation information; generate an operation instruction sequence corresponding to the model to be rendered according to the operation instructions corresponding to each node in the order of the node sequence; Wherein, the operation information includes initial data and operation type; The generating module is specifically used to, when the node is a node of the first type in the mathematical tree, determine a slot identifier corresponding to the initial data included in the node; and generate an operation instruction corresponding to the node according to the slot identifier and the operation type; wherein the slot identifier is a unique identifier corresponding to the slot used to store data; The generating module is specifically used to, when the node is a node of the second type in the mathematical tree, determine the child node corresponding to the node; determine the slot identifier corresponding to the calculation result output by the child node and use it as the input identifier; wherein the slot identifier is a unique identifier corresponding to the slot for storing data; determine the slot identifier corresponding to the calculation result output by the node and use it as the output identifier; determine the operation type in the operation information included in the node, and generate the operation instruction corresponding to the node according to the determined operation type, the input identifier and the output identifier; The generation module is specifically used to determine the calling relationship between the child node and other nodes in the mathematical tree except the child node; according to the calling relationship, determine whether the current child node meets the calling end condition; if so, place the input identifier into a preset free slot identifier set, and determine the slot identifier corresponding to the calculation result output by the node from the free slot identifier set after placement, and use it as the output identifier; if not, do not place the input identifier into the preset free slot identifier set, and determine the slot identifier corresponding to the calculation result output by the node from the free slot identifier set, and use it as the output identifier; The processing module is specifically used to divide the space to be rendered to obtain a plurality of first intervals of a first size; determine the interval ranges corresponding to each of the first intervals; for each first interval, perform interval calculation according to the interval range corresponding to the first interval and the operation instruction sequence through a GPU thread corresponding to the first interval in a graphics processor GPU to obtain a range value of a directed distance from the first interval to the model to be rendered; and determine the directed distance from the voxel included in the first interval to the model to be rendered according to the range value of the directed distance corresponding to the first interval.

4. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method described in any one of claims 1 to 2 is implemented.

5. 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, the method described in any one of claims 1 to 2 is implemented.

Citation Information

Patent Citations

  • Data storage system and method based on persistent learning index

    CN118312092A

  • Image rendering apparatus and method

    US20220254094A1