Three-dimensional model rendering method, device and equipment and computer readable storage medium

通过生成材质贴图和获取材质参数信息,并建立关联关系,针对性渲染待渲染对象的三维模型,解决了现有渲染软件中材质参数和贴图有限的问题,提升了渲染效果与匹配度。

CN120047588APending Publication Date: 2025-05-27XIAN HEHUA RUIBO TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411595257.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-08
Publication Date
2025-05-27

AI Technical Summary

Technical Problem

The pre-set material parameters and material maps in existing rendering software are limited, and specific objects to be rendered cannot be rendered in a targeted manner, resulting in the same rendering effect of different objects to be rendered, and the rendering effect of the three-dimensional model is poor.

Method used

By obtaining the model file of the object to be rendered, a material map is generated based on the vertex normal information, and material parameter information corresponding to the material type of the object to be rendered, a correlation between the material map, material parameter information and model file is established, and targeted rendering is performed.

Benefits of technology

It realizes targeted rendering for specific objects to be rendered, improves the matching between the rendering effect of the three-dimensional model and the objects to be rendered, and ensures high-quality rendering of three-dimensional models in the medical field.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120047588A_ABST
    Figure CN120047588A_ABST
Patent Text Reader

Abstract

The invention discloses a three-dimensional model rendering method, device and equipment and a computer readable storage medium. The method comprises the steps that a first model file of a to-be-rendered object is acquired, the first model file comprises triangular patch information of the to-be-rendered object, the to-be-rendered object comprises at least one of an object included in a medical image, a prosthesis used for being implanted into a body and a medical device, and the triangular patch information comprises vertex normal information; based on the vertex normal information, generating a texture map corresponding to the first model file; obtaining material parameter information corresponding to the material type of the to-be-rendered object; establishing an association relationship among the material chartlet, the material parameter information and the first model file; and rendering the first model file based on the incidence relation, the material chartlet and the material parameter information to obtain a rendered three-dimensional model. According to the rendering method of the three-dimensional model, the rendering effect of the three-dimensional model in the medical field can be ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of medicine, and particularly relates to a method, apparatus, device, and computer-readable storage medium for rendering a three-dimensional model. Background Art

[0002] The application prospect of rendering technology in the medical field is broad. It can not only provide more intuitive and detailed image information but also assist doctors in making more accurate diagnoses and treatment plans.

[0003] Currently, in the medical field, the rendering method usually involves importing the model file of the object to be rendered into rendering software, and then using the rendering software to render the model file based on the material parameters and material textures pre-set in the rendering software, so as to obtain a three-dimensional (3D) model of the object to be rendered.

[0004] However, the pre-set material parameters and material textures in the rendering software are limited and cannot perform targeted rendering on specific objects to be rendered, resulting in the same rendering effects for different objects to be rendered and poor rendering effects of the three-dimensional model. Summary of the Invention

[0005] Embodiments of this application provide a method, apparatus, device, computer-readable storage medium, and computer program product for rendering a three-dimensional model, which can ensure the rendering effect of the three-dimensional model in the medical field.

[0006] In a first aspect, embodiments of this application provide a method for rendering a three-dimensional model, the method comprising:

[0007] Obtain a first model file of the object to be rendered, where the first model file includes triangular patch information of the object to be rendered, and the object to be rendered includes at least one of the following: an object included in a medical image, a prosthesis to be implanted into the body, and a medical device, and the triangular patch information includes vertex normal information;

[0008] Generate a material texture corresponding to the first model file based on the vertex normal information;

[0009] Obtain material parameter information corresponding to the material type of the object to be rendered;

[0010] Establish an association relationship among the material texture, the material parameter information, and the first model file;

[0011] Render the first model file based on the association relationship, the material texture, and the material parameter information to obtain a rendered three-dimensional model.

[0012] In a possible implementation, obtaining the first model file of the object to be rendered includes:

[0013] Obtaining the initial model file of the object to be rendered, where the initial model file includes triangular patch information of the object to be rendered, and the triangular patch information includes vertex information corresponding to a plurality of triangular patches;

[0014] Based on the vertex information, determining the vertex normal of each vertex in each triangular patch to obtain vertex normal information;

[0015] Updating the initial model file with the vertex normal information to obtain the first model file.

[0016] In a possible implementation, based on the vertex information, determining the vertex normal of each vertex in each triangular patch includes:

[0017] Based on the vertex information, calculating the face normal of each triangular patch;

[0018] For each vertex, determining at least one target triangular patch including the vertex among the plurality of triangular patches;

[0019] For each vertex, calculating the average value of the face normals corresponding to the at least one target triangular patch to obtain the vertex normal.

[0020] In a possible implementation, for each vertex, calculating the average value of the face normals corresponding to the at least one target triangular patch to obtain the vertex normal includes:

[0021] Screening a plurality of target face normals with a direction angle greater than a preset threshold among the plurality of face normals;

[0022] For each vertex, calculating the average value of the target face normals corresponding to the at least one target triangular patch to obtain the vertex normal.

[0023] In a possible implementation, based on the vertex information, determining the vertex normal of each vertex in each triangular patch to obtain vertex normal information includes:

[0024] Based on the vertex information, determining the vertex normal of each vertex in each triangular patch;

[0025] Performing linear interpolation on the vertex normals to obtain interpolated normals;

[0026] Determining the vertex normal information according to the vertex normals and the interpolated normals.

[0027] In a possible implementation, obtaining the material parameter information corresponding to the material type of the object to be rendered includes:

[0028] Obtaining the material type of the object to be rendered;

[0029] Determining the material parameter information corresponding to the material type of the object to be rendered according to the correspondence between the material type and the material parameter information.

[0030] In a possible implementation, obtaining the material type of the object to be rendered includes:

[0031] Reading the file name of the first model file, where the file name has an associated relationship with the object to be rendered;

[0032] Determining the material type of the object to be rendered according to the correspondence between the file name and the material type.

[0033] In a possible implementation, establishing the association relationship between the material texture map, the material parameter information, and the first model file includes:

[0034] Writing the storage path information of the material texture map into the first model file to obtain the association relationship between the material texture map and the first model file;

[0035] Writing the material type of the object to be rendered into the first model file to obtain the association relationship between the material parameter information and the first model file.

[0036] In a possible implementation, rendering the first model file based on the association relationship, the material texture map, and the material parameter information to obtain a rendered three-dimensional model includes:

[0037] Generating a lighting value based on the rendering equation according to the material parameter information;

[0038] Rendering the first model file based on the association relationship, the material texture map, and the lighting value to obtain a rendered three-dimensional model.

[0039] In a possible implementation, the material parameter information is stored in a material parameter file. After obtaining the rendered three-dimensional model, the method further includes:

[0040] Receiving an adjustment to the material parameter information in the material parameter file to obtain an updated material parameter file;

[0041] Rendering the first model file based on the association relationship, the material texture map, and the updated material parameter file to obtain a rendered three-dimensional model.

[0042] In a second aspect, an embodiment of the present application provides a rendering device for a three-dimensional model. The device includes:

[0043] A first acquisition module, configured to acquire a first model file of an object to be rendered. The first model file includes triangular patch information of the object to be rendered. The object to be rendered includes at least one of the following: an object included in a medical image, a prosthesis for implantation into the body, and a medical device. The triangular patch information includes vertex normal information;

[0044] A generation module, configured to generate a texture map corresponding to the first model file based on the vertex normal information;

[0045] A second acquisition module, configured to acquire material parameter information corresponding to the material type of the object to be rendered;

[0046] An association module, configured to establish an association relationship among the texture map, the material parameter information, and the first model file;

[0047] A first rendering module, configured to render the first model file based on the association relationship, the texture map, and the material parameter information to obtain a rendered three-dimensional model.

[0048] In a third aspect, an embodiment of the present application provides an electronic device, which includes: a processor and a memory storing computer program instructions;

[0049] When the processor executes the computer program instructions, the method in any possible implementation method in the first aspect is implemented.

[0050] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the method in any possible implementation method in the first aspect is implemented.

[0051] In a fifth aspect, an embodiment of the present application provides a computer program product. When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device is caused to execute the method in any possible implementation method in the first aspect.

[0052] The rendering method, device, equipment, computer-readable storage medium and computer program product of the three-dimensional model according to the embodiments of the present application can ensure the matching degree between the material texture map and the object to be rendered by obtaining the first model file of the object to be rendered in the medical field and generating the material texture map based on the vertex normal information in the first model file. By obtaining the material parameter information corresponding to the material type of the object to be rendered, that is, obtaining different material parameter information for different material types, the matching degree between the material parameter information and the object to be rendered can be ensured. In this way, by establishing the association relationship between the material texture map, the material parameter information and the first model file, and rendering the first model file based on the association relationship, the material texture map and the material parameter information, that is, performing targeted rendering for the specific object to be rendered, the matching degree between the rendered three-dimensional model and the object to be rendered can be ensured, and the rendering effect of the three-dimensional model in the medical field can be ensured. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings required to be used in the embodiments of the present application. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings without creative efforts.

[0054] Figure 1 It is a schematic flowchart of a rendering method of a three-dimensional model provided by an embodiment of the present application;

[0055] Figure 2 It is a schematic diagram of an initial three-dimensional model composed of multiple triangular patches provided by an embodiment of the present application;

[0056] Figure 3 It is a schematic diagram of an initial three-dimensional model composed of wireframes corresponding to multiple triangular patches provided by an embodiment of the present application;

[0057] Figure 4 It is a schematic diagram of the rendering effect of a three-dimensional model including bones and prostheses provided by an embodiment of the present application;

[0058] Figure 5 It is a schematic diagram of the rendering effect of the first screw three-dimensional model provided by an embodiment of the present application;

[0059] Figure 6 It is a schematic diagram of the rendering effect of the second screw three-dimensional model provided by an embodiment of the present application;

[0060] Figure 7 It is a schematic structural diagram of a rendering device of a three-dimensional model provided by an embodiment of the present application;

[0061] Figure 8 It is a schematic structural diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners

[0062] The features of various aspects of the present application and exemplary embodiments will be described in detail below. To make the objectives, technical solutions, and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than limiting the present application. For those skilled in the art, the present application can be implemented without some of these specific details. The following description of the embodiments is only intended to provide a better understanding of the present application by showing examples of the present application.

[0063] It should be noted that, in this document, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover a non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, elements defined by the statement "comprising..." do not preclude the existence of additional identical elements in the process, method, article or device comprising the said elements.

[0064] As described in the background art section, currently, the material parameters and material texture maps preset in rendering software are limited, and it is impossible to perform targeted rendering on specific objects to be rendered, resulting in the same rendering effects for different objects to be rendered, and the rendered 3D models lack a realistic visual effect, and the rendering effect of the 3D models is poor.

[0065] In addition, the triangular patch information in the model files of the prior art usually only includes structural information such as points, lines, and faces. When rendering the model files, face normal information is first generated, and then the model is rendered based on the face normal information, and the rendering result of the 3D model is poor.

[0066] Thus, to solve the problems of the prior art, the embodiments of the present application provide a rendering method, device, equipment, computer-readable storage medium, and computer program product for 3D models. Among them, the rendering method for 3D models can be applied to scenarios such as rendering objects included in medical images, prostheses for implantation in the body, medical devices, etc.

[0067] The rendering method for 3D models provided by the embodiments of the present application will be introduced first below.

[0068] Figure 1The flowchart shows a rendering method for a 3D model provided by an embodiment of the present application. As Figure 1 shown, the rendering method for a 3D model provided by an embodiment of the present application includes the following steps:

[0069] S110. Obtain a first model file of the object to be rendered. The first model file includes triangular patch information of the object to be rendered. The object to be rendered includes at least one of the following: an object included in a medical image, a prosthesis for implantation into the body, and a medical device. The triangular patch information includes vertex normal information;

[0070] S120. Generate a texture map corresponding to the first model file based on the vertex normal information;

[0071] S130. Obtain material parameter information corresponding to the material type of the object to be rendered;

[0072] S140. Establish an association relationship among the texture map, the material parameter information, and the first model file;

[0073] S150. Render the first model file based on the association relationship, the texture map, and the material parameter information to obtain a rendered 3D model.

[0074] The rendering method for a 3D model according to an embodiment of the present application can ensure the matching degree between the texture map and the object to be rendered by obtaining the first model file of the object to be rendered in the medical field and generating a texture map based on the vertex normal information in the first model file. By obtaining the material parameter information corresponding to the material type of the object to be rendered, that is, obtaining different material parameter information for different material types, the matching degree between the material parameter information and the object to be rendered can be ensured. Thus, by establishing the association relationship among the texture map, the material parameter information, and the first model file, and rendering the first model file based on the association relationship, the texture map, and the material parameter information, that is, performing targeted rendering for a specific object to be rendered, the matching degree between the rendered 3D model and the object to be rendered can be ensured, and the rendering effect of the 3D model in the medical field can be guaranteed.

[0075] The following introduces the specific implementation manners of the above steps.

[0076] In some embodiments, in S110, the object to be rendered may belong to the medical field. The object to be rendered may include at least one of the following: an object included in a medical image, a prosthesis for implantation into the body, and a medical device. Among them, the object included in the medical image may be a bone. The bone may include a femur, a leg bone, etc. The medical device may include a screw, a guide plate, a sleeve, etc.

[0077] The first model file may include structure information for describing the object to be rendered, for generating a three-dimensional model of the object to be rendered. Among them, the structure information may include triangle patch information corresponding to a plurality of triangle patches. The triangle patch information may include vertex information, line information, face information, and vertex normal information corresponding to a plurality of triangle patches. In addition, the first model file may be an obj file.

[0078] Since the first model file includes vertex normal information, subsequently, the first model file can be rendered based on the vertex normal information. Compared with rendering the first model file based on face normal information, it can improve the surface smoothness of the rendered three-dimensional model without increasing or decreasing the number of triangle patches, and improve the rendering effect.

[0079] Based on this, in order to improve the surface smoothness of the rendered three-dimensional model and improve the rendering effect, in some embodiments, the above S110 may specifically include:

[0080] Obtain the initial model file of the object to be rendered. The initial model file includes triangle patch information of the object to be rendered, and the triangle patch information includes vertex information corresponding to a plurality of triangle patches;

[0081] Based on the vertex information, determine the vertex normal of each vertex in each triangle patch to obtain vertex normal information;

[0082] Use the vertex normal information to update the initial model file to obtain the first model file.

[0083] Here, the triangle patch information in the initial model file may include vertex information, line information, and face information corresponding to a plurality of triangle patches. If the object to be rendered is an object included in a medical image, the initial model file may be obtained by scanning the object included in the medical image. If the object to be rendered is a prosthesis or medical device for implantation into the body, the initial model file may be predefined.

[0084] As an example, by importing the initial model file into rendering software, the initial three-dimensional model corresponding to the initial model file can be displayed. Among them, the initial three-dimensional model may include a three-dimensional model composed of a plurality of triangle patches and a three-dimensional model composed of wireframes corresponding to a plurality of triangle patches.

[0085] If the object to be rendered is the femur, a schematic diagram of an initial three-dimensional model composed of a plurality of triangle patches provided by an embodiment of the present application may be as Figure 2 shown. A schematic diagram of an initial three-dimensional model composed of wireframes corresponding to a plurality of triangle patches provided by an embodiment of the present application may be as Figure 3 shown.

[0086] In addition, the vertex information may include the coordinate information of the vertices corresponding to multiple triangular patches respectively. Based on the coordinate information of the vertices corresponding to multiple triangular patches respectively, the vertex normal of each vertex in each triangular patch can be calculated. The multiple vertex normals corresponding to multiple vertices can jointly form vertex normal information. Adding the vertex normal information to the triangular patch information of the initial model file can update the initial model file to the first model file.

[0087] In the embodiment of the present application, by calculating vertex normal information based on the vertex information in the initial model file, using the vertex normal information to update the initial model file to obtain the first model file, and subsequent rendering of the first model file, the surface smoothness of the rendered three-dimensional model can be improved, and the rendering effect can be enhanced.

[0088] It should be noted that in the medical field, higher requirements are placed on the display details of the three-dimensional model, and it is expected that some structural information such as burrs and edges in the first model file can also achieve a good smooth display effect. Therefore, in order to further improve the surface smoothness of the rendered three-dimensional model and enhance the rendering effect, in some embodiments, determining the vertex normal of each vertex in each triangular patch based on the vertex information specifically may include:

[0089] Calculating the face normal of each triangular patch based on the vertex information;

[0090] For each vertex, determining at least one target triangular patch including the vertex in multiple triangular patches;

[0091] For each vertex, calculating the average value of the face normals corresponding to at least one target triangular patch to obtain the vertex normal.

[0092] Here, each triangular patch may include three vertices. If the three vertices are respectively denoted as A, B, and C, the face normal N of the triangular patch can be calculated by the following formula (1):

[0093] N = AB × AC (1)

[0094] In formula (1), N may represent the face normal, AB may represent the vector determined by vertices A and B, AC may represent the vector determined by vertices A and C, and × may represent the cross product operation of vectors.

[0095] After calculating the face normal, the face normal can also be normalized to adjust the length of the face normal to 1. By normalizing the face normal, the influence of the size of different faces on the length of the face normal can be eliminated.

[0096] After obtaining the face normals, for each vertex, all the triangular faces containing that vertex can be found, i.e., the target triangular faces. Among them, the target triangular faces can be one or multiple. If a vertex belongs to only one triangular face (e.g., the vertex is located at the edge or corner of the initial 3D model), that is, the vertex corresponds to one target triangular face, then the face normal of this target triangular face can be directly determined as the vertex normal of that vertex. If a vertex belongs to multiple triangular faces, that is, the vertex corresponds to multiple target triangular faces, then the average value of the face normals corresponding to the multiple triangular faces can be calculated to obtain the vertex normal of that vertex.

[0097] Specifically, assume that vertex V has n adjacent faces, that is, there are n triangular faces including vertex V, then vertex V can correspond to n target triangular faces. Among them, n can be a positive integer greater than or equal to 1. If the face normals corresponding to the n target triangular faces are denoted as N1, N2,..., Nn respectively, then the vertex normal Nv of vertex V can be calculated by the following formula (2):

[0098] Nv = (N1 + N2 +... + Nn) / n (2)

[0099] After calculating Nv, Nv can be normalized to adjust the length of the vertex normal to 1 to eliminate the influence of the vertex normal length.

[0100] In the embodiments of the present application, by calculating the average value of the face normals corresponding to at least one adjacent face of each vertex, that is, relative to the face normal, calculating the average value of the face normals of the adjacent faces one more time to obtain the vertex normal, the display effect of 3D models of planar or arc types can be ensured, and the surface smoothness of the rendered 3D model can be further improved, enhancing the rendering effect.

[0101] In addition, in actual situations, a vertex may belong to multiple coplanar faces, that is, the directions of the face normals of some target triangular faces may be the same or very close. In the case where the directions of the face normals of some target triangular faces are the same or very close, in order to reduce the memory occupied by the first model file and improve the rendering efficiency, in some embodiments, the above-mentioned method of calculating the average value of the face normals corresponding to at least one target triangular face for each vertex to obtain the vertex normal may specifically include:

[0102] Screening multiple target face normals with a direction angle greater than a preset threshold among multiple face normals;

[0103] For each vertex, calculate the average value of the target face normals corresponding to at least one target triangular face to obtain the vertex normal.

[0104] Here, the preset threshold can be an angle threshold set in advance for determining whether the directions of the face normals are the same or very close. If the included angle between the directions of two face normals is 0, it can be determined that the directions of the two face normals are the same. If the included angle between the directions of two face normals is greater than 0 and less than the preset threshold, it can be determined that the directions of the two face normals are very close. If the included angle between the directions of two face normals is greater than the preset threshold, it can be determined that the directions of the two face normals are not close. That is, the directions of multiple target face normals are not close.

[0105] If the directions of multiple face normals are the same or very close, one of the face normals can be retained among the multiple face normals, and the remaining face normals can be deleted. That is, for each vertex, the average value of the target face normals corresponding to at least one target triangular patch can be calculated to obtain the vertex normal, so as to reduce the size of the first model file, that is, the memory occupied by the first model file, and further improve the rendering efficiency.

[0106] In addition, in order to further improve the surface smoothness of the rendered three-dimensional model and enhance the rendering effect, in some embodiments, determining the vertex normal of each vertex in each triangular patch based on the vertex information to obtain the vertex normal information may specifically include:

[0107] Determining the vertex normal of each vertex in each triangular patch based on the vertex information;

[0108] Performing linear interpolation on the vertex normals to obtain interpolated normals;

[0109] Determining the vertex normal information according to the vertex normals and the interpolated normals.

[0110] In the embodiments of the present application, by performing linear interpolation on the vertex normals defined by the triangle vertices to calculate the "pseudo-smoothing" normals, that is, the interpolated normals, and jointly determining the vertex normals and the interpolated normals as the vertex normal information, the smooth shading effect of the rendered three-dimensional model can be further improved, the surface smoothness of the rendered three-dimensional model can be further enhanced, and the rendering effect can be improved.

[0111] In some embodiments, in S120, the material map may include a normal map, a roughness map, a specular map, a metallicity map, etc.

[0112] As an example, the material generation algorithm can determine the shape concavity and convexity of the initial three-dimensional model according to the triangular patch information in the first model file, and generate material maps such as a normal map (Normal Map), a roughness map (Roughness Map), a specular map (Specular Map), and a metallicity map (Metallic Map) corresponding to the first model file by using technologies such as UV mapping and depth information capture based on the vertex normal information and the shape concavity and convexity of the initial three-dimensional model, and store the material maps.

[0113] In some embodiments, in S130, the material types of the objects to be rendered may include bone types, prosthesis types, screw types, guide plate types, sleeve types, etc. If the object to be rendered is a bone, the material type of the object to be rendered may be a bone type. If the object to be rendered is a prosthesis, the material type of the object to be rendered may be a prosthesis type. If the object to be rendered is a screw, the material type of the object to be rendered may be a screw type. If the object to be rendered is a guide plate, the material type of the object to be rendered may be a guide plate type. If the object to be rendered is a sleeve, the material type of the object to be rendered may be a sleeve type.

[0114] In addition, the material parameter information may include material attributes such as solid color, metallicity, refractive index, transparency, roughness, diffuse reflectance, and smoothness, as well as the corresponding attribute values for each material attribute. The material parameter information corresponding to different material types may be different. The material parameter information may be stored in a material parameter file.

[0115] Based on this, in order to ensure the matching degree between the material parameter information and the object to be rendered, in some embodiments, the above S130 may specifically include:

[0116] Obtain the material type of the object to be rendered;

[0117] Determine the material parameter information corresponding to the material type of the object to be rendered according to the correspondence between the material type and the material parameter information.

[0118] Here, the correspondence between the material type and the material parameter information may be pre-calibrated. Specifically, for each material type, the attribute values of material attributes such as solid color, metallicity, refractive index, transparency, roughness, diffuse reflectance, and smoothness are adjusted multiple times in different scenarios to render the best effect of this material type in most scenarios in the environment map. That is, for each material type, through comprehensive testing and adjustment of multiple groups of attribute value data, the material parameter information corresponding to each material type can be finally obtained.

[0119] After that, by obtaining the material type of the object to be rendered and determining the material parameter information corresponding to the material type of the object to be rendered according to the correspondence between the material type and the material parameter information, the matching degree between the material parameter information and the object to be rendered can be ensured.

[0120] In some embodiments, the above obtaining the material type of the object to be rendered may specifically include:

[0121] Read the file name of the first model file, and the file name has an associated relationship with the object to be rendered;

[0122] Determine the material type of the object to be rendered according to the correspondence between the file name and the material type.

[0123] Here, if the object to be rendered corresponding to the first model file is the femur, the file name can be femur.obj. If the object to be rendered is the leg bone, the file name can be leg_bone.obj. In addition, the correspondence between the file name and the material type can be as follows: if the file name is femur.obj, the material type can be bone; if the file is leg_bone.obj, the material type can be bone; if the file name is screw_1.obj, the material type can be screw.

[0124] In this way, after reading the file name, according to the association relationship between the file name and the object to be rendered, as well as the correspondence between the file name and the material type, the material type of the object to be rendered can be determined.

[0125] In some embodiments, in S140, after generating and storing the material texture map, an association relationship can be established between the material texture map and the first model file.

[0126] Specifically, by writing the storage path information of the material texture map into the first model file, the association relationship between the material texture map and the first model file can be obtained.

[0127] In addition, after determining the material type of the object to be rendered, an association relationship can be established between the material parameter information and the first model file of the object to be rendered according to the correspondence between the material type and the material parameter information.

[0128] Specifically, by writing the material type of the object to be rendered into the first model file, the association relationship between the material type and the first model file can be obtained. Then, combined with the correspondence between the material type and the material parameter information, the association relationship between the material parameter information and the first model file can be obtained.

[0129] In some embodiments, in S150, after establishing the association relationships among the material texture map, the material parameter information, and the first model file, the first model file can be rendered based on the above association relationships, the material texture map, and the material parameter information to obtain the rendered three-dimensional model.

[0130] A schematic diagram of the rendering effect of a three-dimensional model including bones and prostheses provided by an embodiment of the present application can be as Figure 4 shown. A schematic diagram of the rendering effect of the three-dimensional model of the first screw provided by an embodiment of the present application can be as Figure 5 shown. A schematic diagram of the rendering effect of the three-dimensional model of the second screw provided by an embodiment of the present application can be as Figure 6 shown.

[0131] Based on this, in order to ensure the rendering effect of the three-dimensional model, in some embodiments, the above S150 may specifically include:

[0132] Generate a lighting value based on the rendering equation and according to the material parameter information;

[0133] Render the first model file based on the association relationship, texture map, and lighting value to obtain a rendered 3D model.

[0134] In the medical field, the roughness in the material parameter information is crucial. Specifically, based on the physical optics principle, roughness can control the strength of reflection. Rendering based on roughness can render a light and shadow effect closer to the real physical world, making the visualization of the 3D model more accurate, clearer, and more real, and can better assist clinical engineers in making surgical plans and better assist doctors in diagnosing patients.

[0135] When the object to be rendered is a bone, for the roughness data in the material parameter information, by determining the corresponding normal distribution function and geometric function; based on the normal distribution function and geometric function, determine the bidirectional reflectance distribution function corresponding to the roughness data; based on the bidirectional reflectance distribution function, calculate the lighting value corresponding to the roughness data; based on the association relationship, texture map, and lighting value, render the bone medical image to obtain a visual 3D model corresponding to the bone medical image.

[0136] The following introduces the process of generating a lighting value based on the rendering equation and according to the roughness data in the material parameter information.

[0137] When the roughness data α is obtained, the roughness function k corresponding to the roughness data α can be determined first. The roughness function k can be determined in the following three ways:

[0138] k = α 2 (3)

[0139]

[0140]

[0141] The method of determining the normal distribution function based on the roughness function can be shown as the following formula (6):

[0142]

[0143] In formula (6), n represents the unit normal vector at the incident point, and h is the intermediate vector between the light incident direction vector l and the viewing direction vector v, which is usually also called the half-angle vector.

[0144] The method of determining the geometric function based on the roughness function can be shown as the following formula (7):

[0145]

[0146] In formula (7), v is the viewing direction vector.

[0147] The method for determining the Bidirectional Reflectance Distribution Function (BRDF) based on the normal distribution function and the geometric function can be shown as in formula (8) below:

[0148]

[0149] In formula (8), DFG can respectively represent the normal distribution function, the Fresnel equation, and the geometric function. C represents the surface color; k d represents the diffuse reflection coefficient; k s represents the specular reflection coefficient; w 0 is the reflection direction vector; w i is the incident direction vector.

[0150] It should be noted that the above bidirectional reflectance distribution function describes how much light is reflected into the viewing direction after reflection from a certain direction through the current point.

[0151] The method for calculating the light value corresponding to the roughness data based on the bidirectional reflectance distribution function can be shown as in formula (9) below:

[0152] L 0 (v) = L e (v) + ∫ Ω f(w i , v)L i (w i )(n * w i )dw i (9)

[0153] In formula (9), v is the viewing direction; L 0 (v) is the total light reaching the viewing point from the current point, that is, the light value; L e (v) is the self-luminous part emitted from the current point; ∫ Ω * is an infinitesimal accumulation of the incident light within the hemisphere centered at the current point; f(w i , v) is how much light is reflected into the viewing direction after reflection from a certain direction through the current point; L i (w i ) is the light reaching the current point from a certain direction; (n * w i ) is the attenuation of the light intensity from this direction due to the incident angle; dw i is a certain incident light within the hemisphere centered at the current point for the incident direction.

[0154] The process of generating the lighting value according to other attribute data in the material parameter information can refer to the existing technology and will not be elaborated in detail here.

[0155] In the embodiment of the present application, by generating a material texture map based on the above first model file and obtaining the material parameter information corresponding to the material type of the object to be rendered, during the process of rendering the first model file based on the rendering equation, each parameter of the rendering equation can exhibit the optimal effect, ensuring that the brightness, shadow, highlight, etc. of the rendered three-dimensional model can be better reflected.

[0156] In addition, as described above, the material parameter information can be stored in a material parameter file. Based on this, in order to further improve the rendering effect of the three-dimensional model, in some embodiments, after the above S150, the method may further include:

[0157] Receiving the adjustment of the material parameter information in the material parameter file to obtain an updated material parameter file;

[0158] Rendering the first model file based on the association relationship, the material texture map, and the updated material parameter file to obtain a rendered three-dimensional model.

[0159] Here, the user can adjust the material parameter information in the material parameter file. Among them, a slight change in the parameter value can also exhibit different rendering effects. In this way, by adjusting the material parameter information in the material parameter file, the convenience of parameter adjustment can be improved, facilitating parameter debugging and use. By rendering the first model file based on the association relationship, the material texture map, and the updated material parameter file to obtain a rendered three-dimensional model, the rendering effect of the three-dimensional model can be further improved.

[0160] In the embodiment of the present application, the rendering scene can consist of two parts: a model file and a lighting value. Among them, the innovation of the model file lies in generating and changing the data structure in the original model file. Vertex normal information, the storage path information of the material texture map, and the material type are added to the initial model file to obtain the first model file, making the first model file more flexible than the initial model file, enabling the user to directly load materials and adjust the material parameter information in the first model file, thereby changing the display effect of the three-dimensional model. The innovation of the lighting value lies in order to make each parameter of the rendering equation exhibit the optimal effect, automatically generating a material texture map according to the first model file, which can ensure that the brightness, shadow, and highlight of the three-dimensional model can be better reflected.

[0161] Based on the three-dimensional model rendering method provided in the above embodiments, correspondingly, the present application also provides a specific implementation manner of a three-dimensional model rendering device. Please refer to the following embodiments.

[0162] As Figure 7 shown, the rendering device 700 for the three-dimensional model provided by the embodiment of the present application includes the following modules:

[0163] The first acquisition module 710 is configured to acquire a first model file of an object to be rendered. The first model file includes triangular patch information of the object to be rendered. The object to be rendered includes at least one of the following: an object included in a medical image, a prosthesis for implantation into the body, and a medical device. The triangular patch information includes vertex normal information;

[0164] The generation module 720 is configured to generate a texture map corresponding to the first model file based on the vertex normal information;

[0165] The second acquisition module 730 is configured to acquire material parameter information corresponding to the material type of the object to be rendered;

[0166] The association module 740 is configured to establish an association relationship among the texture map, the material parameter information, and the first model file;

[0167] The first rendering module 750 is configured to render the first model file based on the association relationship, the texture map, and the material parameter information to obtain a rendered three-dimensional model.

[0168] The following is a detailed description of the above-mentioned rendering device 700 for the three-dimensional model, which is specifically as follows:

[0169] In some embodiments, the first acquisition module 710 may specifically include:

[0170] The first acquisition sub-module is configured to acquire an initial model file of the object to be rendered. The initial model file includes triangular patch information of the object to be rendered. The triangular patch information includes vertex information corresponding to a plurality of triangular patches;

[0171] The first determination sub-module is configured to determine the vertex normal of each vertex in each triangular patch based on the vertex information to obtain the vertex normal information;

[0172] The update sub-module is configured to update the initial model file by using the vertex normal information to obtain the first model file.

[0173] In some embodiments, the first determination sub-module may specifically include:

[0174] The first calculation unit is configured to calculate the face normal of each triangular patch based on the vertex information;

[0175] The first determination unit is configured to determine at least one target triangular patch including the vertex in a plurality of triangular patches for each vertex;

[0176] A second calculation unit, configured to calculate, for each vertex, an average value of face normals corresponding to at least one target triangular patch to obtain a vertex normal.

[0177] In some embodiments, the second calculation unit may specifically include:

[0178] A screening subunit, configured to screen, from multiple face normals, multiple target face normals whose direction angles are greater than a preset threshold;

[0179] A calculation subunit, configured to calculate, for each vertex, an average value of target face normals corresponding to at least one target triangular patch to obtain a vertex normal.

[0180] In some embodiments, the first determination sub-module may specifically include:

[0181] A second determination unit, configured to determine, based on vertex information, a vertex normal of each vertex in each triangular patch;

[0182] An interpolation unit, configured to perform linear interpolation on the vertex normals to obtain interpolated normals;

[0183] A third determination unit, configured to determine vertex normal information according to the vertex normals and the interpolated normals.

[0184] In some embodiments, the second acquisition module 730 may specifically include:

[0185] A second acquisition sub-module, configured to acquire a material type of an object to be rendered;

[0186] A second determination sub-module, configured to determine material parameter information corresponding to the material type of the object to be rendered according to a correspondence relationship between the material type and the material parameter information.

[0187] In some embodiments, the second acquisition sub-module may specifically include:

[0188] A reading unit, configured to read a file name of a first model file, where the file name is associated with the object to be rendered;

[0189] A fourth determination unit, configured to determine the material type of the object to be rendered according to a correspondence relationship between the file name and the material type.

[0190] In some embodiments, the association module 740 may specifically include:

[0191] A first writing sub-module, configured to write storage path information of a material texture map into the first model file to obtain an association relationship between the material texture map and the first model file;

[0192] A second writing sub-module, configured to write the material type of the object to be rendered into the first model file, so as to obtain the association relationship between the material parameter information and the first model file.

[0193] In some embodiments, the first rendering module 750 may specifically include:

[0194] A generation sub-module, configured to generate a lighting value based on the rendering equation and according to the material parameter information;

[0195] A rendering sub-module, configured to render the first model file based on the association relationship, the material texture map, and the lighting value, so as to obtain a rendered three-dimensional model.

[0196] In some embodiments, the material parameter information is stored in a material parameter file. Based on this, the three-dimensional model rendering device 700 may further include:

[0197] A receiving module, configured to, after obtaining the rendered three-dimensional model, receive an adjustment to the material parameter information in the material parameter file to obtain an updated material parameter file;

[0198] A second rendering module, configured to render the first model file based on the association relationship, the material texture map, and the updated material parameter file, so as to obtain a rendered three-dimensional model.

[0199] The three-dimensional model rendering device according to the embodiments of the present application obtains the first model file of the object to be rendered in the medical field, and generates a material texture map based on the vertex normal information in the first model file, which can ensure the matching degree between the material texture map and the object to be rendered. By obtaining the material parameter information corresponding to the material type of the object to be rendered, that is, obtaining different material parameter information for different material types, the matching degree between the material parameter information and the object to be rendered can be ensured. In this way, by establishing the association relationship between the material texture map, the material parameter information, and the first model file, and rendering the first model file based on the association relationship, the material texture map, and the material parameter information, that is, performing targeted rendering for a specific object to be rendered, the matching degree between the rendered three-dimensional model and the object to be rendered can be ensured, and the rendering effect of the three-dimensional model in the medical field can be ensured.

[0200] Based on the three-dimensional model rendering method provided in the above embodiments, the embodiments of the present application further provide a specific implementation manner of an electronic device. Figure 8 The schematic diagram of the electronic device 800 provided by the embodiments of the present application is shown.

[0201] The electronic device 800 may include a processor 810 and a memory 820 storing computer program instructions.

[0202] Specifically, the above-mentioned processor 810 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured as one or more integrated circuits for implementing the embodiments of the present application.

[0203] The memory 820 may include a mass storage for data or instructions. By way of example and not limitation, the memory 820 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disc, a magneto-optical disc, a magnetic tape, or a universal serial bus (USB) drive, or a combination of two or more of these. In a suitable case, the memory 820 may include removable or non-removable (or fixed) media. In a suitable case, the memory 820 may be internal or external to the electronic device 800. In a specific embodiment, the memory 820 is a non-volatile solid-state memory.

[0204] The memory may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk storage media device, an optical storage media device, a flash memory device, an electrical, optical, or other physical / tangible memory storage device. Thus, generally, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to the first aspect of the present application.

[0205] The processor 810 reads and executes the computer program instructions stored in the memory 820 to implement any one of the three-dimensional model rendering methods in the above embodiments.

[0206] In one example, the electronic device 800 may further include a communication interface 830 and a bus 840. Among them, as Figure 8 shown, the processor 810, the memory 820, and the communication interface 830 are connected through the bus 840 and complete communication with each other.

[0207] The communication interface 830 is mainly used to implement communication between the modules, devices, units, and / or devices in the embodiments of the present application.

[0208] The bus 840 includes hardware, software, or both, and couples components of an electronic device to each other. By way of example and not limitation, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an InfiniBand interconnect, a Low Pin Count (LPC) bus, a memory bus, a MicroChannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or a combination of two or more of these. Where appropriate, the bus 840 may include one or more buses. Although embodiments of the present application describe and illustrate specific buses, the present application contemplates any suitable bus or interconnect.

[0209] Exemplarily, the electronic device 800 may be a mobile phone, a tablet computer, a laptop computer, a handheld computer, an in-vehicle electronic device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc.

[0210] The electronic device can execute the rendering method of the three-dimensional model in the embodiments of the present application, so as to implement the combination Figures 1 to 7 of the rendering method and device of the three-dimensional model described.

[0211] In addition, in combination with the rendering method of the three-dimensional model in the above embodiments, embodiments of the present application can provide a computer-readable storage medium to implement. Computer program instructions are stored on the computer-readable storage medium; when the computer program instructions are executed by a processor, any one of the rendering methods of the three-dimensional model in the above embodiments is implemented.

[0212] In combination with the rendering method of the three-dimensional model in the above embodiments, embodiments of the present application can provide a computer program product to implement. When the instructions in the computer program product are executed by a processor of an electronic device, any one of the rendering methods of the three-dimensional model in the above embodiments is implemented.

[0213] It should be clear that the present application is not limited to the specific configurations and processes described above and illustrated in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and illustrated as examples. However, the method process of the present application is not limited to the specific steps described and illustrated, and those skilled in the art can make various changes, modifications, and additions, or change the order between steps after understanding the spirit of the present application.

[0214] The functional blocks shown in the above-described structural block diagrams can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application-specific integrated circuit (ASIC), appropriate firmware, a plug-in, a functional card, and so on. When implemented in software, the elements of the present application are programs or code segments for performing the required tasks. The program or code segment can be stored in a machine-readable medium or transmitted over a transmission medium or communication link via a data signal carried in a carrier wave. A "machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical discs, hard disks, fiber optic media, radio frequency (RF) links, and so on. The code segment can be downloaded via a computer network such as the Internet, an intranet, and so on.

[0215] It should also be noted that the exemplary embodiments mentioned in the present application describe some methods or systems based on a series of steps or devices. However, the present application is not limited to the order of the above steps, that is, the steps can be executed in the order mentioned in the embodiments, can be different from the order in the embodiments, or several steps can be executed simultaneously.

[0216] Aspects of the present application have been described above with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to embodiments of the present application. It should be understood that each block in the flowcharts and / or block diagrams, and the combinations of blocks in the flowcharts and / or block diagrams, 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, or other programmable data processing device to produce a machine such that the instructions executed by the processor of the computer or other programmable data processing device enable the implementation of the functions / actions specified in one or more blocks of the flowcharts and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It should also be understood that each block in the block diagrams and / or flowcharts, and the combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by dedicated hardware for performing the specified functions or actions, or by a combination of dedicated hardware and computer instructions.

[0217] As described above, this is only the specific implementation manner of the present application. Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the systems, modules, and units described above can refer to the corresponding processes in the foregoing method embodiments, and will not be elaborated herein. It should be understood that the protection scope of the present application is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present application can easily think of various equivalent modifications or substitutions, and these modifications or substitutions should all be covered within the protection scope of the present application.

Claims

1. A method for rendering a three-dimensional model, characterized in that: include: Acquire a first model file of an object to be rendered, wherein the first model file includes triangular facet information of the object to be rendered, wherein the object to be rendered includes at least one of the following: an object included in a medical image, a prosthesis for implantation in a body, or a medical device, and the triangular facet information includes vertex normal information; Based on the vertex normal information, generating a material map corresponding to the first model file; Acquire material parameter information corresponding to the material type of the object to be rendered; Establishing an association relationship between the material map, the material parameter information and the first model file; Based on the association relationship, the material map and the material parameter information, the first model file is rendered to obtain a rendered three-dimensional model.

2. The method according to claim 1, characterized in that: The step of obtaining a first model file of the object to be rendered includes: Acquire an initial model file of the object to be rendered, wherein the initial model file includes triangular face information of the object to be rendered, and the triangular face information includes vertex information corresponding to a plurality of triangular face information; Based on the vertex information, determine the vertex normal of each vertex in each of the triangular facets to obtain vertex normal information; The initial model file is updated using the vertex normal information to obtain the first model file.

3. The method according to claim 2, characterized in that The step of determining the vertex normal of each vertex in each triangular face based on the vertex information includes: Based on the vertex information, calculate the surface normal of each of the triangular facets; For each of the vertices, determining at least one target triangular facet including the vertex from among the plurality of triangular facets; For each of the vertices, an average value of the surface normals corresponding to the at least one target triangle patch is calculated to obtain the vertex normal.

4. The method according to claim 3, characterized in that The step of calculating, for each of the vertices, an average value of the surface normal corresponding to the at least one target triangle facet to obtain the vertex normal includes: Selecting a plurality of target surface normals whose direction angles are greater than a preset threshold value from the plurality of surface normals; For each of the vertices, an average value of the target surface normals corresponding to the at least one target triangle patch is calculated to obtain the vertex normal.

5. The method according to claim 2, characterized in that: The step of determining the vertex normal of each vertex in each of the triangular facets based on the vertex information to obtain the vertex normal information includes: Based on the vertex information, determining the vertex normal of each vertex in each of the triangular facets; Performing linear interpolation on the vertex normal to obtain an interpolated normal; The vertex normal information is determined according to the vertex normal and the interpolated normal.

6. The method according to claim 1, characterized in that The acquiring of material parameter information corresponding to the material type of the object to be rendered includes: Obtain the material type of the object to be rendered; The material parameter information corresponding to the material type of the object to be rendered is determined according to the correspondence between the material type and the material parameter information.

7. The method according to claim 6, characterized in that The obtaining the material type of the object to be rendered includes: Reading a file name of the first model file, wherein the file name is associated with the object to be rendered; The material type of the object to be rendered is determined according to the correspondence between the file name and the material type.

8. The method according to claim 1, characterized in that The establishing of the association relationship between the material map, the material parameter information and the first model file includes: Writing the storage path information of the material map into the first model file to obtain an association relationship between the material map and the first model file; The material type of the object to be rendered is written into the first model file, and an association relationship between the material parameter information and the first model file is obtained.

9. The method according to claim 1, characterized in that: The rendering of the first model file based on the association relationship, the material map and the material parameter information to obtain a rendered three-dimensional model includes: Based on the rendering equation, generating a lighting value according to the material parameter information; Based on the association relationship, the material map and the illumination value, the first model file is rendered to obtain a rendered three-dimensional model.

10. The method according to claim 1, characterized in that The material parameter information is stored in a material parameter file. After obtaining the rendered three-dimensional model, the method further includes: Receiving adjustment to the material parameter information in the material parameter file to obtain an updated material parameter file; Based on the association relationship, the material map and the updated material parameter file, the first model file is rendered to obtain a rendered three-dimensional model.

11. A three-dimensional model rendering device, characterized in that: The device comprises: A first acquisition module is used to acquire a first model file of an object to be rendered, wherein the first model file includes triangular facet information of the object to be rendered, and the object to be rendered includes at least one of the following: an object included in a medical image, a prosthesis for implantation in a body, or a medical device, and the triangular facet information includes vertex normal information; A generating module, used for generating a material map corresponding to the first model file based on the vertex normal information; A second acquisition module, used to acquire material parameter information corresponding to the material type of the object to be rendered; An association module, used to establish an association relationship between the material map, the material parameter information and the first model file; The first rendering module is used to render the first model file based on the association relationship, the material map and the material parameter information to obtain a rendered three-dimensional model.

12. An electronic device, characterized in that: The electronic device comprises: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, the three-dimensional model rendering method according to any one of claims 1 to 10 is implemented.

13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the three-dimensional model rendering method according to any one of claims 1 to 10 is implemented.

14. A computer program product, characterized in that When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the three-dimensional model rendering method as described in any one of claims 1-10.