Rendering method, device, electronic device and storage medium of three-dimensional model
By acquiring the cross-section dataset and texture maps, the problem of poor rendering effect of the three-dimensional model is solved, high-quality rendering effect is achieved and sub-model deformation is avoided.
Patent Information
- Application Number
- CN202210996952.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-19
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2042-08-19
AI Technical Summary
The rendering effect of three-dimensional models in the prior art is poor, mainly due to the simplified triangular mesh, which causes the sub-model to be deformed.
By obtaining the cross-sectional dataset and corresponding texture maps, the rendering results of the three-dimensional model are determined based on these data. The cross-section data set is used to indicate the envelope frame section of the sub-model, and the texture map represents the texture information that projects the sub-model's texture information onto the cross-section.
Improve the rendering effect of the three-dimensional model, avoid sub-model deformation, and enhance the quality and efficiency of rendering.
Smart Images

Figure CN117635799B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of image processing technology, and in particular to a method, device, electronic device and storage medium for rendering a three-dimensional model. Background Art
[0002] With the improvement of computer performance and the development of image processing technology, three-dimensional models are often used to represent objects. For example, a three-dimensional model of a plant is used to represent the plant. Electronic devices can render three-dimensional models to display the objects represented by the three-dimensional models in scenes such as movies, games, and engineering design.
[0003] In the related art, it is necessary to first model a three-dimensional model of an object. The three-dimensional model includes multiple sub-models. The sub-model is a triangular mesh with texture information. The triangular mesh includes multiple triangles. Since the amount of data of the triangular mesh is large, the rendering efficiency is seriously affected. Therefore, the triangular mesh can be simplified by merging at least two triangles into one triangle, thereby simplifying the sub-model to improve the rendering efficiency. By rendering the simplified sub-models, the rendering result of the three-dimensional model is obtained.
[0004] In the above technology, since the triangular mesh is simplified, the sub-model may be deformed, which results in poor rendering effect of the three-dimensional model. Summary of the invention
[0005] The present application provides a three-dimensional model rendering method, device, electronic device and storage medium, which can be used to solve the problem of poor rendering effect of three-dimensional models in related technologies. The technical solution includes the following contents.
[0006] In one aspect, a method for rendering a three-dimensional model is provided, the method comprising:
[0007] Acquire a cross-sectional data set, wherein the cross-sectional data set is constructed based on a plurality of sub-models included in a three-dimensional model of an object, wherein the sub-models represent components of the object, and texture information of the sub-models represents texture information of the components, wherein the cross-sectional data set includes a plurality of cross-sectional data, and the cross-sectional data is used to indicate a cross-section of an envelope box of at least one sub-model;
[0008] Acquire a texture map corresponding to each cross-sectional data in the cross-sectional data set, wherein the texture map corresponding to any cross-sectional data is determined according to the texture information of each sub-model corresponding to the any cross-sectional data, and the texture map corresponding to any cross-sectional data is used to represent the texture information of each sub-model corresponding to the any cross-sectional data projected onto the cross-sectional area indicated by the any cross-sectional data;
[0009] Based on each cross-sectional data in the cross-sectional data set and the corresponding texture map, a rendering result of the three-dimensional model is determined.
[0010] In another aspect, a three-dimensional model rendering device is provided, the device comprising:
[0011] An acquisition module is used to acquire a cross-sectional data set, wherein the cross-sectional data set is constructed based on a plurality of sub-models included in a three-dimensional model of an object, wherein the sub-models represent parts of the object, and texture information of the sub-models represents texture information of the parts, wherein the cross-sectional data set includes a plurality of cross-sectional data, and the cross-sectional data is used to indicate a cross-section of an envelope of at least one sub-model;
[0012] The acquisition module is further used to acquire a texture map corresponding to each cross-sectional data in the cross-sectional data set, wherein the texture map corresponding to any cross-sectional data is determined according to the texture information of each sub-model corresponding to the any cross-sectional data, and the texture map corresponding to any cross-sectional data is used to represent the texture information of each sub-model corresponding to the any cross-sectional data projected onto the cross-sectional area indicated by the any cross-sectional data;
[0013] The determination module is used to determine the rendering result of the three-dimensional model based on each cross-sectional data in the cross-sectional data set and the corresponding texture map.
[0014] In a possible implementation, the cross-sectional data set includes at least two levels of data sets, and any level of data sets includes at least one cross-sectional data, and one cross-sectional data of the previous level corresponds to at least one cross-sectional data of the next level;
[0015] The determination module is also used to determine the data set of the previous level based on the data set of the next level. When the next level is the lowest level of the at least two levels, the data set of the next level is determined based on the cross-sectional data corresponding to each sub-model in the three-dimensional model; in response to meeting the set conditions, the cross-sectional data set is obtained based on the data sets of each level.
[0016] In a possible implementation, the determination module is also used to determine a basic sub-model in the three-dimensional model, where the basic sub-model is any sub-model in the three-dimensional model; determine transformation information from the basic sub-model to other sub-models, where the other sub-model is any sub-model in the three-dimensional model except the basic sub-model; determine cross-sectional data corresponding to the basic sub-model; and determine cross-sectional data corresponding to the other sub-models based on the cross-sectional data corresponding to the basic sub-model and the transformation information.
[0017] In a possible implementation, the determination module is used to classify the sub-models in the three-dimensional model into at least one category according to the texture information of the sub-models in the three-dimensional model; for any category, select any sub-model from the sub-models in the any category as the basic sub-model of the any category; determine the transformation information from the basic sub-model of the any category to other sub-models of the any category, and the other sub-models of the any category are sub-models in the any category other than the basic sub-model of the any category.
[0018] In one possible implementation, the determination module is used to determine a first envelope box of a basic sub-model of any one category; determine a second envelope box of other sub-models of any one category; and determine transformation information from the basic sub-model of any one category to other sub-models of any one category based on the first envelope box and the second envelope box.
[0019] In one possible implementation, the determination module is used to determine the cross-sectional data corresponding to any two cross-sectional data in the data set of the next level, based on the sub-model corresponding to any two cross-sectional data, if the any two cross-sectional data meet the aggregation condition; if the number of cross-sectional data in the candidate data set is less than the reference number, the candidate data set is used as the data set of the previous level, and the candidate data set includes the cross-sectional data corresponding to any two cross-sectional data that meet the aggregation condition and the cross-sectional data that does not meet the aggregation condition.
[0020] In a possible implementation, the aggregation condition satisfied by any two cross-sectional data includes at least one of the following:
[0021] The distance between the cross sections indicated by any two cross section data is less than a distance threshold;
[0022] The normal vector angle between the cross sections indicated by any two cross section data is smaller than the angle threshold.
[0023] In one possible implementation, the determination module is also used to, if the number of cross-sectional data in the candidate data set is not less than the reference number, use the candidate data set as the data set of the next level, and cyclically execute the step of determining the cross-sectional data corresponding to any two cross-sectional data based on the sub-models corresponding to any two cross-sectional data if any two cross-sectional data satisfy the aggregation condition, until the number of cross-sectional data in the candidate data set is less than the reference number, and use the candidate data set as the data set of the previous level.
[0024] In a possible implementation, the determination module is also used to, in response to the set condition not being met, use the data set of the previous level as the data set of the next level, and cyclically execute the process of determining the data set of the previous level based on the data set of the next level until the set condition is met, thereby obtaining the cross-sectional data set based on the data sets of each level.
[0025] In a possible implementation, the determination module is also used to project the texture information of any sub-model corresponding to any cross-sectional data onto the cross-section indicated by any cross-sectional data to obtain the texture map of any sub-model; and to fuse the texture maps of each sub-model corresponding to any cross-sectional data to obtain the texture map corresponding to any cross-sectional data.
[0026] In a possible implementation, the cross-sectional data set includes at least two levels of data sets, and any level of data sets includes at least one cross-sectional data, and one cross-sectional data of the previous level corresponds to at least one cross-sectional data of the next level;
[0027] The determination module is used to render any cross-sectional data of the previous level according to the texture map corresponding to any cross-sectional data to obtain a rendering result of the any cross-sectional data if the any cross-sectional data satisfies the first rendering condition and the second rendering condition; if all the cross-sectional data of the previous level that satisfy the first rendering condition all satisfy the second rendering condition, then the rendering result of the three-dimensional model is obtained based on the rendering results of each cross-sectional data.
[0028] In a possible implementation, the determination module is also used to, if the previous level is not the lowest level of the at least two levels and there is target cross-sectional data in the previous level that satisfies the first rendering condition but does not satisfy the second rendering condition, then loop execution to determine each cross-sectional data of the next level corresponding to the target cross-sectional data; take the next level as the previous level; for any cross-sectional data of the previous level, if any cross-sectional data satisfies the first rendering condition and the second rendering condition, render the any cross-sectional data according to the texture map corresponding to the any cross-sectional data to obtain a rendering result corresponding to the any cross-sectional data; until all cross-sectional data in the previous level that satisfy the first rendering condition also satisfy the second rendering condition; based on the rendering results of each cross-sectional data, obtain a rendering result of the three-dimensional model.
[0029] In a possible implementation, the determination module is also used to obtain a target sub-model corresponding to the target cross-sectional data if the previous level is the lowest level of the at least two levels and there is target cross-sectional data in the previous level that satisfies the first rendering condition but does not satisfy the second rendering condition; render the target sub-model to obtain a rendering result of the target sub-model; and obtain a rendering result of the three-dimensional model based on the rendering results of the individual cross-sectional data and the rendering result of the target sub-model.
[0030] In a possible implementation, the determination module is also used to obtain the basic submodel if the target submodel corresponding to the target cross-section data is a basic submodel; if the target submodel corresponding to the target cross-section data is other submodels, obtain the basic submodel and transformation information from the basic submodel to the other submodel, and obtain the other submodel based on the basic submodel and the transformation information.
[0031] In a possible implementation manner, the transformation information includes at least one of translation information, scaling information, and rotation information.
[0032] In a possible implementation manner, the any section data satisfies the first rendering condition including that the section indicated by the any section data is within the view frustum;
[0033] The fact that any of the cross-sectional data satisfies the second rendering condition includes that the size data of any of the cross-sectional data on the screen is not greater than a size threshold.
[0034] On the other hand, an electronic device is provided, comprising a processor and a memory, wherein the memory stores at least one computer program, and the at least one computer program is loaded and executed by the processor so that the electronic device implements any of the above-mentioned three-dimensional model rendering methods.
[0035] On the other hand, a computer-readable storage medium is provided, in which at least one computer program is stored. The at least one computer program is loaded and executed by a processor so that an electronic device can implement any of the above-mentioned three-dimensional model rendering methods.
[0036] On the other hand, a computer program or a computer program product is also provided, wherein at least one computer program is stored in the computer program or the computer program product, and the at least one computer program is loaded and executed by a processor so that an electronic device can implement any of the above-mentioned three-dimensional model rendering methods.
[0037] The technical solution provided by this application brings at least the following beneficial effects:
[0038] In the technical solution provided by the present application, cross-sectional data is first obtained, and the cross-sectional data is used to indicate the cross-sectional area of the envelope of at least one sub-model, and then a texture map corresponding to the cross-sectional data is obtained, and the texture map corresponding to the cross-sectional data is determined according to the texture information of each sub-model corresponding to the cross-sectional data. Since the texture map represents the texture information of each sub-model corresponding to the cross-sectional data projected onto the cross-sectional area indicated by any cross-sectional data, the appearance of each sub-model after projection is not easily deformed, so that the rendering effect can be improved when rendering based on the cross-sectional data and the corresponding texture map. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0040] Figure 1 It is a schematic diagram of an implementation environment of a three-dimensional model rendering method provided in an embodiment of the present application;
[0041] Figure 2 is a flowchart of a three-dimensional model rendering method provided in an embodiment of the present application;
[0042] Figure 3 It is a schematic diagram of obtaining cross-sectional data of a base leaf model provided in an embodiment of the present application;
[0043] Figure 4 is a schematic diagram of a data set at each level provided in an embodiment of the present application;
[0044] Figure 5 is a schematic diagram of an index structure provided in an embodiment of the present application;
[0045] Figure 6 is a schematic diagram of a texture map provided in an embodiment of the present application;
[0046] Figure 7 It is a schematic diagram of a rendering provided by an embodiment of the present application;
[0047] Figure 8 is a rendering schematic diagram of a plant model provided in an embodiment of the present application;
[0048] Fig. 9 is a schematic diagram of a rendering result of a plant model provided in an embodiment of the present application;
[0049] Fig.10 is a schematic diagram of a rendering result of another plant model provided in an embodiment of the present application;
[0050] Fig.11 is a schematic diagram of another rendering result provided in an embodiment of the present application;
[0051] Fig.12 It is a structural schematic diagram of a three-dimensional model rendering device provided in an embodiment of the present application;
[0052] Fig.13 It is a structural diagram of a terminal device provided in an embodiment of the present application;
[0053] Fig.14 It is a structural diagram of a server provided in an embodiment of the present application. DETAILED DESCRIPTION
[0054] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0055] Figure 1 is a schematic diagram of an implementation environment of a three-dimensional model rendering method provided in an embodiment of the present application, such as Figure 1 As shown, the implementation environment includes a terminal device 101 and a server 102. The three-dimensional model rendering method in the embodiment of the present application can be executed by the terminal device 101, can also be executed by the server 102, or can be executed by the terminal device 101 and the server 102 together.
[0056] The terminal device 101 can be a smart phone, a game console, a desktop computer, a tablet computer, a laptop computer, a smart TV, a smart car device, an intelligent voice interaction device, a smart home appliance, etc. The server 102 can be a single server, or a server cluster consisting of multiple servers, or any one of a cloud computing platform and a virtualization center, which is not limited in the embodiments of the present application. The server 102 can be connected to the terminal device 101 through a wired network or a wireless network. The server 102 can have functions such as data processing, data storage, and data transmission and reception, which are not limited in the embodiments of the present application. The number of terminal devices 101 and servers 102 is not limited and can be one or more.
[0057] The technical solution provided in the embodiment of the present application can be implemented based on cloud technology. Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and network in a wide area network or a local area network to realize data calculation, storage, processing, and sharing.
[0058] Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the cloud computing business model. It can form a resource pool, which can be used on demand and is flexible and convenient. Cloud computing technology will become an important support. The backend services of the technical network system require a large amount of computing and storage resources, such as video websites, image websites and more portal websites. With the rapid development and application of the Internet industry, in the future, each item may have its own identification mark, which needs to be transmitted to the backend system for logical processing. Data of different levels will be processed separately. All kinds of industry data need strong system backing support, which can only be achieved through cloud computing.
[0059] In the field of image processing technology, electronic devices can display objects represented by three-dimensional models in scenes such as movies, games, and engineering design by rendering each sub-model in the three-dimensional model of the object. Usually, each sub-model of the three-dimensional model is a triangular mesh, which includes multiple triangles. The texture information of the sub-model can represent the texture information of the corresponding parts on the object. When rendering any sub-model, some triangles of the sub-model are merged into large triangles, thereby simplifying the triangular mesh, that is, simplifying the sub-model. This process causes the sub-model to deform, resulting in poor rendering effect of the three-dimensional model.
[0060] The present application embodiment provides a method for rendering a three-dimensional model, which can be applied in the above implementation environment to solve the problem of poor rendering effect of the above three-dimensional model. Figure 2 Taking the flowchart of a 3D model rendering method provided in the embodiment of the present application as an example, for the convenience of description, the terminal device 101 or the server 102 that executes the 3D model rendering method in the embodiment of the present application is referred to as an electronic device, and the method can be executed by an electronic device. Figure 2 As shown, the method includes steps 201 to 203.
[0061] Step 201, obtaining a cross-sectional data set, the cross-sectional data set is constructed based on a plurality of sub-models included in a three-dimensional model of the object, the sub-models represent parts of the object, and the texture information of the sub-models represents the texture information of the parts. The cross-sectional data set includes a plurality of cross-sectional data, and the cross-sectional data is used to indicate a cross-section of an envelope box of at least one sub-model.
[0062] In an embodiment of the present application, the electronic device may first obtain a three-dimensional model of the object, and then construct a cross-sectional data set based on each sub-model included in the three-dimensional model. The content of the three-dimensional model is described below.
[0063] The modeling technology of the three-dimensional model can be used to model any object to obtain a three-dimensional model of the object. The embodiment of the present application does not limit the modeling method, and any modeling tool can be used to model the object. For example, a modeling tool (such as Speed Tree) can be used to model any plant to obtain a three-dimensional model of the plant (referred to as a plant model).
[0064] The electronic device can directly obtain the modeled three-dimensional model, which includes multiple sub-models. In general, any object can be regarded as composed of multiple parts. By modeling any part, a sub-model representing the part can be obtained. For example, plants include roots, trunks, branches, leaves and other parts. Taking leaves as an example, the leaves are modeled to obtain a sub-model representing the leaves. The sub-model representing the leaves can be called a leaf model.
[0065] Each sub-model has its corresponding triangular mesh, which is a type of polygonal mesh (referred to as mesh) in computer graphics. In computer graphics and 3D solid modeling, a polygonal mesh is a collection of vertices, edges, and faces that define the shape of a polyhedral object. A triangular mesh consists of a group of triangles (usually triangles in 3D space) connected by common edges or angles. Simply put, a triangular mesh consists of multiple triangles, and the shape, outline, and other information of the components corresponding to the sub-model can be represented through the triangular mesh.
[0066] In the embodiment of the present application, the triangular mesh corresponding to the sub-model is a triangular mesh with texture information, and the triangular mesh is expressed by triangular mesh data and a texture image.
[0067] Normally, the triangular mesh data corresponding to the sub-model records the data of each vertex in the triangular mesh corresponding to the sub-model. The data of any vertex includes the three-dimensional coordinates of the vertex, the identification information of the vertex, and the UV coordinates (i.e., texture coordinates) of the vertex. Optionally, three vertices in the triangular mesh can determine a triangular face, and the triangular mesh data may include the data of the triangular face in addition to the data of each vertex. The data of the triangular face includes at least one of the plane equation of the triangular face, the line equation of the line where any two vertices of the triangular face are located, the normal vector of the triangular face, the data of each vertex in the triangular face, etc.
[0068] The sub-model corresponds to at least one texture image, and the texture images include albedo maps, normal maps, subsurface scattering maps, and position maps. Among them, the albedo map corresponding to the sub-model can reflect the color and texture of the sub-model. The normal map corresponding to the sub-model is a map obtained by drawing a normal line at each point on the concave and convex surface of the sub-model and using the pixel value to represent the direction of the normal line. Therefore, the normal map corresponding to the sub-model can reflect the concave and convex surface of the sub-model. The subsurface scattering map corresponding to the sub-model can reflect the visual effect after light is irradiated on the surface of the sub-model. The pixel value of any pixel point in the position map corresponding to the sub-model corresponds to the three-dimensional coordinates of a point in three-dimensional space. Therefore, the position map corresponding to the sub-model can reflect the three-dimensional structure of the sub-model.
[0069] It should be noted that the texture color value (texture value for short) corresponding to the vertex can be determined based on the UV coordinates of the vertex. Therefore, the UV coordinates of each vertex in the triangular mesh corresponding to the sub-model can reflect the texture information of the component corresponding to the sub-model, and the texture image corresponding to the sub-model can also reflect the texture information of the component corresponding to the sub-model. Therefore, the UV coordinates and texture image of each vertex corresponding to the sub-model belong to the texture information corresponding to the sub-model.
[0070] For example, the triangular mesh data corresponding to the leaf model records the three-dimensional coordinates of each vertex in the triangular mesh corresponding to the leaf model, the identification information of each vertex, and the texture coordinates of each vertex. The three-dimensional coordinates of each vertex in the triangular mesh can represent the shape, outline, and other information of the leaf. The leaf model also corresponds to the albedo map, normal map, subsurface scattering map, and position map. The texture information of the leaf can be represented by these maps and the texture coordinates of each vertex in the triangular mesh.
[0071] The above describes the content of the three-dimensional model. It can be seen from the above that the three-dimensional model includes multiple sub-models. In an embodiment of the present application, the electronic device can determine a section data based on at least one sub-model. In this way, each section data in the section data set can be determined based on multiple sub-models. Among them, the section data is used to indicate the section of the envelope box of at least one sub-model. Since the sub-model belongs to the three-dimensional model, the envelope box is a three-dimensional geometric body. Optionally, the envelope box is a polyhedron, and the cross section is any cross section of the polyhedron. The embodiment of the present application does not limit the shape of the cross section. Exemplarily, the cross section is a quadrilateral, triangle, hexagon, etc.
[0072] Optionally, the envelope is a minimum cuboid enclosing at least one sub-model, in which case the cross section may be a cross section passing through the center of the minimum cuboid. That is, the cross section data is used to indicate the cross section of the minimum cuboid enclosing at least one sub-model, and the cross section passes through the center of the minimum cuboid. Optionally, the cross section indicated by the cross section data is composed of triangular faces located in the same plane, for example, the cross section of the minimum cuboid is a rectangle, which is composed of two triangular faces, and the two triangular faces are located in the same plane.
[0073] A possible implementation of step 201 includes implementation A as shown below.
[0074] In implementation mode A, the cross-sectional data set includes at least two levels of data sets, and any level of data sets includes at least one cross-sectional data, and one cross-sectional data of the upper level corresponds to at least one cross-sectional data of the lower level.
[0075] At least two levels of data sets belong to a data structure of multiple levels of detail (LOD). Since one section data of the upper level corresponds to at least one section data of the lower level, the number of section data included in the data set of the upper level is less than the number of section data included in the data set of the lower level.
[0076] In the embodiment of the present application, the level of detail of any level is related to the number of cross-sectional data included in the data set of the level. The more cross-sectional data included in the data set of any level, the finer (i.e., higher) the level of detail of the level; the fewer cross-sectional data included in the data set of any level, the coarser (i.e., lower) the level of detail of the level. Since the number of cross-sectional data included in the data set of the previous level is less than the number of cross-sectional data included in the data set of the next level, the level of detail of the previous level is lower than the level of detail of the next level.
[0077] In the case of implementation method A, step 201 also includes steps 2011 to 2012 before step 201.
[0078] Step 2011, determining the data set of the previous level based on the data set of the next level, when the next level is the lowest level of at least two levels, the data set of the next level is determined based on the cross-sectional data corresponding to each sub-model in the three-dimensional model.
[0079] In an embodiment of the present application, the cross-sectional data corresponding to each sub-model in the three-dimensional model can be determined first, and the cross-sectional data corresponding to each sub-model in the three-dimensional model can be used as each cross-sectional data in the lowest level data set of at least two levels. Alternatively, the cross-sectional data corresponding to each sub-model in the three-dimensional model are aggregated to obtain a data set of the lowest level of at least two levels. The aggregation method can be found in the description of step B1 below, which will not be repeated here. Then, starting from the lowest level, a method of determining the data set of the previous level based on the data set of the next level is adopted to obtain data sets of at least two levels. The method of determining the data set of the lowest level is introduced below.
[0080] In a possible implementation, steps A1 to A3 as shown below may be used to determine the cross-sectional data corresponding to each sub-model in the three-dimensional model to obtain a data set at the lowest level.
[0081] Step A1, determining a basic sub-model in a three-dimensional model, where the basic sub-model is any sub-model in the three-dimensional model, and determining transformation information from the basic sub-model to other sub-models, where the other sub-model is any sub-model in the three-dimensional model except the basic sub-model.
[0082] In the process of modeling a three-dimensional model, a set number of sub-models can be modeled first, and these sub-models can be called basic sub-models. The basic sub-models are deformed to obtain other sub-models by means of three-dimensional (3D) affine transformation. For example, for a plant model, when the number of leaf models in the plant model is greater than a threshold value, it means that the number of leaf models in the plant model is large, and a set number of leaf models can be modeled. These leaf models are used as base leaf models (i.e., basic sub-models), and the base leaf models are deformed to obtain other leaf models.
[0083] Generally, in the process of modeling a three-dimensional model, each time a basic sub-model is modeled, the triangular mesh (i.e., triangular mesh data and at least one texture image) corresponding to the basic sub-model will be stored in a set storage space. Each time the basic sub-model is deformed to obtain other sub-models, transformation information will be stored in the storage space to record the deformation operation using the transformation information. Therefore, in addition to the corresponding triangular mesh, the basic sub-model also corresponds to a transformation file, which records the transformation information from the basic sub-model to multiple other sub-models.
[0084] Optionally, the transformation information includes at least one of translation information, scaling information, and rotation information. The transformation information of the basic sub-model to any other sub-model consists of 8 data types of floating-point numbers, and the floating-point number is a data type that contains both decimals and integers. Among them, the translation information corresponds to 3 data types of floating-point numbers, which are used to record the translation transformation. The scaling information corresponds to 1 data type of floating-point numbers, which is used to record the uniform scaling transformation. The rotation information corresponds to 4 data types of floating-point numbers, among which 1 data type of floating-point numbers is used to record the rotation angle, and 3 data types of floating-point numbers are used to record the rotation axis.
[0085] In the embodiment of the present application, the triangular mesh and transformation file corresponding to each basic sub-model can be directly read from the storage space to obtain the basic sub-model in the three-dimensional model and the transformation information from the basic sub-model to other sub-models.
[0086] In a possible implementation, the three-dimensional model includes triangular meshes corresponding to each sub-model. After the electronic device stores the three-dimensional model in a storage space, the storage space stores triangular meshes corresponding to each sub-model, rather than triangular meshes and transformation files corresponding to the basic sub-model. At this time, it is necessary to determine the basic sub-model and transformation information in the three-dimensional model based on the triangular meshes corresponding to each sub-model in the three-dimensional model.
[0087] Optionally, determining a basic sub-model in a three-dimensional model includes: classifying each sub-model in the three-dimensional model into at least one category according to texture information of each sub-model in the three-dimensional model; and for any category, selecting any sub-model from each sub-model in any category as a basic sub-model of any category.
[0088] In the embodiments of the present application, there are multiple transformation methods, and any transformation method can transform the basic sub-model into other sub-models. Take the transformation of the basic sub-model into other sub-models by 3D affine transformation as an example. When the transformation is performed by 3D affine transformation, the three-dimensional coordinates of each vertex in the triangular mesh will change. Since the three-dimensional coordinates of the vertices will change, the plane equation of the triangular face, the straight line equation of the straight line where any two vertices in the triangular face are located, and the normal vector of the triangular face will change. However, the identification information of each vertex in the triangular mesh and the texture coordinates of each vertex will not change. In other words, when the basic sub-model is transformed into other sub-models, the appearance of the sub-model will change, but the texture information of the sub-model will not change.
[0089] Therefore, when the texture information of any two sub-models in the three-dimensional model is the same, it indicates that the two sub-models are obtained by transforming the same basic sub-model, and the two sub-models can be classified into the same category. In this way, each sub-model in the three-dimensional model can be classified into each category. Optionally, when the number of texture coordinates corresponding to the two sub-models is the same (that is, the number of vertices is the same), it is determined that the texture information of the two sub-models is the same. Optionally, when the number of texture coordinates corresponding to the two sub-models is the same, the texture coordinates of each vertex corresponding to the sub-models can also be sorted. When the sorted texture coordinates corresponding to the two sub-models are the same, the texture information of the two sub-models is the same.
[0090] Optionally, each sub-model corresponds to a material information, for example, the material information corresponding to the leaf model can be plastic, paper or cloth, etc. When the basic sub-model is transformed to other sub-models, the material information corresponding to the sub-model will not change. Therefore, each sub-model can also be divided into at least one category based on the texture information and material information of each sub-model. When the texture information and material information of any two sub-models are the same, the two sub-models are classified in the same category. In this way, each sub-model in the three-dimensional model can be divided into multiple categories. For example, multiple leaf models are pre-classified according to the material information of each leaf model, and for each category divided, the category is reclassified according to the texture information of the leaf model. Alternatively, multiple leaf models are pre-classified according to the texture information of each leaf model, and for each category divided, the category is reclassified according to the material information of the leaf model. In other words, the embodiment of the present application does not limit the order of the texture information and material information on which the classification is based.
[0091] After the plurality of sub-models are classified into at least one category, any sub-model can be selected from the sub-models of any category as a basic sub-model of any category. Then, transformation information from the basic sub-model to other sub-models is determined, including: determining transformation information from the basic sub-model of any category to other sub-models of any category, where the other sub-models of any category are sub-models in any category other than the basic sub-model of any category.
[0092] In the embodiment of the present application, for any category, transformation information from the basic sub-model of the category to other sub-models of the category can be calculated based on the triangular mesh of the basic sub-model of the category and the triangular meshes of other sub-models of the category.
[0093] In one possible implementation, the transformation information from a basic sub-model of any category to other sub-models of any category is determined, including: determining a first envelope box of the basic sub-model of any category; determining a second envelope box of other sub-models of any category; and determining the transformation information from the basic sub-model of any category to other sub-models of any category based on the first envelope box and the second envelope box.
[0094] The triangular mesh data corresponding to the basic sub-model can be obtained. Since the triangular mesh data records the data of each vertex in the triangular mesh corresponding to the basic sub-model, the data of the envelope of the basic sub-model can be determined based on the data of each vertex (such as the three-dimensional coordinates of each vertex), thereby determining the first envelope (i.e., the envelope of the basic sub-model), wherein the first envelope surrounds each vertex and each triangular face corresponding to the basic sub-model.
[0095] In a possible implementation, the first envelope is a minimum envelope (i.e., a bounding box) surrounding the basic sub-model. Optionally, by using a principal component analysis (PCA) method, the triangular mesh data corresponding to the basic sub-model is analyzed to determine at least one of the directions of the three coordinate axes, the lengths of the three sides, the coordinates of the center point, etc. Determining this information is equivalent to determining the minimum envelope surrounding the basic sub-model, and the minimum envelope is a cuboid.
[0096] In a three-dimensional scenario, the PCA method can be used to find a set of mutually orthogonal coordinate axes from the three-dimensional space to obtain the directions of the three coordinate axes of the minimum envelope. Among them, the direction of the first coordinate axis satisfies that the variance of each projected vertex is the largest when each vertex corresponding to the basic sub-model is projected after the coordinate axis; the direction of the second coordinate axis satisfies that the variance of each projected vertex is the largest when each vertex corresponding to the basic sub-model is projected after the coordinate axis in a plane orthogonal to the first coordinate axis; the direction of the third coordinate axis satisfies that the variance of each projected vertex is the largest when each vertex corresponding to the basic sub-model is projected after the coordinate axis in a plane orthogonal to the first two coordinate axes. The coordinates of the center point of the basic sub-model can be obtained by averaging the three-dimensional coordinates of each vertex corresponding to the basic sub-model, and the coordinates of the center point of the basic sub-model are used as the coordinates of the center point of the minimum envelope. The lengths of the three sides of the minimum envelope are determined based on the distribution of each vertex corresponding to the basic sub-model on the three coordinate axes.
[0097] Finally, according to the method of determining the first envelope frame mentioned above, the data of the envelope frames of other sub-models can be determined, thereby determining the second envelope frame (i.e., the envelope frames of other sub-models). Based on the data of the envelope frame of the basic sub-model and the data of the envelope frames of other sub-models, the transformation information from the basic sub-model to the other sub-models can be calculated.
[0098] In an embodiment of the present application, the storage resources required to store the transformation information from the basic sub-model to other sub-models are less than the storage resources required to store the three-dimensional mesh data and texture images of other sub-models. Therefore, by determining the basic sub-model and the transformation information from the basic sub-model to other sub-models, the electronic device only needs to store the basic sub-model and the transformation information without storing other sub-models, thereby reducing the occupancy of storage resources and reducing the hardware requirements for the electronic device.
[0099] Step A2, determining the cross-sectional data corresponding to the basic sub-model.
[0100] In the embodiment of the present application, the data of the envelope of the basic sub-model can be determined based on the triangular mesh data corresponding to the basic sub-model. Based on the data of the envelope, the cross-sectional data representing any cross section of the envelope is determined to obtain the cross-sectional data corresponding to the basic sub-model.
[0101] Optionally, the envelope is a minimum envelope, and the minimum envelope corresponds to multiple cross sections passing through the center of the minimum envelope, and each cross section corresponds to the data of a cross section. For any cross section, the basic sub-model is projected onto the cross section to obtain the projection area corresponding to the cross section. For example, each triangular face in the triangular mesh corresponding to the basic sub-model is projected onto the cross section to obtain each triangular face after projection. The area of any projected triangular face can be determined, and the areas of each projected triangular face are added to obtain the projection area corresponding to the cross section. From the projection areas corresponding to each cross section, the maximum projection area is selected, and the data of the cross section corresponding to the maximum projection area is used as the cross-sectional data of the basic sub-model.
[0102] See also Figure 3 , Figure 3 Schematic diagram of obtaining cross-sectional data of a base leaf model provided in an embodiment of the present application. Figure 3 The model shown by reference numeral 301 in (1) is a base leaf model. The minimum envelope of the base leaf model can be determined first, such as Figure 3 As shown in the reference numeral 303 in (1) of FIG. Next, multiple cross sections passing through the center of the minimum envelope are determined. For any cross section, the projection area of the base leaf model projected onto the cross section is determined to obtain the projection area corresponding to the cross section. Based on the projection areas corresponding to the cross sections, the cross section corresponding to the maximum projection area is selected, as shown in FIG. Figure 3As shown in the reference numeral 302 in (1) of FIG. 1 , the data of the cross section corresponding to the maximum projection area is used as the cross section data of the base leaf model, so as to use the cross section data of the base leaf model to characterize the cross section corresponding to the maximum projection area in the minimum envelope of the base leaf model, as shown in FIG. Figure 3 As shown in (2) in FIG. 1 , the cross section is composed of triangular faces located in the same plane.
[0103] Step A3: Based on the cross-sectional data and transformation information corresponding to the basic sub-model, determine the cross-sectional data corresponding to other sub-models.
[0104] After the transformation information from the basic sub-model to other sub-models and the cross-sectional data corresponding to the basic sub-model have been determined, the cross-sectional data can be transformed based on the transformation information to obtain the transformed cross-sectional data, which is the cross-sectional data corresponding to other sub-models. Since the amount of calculation involved in transforming the cross-sectional data based on the transformation information is less than the amount of calculation involved in determining the cross-sectional data corresponding to the sub-model through the triangular mesh data corresponding to the sub-model, the embodiment of the present application can quickly and accurately obtain the cross-sectional data of each sub-model, reducing the amount of calculation.
[0105] Of course, in actual application, the same principle as that for determining the cross-sectional data of the basic sub-model can be adopted. First, the envelope frame data of other sub-models can be determined based on the three-dimensional mesh data of other sub-models, and then the corresponding cross-sectional data of other sub-models can be determined based on the envelope frame data of other sub-models. This will not be repeated here.
[0106] In the embodiment of the present application, the next level can be any level except the highest level of the at least two levels, including but not limited to the lowest level of the at least two levels. The embodiment of the present application determines the data set of the previous level based on the data set of the next level.
[0107] In a possible implementation, determining a data set at an upper level based on a data set at a lower level includes step B1 and step B2.
[0108] Step B1, for any two cross-sectional data in the data set of the next level, if any two cross-sectional data meet the aggregation condition, then based on the sub-model corresponding to any two cross-sectional data, determine the cross-sectional data corresponding to any two cross-sectional data.
[0109] After each cross-sectional data in the data set of the next level is determined, each cross-sectional data may be aggregated so as to use a new cross-sectional data to approximate at least two cross-sectional data before the aggregation.
[0110] In the embodiment of the present application, it can be determined whether any two cross-sectional data in the data set of the next level meet the aggregation condition. Optionally, any two cross-sectional data meet the aggregation condition including at least one of the case C1 and the case C2.
[0111] Case C1: the distance between the sections indicated by any two section data is less than the distance threshold.
[0112] In the embodiment of the present application, the center coordinates of the cross section indicated by the cross section data can be determined to characterize the center of the cross section by using the center coordinates. The distance between the centers of the two cross sections is calculated by using the center coordinates of the two cross section data, and the distance is used as the distance between the two cross sections.
[0113] If the distance between two sections is less than the distance threshold, the section data corresponding to the two sections meet the aggregation condition. The embodiment of the present application does not limit the distance threshold. Exemplarily, the distance threshold is related to the number of levels of the current level. The smaller the number of levels of the current level, the higher the current level, the coarser the level of detail of the current level, the smaller the number of section data included in the data set of the current level, and the larger the distance threshold.
[0114] Case C2: the normal vector angle between the cross sections indicated by any two cross section data is less than the angle threshold.
[0115] In the embodiment of the present application, the triangular mesh data corresponding to any sub-model may include the normal vectors of each triangular face in the triangular mesh corresponding to the sub-model, or the normal vectors of each triangular face in the triangular mesh corresponding to the sub-model may be determined based on the data of each vertex in the triangular mesh data corresponding to any sub-model. Each normal vector corresponds to a direction, which may be a positive direction (from the inside of the sub-model's envelope to the outside) or a negative direction (from the outside of the sub-model's envelope to the inside).
[0116] Since any section data corresponds to at least one sub-model, the average direction can be calculated based on the directions corresponding to the normal vectors of each triangular face corresponding to the at least one sub-model, and the normal vector of the section indicated by the section data can be determined based on the average direction and the section data.
[0117] If the angle between the normal vectors of the cross sections indicated by any two cross-sectional data (i.e., the normal vector angle) is less than the angle threshold, then the two cross-sectional data meet the aggregation condition. The embodiment of the present application does not limit the angle threshold. For example, the angle threshold is a set value, such as the angle threshold is 30 degrees.
[0118] For two cross-sectional data that meet the aggregation conditions, the same principle as "determining the cross-sectional data of the basic sub-model" can be adopted. Based on the sub-model corresponding to the two cross-sectional data, a cross-sectional data can be determined, and the cross-sectional data can be used as the cross-sectional data corresponding to the two cross-sectional data, so as to use the cross-sectional data to approximate the two cross-sectional data and realize the aggregation of the two cross-sectional data. That is, the sub-models corresponding to the two cross-sectional data are taken as a combination, and the data of the envelope frame of the combination is determined. Based on the data of the envelope frame, the cross-sectional data corresponding to the combination is determined, and the cross-sectional data corresponding to the two cross-sectional data is obtained. This process can be seen in the description of step A2 above, and will not be repeated here.
[0119] Through step B1, two cross-sectional data satisfying the aggregation condition in the next level are aggregated according to the position and direction of the cross-sectional data indicated by the cross-sectional data in the next level, and these two cross-sectional data are not aggregated with other cross-sectional data in the next level. Through the aggregation operation, the amount of cross-sectional data is reduced and the degree of detail is reduced.
[0120] Step B2: if the number of cross-sectional data in the candidate data set is less than the reference number, the candidate data set is used as the data set of the previous level, and the candidate data set includes cross-sectional data corresponding to any two cross-sectional data that meet the aggregation condition and cross-sectional data that do not meet the aggregation condition.
[0121] It is understandable that when aggregating the cross-sectional data of the next level, in addition to the two cross-sectional data that meet the aggregation conditions can be aggregated into one cross-sectional data, some cross-sectional data cannot be aggregated. In an embodiment of the present application, the cross-sectional data corresponding to any two cross-sectional data that meet the aggregation conditions can be used to aggregate with the cross-sectional data corresponding to the other two cross-sectional data that meet the aggregation conditions, or can be used to aggregate with the cross-sectional data that does not meet the aggregation conditions, and the cross-sectional data that does not meet the aggregation conditions is also used to aggregate with another cross-sectional data that does not meet the aggregation conditions. Therefore, the cross-sectional data corresponding to any two cross-sectional data that meet the aggregation conditions and the cross-sectional data that do not meet the aggregation conditions are used in the same way. For ease of description, the cross-sectional data corresponding to any two cross-sectional data that meet the aggregation conditions and the cross-sectional data that do not meet the aggregation conditions are regarded as cross-sectional data in a set, and the set is called a candidate data set.
[0122] By aggregating the cross-sectional data of the next level, the cross-sectional data in the candidate data set is obtained, so that the number of cross-sectional data is reduced while the number of sub-models corresponding to the cross-sectional data may be increased, so that multiple sub-models can be rendered at one time when the cross-sectional data is subsequently rendered, thereby improving the rendering speed and rendering efficiency.
[0123] If the number of cross-sectional data in the candidate data set is less than the reference number, the candidate data set will be used as the data set of the previous level. The embodiment of the present application does not limit the reference number. Exemplarily, the reference number is related to the level number of the previous level. The smaller the level number, the higher the level, and the smaller the reference number.
[0124] In the embodiment of the present application, the method further includes step B3, which is performed after step B1.
[0125] Step B3, if the number of cross-sectional data in the candidate data set is not less than the reference number, the candidate data set is used as the data set of the next level, and the loop is executed. If any two cross-sectional data meet the aggregation conditions, the cross-sectional data corresponding to any two cross-sectional data are determined based on the sub-model corresponding to any two cross-sectional data, until the number of cross-sectional data in the candidate data set is less than the reference number, and the candidate data set is used as the data set of the previous level.
[0126] In an embodiment of the present application, if the number of cross-sectional data in the candidate data set is not less than the reference number, the candidate data set is used as the data set of the next level, and step B1 is re-executed to obtain the candidate data set. Determine whether to execute step B2 or step B3 based on the number of cross-sectional data in the candidate data set. When step B2 is executed, the loop ends and the data set of the previous level is obtained. When step B3 is executed, the loop continues. In this way, the cross-sectional data of the data set of the next level is aggregated once or multiple times until cross-sectional data less than the reference data is obtained, thereby obtaining the data set of the previous level.
[0127] See also Figure 4 , Figure 4 is a schematic diagram of a data set at each level provided in an embodiment of the present application. Figure 4 (1) in the figure shows all leaf models in the plant model, with a total of 6,004,752 leaf models. Figure 4 (2) is based on Figure 4 The lowest level data set is determined by (1) in , which includes 307936 cross-sectional data. Figure 4 The data set shown in (2) in the figure is aggregated once or multiple times to obtain Figure 4 The data set shown in (3) in is the data set of the previous level of the lowest level, and the data set includes 15408 cross-sectional data. Figure 4 The data set shown in (3) in the figure is aggregated once or multiple times to obtain Figure 4 The data set shown in (4) in is the data set of the two levels above the lowest level, and the data set includes 762 cross-sectional data. Figure 4The darker the color of the area, the closer the direction of the normal vector of the cross section corresponding to the area is to the positive direction, and the lighter the color of the area, the closer the direction of the normal vector of the cross section corresponding to the area is to the negative direction.
[0128] Step 2012: in response to satisfying the set conditions, obtaining a cross-sectional data set based on the data sets at each level.
[0129] The embodiment of the present application does not limit the setting condition. For example, the setting condition is satisfied when the previous level is the highest level of at least two levels, or when the number of cycles is updated once each time step 2011 is executed, that is, 1 is added to the previous number of cycles to obtain the current number of cycles, and the setting condition is satisfied when the number of cycles reaches the set number of cycles.
[0130] In the embodiment of the present application, the method further includes step 2013. Step 2013 is performed after step 2011.
[0131] Step 2013, in response to the set condition not being met, the data set of the previous level is used as the data set of the next level, and the data set of the previous level is determined based on the data set of the next level in a loop until the set condition is met, and the cross-sectional data set is obtained based on the data sets of each level.
[0132] In the embodiment of the present application, when the set condition is not met, the data set of the previous level is used as the data set of the next level, and step 2011 is executed cyclically to determine whether the set condition is met. When the set condition is met, the loop is terminated to obtain the cross-sectional data set, and when the set condition is not met, the loop continues. In this way, the data set of the previous level can be continuously determined based on the data set of the lowest level until the cross-sectional data set is obtained.
[0133] In the embodiment of the present application, any cross-sectional data of the previous level corresponds to at least one cross-sectional data of the next level, and in this way, cross-sectional data of different levels are associated. In the embodiment of the present application, an index structure can be used to store cross-sectional data of each level, and the index structure can also be called a LOD data structure, and the index structure is a tree structure, so the index structure can be called a LOD tree structure.
[0134] The LOD tree structure includes at least two levels, the highest level corresponds to at least one root node, and the lowest level corresponds to multiple leaf nodes. When there are only two levels, a root node of the highest level corresponds to at least one leaf node of the lowest level, and a root node represents a cross-sectional data in the data set of the highest level, so the number of root nodes is equal to the number of cross-sectional data in the data set of the highest level. Leaf nodes have no child nodes, and a leaf node represents a cross-sectional data in the data set of the lowest level, so the number of leaf nodes is equal to the number of cross-sectional data in the data set of the lowest level. In a possible implementation, the data set of the lowest level includes the cross-sectional data of each sub-model in the three-dimensional model, so the number of leaf nodes is equal to the number of sub-models.
[0135] When the LOD tree structure has more than two levels, the LOD tree structure also includes at least one intermediate level, which is any level other than the lowest level and the highest level. One intermediate level corresponds to multiple intermediate nodes. At this time, a root node of the highest level corresponds to at least one intermediate node of the next intermediate level, and an intermediate node of the previous intermediate level corresponds to at least one intermediate node of the next intermediate level. An intermediate node of the last intermediate level corresponds to at least one leaf node of the lowest level.
[0136] See also Figure 5 , Figure 5 It is a schematic diagram of a LOD tree structure provided in an embodiment of the present application. The LOD tree structure includes levels 0 to n+1, where n is a positive integer. Among them, any level corresponds to multiple nodes, and one node represents a cross-sectional data. Level n+1 is the lowest level, and each cross-sectional data of level n+1 corresponds to each leaf model of the plant model in turn. Therefore, the number of cross-sectional data of level n+1 is the same as the number of leaf models of the plant model. Any cross-sectional data of level n corresponds to at least one cross-sectional data of level n+1, and so on, until level 0. Level 0 is the highest level, and any cross-sectional data of level 0 corresponds to at least one cross-sectional data of level 1.
[0137] Step 202, obtaining the texture map corresponding to each cross-sectional data in the cross-sectional data set. The texture map corresponding to any cross-sectional data is determined based on the texture information of each sub-model corresponding to any cross-sectional data. The texture map corresponding to any cross-sectional data is used to represent the texture information of each sub-model corresponding to any cross-sectional data projected onto the cross-sectional data indicated by any cross-sectional data.
[0138] In an embodiment of the present application, for any cross-sectional data in a cross-sectional data set, a texture map corresponding to any cross-sectional data is determined according to the texture information of each sub-model corresponding to any cross-sectional data. When a cross-sectional data is determined based on N sub-models, the texture information of the N sub-models can be obtained, and the texture information of the N sub-models can be projected onto the cross-sectional data indicated by the cross-sectional data, and the obtained texture information is the texture map corresponding to the cross-sectional data. Since when the texture information of the sub-model is projected onto the cross-sectional data indicated by the cross-sectional data, the cross-sectional data includes the area where the texture information after projection is located, the texture information on the area can reflect the texture of the sub-model after projection, and the contour of the area can reflect the shape of the sub-model after projection. Therefore, the texture map corresponding to the cross-sectional data can reflect the texture and shape of each sub-model corresponding to the cross-sectional data after projection, ensuring that the shape of the sub-model after projection will not be deformed, and ensuring the fidelity of the texture of the sub-model after projection.
[0139] In a possible implementation, before obtaining the texture maps corresponding to each cross-sectional data in the cross-sectional data set, it also includes: for any sub-model corresponding to any cross-sectional data, projecting the texture information of any sub-model onto the cross-section indicated by any cross-sectional data to obtain the texture map of any sub-model; and fusing the texture maps of each sub-model corresponding to any cross-sectional data to obtain the texture map corresponding to any cross-sectional data.
[0140] In the embodiment of the present application, for any sub-model corresponding to the cross-sectional data, the texture information corresponding to the sub-model includes the UV coordinates of each vertex corresponding to the sub-model and at least one texture image corresponding to the sub-model. Generally speaking, the UV coordinates of the vertex are used to determine the texture value corresponding to the vertex, and the texture image includes the texture values of multiple pixels. Therefore, the texture information corresponding to the sub-model can be understood as the texture value of each pixel.
[0141] Optionally, in units of pixels, any pixel corresponding to the sub-model is projected onto a section indicated by any section data to obtain the projected pixel, and the texture value of any pixel is assigned to the projected pixel, so that the texture value of the projected pixel is the same as the texture value of the pixel before projection. By projecting each pixel corresponding to the sub-model, the texture map of the sub-model can be obtained.
[0142] It is understandable that the sub-model belongs to a three-dimensional model, the texture information corresponding to the sub-model is equivalent to the 3D texture information, and the texture map of the sub-model belongs to a two-dimensional map. Therefore, the embodiment of the present application projects the 3D texture information into the 2D UV domain. When projecting, the pixel points need to be projected on the cross section, that is, each triangular face corresponding to the sub-model needs to be projected on the cross-sectional area.
[0143] In a possible implementation, the vertices of the sub-model can be projected onto the cross-sectional area to obtain the vertices of the sub-model after projection. At this time, for any pixel point, the centroid coordinates of the pixel point are determined according to the vertices of the sub-model after projection, the texture value of the pixel point before projection is obtained according to the centroid coordinates and the vertices of the sub-model, and the texture value of the pixel point before projection is assigned to the pixel point after projection.
[0144] Through the above method, the texture information of each sub-model corresponding to any section data can be projected onto the section indicated by the section data to obtain the texture map of each sub-model corresponding to the section data. Then, the texture maps of each sub-model corresponding to the section data are fused to obtain the texture map corresponding to the section data. For example, any point on the section indicated by the section data corresponds to at least two pixels, and these two pixels belong to the texture maps of different sub-models. Then, the pixel values of at least two pixels are averaged to obtain a new pixel value, thereby realizing the fusion of at least two pixels. In this way, the texture maps of each sub-model corresponding to the section data can be fused. Optionally, the depth of the pixel can be appropriately adjusted according to the position of the pixel to optimize the texture map.
[0145] In the embodiment of the present application, each cross-sectional data in the cross-sectional data set has its corresponding texture map. Assuming that the cross-sectional data set includes N cross-sectional data, there are also N texture maps. Optionally, the UV domain is evenly divided into UV grids, assign the first N UV grids to N section data, and each UV grid stores the texture map of the corresponding section data.
[0146] Optionally, the cross section indicated by the cross section data is composed of triangular faces located in the same plane. Assuming that the number of triangular faces is A, each UV grid will be subdivided into A UV sub-grids, and one UV sub-grid is used to store the texture map of one triangular face.
[0147] See also Figure 6 , Figure 6 is a schematic diagram of a texture map provided in an embodiment of the present application. Figure 6 (1) in the figure shows the cross sections indicated by the cross section data of a certain level in the cross section data set. There are 9440 cross sections in total. Figure 6 The left half of (2) shows the texture map corresponding to 9440 cross-sectional data. Figure 6 The right half of (2) in Figure 2 shows some enlarged images of texture maps. Figure 6 As can be seen from (2) in FIG. 1 , the texture information of at least one sub-model is projected onto a cross section indicated by cross-sectional data to obtain a texture map corresponding to the cross-sectional data, and the texture map can reflect the texture and shape of each sub-model after projection.
[0148] Step 203: Determine a rendering result of the three-dimensional model based on each cross-sectional data in the cross-sectional data set and the corresponding texture map.
[0149] In the embodiment of the present application, for any section data in the section data set, the texture map corresponding to the section data can be rendered on the section indicated by the section data to obtain the rendering result of the section data. Since the section data is used to indicate the section of the envelope of at least one sub-model, and the texture map corresponding to the section data is used to represent the texture information of each sub-model corresponding to the section data projected onto the section indicated by the section data, the rendering result of the section data is equivalent to the rendering result of the sub-model. By rendering each sub-model of the three-dimensional model, the rendering result of the three-dimensional model can be obtained.
[0150] In a possible implementation, the cross-sectional data set includes at least two levels of data sets, and any level of data sets includes at least one cross-sectional data, and one cross-sectional data of the previous level corresponds to at least one cross-sectional data of the next level; step 203 includes step 2031 and step 2032.
[0151] Step 2031, for any cross-section data of the previous level, if any cross-section data meets the first rendering condition and the second rendering condition, any cross-section data is rendered according to the texture map corresponding to any cross-section data to obtain a rendering result of any cross-section data.
[0152] Optionally, starting from any level of at least two levels (for example, the highest level), traverse the cross-sectional data of any level and each level below it in order from top to bottom, render the cross-sectional data that meets the first rendering condition and the second rendering condition, and obtain the rendering result of the cross-sectional data.
[0153] Any cross-section data satisfies the first rendering condition, including that the cross-section indicated by any cross-section data is within the view frustum; any cross-section data satisfies the second rendering condition, including that the size data of any cross-section data on the screen is not greater than a size threshold.
[0154] When rendering starts, the camera position, camera parameters and the position of the three-dimensional model can be obtained. The camera parameters can indicate the relative relationship between the camera and the screen. On the one hand, through the camera position, camera parameters and the position of the three-dimensional model, it can be determined whether the section indicated by the section data is within the view frustum. Among them, the view frustum is a three-dimensional area. If an object is in this three-dimensional area, the object is visible on the screen. Therefore, the view frustum is equivalent to the field of view of the camera. On the other hand, through the camera position, camera parameters and the position of the three-dimensional model, the size data of the section data on the screen can be calculated, wherein the size data can be any one of the circumference, area, diagonal length, etc. of the section indicated by the section data on the screen.
[0155] In the embodiment of the present application, for any cross-section data of the previous level, if the cross-section data satisfies the first rendering condition, it indicates that all or part of the cross-section indicated by the cross-section data is located within the view frustum. At this time, each sub-model corresponding to the cross-section data is within the camera field of view, so it is necessary to render this part of the sub-model.
[0156] If the cross-sectional data meets the second rendering condition, that is, the size data of the cross-sectional data on the screen is not greater than the size threshold, it indicates that each sub-model corresponding to the cross-sectional data is relatively far from the camera, and the texture map corresponding to the cross-sectional data can be directly obtained, and the texture map corresponding to the cross-sectional data is rendered on the cross-sectional surface corresponding to the cross-sectional data using a pixel shader to obtain the rendering result of the cross-sectional data. The embodiment of the present application does not limit the size threshold, and illustratively, the size threshold is a set value.
[0157] Step 2032: If each cross-sectional data satisfying the first rendering condition at the previous level also satisfies the second rendering condition, a rendering result of the three-dimensional model is obtained based on the rendering results of each cross-sectional data.
[0158] If all the cross-sectional data that meet the first rendering condition in the previous level meet the second rendering condition, then these cross-sectional data have obtained the rendering results in accordance with step 2031. At this time, all sub-models within the camera field of view have been rendered, and the rendering results of the three-dimensional model can be obtained based on the rendering results of each cross-sectional data.
[0159] In a possible implementation, the method further includes step 2033 and step 2034. Step 2033 and step 2034 may be performed after step 2031.
[0160] Step 2033, if the previous level is not the lowest level of at least two levels and there is target cross-section data in the previous level that meets the first rendering condition but does not meet the second rendering condition, then loop execution to determine each cross-section data of the next level corresponding to the target cross-section data; take the next level as the previous level; for any cross-section data of the previous level, if any cross-section data meets the first rendering condition and the second rendering condition, render any cross-section data according to the texture map corresponding to any cross-section data to obtain a rendering result corresponding to any cross-section data; until all cross-section data in the previous level that meet the first rendering condition meet the second rendering condition.
[0161] If the previous level is not the lowest level of at least two levels, and there are cross-sectional data that do not meet the second rendering condition among the cross-sectional data that meet the first rendering condition in the previous level, the loop starts at this time. First, this part of the cross-sectional data that does not meet the second rendering condition is used as the target cross-sectional data. Then, each cross-sectional data of the next level corresponding to the target cross-sectional data is used as the cross-sectional data of the previous level, and step 2031 is executed to obtain the rendering result corresponding to any cross-sectional data. When there are cross-sectional data that do not meet the second rendering condition among the cross-sectional data that meet the first rendering condition in the previous level, the loop continues; when all the cross-sectional data that meet the first rendering condition in the previous level meet the second rendering condition, the loop ends.
[0162] Step 2034, based on the rendering results of each cross-sectional data, a rendering result of the three-dimensional model is obtained.
[0163] At the end of the loop, any level may have some cross-sectional data involved in the rendering, so the rendering result of each cross-sectional data includes the rendering result of the cross-sectional data of at least one level. Based on the rendering results of the cross-sectional data of each level, the rendering result of the three-dimensional model can be obtained.
[0164] It should be noted that the cross-sectional data involved in rendering must all meet the first rendering condition, that is, the cross-sectional data indicated by the cross-sectional data must be completely or partially within the view frustum. Since the embodiment of the present application traverses the cross-sectional data of any level and each level below it layer by layer in a top-to-bottom order, if the cross-sectional data of a certain level indicated by all cross-sectional data are outside the view frustum, then this cross-sectional data does not participate in rendering, and the cross-sectional data of each level below this level corresponding to this cross-sectional data does not participate in rendering. If the cross-sectional data indicated by this cross-sectional data is completely or partially outside the view frustum, then if the second rendering condition is met, this cross-sectional data participates in rendering, or, if the second rendering condition is not met, each cross-sectional data of the next level corresponding to this cross-sectional data needs to be judged whether the first rendering condition and the second rendering condition are met, and whether to participate in rendering is determined based on the judgment result. In this way, completely invisible cross-sectional areas can be quickly and efficiently eliminated, the amount of cross-sectional data that needs to be rendered can be saved, and rendering performance can be improved.
[0165] In a possible implementation, the method further includes steps 2035 to 2037. Steps 2035 to 2037 may be performed after step 2031.
[0166] Step 2035 , if the previous level is the lowest level of at least two levels and there is target cross-section data in the previous level that meets the first rendering condition but does not meet the second rendering condition, then obtain a target sub-model corresponding to the target cross-section data.
[0167] In the embodiment of the present application, when the previous level is the lowest level of at least two levels and there is target cross-section data in the previous level, since there is no cross-section data of the next level corresponding to the target cross-section data, the target sub-model corresponding to the target cross-section data can be obtained to render the target sub-model, thereby improving the rendering effect.
[0168] Optionally, obtaining a target sub-model corresponding to the target section data includes: if the target sub-model corresponding to the target section data is a basic sub-model, obtaining the basic sub-model; if the target sub-model corresponding to the target section data is other sub-models, obtaining the basic sub-model and transformation information from the basic sub-model to other sub-models, and obtaining other sub-models based on the basic sub-model and the transformation information.
[0169] The sub-models in the three-dimensional model include a basic sub-model and other sub-models except the basic sub-model. The basic sub-model and the method for determining the transformation information from the basic sub-model to other sub-models have been described above and will not be repeated here.
[0170] Since the basic sub-model can be transformed to other sub-models through the basic sub-model and the transformation information from the basic sub-model to other sub-models, the basic sub-model and other sub-models have similar shapes and textures. By storing the basic sub-model and the transformation information from the basic sub-model to other sub-models in the storage space, the electronic device only needs to have the shape and texture of the basic sub-model, and does not need to have the shape and texture of other sub-models, which can avoid storing repeated sub-model shapes and textures and reduce the storage space occupied. Especially when the number of sub-models is large and the complexity of the sub-model is high (that is, the sub-model has more vertices and triangles), the storage space occupied can be greatly reduced.
[0171] In an embodiment of the present application, each sub-model in the three-dimensional model has its corresponding identification information, and a first mapping relationship between the identification information and the basic sub-model and a second mapping relationship between the identification information and the basic sub-model and transformation information can be stored in the storage space. Any identification information corresponding to the target cross-sectional data can be determined based on the target cross-sectional data, thereby determining the target sub-model corresponding to the identification information. If the identification information is included in the first mapping relationship, it means that the target sub-model is a basic sub-model, and the target sub-model corresponding to the identification information can be directly obtained from the storage space; if the identification information is included in the second mapping relationship, it means that the target sub-model is another sub-model, and the basic sub-model and transformation information corresponding to the identification information can be directly obtained from the storage space, and the basic sub-model is transformed based on the transformation information to obtain the target sub-model corresponding to the identification information.
[0172] Step 2036: Render the target sub-model to obtain a rendering result of the target sub-model. The target sub-model may be rendered using a pixel shader, and the rendering method is not limited here.
[0173] Step 2037, based on the rendering results of each cross-section data and the rendering results of the target sub-model, a rendering result of the three-dimensional model is obtained.
[0174] In an embodiment of the present application, some sub-models in the three-dimensional model render their cross-sectional data, while other sub-models render them directly. Therefore, the rendering result of the three-dimensional model can be directly obtained based on the rendering results of each cross-sectional data and the rendering results of the target sub-model.
[0175] It should be noted that all sub-models in the three-dimensional model may be obtained by directly rendering the same. In this case, the rendering result of the three-dimensional model is directly obtained based on the rendering results of each target sub-model.
[0176] See also Figure 7 , Figure 7is a schematic diagram of a rendering provided by an embodiment of the present application. The embodiment of the present application is based on Figure 5 In the embodiment of the present application, the nodes of the LOD tree structure are traversed from top to bottom starting from level 0. For any node in level 0, the node corresponds to a cross-section data, and the size data of the cross-section data on the screen can be determined based on the mesh shader.
[0177] The mesh shader corresponds to at least one thread, one of which is used to determine the size data of the cross-section data on the screen, that is, the thread is used to determine the edge length (that is, the perimeter) of the cross-section indicated by the cross-section data when it is projected on the screen.
[0178] If the size data is not greater than the size threshold, it is determined not to select the cross-sectional data of the next level (i.e., level 1) corresponding to the cross-sectional data, and after rasterizing the cross-sectional data, the pixel shader is used to render the rasterized cross-sectional data. Rasterizing the cross-sectional data is to project the cross-sectional data indicated by the cross-sectional data onto the screen to obtain the cross-sectional data on the screen, and then the pixel shader can render the cross-sectional data on the screen based on the texture map of the cross-sectional data to obtain the rendering result of the cross-sectional data. For example, Figure 7 The cross-section data corresponding to the black nodes are rasterized and then rendered using a pixel shader.
[0179] If the size data is greater than the size threshold, the next level of cross-sectional data corresponding to the cross-sectional data is determined to be selected, and the cross-sectional data of the next level is stored in a graphics processing unit (GPU) buffer, that is, the cross-sectional data of level 1 corresponding to the cross-sectional data is stored in the GPU buffer. For example, Figure 7 The nodes of the next level corresponding to the medium gray nodes are stored in the GPU buffer.
[0180] After all nodes in level 0 are traversed, each node stored in the GPU buffer can be traversed based on the mesh shader. Since the GPU buffer stores the nodes of the next level corresponding to the nodes in level 0 whose size data is greater than the size threshold, these nodes can be processed in the same way as the nodes in level 0, which will not be described in detail here.
[0181] It should be noted that the nodes stored in the GPU buffer are arranged in order, which ensures continuous memory access and facilitates faster information retrieval.
[0182] When the GPU buffer stores nodes of the next level (i.e., level n+1) corresponding to the nodes in level n whose size data is greater than the size threshold, this part of the nodes in level n+1 can be traversed based on the mesh shader. For any node, if the size data corresponding to the node is not greater than the size threshold, the cross-sectional data corresponding to the node can be rasterized, and the pixel shader can render the rasterized cross-sectional data based on the texture map corresponding to the node. If the size data corresponding to the node is greater than the size threshold, the leaf model corresponding to the node can be rasterized, and the pixel shader can render the rasterized leaf model.
[0183] In the embodiment of the present application, although the cross-sectional data is rendered, when the cross-sectional data indicates a quadrilateral, the quadrilateral can be regarded as composed of two triangles, and the amount of calculation seems to be small, and rendering based on the LOD tree structure can reduce the amount of cross-sectional data that needs to be rendered, but in large-scale scenes, the amount of calculation is still large. By using a mesh shader to calculate the size data of the cross-sectional data on the screen, it is possible to quickly determine whether to render the cross-sectional data, thereby speeding up the rendering speed and ensuring the real-time rendering, so that the embodiment of the present application still has a good rendering effect even in real-time interactive scenes such as video scenes and game scenes. Among them, the mesh shader can be replaced by other GPU hardware (for example, a compute shader).
[0184] In some related technologies, the entire three-dimensional model is directly rendered. Based on this rendering method, when rendering two consecutive frames of images, it is equivalent to directly replacing the entire three-dimensional model. If the camera position and camera parameters corresponding to two consecutive frames of images change greatly, the change of the three-dimensional model will be relatively sudden, which is easy to cause visual defects. In the embodiment of the present application, on the one hand, cross-sectional data of different levels are constructed for the sub-models of the three-dimensional model, and then the cross-sectional data of a certain level can be flexibly selected for rendering according to the camera position, the sub-model position and the camera parameters. Even if the camera position and camera parameters change greatly, by rendering at the level of the sub-model, the change of the entire three-dimensional model will be relatively smooth, thereby avoiding sudden visual defects caused by large changes in the three-dimensional model. On the other hand, the cross-sectional data is rendered based on the texture map corresponding to the cross-sectional data. Since the texture map can retain the shape, texture and other information of the sub-model, even if the camera position and camera parameters change greatly, the sub-model will not be deformed, which will reduce visual defects to a certain extent.
[0185] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals involved in this application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions. For example, the three-dimensional models involved in this application are all obtained with full authorization.
[0186] In the above method, cross-sectional data is first obtained, the cross-sectional data is used to indicate the cross-sectional area of the envelope of at least one sub-model, and then a texture map corresponding to the cross-sectional data is obtained, and the texture map corresponding to the cross-sectional data is determined according to the texture information of each sub-model corresponding to the cross-sectional data. Since the texture map represents the texture information of each sub-model corresponding to the cross-sectional data projected onto the cross-sectional area indicated by any cross-sectional data, the appearance of each sub-model after projection is not easily deformed, thereby improving the rendering effect when rendering based on the cross-sectional data and the corresponding texture map.
[0187] The above describes the rendering method of the three-dimensional model provided by the embodiment of the present application from the perspective of method steps, and is further described below in combination with a scene. In the scene of the embodiment of the present application, the three-dimensional model is a plant model, and the sub-model is a leaf model.
[0188] See also Figure 8 , Figure 8 It is a rendering schematic diagram of a plant model provided in an embodiment of the present application. In an embodiment of the present application, a plant model may be first obtained, and the plant model includes a plurality of leaf models. Then, a base leaf model among the plurality of leaf models and transformation information from the base leaf model to other leaf models are determined, where the other leaf models are leaf models other than the base leaf model among the plurality of leaf models. The base leaf model corresponds to the basic sub-model mentioned above, and the other leaf models correspond to the other sub-models mentioned above.
[0189] Determine the cross-sectional data of the base leaf model, determine the cross-sectional data of other leaf models based on the cross-sectional data of the base leaf model and the transformation information, obtain each cross-sectional data of the lowest level, and then execute step S1.
[0190] Step S1: if any two cross-sectional data of the next level meet the aggregation condition, the cross-sectional data corresponding to the two cross-sectional data are determined based on the leaf models corresponding to the two cross-sectional data. The cross-sectional data corresponding to the two cross-sectional data meeting the aggregation condition and the cross-sectional data not meeting the aggregation condition are taken as the cross-sectional data in the candidate data set.
[0191] If the number of cross-sectional data in the candidate data set is not less than the reference number, each cross-sectional data in the candidate data set is used as each cross-sectional data of the next level, and step S1 is executed again.
[0192] If the number of cross-sectional data in the candidate data set is less than the reference number, each cross-sectional data in the candidate data set is used as each cross-sectional data of the previous level. If the set conditions are not met, each cross-sectional data of the previous level is used as each cross-sectional data of the next level, and step S1 is executed again; if the set conditions are met, the LOD tree structure is obtained based on the cross-sectional data of each level, and the texture map corresponding to each cross-sectional data in the LOD tree structure is determined.
[0193] Next, for any cross-sectional data of the previous level, if the cross-sectional data meets the first rendering condition and the second rendering condition, the cross-sectional data is rendered according to the texture map corresponding to the cross-sectional data. Then, step S2 is executed.
[0194] Step S2: for any cross-sectional data of the previous level, if the cross-sectional data meets the first rendering condition and the second rendering condition, the cross-sectional data is rendered according to the texture map corresponding to the cross-sectional data.
[0195] If the previous level is not the lowest level and there is target section data that meets the first rendering condition but does not meet the second rendering condition, each section data of the next level corresponding to the target section data is determined, and the next level is taken as the previous level, and step S2 is re-executed.
[0196] If the previous level is the lowest level and there is target cross-section data that meets the first rendering condition but does not meet the second rendering condition, the target sub-model corresponding to the target cross-section data is rendered to obtain a rendering result of the plant model.
[0197] If all cross-section data that meet the first rendering condition at the previous level also meet the second rendering condition, the rendering result of the plant model is obtained.
[0198] pass Figure 8 Optionally, on an electronic device with a Windows 10 operating system, 24 CPU cores, 128 CPU memory storage, and an NVIDIA GeForce RTX 3090 GPU (a graphics card), DirectX 12 is used as a graphics application programming interface (API), and a Figure 8 Render the plant model as shown.
[0199] In the embodiment of the present application, based on 15 plant models, the leaf models of 10,000 plant models are rendered using the above electronic device. In order to better test the rendering efficiency of the leaf model, the GPU occupation of other tasks can be reduced. In this case, the rendering efficiency can be as high as 1500 frames per second (Frame Per Second, FPS), and each frame image occupies up to 463 megabytes (MB) of GPU memory. The rendering results are shown in Figure 1. Fig. 9 shown.
[0200] in, Fig. 9 (1) and (2) are the rendering results of the plant model when the rendering frame rate can be as high as 1321FPS and 1557FPS and the distance between the plant model and the camera is relatively close. Fig. 9 (3) and (4) are the rendering results of the plant model when the rendering frame rate can be as high as 785FPS and 894FPS and the distance between the plant model and the camera is moderate. Fig. 9 (5) and (6) are the rendering results of the plant model when the rendering frame rate can be as high as 1002FPS and 1032FPS and the distance between the plant model and the camera is far.
[0201] In the embodiment of the present application, four kinds of plant models can be obtained, and the number of each kind of plant model is set to 500, so a total of 2000 plant models are obtained. On the one hand, based on the four kinds of plant models, the above electronic device is used to render the 2000 plant models using a rendering method in the related art (such as the Nanite method) to obtain Fig.10 On the other hand, based on these four plant models, using the above electronic equipment, Figure 8 The rendering method shown is used to render 2000 plant models. Fig.10 The rendering result shown in (2) in FIG. Since Nanite needs to be used in UE5 (an Unreal Engine), the rendering method and Figure 8 The rendering methods shown are all rendered based on UE5. Since rendering based on UE5 will introduce additional rendering costs, such as global illumination and shadows, Figure 8 The rendering method shown can be rendered without UE5, so Figure 8 The rendering method shown will render less efficiently.
[0202] contrast Fig.10 From (1) and (2) in the figure, it can be concluded that the content shown in the dotted box in (1) does not display the plant model, while the content shown in the dotted box in (2) does display the plant model. Therefore, Figure 8 The rendering method shown can improve the rendering effect of the plant model and avoid the disappearance of the plant model.
[0203] also, Fig.10 (1) is rendered using a GPU with 1146MB of memory and a 5.7ms / frame leaf model at a rendering speed of up to 76FPS. Fig.10 (2) in the figure is rendered using a GPU with 630MB of memory and a leaf model with a frame rate of 2.5ms / frame, at a rendering speed of up to 102FPS. Figure 8 The rendering method shown has higher rendering efficiency and uses less computing resources for rendering.
[0204] The three-dimensional model rendering method provided in the embodiment of the present application can be applied in many scenarios, such as 3D video games, virtual reality, geographic environment visualization, etc. Fig.11 , Fig.11 is a schematic diagram of another rendering result provided in an embodiment of the present application. Fig.11 A forest in a game scene is shown. Since the embodiments of the present application can improve the rendering effect of the plant model, the gaming experience can be improved.
[0205] Fig.12 FIG. 1 is a schematic diagram of a structure of a rendering device for a three-dimensional model provided in an embodiment of the present application. Fig.12 As shown, the device comprises:
[0206] An acquisition module 1201 is used to acquire a cross-sectional data set, where the cross-sectional data set is constructed based on a plurality of sub-models included in a three-dimensional model of an object, where the sub-models represent parts of the object, and texture information of the sub-models represents texture information of the parts. The cross-sectional data set includes a plurality of cross-sectional data, and the cross-sectional data is used to indicate a cross-section of an envelope box of at least one sub-model.
[0207] The acquisition module 1201 is further used to acquire the texture map corresponding to each cross-sectional data in the cross-sectional data set. The texture map corresponding to any cross-sectional data is determined according to the texture information of each sub-model corresponding to any cross-sectional data. The texture map corresponding to any cross-sectional data is used to represent the texture information of each sub-model corresponding to any cross-sectional data projected onto the cross-sectional data indicated by any cross-sectional data.
[0208] The determination module 1202 is used to determine the rendering result of the three-dimensional model based on each cross-sectional data in the cross-sectional data set and the corresponding texture map.
[0209] In a possible implementation, the cross-sectional data set includes at least two levels of data sets, and any level of data sets includes at least one cross-sectional data, and one cross-sectional data of the previous level corresponds to at least one cross-sectional data of the next level;
[0210] Determination module 1202 is also used to determine the data set of the previous level based on the data set of the next level. When the next level is the lowest level of at least two levels, the data set of the next level is determined based on the cross-sectional data corresponding to each sub-model in the three-dimensional model; in response to meeting the set conditions, a cross-sectional data set is obtained based on the data sets of each level.
[0211] In one possible implementation, the determination module 1202 is also used to determine a basic sub-model in the three-dimensional model, where the basic sub-model is any sub-model in the three-dimensional model; determine transformation information from the basic sub-model to other sub-models, where the other sub-models are any sub-models in the three-dimensional model except the basic sub-model; determine cross-sectional data corresponding to the basic sub-model; and determine cross-sectional data corresponding to other sub-models based on the cross-sectional data and transformation information corresponding to the basic sub-model.
[0212] In one possible implementation, the determination module 1202 is used to classify the sub-models in the three-dimensional model into at least one category according to the texture information of the sub-models in the three-dimensional model; for any category, select any sub-model from the sub-models in any category as the basic sub-model of any category; determine the transformation information from the basic sub-model of any category to other sub-models of any category, and the other sub-models of any category are sub-models in any category other than the basic sub-model of any category.
[0213] In one possible implementation, the determination module 1202 is used to determine a first envelope box of a basic sub-model of any category; determine a second envelope box of other sub-models of any category; and determine transformation information from the basic sub-model of any category to other sub-models of any category based on the first envelope box and the second envelope box.
[0214] In one possible implementation, determination module 1202 is used to determine the cross-sectional data corresponding to any two cross-sectional data in a data set of a next level, if any two cross-sectional data meet the aggregation condition, based on the sub-model corresponding to any two cross-sectional data; if the number of cross-sectional data in the candidate data set is less than the reference number, the candidate data set is used as the data set of the previous level, and the candidate data set includes the cross-sectional data corresponding to any two cross-sectional data that meet the aggregation condition and the cross-sectional data that do not meet the aggregation condition.
[0215] In a possible implementation, any two cross-sectional data satisfy the aggregation condition including at least one of the following:
[0216] The distance between the sections indicated by any two section data is less than the distance threshold;
[0217] The normal vector angle between the sections indicated by any two section data is smaller than the angle threshold.
[0218] In one possible implementation, the determination module 1202 is also used to use the candidate data set as the data set of the next level if the number of cross-sectional data in the candidate data set is not less than the reference number, and to loop the execution to determine the cross-sectional data corresponding to any two cross-sectional data based on the sub-models corresponding to any two cross-sectional data if any two cross-sectional data satisfy the aggregation condition, until the number of cross-sectional data in the candidate data set is less than the reference number, and the candidate data set is used as the data set of the previous level.
[0219] In one possible implementation, the determination module 1202 is also used to, in response to a set condition not being met, use the data set of the previous level as the data set of the next level, and cyclically determine the data set of the previous level based on the data set of the next level until the set condition is met, thereby obtaining a cross-sectional data set based on the data sets of each level.
[0220] In a possible implementation, the determination module 1202 is also used to project the texture information of any sub-model corresponding to any cross-sectional data onto the cross-section indicated by any cross-sectional data to obtain the texture map of any sub-model; and to fuse the texture maps of each sub-model corresponding to any cross-sectional data to obtain the texture map corresponding to any cross-sectional data.
[0221] In a possible implementation, the cross-sectional data set includes at least two levels of data sets, and any level of data sets includes at least one cross-sectional data, and one cross-sectional data of the previous level corresponds to at least one cross-sectional data of the next level;
[0222] Determination module 1202 is used to render any cross-sectional data of the previous level according to the texture map corresponding to any cross-sectional data to obtain the rendering result of any cross-sectional data if any cross-sectional data satisfies the first rendering condition and the second rendering condition; if each cross-sectional data of the previous level that satisfies the first rendering condition also satisfies the second rendering condition, then based on the rendering results of each cross-sectional data, the rendering result of the three-dimensional model is obtained.
[0223] In one possible implementation, the determination module 1202 is also used to, if the previous level is not the lowest level of at least two levels and there is target cross-sectional data in the previous level that satisfies the first rendering condition but does not satisfy the second rendering condition, then loop execution is performed to determine each cross-sectional data of the next level corresponding to the target cross-sectional data; the next level is taken as the previous level; for any cross-sectional data of the previous level, if any cross-sectional data satisfies the first rendering condition and the second rendering condition, render any cross-sectional data according to the texture map corresponding to any cross-sectional data to obtain a rendering result corresponding to any cross-sectional data; until all cross-sectional data in the previous level that satisfy the first rendering condition satisfy the second rendering condition; based on the rendering results of each cross-sectional data, a rendering result of the three-dimensional model is obtained.
[0224] In one possible implementation, the determination module 1202 is also used to obtain a target sub-model corresponding to the target cross-sectional data if the previous level is the lowest level of at least two levels and there is target cross-sectional data in the previous level that satisfies the first rendering condition but does not satisfy the second rendering condition; render the target sub-model to obtain a rendering result of the target sub-model; and obtain a rendering result of the three-dimensional model based on the rendering results of each cross-sectional data and the rendering result of the target sub-model.
[0225] In one possible implementation, the determination module 1202 is also used to obtain the basic submodel if the target submodel corresponding to the target section data is a basic submodel; if the target submodel corresponding to the target section data is other submodels, obtain the basic submodel and transformation information from the basic submodel to other submodels, and obtain other submodels based on the basic submodel and the transformation information.
[0226] In a possible implementation manner, the transformation information includes at least one of translation information, scaling information, and rotation information.
[0227] In a possible implementation, any section data satisfies the first rendering condition including that a section indicated by any section data is within the view frustum;
[0228] Any cross-sectional data satisfies the second rendering condition including that the size data of any cross-sectional data on the screen is not greater than a size threshold.
[0229] The above device first obtains cross-sectional data, which is used to indicate the cross-sectional area of the envelope of at least one sub-model, and then obtains a texture map corresponding to the cross-sectional data, which is determined according to the texture information of each sub-model corresponding to the cross-sectional data. Since the texture map represents the texture information of each sub-model corresponding to the cross-sectional data projected onto the cross-sectional area indicated by any cross-sectional data, the appearance of each sub-model after projection is not easily deformed, thereby improving the rendering effect when rendering based on the cross-sectional data and the corresponding texture map.
[0230] It should be understood that the above Fig.12 When the device provided realizes its functions, only the division of the above-mentioned functional modules is used as an example for illustration. In practical applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiments belong to the same concept, and their specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0231] Fig.13 The structure block diagram of a terminal device 1300 provided by an exemplary embodiment of the present application is shown. The terminal device 1300 includes: a processor 1301 and a memory 1302 .
[0232] The processor 1301 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 1301 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 1301 may also include a main processor and a coprocessor. The main processor is a processor for processing data in an awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 1301 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 1301 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0233] The memory 1302 may include one or more computer-readable storage media, which may be non-transitory. The memory 1302 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 1302 is used to store at least one computer program, which is used to be executed by the processor 1301 to implement the rendering method of the three-dimensional model provided in the method embodiment of the present application.
[0234] In some embodiments, the terminal device 1300 may also optionally include: a peripheral device interface 1303 and at least one peripheral device. The processor 1301, the memory 1302 and the peripheral device interface 1303 may be connected via a bus or a signal line. Each peripheral device may be connected to the peripheral device interface 1303 via a bus, a signal line or a circuit board. Specifically, the peripheral device includes: at least one of a radio frequency circuit 1304, a display screen 1305, a camera assembly 1306, an audio circuit 1307 and a power supply 1308.
[0235] The peripheral device interface 1303 may be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 1301 and the memory 1302. In some embodiments, the processor 1301, the memory 1302, and the peripheral device interface 1303 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 1301, the memory 1302, and the peripheral device interface 1303 may be implemented on a separate chip or circuit board, which is not limited in this embodiment.
[0236] The radio frequency circuit 1304 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 1304 communicates with the communication network and other communication devices through electromagnetic signals. The radio frequency circuit 1304 converts the electrical signal into an electromagnetic signal for transmission, or converts the received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 1304 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, and the like. The radio frequency circuit 1304 can communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes, but is not limited to: the World Wide Web, a metropolitan area network, an intranet, various generations of mobile communication networks (2G, 3G, 4G and 5G), a wireless local area network and / or a WiFi (Wireless Fidelity) network. In some embodiments, the radio frequency circuit 1304 may also include circuits related to NFC (Near Field Communication), which is not limited in this application.
[0237] The display screen 1305 is used to display a UI (User Interface). The UI may include graphics, text, icons, videos, and any combination thereof. When the display screen 1305 is a touch display screen, the display screen 1305 also has the ability to collect touch signals on the surface or above the surface of the display screen 1305. The touch signal can be input to the processor 1301 as a control signal for processing. At this time, the display screen 1305 can also be used to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards. In some embodiments, the display screen 1305 can be one, which is set on the front panel of the terminal device 1300; in other embodiments, the display screen 1305 can be at least two, which are respectively set on different surfaces of the terminal device 1300 or are folded; in other embodiments, the display screen 1305 can be a flexible display screen, which is set on the curved surface or folded surface of the terminal device 1300. Even, the display screen 1305 can also be set to a non-rectangular irregular shape, that is, a special-shaped screen. The display screen 1305 can be made of materials such as LCD (Liquid Crystal Display) and OLED (Organic Light-Emitting Diode).
[0238] The camera assembly 1306 is used to capture images or videos. Optionally, the camera assembly 1306 includes a front camera and a rear camera. Typically, the front camera is arranged on the front panel of the terminal, and the rear camera is arranged on the back of the terminal. In some embodiments, there are at least two rear cameras, which are any one of a main camera, a depth of field camera, a wide-angle camera, and a telephoto camera, so as to realize the fusion of the main camera and the depth of field camera to realize the background blur function, the fusion of the main camera and the wide-angle camera to realize the panoramic shooting and VR (Virtual Reality) shooting function or other fusion shooting functions. In some embodiments, the camera assembly 1306 may also include a flash. The flash can be a monochrome temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cold light flash, which can be used for light compensation at different color temperatures.
[0239] The audio circuit 1307 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals and input them into the processor 1301 for processing, or input them into the RF circuit 1304 to achieve voice communication. For the purpose of stereo acquisition or noise reduction, there may be multiple microphones, which are respectively arranged at different parts of the terminal device 1300. The microphone may also be an array microphone or an omnidirectional acquisition microphone. The speaker is used to convert the electrical signal from the processor 1301 or the RF circuit 1304 into sound waves. The speaker may be a traditional film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert the electrical signal into sound waves audible to humans, but also convert the electrical signal into sound waves inaudible to humans for purposes such as ranging. In some embodiments, the audio circuit 1307 may also include a headphone jack.
[0240] The power supply 1308 is used to power various components in the terminal device 1300. The power supply 1308 can be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power supply 1308 includes a rechargeable battery, the rechargeable battery can be a wired rechargeable battery or a wireless rechargeable battery. A wired rechargeable battery is a battery charged through a wired line, and a wireless rechargeable battery is a battery charged through a wireless coil. The rechargeable battery can also be used to support fast charging technology.
[0241] In some embodiments, the terminal device 1300 further includes one or more sensors 1309 , including but not limited to: an acceleration sensor 1311 , a gyroscope sensor 1312 , a pressure sensor 1313 , an optical sensor 1314 , and a proximity sensor 1315 .
[0242] The acceleration sensor 1311 can detect the magnitude of acceleration on the three coordinate axes of the coordinate system established by the terminal device 1300. For example, the acceleration sensor 1311 can be used to detect the components of gravity acceleration on the three coordinate axes. The processor 1301 can control the display screen 1305 to display the user interface in a horizontal view or a vertical view according to the gravity acceleration signal collected by the acceleration sensor 1311. The acceleration sensor 1311 can also be used to collect motion data of games or users.
[0243] The gyroscope sensor 1312 can detect the body direction and rotation angle of the terminal device 1300, and the gyroscope sensor 1312 can cooperate with the acceleration sensor 1311 to collect the user's 3D actions on the terminal device 1300. The processor 1301 can implement the following functions based on the data collected by the gyroscope sensor 1312: motion sensing (such as changing the UI according to the user's tilt operation), image stabilization during shooting, game control, and inertial navigation.
[0244] The pressure sensor 1313 can be set on the side frame of the terminal device 1300 and / or the lower layer of the display screen 1305. When the pressure sensor 1313 is set on the side frame of the terminal device 1300, the user's holding signal of the terminal device 1300 can be detected, and the processor 1301 performs left and right hand recognition or shortcut operations according to the holding signal collected by the pressure sensor 1313. When the pressure sensor 1313 is set on the lower layer of the display screen 1305, the processor 1301 controls the operability controls on the UI interface according to the user's pressure operation on the display screen 1305. The operability controls include at least one of a button control, a scroll bar control, an icon control, and a menu control.
[0245] The optical sensor 1314 is used to collect the ambient light intensity. In one embodiment, the processor 1301 can control the display brightness of the display screen 1305 according to the ambient light intensity collected by the optical sensor 1314. Specifically, when the ambient light intensity is high, the display brightness of the display screen 1305 is increased; when the ambient light intensity is low, the display brightness of the display screen 1305 is reduced. In another embodiment, the processor 1301 can also dynamically adjust the shooting parameters of the camera assembly 1306 according to the ambient light intensity collected by the optical sensor 1314.
[0246] The proximity sensor 1315, also called a distance sensor, is usually arranged on the front panel of the terminal device 1300. The proximity sensor 1315 is used to collect the distance between the user and the front of the terminal device 1300. In one embodiment, when the proximity sensor 1315 detects that the distance between the user and the front of the terminal device 1300 is gradually decreasing, the processor 1301 controls the display screen 1305 to switch from the screen-on state to the screen-off state; when the proximity sensor 1315 detects that the distance between the user and the front of the terminal device 1300 is gradually increasing, the processor 1301 controls the display screen 1305 to switch from the screen-off state to the screen-on state.
[0247] Those skilled in the art will understand that Fig.13 The structure shown in the figure does not constitute a limitation on the terminal device 1300, and may include more or fewer components than shown in the figure, or combine certain components, or adopt a different component arrangement.
[0248] Fig.14 This is a schematic diagram of the structure of the server provided in the embodiment of the present application. The server 1400 may have relatively large differences due to different configurations or performances, and may include one or more processors 1401 and one or more memories 1402, wherein the one or more memories 1402 store at least one computer program, and the at least one computer program is loaded and executed by the one or more processors 1401 to implement the three-dimensional model rendering method provided in the above-mentioned various method embodiments. Exemplarily, the processor 1401 is a CPU. Of course, the server 1400 may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output. The server 1400 may also include other components for implementing device functions, which will not be described in detail here.
[0249] In an exemplary embodiment, a computer-readable storage medium is further provided, in which at least one computer program is stored. The at least one computer program is loaded and executed by a processor to enable an electronic device to implement any of the above-mentioned three-dimensional model rendering methods.
[0250] Optionally, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, etc.
[0251] In an exemplary embodiment, a computer program or a computer program product is also provided, wherein at least one computer program is stored in the computer program or the computer program product, and the at least one computer program is loaded and executed by a processor to enable an electronic device to implement any of the above-mentioned three-dimensional model rendering methods.
[0252] It should be understood that the "plurality" mentioned in this article refers to two or more. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects are in an "or" relationship.
[0253] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0254] The above description is only an exemplary embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for rendering a three-dimensional model, characterized in that: The method comprises: Acquire a cross-sectional data set, wherein the cross-sectional data set is constructed based on a plurality of sub-models included in a three-dimensional model of an object, wherein the sub-models represent components of the object, and texture information of the sub-models represents texture information of the components, wherein the cross-sectional data set includes a plurality of cross-sectional data, and the cross-sectional data is used to indicate a cross-section of an envelope box of at least one sub-model; Acquire a texture map corresponding to each cross-sectional data in the cross-sectional data set, wherein the texture map corresponding to any cross-sectional data is determined according to the texture information of each sub-model corresponding to the any cross-sectional data, and the texture map corresponding to any cross-sectional data is used to represent the texture information of each sub-model corresponding to the any cross-sectional data projected onto the cross-sectional area indicated by the any cross-sectional data; Based on each cross-sectional data in the cross-sectional data set and the corresponding texture map, a rendering result of the three-dimensional model is determined.
2. The method according to claim 1, characterized in that The cross-sectional data set includes at least two levels of data sets, and any level of data sets includes at least one cross-sectional data, and one cross-sectional data of the previous level corresponds to at least one cross-sectional data of the next level; Before obtaining the cross-sectional data set, the method further includes: Determining a data set of a previous level based on a data set of a next level, wherein when the next level is the lowest level of the at least two levels, the data set of the next level is determined based on cross-sectional data corresponding to each sub-model in the three-dimensional model; In response to satisfying a set condition, the cross-sectional data set is obtained based on the data sets at each level.
3. The method according to claim 2, characterized in that The method further comprises: Determine a basic sub-model in the three-dimensional model, where the basic sub-model is any sub-model in the three-dimensional model; Determine transformation information from the basic sub-model to other sub-models, where the other sub-model is any sub-model in the three-dimensional model except the basic sub-model; Determining cross-sectional data corresponding to the basic sub-model; Based on the cross-sectional data corresponding to the basic sub-model and the transformation information, the cross-sectional data corresponding to the other sub-models are determined.
4. The method according to claim 3, characterized in that The determining of the basic sub-model in the three-dimensional model comprises: Classifying each sub-model in the three-dimensional model into at least one category according to texture information of each sub-model in the three-dimensional model; For any category, selecting any sub-model from each sub-model of the category as a basic sub-model of the category; The determining of transformation information from the basic sub-model to other sub-models includes: Transformation information from a basic sub-model of the any one category to other sub-models of the any one category is determined, wherein the other sub-models of the any one category are sub-models in the any one category other than the basic sub-model of the any one category.
5. The method according to claim 4, characterized in that The determining of transformation information from the basic sub-model of any category to other sub-models of any category includes: Determine a first envelope of a basic sub-model of any one of the categories; Determine a second envelope of other sub-models of any one category; Based on the first envelope and the second envelope, transformation information from a basic sub-model of any one category to other sub-models of any one category is determined.
6. The method according to claim 2, characterized in that The determining of the data set of the previous level based on the data set of the next level includes: For any two cross-sectional data in the data set of the next level, if the any two cross-sectional data meet the aggregation condition, determining the cross-sectional data corresponding to the any two cross-sectional data based on the sub-model corresponding to the any two cross-sectional data; If the number of cross-sectional data in the candidate data set is less than the reference number, the candidate data set is used as the data set of the previous level, and the candidate data set includes cross-sectional data corresponding to any two cross-sectional data that meet the aggregation condition and cross-sectional data that do not meet the aggregation condition.
7. The method according to claim 6, characterized in that The aggregation condition satisfied by any two cross-sectional data includes at least one of the following: The distance between the cross sections indicated by any two cross section data is less than a distance threshold; The normal vector angle between the cross sections indicated by any two cross section data is smaller than the angle threshold.
8. The method according to claim 6, characterized in that The method further comprises: If the number of cross-sectional data in the candidate data set is not less than the reference number, the candidate data set is used as the data set of the next level, and the step of if any two cross-sectional data meet the aggregation condition, then based on the sub-model corresponding to any two cross-sectional data, determining the cross-sectional data corresponding to any two cross-sectional data is executed in a loop until the number of cross-sectional data in the candidate data set is less than the reference number, and the candidate data set is used as the data set of the previous level.
9. The method according to claim 2, characterized in that: The method further comprises: In response to the setting condition not being met, the data set of the previous level is used as the data set of the next level, and the process of determining the data set of the previous level based on the data set of the next level is cyclically executed until the setting condition is met, and the cross-sectional data set is obtained based on the data sets of each level.
10. The method according to claim 1, characterized in that Before obtaining the texture map corresponding to each cross-sectional data in the cross-sectional data set, the method further includes: For any sub-model corresponding to any section data, projecting the texture information of any sub-model onto the section indicated by any section data to obtain a texture map of any sub-model; The texture maps of each sub-model corresponding to any cross-sectional data are merged to obtain the texture map corresponding to any cross-sectional data.
11. The method according to claim 1, characterized in that: The cross-sectional data set includes at least two levels of data sets, and any level of data sets includes at least one cross-sectional data, and one cross-sectional data of the previous level corresponds to at least one cross-sectional data of the next level; The step of determining the rendering result of the three-dimensional model based on each cross-sectional data in the cross-sectional data set and the corresponding texture map comprises: For any cross-sectional data of the previous level, if the any cross-sectional data satisfies the first rendering condition and the second rendering condition, the any cross-sectional data is rendered according to the texture map corresponding to the any cross-sectional data to obtain a rendering result of the any cross-sectional data; If each cross-sectional data of the previous level that satisfies the first rendering condition also satisfies the second rendering condition, a rendering result of the three-dimensional model is obtained based on the rendering results of each cross-sectional data.
12. The method according to claim 11, characterized in that The method further comprises: If the previous level is not the lowest level of the at least two levels and there is target cross-section data in the previous level that meets the first rendering condition but does not meet the second rendering condition, then loop execution to determine each cross-section data of the next level corresponding to the target cross-section data; take the next level as the previous level; for any cross-section data of the previous level, if the any cross-section data meets the first rendering condition and the second rendering condition, render the any cross-section data according to the texture map corresponding to the any cross-section data to obtain a rendering result corresponding to the any cross-section data; until all cross-section data in the previous level that meet the first rendering condition meet the second rendering condition; Based on the rendering results of each cross-sectional data, a rendering result of the three-dimensional model is obtained.
13. The method according to claim 11, characterized in that The method further comprises: If the previous level is the lowest level of the at least two levels and there is target cross-section data in the previous level that satisfies the first rendering condition but does not satisfy the second rendering condition, acquiring a target sub-model corresponding to the target cross-section data; Rendering the target sub-model to obtain a rendering result of the target sub-model; The rendering result of the three-dimensional model is obtained based on the rendering results of the respective cross-section data and the rendering result of the target sub-model.
14. The method according to claim 13, characterized in that The step of obtaining the target sub-model corresponding to the target cross-section data includes: If the target sub-model corresponding to the target cross-section data is a basic sub-model, acquiring the basic sub-model; If the target sub-model corresponding to the target cross-section data is another sub-model, the basic sub-model and transformation information from the basic sub-model to the other sub-model are obtained, and the other sub-model is obtained based on the basic sub-model and the transformation information.
15. The method according to claim 14, characterized in that The transformation information includes at least one of translation information, scaling information, and rotation information.
16. The method according to any one of claims 11 to 13, characterized in that Any of the cross-section data satisfies the first rendering condition including that the cross-section indicated by any of the cross-section data is within the view frustum; The fact that any of the cross-sectional data satisfies the second rendering condition includes that the size data of any of the cross-sectional data on the screen is not greater than a size threshold.
17. A three-dimensional model rendering device, characterized in that: The device comprises: An acquisition module is used to acquire a cross-sectional data set, wherein the cross-sectional data set is constructed based on a plurality of sub-models included in a three-dimensional model of an object, wherein the sub-models represent parts of the object, and texture information of the sub-models represents texture information of the parts, wherein the cross-sectional data set includes a plurality of cross-sectional data, and the cross-sectional data is used to indicate a cross-section of an envelope of at least one sub-model; The acquisition module is further used to acquire a texture map corresponding to each cross-sectional data in the cross-sectional data set, wherein the texture map corresponding to any cross-sectional data is determined according to the texture information of each sub-model corresponding to the any cross-sectional data, and the texture map corresponding to any cross-sectional data is used to represent the texture information of each sub-model corresponding to the any cross-sectional data projected onto the cross-sectional area indicated by the any cross-sectional data; The determination module is used to determine the rendering result of the three-dimensional model based on each cross-sectional data in the cross-sectional data set and the corresponding texture map.
18. The device according to claim 17, characterized in that The cross-sectional data set includes at least two levels of data sets, and any level of data sets includes at least one cross-sectional data, and one cross-sectional data of the previous level corresponds to at least one cross-sectional data of the next level; The determination module is also used to determine the data set of the previous level based on the data set of the next level. When the next level is the lowest level of the at least two levels, the data set of the next level is determined based on the cross-sectional data corresponding to each sub-model in the three-dimensional model; in response to meeting the set conditions, the cross-sectional data set is obtained based on the data sets of each level.
19. The device according to claim 18, characterized in that The determination module is also used to determine a basic sub-model in the three-dimensional model, where the basic sub-model is any sub-model in the three-dimensional model; determine transformation information from the basic sub-model to other sub-models, where the other sub-model is any sub-model in the three-dimensional model except the basic sub-model; determine cross-sectional data corresponding to the basic sub-model; and determine cross-sectional data corresponding to the other sub-models based on the cross-sectional data corresponding to the basic sub-model and the transformation information.
20. The device according to claim 19, characterized in that The determination module is used to classify the sub-models in the three-dimensional model into at least one category according to the texture information of the sub-models in the three-dimensional model; for any category, select any sub-model from the sub-models in the any category as the basic sub-model of the any category; determine the transformation information from the basic sub-model of the any category to the other sub-models of the any category, and the other sub-models of the any category are the sub-models in the any category except the basic sub-model of the any category.
21. The device according to claim 20, characterized in that The determination module is used to determine a first envelope frame of a basic sub-model of any category; and determine a second envelope frame of other sub-models of any category; Based on the first envelope and the second envelope, transformation information from a basic sub-model of any one category to other sub-models of any one category is determined.
22. The device according to claim 18, characterized in that The determination module is used for determining the cross-sectional data corresponding to any two cross-sectional data in the data set of the next level, based on the sub-models corresponding to the any two cross-sectional data, if the any two cross-sectional data meet the aggregation condition; If the number of cross-sectional data in the candidate data set is less than the reference number, the candidate data set is used as the data set of the previous level, and the candidate data set includes cross-sectional data corresponding to any two cross-sectional data that meet the aggregation condition and cross-sectional data that do not meet the aggregation condition.
23. The device according to claim 22, characterized in that The aggregation condition satisfied by any two cross-sectional data includes at least one of the following: The distance between the cross sections indicated by any two cross section data is less than a distance threshold; The normal vector angle between the cross sections indicated by any two cross section data is smaller than the angle threshold.
24. The device according to claim 22, characterized in that The determination module is also used to use the candidate data set as the data set of the next level if the number of cross-sectional data in the candidate data set is not less than the reference number, and to cyclically execute the step of determining the cross-sectional data corresponding to any two cross-sectional data based on the sub-models corresponding to any two cross-sectional data if any two cross-sectional data satisfy the aggregation condition, until the number of cross-sectional data in the candidate data set is less than the reference number, and use the candidate data set as the data set of the previous level.
25. The device according to claim 18, characterized in that The determination module is also used to, in response to the set condition not being met, use the data set of the previous level as the data set of the next level, and cyclically execute the process of determining the data set of the previous level based on the data set of the next level until the set condition is met, thereby obtaining the cross-sectional data set based on the data sets of each level.
26. The device according to claim 17, characterized in that The determination module is also used to project the texture information of any sub-model corresponding to any cross-sectional data onto the cross-section indicated by any cross-sectional data to obtain the texture map of any sub-model; and to fuse the texture maps of each sub-model corresponding to any cross-sectional data to obtain the texture map corresponding to any cross-sectional data.
27. The device according to claim 17, characterized in that The cross-sectional data set includes at least two levels of data sets, and any level of data sets includes at least one cross-sectional data, and one cross-sectional data of the previous level corresponds to at least one cross-sectional data of the next level; The determining module is used for rendering any cross-sectional data of the previous level according to the texture map corresponding to any cross-sectional data to obtain a rendering result of any cross-sectional data if the any cross-sectional data satisfies the first rendering condition and the second rendering condition; If each cross-sectional data of the previous level that satisfies the first rendering condition also satisfies the second rendering condition, a rendering result of the three-dimensional model is obtained based on the rendering results of each cross-sectional data.
28. The device according to claim 27, characterized in that The determining module is further configured to, if the previous level is not the lowest level of the at least two levels and there is target cross-section data in the previous level that meets the first rendering condition but does not meet the second rendering condition, cyclically execute to determine each cross-section data in the next level corresponding to the target cross-section data; Taking the next level as the previous level; for any cross-sectional data of the previous level, if the any cross-sectional data satisfies the first rendering condition and the second rendering condition, rendering the any cross-sectional data according to the texture map corresponding to the any cross-sectional data to obtain a rendering result corresponding to the any cross-sectional data; Until all the cross-section data of the previous level that satisfy the first rendering condition satisfy the second rendering condition; Based on the rendering results of each cross-sectional data, a rendering result of the three-dimensional model is obtained.
29. The device according to claim 27, characterized in that The determining module is further configured to obtain a target sub-model corresponding to the target cross-section data if the previous level is the lowest level of the at least two levels and the previous level has target cross-section data that satisfies the first rendering condition but does not satisfy the second rendering condition; Rendering the target sub-model to obtain a rendering result of the target sub-model; The rendering result of the three-dimensional model is obtained based on the rendering results of the respective cross-section data and the rendering result of the target sub-model.
30. The device according to claim 29, characterized in that The determination module is also used to obtain the basic submodel if the target submodel corresponding to the target section data is a basic submodel; if the target submodel corresponding to the target section data is other submodels, obtain the basic submodel and transformation information from the basic submodel to the other submodel, and obtain the other submodel based on the basic submodel and the transformation information.
31. The device according to claim 30, characterized in that The transformation information includes at least one of translation information, scaling information, and rotation information.
32. The device according to any one of claims 27 to 29, characterized in that Any of the cross-section data satisfies the first rendering condition including that the cross-section indicated by any of the cross-section data is within the view frustum; The fact that any of the cross-sectional data satisfies the second rendering condition includes that the size data of any of the cross-sectional data on the screen is not greater than a size threshold.
33. An electronic device, characterized in that: The electronic device includes a processor and a memory, wherein the memory stores at least one computer program, and the at least one computer program is loaded and executed by the processor so that the electronic device implements the three-dimensional model rendering method as described in any one of claims 1 to 16.
34. A computer-readable storage medium, characterized in that: At least one computer program is stored in the computer-readable storage medium, and the at least one computer program is loaded and executed by the processor to enable the electronic device to implement the three-dimensional model rendering method as described in any one of claims 1 to 16.
35. A computer program product, characterized in that The computer program product stores at least one computer program, and the at least one computer program is loaded and executed by a processor so that the electronic device implements the three-dimensional model rendering method as described in any one of claims 1 to 16.
Citation Information
Patent Citations
Three-dimensional model construction method, device and equipment and computer readable storage medium
CN113239442A
Route modeling method and device based on cross section template
CN113888718A