Model rendering method and device, equipment and storage medium
By adaptively adjusting the vertex distribution and mesh division of the 3D model, the problem of low efficiency in manual rendering is solved, achieving efficient and automated 3D model rendering, which is suitable for special effects display in games and videos.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-11
- Publication Date
- 2026-03-13
AI Technical Summary
In existing technologies, manual rendering of 3D models is inefficient and cannot meet the needs of real-time rendering scenes, especially in the display of special effects in games and videos, where high-quality rendering effects cannot be guaranteed.
By acquiring vertex feature data of the 3D model, the vertex distribution is adaptively adjusted to achieve coarse and fine mesh division. The GPU is used to accelerate the rendering process, ensuring high-precision rendering of critical areas and sparse rendering of non-critical areas.
It enables automated rendering with different rendering precision in different areas, ensuring rendering quality while improving rendering efficiency, and is suitable for real-time rendering scenarios.
Smart Images

Figure CN121661212A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer graphics technology, and in particular to a model rendering method, apparatus, device, and storage medium. Background Technology
[0002] With the development of computer technology, users have increasingly higher requirements for special effects in games or videos, and high-quality 3D model rendering effects can provide users with a better viewing experience.
[0003] Currently, to ensure the quality of model rendering, the rendering process is mostly handled manually. However, manual rendering of 3D models is inefficient and not suitable for many scenarios. Summary of the Invention
[0004] This application provides a model rendering method, apparatus, device, and storage medium. The technical solutions provided by this application are as follows:
[0005] According to one aspect of the embodiments of this application, a model rendering method is provided, the method comprising:
[0006] Obtain the 3D model to be rendered;
[0007] Based on the feature data of each vertex in the 3D model to be rendered, the vertex distribution of the 3D model to be rendered is adjusted to obtain the adjusted 3D model; wherein, the feature data of the vertices of the 3D model is used to reflect the features of the position of the vertex in the 3D model.
[0008] The adjusted 3D model is rendered based on the vertex distribution of the adjusted 3D model.
[0009] According to one aspect of the embodiments of this application, a model rendering apparatus is provided, the apparatus comprising:
[0010] The acquisition module is used to acquire the 3D model to be rendered;
[0011] An adjustment module is used to adjust the vertex distribution of the three-dimensional model to be rendered based on the feature data of each vertex in the three-dimensional model to be rendered, so as to obtain an adjusted three-dimensional model; wherein, the feature data of the vertices of the three-dimensional model is used to reflect the features of the position of the vertex in the three-dimensional model.
[0012] The rendering module is used to render the adjusted 3D model based on the vertex distribution of the adjusted 3D model.
[0013] According to one aspect of the present application, a computer device is provided, the computer device including a processor and a memory, the memory storing a computer program, the computer program being loaded and executed by the processor to implement the above-described model rendering method.
[0014] According to one aspect of the embodiments of this application, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium, the computer program being loaded and executed by a processor to implement the above-described model rendering method.
[0015] According to one aspect of the embodiments of this application, a computer program product is provided, the computer program product including a computer program stored in a computer-readable storage medium, and a processor reading from the computer-readable storage medium and executing the computer program to implement the above-described model rendering method.
[0016] The technical solutions provided in this application have at least the following beneficial effects:
[0017] Before rendering a 3D model, the vertex distribution of the model is adjusted based on the feature data of its vertices. The adjusted 3D model is then rendered. Since the feature data reflects the position of vertices within the 3D model, this method adaptively adjusts the vertex distribution for different positions within the model. This results in different vertex densities in different regions of the adjusted 3D model during rendering, allowing for different rendering precisions in different areas. This achieves automated rendering while maintaining rendering quality. Attached Figure Description
[0018] Figure 1 This is a schematic diagram of a model rendering method provided in one embodiment of this application;
[0019] Figure 2 This is a schematic diagram of a computer system provided in one embodiment of this application;
[0020] Figure 3 This is a flowchart of a model rendering method provided in one embodiment of this application;
[0021] Figure 4 This is a schematic diagram of the vertex distribution in an adjusted three-dimensional model provided in one embodiment of this application;
[0022] Figure 5 This is a schematic diagram illustrating the vertex changes of a unit region according to an embodiment of this application;
[0023] Figure 6This is a schematic diagram illustrating the vertex changes in a unit region according to another embodiment of this application;
[0024] Figure 7 This is a schematic diagram illustrating the vertex changes in a unit region according to another embodiment of this application;
[0025] Figure 8 This is a flowchart of a model rendering method provided in another embodiment of this application;
[0026] Figure 9 This is a schematic diagram of a coarse mesh division provided in one embodiment of this application;
[0027] Figure 10 This is a schematic diagram of mesh subdivision provided in one embodiment of this application;
[0028] Figure 11 This is a block diagram of a model rendering apparatus provided in one embodiment of this application;
[0029] Figure 12 This is a structural block diagram of a computer device provided in one embodiment of this application. Detailed Implementation
[0030] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0031] Before introducing the technical solutions of this application, some terms involved in this application will be explained. The following related explanations are optional solutions and can be arbitrarily combined with the technical solutions of the embodiments of this application, all of which fall within the protection scope of the embodiments of this application. The embodiments of this application include at least some of the following contents.
[0032] 3D model: A polygonal representation of an object. A 3D model can represent real-world entities or virtual objects.
[0033] Mesh: Also known as a mesh surface, it is the basic unit that makes up a 3D model. The vertices of a 3D model are the vertices of its mesh.
[0034] Edges: In a two-dimensional image, an edge refers to a region in the image where the pixel value (grayscale value) changes abruptly, such as the outline of an object in a two-dimensional image (the outline of the object distinguishes it from the background). In a three-dimensional model, an edge refers to a region in three-dimensional space where the structure of the three-dimensional model changes abruptly, such as the edges of the three-dimensional model.
[0035] Corner: A corner is the point where at least two edges of a 3D model meet, such as the intersection of at least two edge edges.
[0036] As mentioned above, a 3D model is composed of a mesh, and the vertices of the 3D model are the vertices of the mesh that make up the 3D model. During the rendering process of a 3D model, rendering is performed on a vertex or mesh basis. Therefore, the density of vertices in a certain region of the 3D model determines the rendering accuracy of that region. To ensure the quality of the final rendering result, technicians often manually adjust the vertex distribution and rendering strategy of the 3D model based on the real-time rendering effect. However, manual rendering of 3D models is inefficient and not suitable for many scenarios (such as game scenarios that require real-time rendering of 3D models).
[0037] Based on this, embodiments of this application provide a model rendering method that adaptively adjusts the vertex distribution of a 3D model according to its geometric structure, thereby achieving automated rendering of the 3D model while ensuring rendering quality.
[0038] Please refer to Figure 1 The diagram illustrates a model rendering method provided in one embodiment of this application. The method includes at least one of the following steps:
[0039] 1. Obtain the 3D model to be rendered. For example... Figure 1 As shown, the 3D model to be rendered is composed of a mesh.
[0040] 2. Coarse Mesh Generation: Based on the feature data of the mesh vertices (feature data reflecting the position of vertices in the 3D model), coarse mesh generation is performed on the 3D model to be rendered, resulting in a coarsely generated 3D model. In the coarsely generated 3D model, the number of vertices is reduced, and the number of meshes is correspondingly reduced. That is, coarse mesh generation refers to the process of reducing the number of vertices in the 3D model to reduce the number of meshes in the 3D model.
[0041] 3. Mesh Subdivision: Based on the feature data of the mesh vertices, the coarsely subdivided 3D model is subdivided to obtain an adjusted 3D model. In the adjusted 3D model, the number of vertices increases, and the number of meshes also increases accordingly. That is, mesh subdivision refers to the process of increasing the number of vertices in the 3D model to increase the number of meshes in the 3D model.
[0042] 4. Model rendering: The rendering process of the adjusted 3D model is executed and accelerated by the GPU (Graphics Processing Unit).
[0043] In the above scheme, both mesh subdivision and mesh coarsening are adaptively performed based on the geometry of the 3D model. This allows for finer meshing in areas of the 3D model that require high-precision rendering (such as edges and corners), while the mesh is sparser for structures that do not require high-precision rendering, thus achieving accurate and efficient rendering. This will be explained in more detail in the following embodiments.
[0044] Please refer to Figure 2 This illustration shows a schematic diagram of a computer system provided in one embodiment of this application. The computer system may include: a terminal device 10 and a server 20.
[0045] Terminal device 10 can be an electronic device such as a mobile phone, tablet computer, multimedia playback device, PC (Personal Computer), wearable device, in-vehicle terminal device, VR (Virtual Reality) device, AR (Augmented Reality) device, MR (Mixed Reality) device, etc. Terminal device 10 can run a client of the target application. The target application is an application that requires the use of a 3D model, or, more specifically, an application used to construct a 3D model. For example, the target application may include: a game application, a video application, a game engine application, a modeling application, etc. In some embodiments, terminal device 10 also has a rendering application installed for automatically rendering the 3D model, to which the 3D model in the target application is exported for rendering.
[0046] Server 20 can be used to provide background services for the client of the aforementioned target application (such as a game application). For example, server 20 can be the background server for the target application. In some embodiments, during the operation of the target application, the 3D model to be rendered (or a 3D model that failed to render) in the target application is uploaded to server 20 for real-time rendering. Server 20 then returns the rendered 3D model to the client of the target application to achieve real-time display of the rendered 3D model. Server 20 can be a single server, a server cluster consisting of multiple servers, or a cloud computing service center.
[0047] Terminal device 10 can communicate with server 20 via a network, such as a wireless or wired network.
[0048] Furthermore, in this embodiment, the implementation form of the target application is not limited. For example, it can be an application that needs to be downloaded and installed, a mini-program that does not require installation, a web application, etc.
[0049] Please refer to Figure 3 The diagram illustrates a flowchart of a model rendering method provided in one embodiment of this application. The execution entity for each step of this method is a computer device, which can be the terminal device 10 in the above embodiment or a server 20. The method includes at least one of the following steps 310 to 330.
[0050] Step 310: Obtain the 3D model to be rendered.
[0051] The 3D model to be rendered is the 3D model that has not yet been rendered.
[0052] In some embodiments, the 3D model to be rendered is obtained from the target application (the client).
[0053] In some embodiments, the 3D model to be rendered is a 3D model generated during the operation of the target application (game application), such as a 3D model in a game scene. In some embodiments, the 3D model to be rendered is obtained from the client of the game application.
[0054] In some embodiments, the target application performs rendering on its adopted 3D model during runtime. The 3D model that failed to render is exported from the target application as the 3D model to be rendered in this application.
[0055] In some embodiments, the 3D model to be rendered is a 3D model constructed by a technician that will be used to generate multimedia data such as videos, images, or games. In some embodiments, the 3D model to be rendered is obtained from a client of a modeling application or game engine application.
[0056] Step 320: Based on the feature data of each vertex in the 3D model to be rendered, adjust the vertex distribution of the 3D model to be rendered to obtain the adjusted 3D model.
[0057] Vertex feature data is used to reflect the characteristics of a vertex's position in a 3D model. The vertex feature data of the 3D model to be rendered is used to reflect the characteristics of a vertex's position in the 3D model to be rendered.
[0058] Adjusting the vertex distribution of a 3D model to be rendered refers to adjusting the density of vertex distribution in each region of the 3D model to be rendered (i.e., the number of vertices in each region).
[0059] Since the feature data of different vertices in the 3D model to be rendered may be different, after adjusting the vertex distribution of the 3D model to be rendered based on the feature data of each vertex in the 3D model to obtain the adjusted 3D model, for a certain unit region with a fixed area (the shape and position of the unit region are not fixed), the number of vertices included in the unit region may change when the unit region is located in different positions in the adjusted 3D model (that is, the density of vertex distribution in the unit region changes).
[0060] In some embodiments, the feature data of a vertex is used to reflect the proximity between the vertex's position in the 3D model and a key position in the 3D model.
[0061] Key locations in a 3D model include at least one of its edges and corners. It's important to note that these edges and corners differ from the edges and vertices of a mesh; they refer to the overall 3D model, not a single mesh element.
[0062] In some embodiments, for a unit region in the adjusted 3D model, the number of vertices in the unit region is positively correlated with the proximity between the unit region and the key locations in the adjusted 3D model.
[0063] In other words, the closer a unit region is to a key location in the 3D model, the more vertices it contains.
[0064] In a 3D model, the density of vertices in a given region can also be measured by the length of the edges connecting those vertices in that region. The edges connecting a vertex in a 3D model include the vertex itself.
[0065] In some embodiments, in the adjusted 3D model, the length of the associated edge of a vertex is positively correlated with the proximity between the vertex and a key location in the adjusted 3D model. That is, the closer a vertex is to a key location, the shorter its associated edge, thereby achieving a finer mesh at the key location.
[0066] For example, please refer to Figure 4 This diagram illustrates the vertex distribution in an adjusted 3D model provided in one embodiment of this application. It can be seen that in this adjusted 3D model 40, the closer a unit region 41 is to a critical location (such as an edge 42 and a corner 43), the more vertices there are in that unit region, and the shorter the length of the associated edges of the vertices in that unit region. This results in a finer mesh division at critical locations such as edges 42 and corners 43.
[0067] In the above embodiment, the vertex feature data is used to reflect the proximity of the vertex's position in the 3D model to the key position of the 3D model. After adjusting the vertex distribution according to the feature data, the closer the vertex is to the key position in the adjusted 3D model, the denser the vertex distribution. That is, the closer the vertex is to the key position, the higher the rendering accuracy, thereby ensuring that the rendered 3D model achieves a better rendering effect at the key position.
[0068] In some embodiments, the vertex feature data includes at least one of edge strength and corner measurement.
[0069] Edge strength is used to reflect the proximity of a vertex to the edge of a 3D model, while corner metric is used to reflect the proximity of a vertex to the corner of a 3D model.
[0070] In some embodiments, for the first vertex in the 3D model to be rendered, the edge strength and corner measurement are obtained through the following steps:
[0071] 1. Based on the position vector of the first vertex, the number of adjacent vertices of the first vertex, and the position vectors of each adjacent vertex of the first vertex, the edge strength of the first vertex is obtained.
[0072] The first vertex is any vertex in the 3D model to be rendered.
[0073] In some embodiments, the same processing is performed on each vertex in the 3D model to be rendered as on the first vertex.
[0074] In a 3D model, the position vector of a point (such as a vertex or face) is a vector pointing from the origin of the coordinate system in the 3D space where the 3D model is located. For example, the position vector of the first vertex is a vector pointing from the origin of the coordinate system in the 3D space where the 3D model to be rendered is located.
[0075] In the embodiments of this application, the position of the origin of the coordinate system in the three-dimensional space is not limited. For example, the origin of the coordinate system can be set outside the three-dimensional model, or it can be set at the center point of the three-dimensional model.
[0076] In some embodiments, the edge strength of the first vertex is obtained by multiplying the sum of the norms (such as L2 norms) between the position vector of the first vertex and the position vectors of each adjacent vertex by the reciprocal of the number of adjacent vertices of the first vertex.
[0077] That is, for vertex v, E(v) = 1 / |N(v)|∑ u∈N(v) ||pu-pv||, where E(v) is the edge strength of vertex v, N(v) is the set of adjacent vertices of vertex v, |N(v)| is the number of adjacent vertices of vertex v, pu is the position vector of adjacent vertex u of vertex v, and pv is the position vector of vertex v.
[0078] It should be noted that vertex v can be any vertex in any three-dimensional model mentioned in the embodiments of this application. This application only uses vertex v as an example to illustrate the calculation formula involved in this application.
[0079] 2. Based on the number of associated edges of the first vertex and the curvature of each associated edge of the first vertex, obtain the corner measure of the first vertex. The associated edges of the vertex include the vertex itself.
[0080] In some embodiments, the corner measure of the first vertex is obtained by multiplying the sum of the curvatures of the associated edges of the first vertex by the reciprocal of the number of associated edges of the first vertex.
[0081] That is, for vertex v, the corner metric C(v) = 1 / |N(v)|∑ u∈N(v) κ(u,v), where κ(u,v) is the curvature of the edge associated with vertex v (the other vertex of the associated edge is the adjacent vertex u).
[0082] In the above embodiment, the edge strength and corner measurement of the first vertex can be determined based on the distribution of the adjacent vertices of the first vertex and the curvature of the associated edges of the first vertex. This enables automatic identification of edges, corners and other regions in the 3D model, thereby achieving efficient rendering.
[0083] In some embodiments, step 320 includes: adjusting the vertex distribution of the three-dimensional model to be rendered based on at least one of the edge strength and corner measurement of each vertex in the three-dimensional model to be rendered, to obtain an adjusted three-dimensional model.
[0084] In some embodiments, step 320 includes at least one of the following steps:
[0085] 1. Based on the edge intensity of each vertex in the 3D model to be rendered, determine a1 vertices belonging to the edge type and b1 vertices belonging to the non-edge type from the 3D model to be rendered.
[0086] Both a1 and b1 are integers greater than 1.
[0087] In some embodiments, vertices in the (to be rendered) 3D model whose edge strength meets the edge determination criteria are determined as vertices of the edge type, and vertices whose edge strength does not meet the edge determination criteria are determined as vertices of the non-edge type.
[0088] Edge determination conditions are set by technicians as needed. For example, edge determination conditions may be that the edge intensity is greater than the edge determination threshold set by the technician, or that the edge intensity belongs to the edge determination range set by the technician. This application does not limit this.
[0089] 2. Based on the aforementioned vertices a1, generate vertices a2, and based on the aforementioned vertices b1, generate vertices b2. Where a2 is greater than a1 and b2 is less than b1, the adjusted 3D model includes the aforementioned vertices a2 and b2.
[0090] In some embodiments, for an edge mesh surface in the 3D model to be rendered, the position vectors of each vertex of the edge mesh surface are weighted and summed to obtain the position vector of the newly added vertex corresponding to the edge mesh surface (e.g., the newly added vertex is the center point of the edge mesh surface). The aforementioned a2 vertices include the a1 vertices and the newly added vertices of each edge mesh surface. Each vertex of the edge mesh surface belongs to the a1 vertices.
[0091] In some embodiments, for an edge in the 3D model to be rendered, the position vectors of the two vertices of the edge are weighted and summed to obtain the position vector of the newly added vertex corresponding to the edge. The aforementioned a2 vertices include the a1 vertices and the newly added vertices of each edge. Both vertices of the edge belong to the a1 vertices.
[0092] In some embodiments, for each of the b2 non-edge mesh faces in the 3D model to be rendered, the position vectors of each vertex of the non-edge mesh face are weighted and summed to obtain the position vector of the replacement vertex corresponding to the non-edge mesh face (e.g., the replacement vertex is the center point of the non-edge mesh face). Each vertex of the non-edge mesh face belongs to the aforementioned b1 vertices, and the aforementioned b2 vertices are the replacement vertices of each of the b2 non-edge mesh faces. In some embodiments, the vertices contained in the b2 non-edge mesh faces are all different.
[0093] In some embodiments, for each of the b2 non-edge edges in the 3D model to be rendered, the position vectors of the two vertices of the non-edge edge are weighted and summed to obtain the position vector of the replacement vertex corresponding to the non-edge edge (e.g., the replacement vertex is the midpoint of the non-edge edge). Both vertices of the non-edge edge belong to the aforementioned b1 vertices, and the aforementioned b2 vertices are the replacement vertices of each of the b2 non-edge edges. In some embodiments, the vertices contained in the b2 non-edge edges are all different.
[0094] The above embodiments enable more refined mesh division of the edge regions in a 3D model.
[0095] For example, please refer to Figure 5For a unit region 41 in the 3D model to be rendered, if the vertices of the mesh in unit region 41 are edge-type, then in the adjusted 3D model, the number of vertices in unit region 41 increases, and the mesh becomes denser. If the vertices of the mesh in unit region 41 are non-edge-type, then in the adjusted 3D model, the number of vertices in unit region 41 decreases, and the mesh becomes sparser.
[0096] In some embodiments, step 320 includes at least one of the following steps:
[0097] 1. Based on the corner measurements of each vertex in the 3D model to be rendered, determine c1 vertices of the corner type and d1 vertices of the non-corner type from the 3D model to be rendered.
[0098] c1 and d1 are both integers greater than 1.
[0099] In some embodiments, vertices in the (to be rendered) 3D model whose corner measurement meets the corner determination criteria are determined as vertices of the corner type, and vertices whose corner measurement does not meet the corner determination criteria are determined as vertices of the non-corner type.
[0100] The corner determination conditions are set by the technicians as needed. For example, the corner determination conditions may be that the corner measurement is greater than the corner determination threshold set by the technicians, or that the corner measurement belongs to the corner determination range set by the technicians. This application does not limit this.
[0101] 2. Based on the above c1 vertices, generate c2 vertices, and based on the above d1 vertices, generate d2 vertices. Where c2 is greater than c1 and d2 is less than d1, the adjusted 3D model includes the above c2 vertices and the above d2 vertices.
[0102] In some embodiments, for a corner mesh surface in the 3D model to be rendered, the position vectors of each vertex of the corner mesh surface are weighted and summed to obtain the position vector of the newly added vertex corresponding to the corner mesh surface (e.g., the newly added vertex is the center point of the corner mesh surface). The aforementioned c2 vertices include the c1 vertices and the newly added vertices of each corner mesh surface. Each vertex of the corner mesh surface belongs to the c1 vertices.
[0103] In some embodiments, for a corner edge in the 3D model to be rendered, the position vectors of the two vertices of the corner edge are weighted and summed to obtain the position vector of the newly added vertex corresponding to the corner edge. The aforementioned c2 vertices include c1 vertices and the newly added vertices of each corner edge. Both vertices of the corner edge belong to c1 vertices.
[0104] In some embodiments, for each of the d2 non-corner mesh faces in the 3D model to be rendered, the position vectors of each vertex of the non-corner mesh face are weighted and summed to obtain the position vector of the replacement vertex corresponding to the non-corner mesh face (e.g., the replacement vertex is the center point of the non-corner mesh face). Each vertex of the non-corner mesh face belongs to the aforementioned d1 vertices, and the aforementioned d2 vertices are the replacement vertices of each of the d2 non-corner mesh faces. In some embodiments, the vertices contained in the d2 non-corner mesh faces are all different.
[0105] In some embodiments, for each of the d2 non-corner edges in the 3D model to be rendered, the position vectors of the two vertices of the non-corner edge are weighted and summed to obtain the position vector of the replacement vertex corresponding to the non-corner edge (e.g., the replacement vertex is the midpoint of the non-corner edge). Both vertices of the non-corner edge belong to the aforementioned d1 vertices, and the aforementioned d2 vertices are the replacement vertices of each of the d2 non-corner edges. In some embodiments, the vertices contained in the d2 non-corner edges are all different.
[0106] The above embodiments enable more refined mesh division of the area where corner points are located in a 3D model.
[0107] For example, please refer to Figure 6 For a unit region 41 in the 3D model to be rendered, if the vertices of the mesh in unit region 41 are corner points, then in the adjusted 3D model, the number of vertices in unit region 41 increases, and the mesh becomes denser. If the vertices of the mesh in unit region 41 are non-corner points, then in the adjusted 3D model, the number of vertices in unit region 41 decreases, and the mesh becomes sparser.
[0108] In some embodiments, step 320 includes at least one of the following steps:
[0109] 1. Based on the edge strength and corner measurement of each vertex in the 3D model to be rendered, determine x1 vertices of the corner type, y1 vertices of the edge type, and z1 vertices of the smooth type from the 3D model to be rendered.
[0110] In some embodiments, vertices in the 3D model to be rendered whose corner measurement meets the corner determination criteria are determined as vertices of the corner type, vertices whose corner measurement does not meet the corner determination criteria but whose edge strength meets the edge determination criteria are determined as vertices of the edge type, and vertices whose corner measurement does not meet the corner determination criteria and whose edge strength does not meet the edge determination criteria are determined as vertices of the smooth type.
[0111] 2. Based on the aforementioned x1 vertices, generate x2 vertices; based on the aforementioned y1 vertices, generate y2 vertices; and based on the aforementioned z1 vertices, generate z2 vertices. Where x2 is greater than x1, y2 is greater than y1, z2 is less than z1, and the ratio of x2 to x1 is greater than the ratio of y2 to y1. The adjusted 3D model includes the aforementioned x2 vertices, y2 vertices, and z2 vertices.
[0112] In some embodiments, for a corner mesh surface in the 3D model to be rendered, the position vectors of each vertex of the corner mesh surface are weighted and summed to obtain the position vector of the newly added vertex corresponding to the corner mesh surface (e.g., the newly added vertex is the center point of the corner mesh surface). Each vertex of the corner mesh surface belongs to x1 vertices. For a corner edge in the 3D model to be rendered, the position vectors of the two vertices of the corner edge are weighted and summed to generate the position vector of the newly added vertex corresponding to the corner edge (a corner edge can correspond to one or more newly added vertices, and multiple newly added vertices corresponding to a corner edge can be obtained by weighting and summing with different weight parameters). The aforementioned x2 vertices include x1 vertices, the newly added vertices of each corner mesh surface, and the newly added vertices of each corner edge. The two vertices of the corner edge belong to x1 vertices.
[0113] In some embodiments, for an edge mesh surface in the 3D model to be rendered, the position vectors of each vertex of the edge mesh surface are weighted and summed to obtain the position vector of the newly added vertex corresponding to the edge mesh surface (e.g., the newly added vertex is the center point of the edge mesh surface). The aforementioned y2 vertices include the y1 vertices and the newly added vertices of each edge mesh surface. Each vertex of the edge mesh surface belongs to the y1 vertices.
[0114] In some embodiments, for an edge in the 3D model to be rendered, the position vectors of the two vertices of the edge are weighted and summed to generate a new vertex corresponding to the edge. The aforementioned y2 vertices include the y1 vertices and the new vertices of each edge. Both vertices of the edge belong to the y1 vertices.
[0115] In some embodiments, for each of the z2 smooth mesh faces in the 3D model to be rendered, the position vectors of each vertex of the smooth mesh face are weighted and summed to obtain the position vector of the replacement vertex corresponding to the smooth mesh face (e.g., the replacement vertex is the center point of the smooth mesh face). Each vertex of the smooth mesh face belongs to the aforementioned z1 vertices, and the aforementioned z2 vertices are the replacement vertices of each of the z2 smooth mesh faces. In some embodiments, the vertices contained in the z2 smooth mesh faces are all different.
[0116] In some embodiments, for each of the z2 smooth edges in the 3D model to be rendered, the position vectors of the two vertices of the smooth edge are weighted and summed to obtain the position vector of the replacement vertex corresponding to the smooth edge (e.g., the replacement vertex is the midpoint of the smooth edge). Both vertices of the smooth edge belong to the aforementioned z1 vertices, and the aforementioned z2 vertices are the replacement vertices of each of the z2 smooth edges. In some embodiments, the z2 smooth edges contain distinct vertices.
[0117] Through the above embodiments, it is possible to divide the 3D model into meshes at three levels of fineness: the corner area, the edge area, and the smooth area, thereby improving the rendering effect of the 3D model.
[0118] For example, please refer to Figure 7 For a unit region 41 in the 3D model to be rendered, if the vertices of the mesh in unit region 41 are corner vertices, then in the adjusted 3D model, the number of vertices in unit region 41 increases, and the mesh becomes denser. If the vertices of the mesh in unit region 41 are edge vertices, then in the adjusted 3D model, the number of vertices in unit region 41 increases, but by less than in the previous case. If the vertices of the mesh in unit region 41 are z1 vertices, then in the adjusted 3D model, the number of vertices in unit region 41 decreases, and the mesh becomes sparser.
[0119] It should be noted that the method of generating new vertices based on existing vertices in the above embodiments is only an illustrative example. It can also refer to the methods described in the following embodiments (such as the method of generating the first coarse vertices based on the first vertex or the method of generating m vertices based on the second vertex), or any other coarse or fine meshing method can be used. This application does not limit this.
[0120] Step 330: Render the adjusted 3D model based on the vertex distribution of the adjusted 3D model.
[0121] In some embodiments, the adjusted 3D model is rendered based on the vertex distribution of the adjusted 3D model to obtain the rendered 3D model.
[0122] The vertex distribution of the adjusted 3D model is different from that of the 3D model to be rendered; that is, the mesh structure of the adjusted 3D model is different from that of the 3D model to be rendered.
[0123] In some embodiments, the adjusted 3D model is rendered via GPU rendering, for example, via shaders in the GPU.
[0124] In some embodiments, the rendering of the adjusted 3D model is performed in stages, with different configuration parameters corresponding to different stages. These configuration parameters are used to configure the shaders used for rendering the 3D model (e.g., to configure the computing resources used by the shaders to render the 3D model, the shader's performance, metrics, etc.). The configuration parameters are calculated using the following formula:
[0125] C shader =∑ i=1 n S shader-i , where C shader For the configuration parameters of the shader, ∑ i=1 n S shader-i This is the sum of the identifiers of the rendering stages the adjusted 3D model has already gone through and the identifier of the current rendering stage (different rendering stages correspond to different identifiers).
[0126] In some embodiments, step 330 includes: rendering the associated mesh surfaces of each vertex in the adjusted 3D model according to the shading parameters of each vertex in the adjusted 3D model, wherein the associated mesh surface of a vertex is a mesh surface that includes the vertex.
[0127] Shading parameters are used to indicate the color and texture of the associated mesh face of a vertex.
[0128] In some embodiments, the shading parameters of vertex v are calculated using the following formula:
[0129] F color (v)=1 / ∣N(v)∣∑u ∈N(v) κ color (u,v), where F color (v) refers to the coloring parameters of vertex v, κ color (u,v) is the color curvature of the associated edge of vertex v (the other vertex of the associated edge is an adjacent vertex). The color curvature is the product of the minimum and maximum normal curvatures of the points on the associated edge.
[0130] In some embodiments, the rendered 3D model is sent to the client of the target application, and the target application displays the rendered 3D model.
[0131] In some embodiments, multimedia data (such as video multimedia data) for display is generated based on the rendered 3D model.
[0132] The technical solution provided in this application adjusts the vertex distribution of the 3D model to be rendered based on the feature data of the vertices in the 3D model before rendering, and then renders the adjusted 3D model accordingly. Since the feature data reflects the position of the vertices in the 3D model, the above method adaptively adjusts the vertex distribution for different positions in the 3D model. This results in different vertex densities in different regions of the 3D model during rendering, thereby enabling different rendering accuracies in different regions of the 3D model to be rendered, achieving automated rendering while ensuring rendering quality.
[0133] Please refer to Figure 8 The diagram illustrates a flowchart of a model rendering method provided in another embodiment of this application. The execution entity for each step of this method is a computer device, which can be the terminal device 10 in the above embodiment or a server 20. The method includes at least one of the following steps 810 to 840.
[0134] Step 810: Obtain the 3D model to be rendered.
[0135] For a detailed description of step 810, please refer to step 310 in the above embodiment, which will not be repeated here.
[0136] Step 820: Based on the feature data of each vertex in the 3D model to be rendered, adjust the vertex distribution of the 3D model to be rendered to obtain the coarsely segmented 3D model.
[0137] The number of vertices in the coarsely segmented 3D model is less than the number of vertices in the 3D model to be rendered.
[0138] In some embodiments, the feature data of a vertex includes at least one of the vertex's edge strength and corner measurement.
[0139] In some embodiments, based on the edge intensity of each vertex in the 3D model to be rendered, vertices belonging to non-edge types are determined from the 3D model to be rendered, and coarse segmentation is performed on these non-edge types of vertices to obtain a coarsely segmented 3D model. Coarse segmentation refers to the process of generating fewer vertices based on the original vertices to replace the original vertices.
[0140] In some embodiments, the above steps include at least one of the following steps:
[0141] 1. Based on the edge intensity of each vertex in the 3D model to be rendered, determine a1 vertices belonging to the edge type and b1 vertices belonging to the non-edge type from the 3D model to be rendered.
[0142] For a detailed explanation of this step, please refer to the above embodiment; it will not be repeated here.
[0143] 2. Based on the above b1 vertices, generate b2 vertices. The coarsely divided 3D model includes the above a1 vertices and the above b2 vertices.
[0144] For a detailed explanation of this step, please refer to the above embodiment; it will not be repeated here.
[0145] In some embodiments, based on the corner measurement of each vertex in the 3D model to be rendered, vertices belonging to non-corner types are determined from the 3D model to be rendered, and coarse segmentation is performed on these non-corner types to obtain the coarsely segmented 3D model.
[0146] In some embodiments, the above steps include at least one of the following:
[0147] 1. Based on the corner measurements of each vertex in the 3D model to be rendered, determine c1 vertices of the corner type and d1 vertices of the non-corner type from the 3D model to be rendered.
[0148] For a detailed explanation of this step, please refer to the above embodiment; it will not be repeated here.
[0149] 2. Based on the above d1 vertices, generate d2 vertices. The coarsely divided 3D model includes the above c1 vertices and the above d2 vertices.
[0150] For a detailed explanation of this step, please refer to the above embodiment; it will not be repeated here.
[0151] In some embodiments, the vertex feature data includes edge strength and corner measurement, and step 820 includes at least one of the following sub-steps 822 to 826:
[0152] Sub-step 822: For the first vertex in the 3D model to be rendered, obtain the coarse subdivision level of the first vertex based on the edge intensity of the first vertex.
[0153] The coarseness level of a vertex is used to reflect the length of the edge connected to that vertex, and the coarseness level of the first vertex is used to reflect the length of the edge connected to the first vertex.
[0154] The first vertex is any vertex in the 3D model to be rendered.
[0155] In some embodiments, the same processing is performed on each vertex in the 3D model to be rendered as on the first vertex.
[0156] In some embodiments, the coarseness level and the length of the edge connected to the vertex are positively correlated.
[0157] In some embodiments, the coarseness level and the length of the edge connected to the vertex are negatively correlated.
[0158] In some embodiments, the coarse division level of the first vertex is obtained by taking the logarithm of the reciprocal of the sum of the edge strength of the first vertex and the set positive numbers, with base 2.
[0159] In some embodiments, the coarse classification level of vertex v is calculated using the following formula:
[0160] L(v) = log₂1 / (E(v) + ∈), where L(v) is the coarse division level of vertex v, ∈ is a set positive number, and ∈ is a small positive number used to prevent division by zero errors. In some embodiments, the final coarse division level of vertex v is approximated by the calculation result of the above formula (e.g., obtained by rounding).
[0161] Sub-step 824: Based on the coarse division level of the first vertex and the corner measurement of the first vertex, obtain the feature preservation function value of the first vertex.
[0162] The feature preservation function value of a vertex is used to determine whether the coarse subdivision level of that vertex is reasonable. The feature preservation function value of the first vertex is used to determine whether the coarse subdivision level of the first vertex is reasonable.
[0163] In some embodiments, a coarse weight is calculated based on the corner metric of the first vertex for multiplication with the coarse weight level.
[0164] In some embodiments, 1 is added to a power function value with base e and an exponent of the median value obtained based on the corner measurement of the first vertex to obtain the coarse weight of the first vertex.
[0165] In some embodiments, the coarse weight of vertex v is calculated using the following formula:
[0166] W(v) = 1 + e -1 / α(C(v)-β) , where W(v) is the coarse weight of vertex v, and α and β are parameters set by the technician to control the shape of the function.
[0167] In some embodiments, the coarse segmentation level of the first vertex and the coarse segmentation weight of the first vertex are multiplied together to obtain the feature preservation function value of the first vertex.
[0168] That is, the coarse weight of vertex v is calculated using the following formula:
[0169] S(v) = L(v)W(v), where S(v) is the coarse weight of vertex v.
[0170] If the feature preservation function value of a vertex falls within a reasonable range, the coarse subdivision level of the vertex is reasonable; if the feature preservation function value of a vertex does not fall within a reasonable range, the coarse subdivision level of the vertex is unreasonable.
[0171] The above-mentioned reasonable range shall be set by technical personnel as needed.
[0172] In some embodiments, different coarse subdivision levels correspond to different reasonable ranges. The feature preservation function value of the first vertex belonging to a reasonable range means that the feature preservation function value of the first vertex belongs to the reasonable range corresponding to the coarse subdivision level of the first vertex.
[0173] In some embodiments, if the feature preservation function value of the first vertex is within a reasonable range, a coarsely segmented 3D model is obtained based on the first vertex (in this case, the first vertex is often a vertex close to corners, edges, etc., so coarse segmentation is unnecessary, thus avoiding damage to the details of the above-mentioned areas). That is, if the feature preservation function value of the first vertex is within a reasonable range, the coarsely segmented 3D model includes the first vertex.
[0174] Sub-step 826: If the coarse division level of the first vertex is unreasonable, determine the first coarse division vertex based on the first vertex.
[0175] Provided that the feature preservation function value of the first coarsely divided vertex is within a reasonable range, the coarsely divided 3D model includes the first coarsely divided vertex (but does not include the first vertex).
[0176] The feature preservation function value of the first coarse segment vertex is used to determine whether the coarse segmentation level of the first coarse segment vertex is reasonable. Its calculation method is similar to that of the feature preservation function value of the first vertex, and will not be described in detail here.
[0177] In some embodiments, if the feature preservation function value of the first coarse-divided vertex is within a reasonable range, a coarse-divided 3D model is obtained based on the first coarse-divided vertex. In some embodiments, in the 3D model to be rendered, the first vertex is replaced with the first coarse-divided vertex to obtain the coarse-divided 3D model. In some embodiments, the first coarse-divided vertex is connected to other vertices in the 3D model to be rendered (other vertices include newly generated vertices) to obtain the coarse-divided 3D model.
[0178] It should be noted that if the coarse division level of the first coarse division vertex is still unreasonable (i.e., the coarse division function of the first coarse division vertex is still not within a reasonable range), then it is necessary to determine a new vertex based on the first coarse division vertex, and so on, until a vertex with a reasonable coarse division level is determined. The method for determining a new vertex is the same as the method for determining the first coarse division vertex based on the first vertex, and will not be described in detail here.
[0179] In the above embodiment, the feature preservation function value obtained by combining edge strength and corner measurement is used as the criterion for determining whether coarse subdivision of vertices is required. This allows different coarse subdivision levels to be assigned to different regions of the 3D model, thereby ensuring that the key locations such as corners and edges of the coarsely subdivided 3D model can retain sufficient detail.
[0180] In some embodiments, sub-step 826 includes: when the feature preservation function values of each vertex of the first mesh face in the 3D model to be rendered are not within a reasonable range, determining the position vector of the first coarse vertex based on the position vector of each vertex in the first mesh face, wherein each vertex in the first mesh face includes the first vertex.
[0181] In some embodiments, the sum of the position vectors of each vertex of the first grid face (by performing vector addition) is divided by the number of vertices of the first grid face to obtain the position vector of the first coarse-divided vertex.
[0182] For example, the position vector V of the first coarse-divided vertex Z =1 / 4∑ i=1 4 V i , where V i Let be the position vector of the vertex of the first mesh face.
[0183] In this case, the multiple vertices of the first mesh face are coarsely divided into a single first coarse vertex (the first coarse vertex replaces all the vertices of the first mesh face).
[0184] For example, please refer to Figure 9 For the first grid surface 100 including the first vertex 101, if the feature preservation function values of the four vertices of the first grid surface 100 are not within a reasonable range, the sum of the position vectors of the four vertices of the first grid surface 100 (first vertex 101, vertex 102, vertex 103, vertex 104) is divided by 4 to obtain the position vector of the first coarse vertex 111. It can be seen that the four vertices of the first grid surface 100 are replaced by the first coarse vertex 111.
[0185] In some embodiments, sub-step 826 includes: when the feature preservation function values of the two vertices of the first associated edge in the 3D model to be rendered are not within a reasonable range, determining the position vector of the first coarse-divided vertex based on the position vectors of the two vertices in the first associated edge and the position vectors of the two adjacent face points of the first associated edge, wherein the two vertices of the first associated edge include the first vertex and the adjacent face points are the center points of the mesh face in the 3D model that includes the first associated edge.
[0186] In some embodiments, if the feature preservation function value of the first vertex does not belong to a reasonable range, and if there is no first grid face where the feature preservation function values of all vertices do not belong to a reasonable range, and there is a first associated edge where the feature preservation function values of two vertices do not belong to a reasonable range, then the position vector of the first coarse division vertex is determined based on the position vectors of the two vertices in the first associated edge and the position vectors of the two adjacent face points of the first associated edge.
[0187] In some embodiments, the position vector of the first coarse-divided vertex is obtained by dividing the sum of the position vectors of the two vertices of the first associated edge and the position vectors of the two adjacent face points of the first associated edge by 4.
[0188] That is, the position vector V of the first coarse-divided vertex. Z =1 / 4(V) j +V k +F1+F2), where V j and V k F1 and F2 are the position vectors of two vertices in the first associated edge, and F1 and F2 are the position vectors of two adjacent face points of the first associated edge.
[0189] In this case, the two vertices of the first associated edge are coarsely divided into a single first coarsely divided vertex (the two vertices of the first associated edge are replaced by the first coarsely divided vertex).
[0190] For example, please refer to Figure 9 For the first associated edge 110 including the first vertex 101, if the feature preservation function values of the two vertices (first vertex 101 and vertex 104) of the first associated edge 110 are not within a reasonable range, the sum of the position vectors of the two vertices in the first associated edge 110 and the position vectors of the two adjacent face points (face point 105 and face point 106) of the first associated edge 110 is divided by 4 to obtain the position vector of the first coarse vertex 111. It can be seen that the two vertices of the first associated edge 110 are replaced by the first coarse vertex 111.
[0191] In some embodiments, sub-step 826 includes: if the feature preservation function value of the first vertex does not fall within a reasonable range, determining the position vector of the first coarse-divided vertex based on the position vector of the first vertex and the position vectors of the adjacent vertices of the first vertex.
[0192] In some embodiments, if the feature preservation function value of the first vertex does not belong to a reasonable range, and if there is no first grid surface where the feature preservation function values of all vertices do not belong to a reasonable range, and there is no first associated edge where the feature preservation function values of two vertices do not belong to a reasonable range, then the position vector of the first coarse-divided vertex is determined based on the position vector of the first vertex and the position vectors of the adjacent vertices of the first vertex.
[0193] In some embodiments, the position vector of the first vertex is added together with the weighted sum of the position vectors of the adjacent vertices of the first vertex to obtain the position vector of the first coarse vertex.
[0194] For example, the position vector of the first coarse vertex is Vz = α N V+β N ∑ i=1 N V 2i +γ N ∑ i=1 N V 2i-1 Where V is the position vector of the first vertex, V 2i and V 2i-1 Let α be the position vector of adjacent vertices. N β N and γ N The weight parameters are determined based on the number of adjacent vertices N.
[0195] In this case, the first vertex is coarsely divided into the first coarsely divided vertex (the first vertex is replaced by the first coarsely divided vertex).
[0196] For example, please refer to Figure 9 If the feature preservation function value of the first vertex 101 is not within a reasonable range, the position vector of the first vertex 101 is added to the weighted sum of the position vectors of the adjacent vertices (vertices 102, 104, 107 and 108) of the first vertex, and the position vector of the first coarse vertex 111 is obtained. It can be seen that the first vertex 101 is replaced by the first coarse vertex 111.
[0197] It should be noted that in the 3D model to be rendered, there may be other vertices that are different from the first vertex and are also coarsely divided into the first coarse vertex. Therefore, the above method can also reduce the number of vertices.
[0198] In the above embodiments, three coarse subdivision methods are provided: coarse subdivision of mesh surfaces (coarse subdivision of surface points), coarse subdivision of edges (coarse subdivision of edge points), and coarse subdivision of vertices (coarse subdivision of vertices). These methods are applicable to various situations where the coarse subdivision level is unreasonable and have strong versatility.
[0199] Step 830: Based on the feature data of each vertex in the coarsely segmented 3D model, adjust the vertex distribution of the coarsely segmented 3D model to obtain the adjusted 3D model.
[0200] The number of vertices in the adjusted 3D model is greater than the number of vertices in the coarsely divided 3D model.
[0201] In some embodiments, based on the edge intensity of each vertex in the coarsely segmented 3D model, vertices belonging to the edge type are determined from the coarsely segmented 3D model, and subdivision processing is performed on these edge-type vertices to obtain a subdivided 3D model. Subdivision processing refers to the process of obtaining a larger number of vertices (in some embodiments, these vertices include the original vertices) based on the original vertices.
[0202] In some embodiments, the above steps include at least one of the following steps:
[0203] 1. Based on the edge intensity of each vertex in the coarsely segmented 3D model, determine p1 vertices belonging to the edge type and q1 vertices belonging to the non-edge type from the coarsely segmented 3D model.
[0204] p1 and q1 are both integers greater than 1.
[0205] The specific implementation of this step can be found in the above embodiment, which involves determining the a1 vertices belonging to the edge type and the b1 vertices belonging to the non-edge type from the 3D model to be rendered based on the edge intensity of each vertex. This will not be repeated here.
[0206] 2. Based on the p1 vertices mentioned above, generate p2 vertices. Where p2 is greater than p1, the adjusted 3D model includes the q1 vertices mentioned above and the p2 vertices mentioned above.
[0207] The specific implementation of this step can be found in the above embodiment, which describes the step of generating a2 vertices based on a1 vertices. It will not be repeated here.
[0208] In some embodiments, based on the corner measurement of each vertex in the 3D model to be rendered, vertices belonging to the corner type are determined from the 3D model to be rendered, and subdivision processing is performed on these vertices belonging to the corner type to obtain the subdivided 3D model.
[0209] In some embodiments, the above steps include at least one of the following steps:
[0210] 1. Based on the corner measurement of each vertex in the coarsely divided 3D model, determine r1 vertices belonging to the corner type and t1 vertices belonging to the non-corner type from the coarsely divided 3D model.
[0211] Both r1 and t1 are integers greater than 1.
[0212] The specific implementation of this step can be found in the above embodiment, which involves determining c1 vertices of the corner type and d1 vertices of the non-corner type from the 3D model to be rendered based on the corner measurement of each vertex. This will not be elaborated here.
[0213] 2. Based on the above r1 vertices, generate r2 vertices. Where r2 is greater than r1, the adjusted 3D model includes the above t1 vertices and the above r2 vertices.
[0214] The specific implementation of this step can be found in the above embodiment, which describes the step of generating c2 vertices based on c1 vertices. It will not be repeated here.
[0215] In some embodiments, the feature data of a vertex includes the edge intensity of the vertex, and step 830 includes at least one of the following sub-steps 832 to 834.
[0216] Sub-step 832: For the second vertex in the coarsely subdivided 3D model, the dynamic subdivision level of the second vertex is obtained based on the edge strength and view influence factor of the second vertex. The dynamic subdivision level of the second vertex is used to indicate the number of vertices generated based on the second vertex.
[0217] The second vertex is any vertex in the coarsely divided 3D model.
[0218] In some embodiments, the same processing is performed on each vertex in the coarsely segmented 3D model as on the second vertex.
[0219] The viewpoint influence factor of a vertex is related to the distance between the vertex and the virtual camera in the 3D space where the 3D model is located. The viewpoint influence factor of the second vertex is related to the distance between the second vertex and the virtual camera in the 3D space where the coarsely segmented 3D model is located.
[0220] In some embodiments, the viewpoint influence factor of the second vertex is obtained by adding 1 to a power function value with base e, which is the intermediate value of the distance between the virtual camera in the three-dimensional space where the second vertex and the coarsely divided three-dimensional model are located.
[0221] In some embodiments, the viewpoint influence factor of vertex v is calculated using the following formula:
[0222] A(v) = 1 + e -1 / α(D(v)-β) Where A(v) is the viewpoint influence factor of vertex v, and D(v) is the distance between vertex v and the virtual camera, i.e., D(v) = ||P camera -P v ||, where P camera Let P be the coordinates of the virtual camera in three-dimensional space. v Let v be the coordinates of vertex v in three-dimensional space.
[0223] In some embodiments, the viewpoint influence factor of the second vertex and the static subdivision level of the second vertex are multiplied together to obtain the dynamic subdivision level of the second vertex. That is, the dynamic subdivision level L of vertex v.dynamic (v) = L(v)A(v). The calculation method for the static subdivision level is the same as that for the coarse subdivision level in the above embodiment. Therefore, in the embodiments of this application, for vertex v, both the coarse subdivision level and the static subdivision level are represented by L(v). In some embodiments, the final coarse subdivision level of vertex v is approximately obtained from the calculation result of the above formula (e.g., rounded).
[0224] Sub-step 834: Based on the second vertex, generate m vertices, where m is an integer greater than or equal to 0, and m is indicated by the dynamic subdivision level of the second vertex.
[0225] In some embodiments, different dynamic subdivision levels correspond to different numbers of vertices.
[0226] In some embodiments, the dynamic subdivision level of the second vertex directly indicates the value of m.
[0227] The adjusted 3D model includes a second vertex and m vertices.
[0228] In some embodiments, an adjusted 3D model is obtained based on the second vertex and m vertices.
[0229] In some embodiments, the second vertex, m vertices, and other vertices (including newly generated vertices) in the coarsely divided 3D model are connected to obtain the adjusted 3D model.
[0230] In some embodiments, m is 0, meaning that no subdivision is performed based on the second vertex (no more vertices are generated).
[0231] In the above embodiment, during the subdivision of the coarsely subdivided 3D model (subdivision is performed on the second vertex), both the geometric features of the 3D model in static state and the perspective switching of the 3D model in dynamic scenes are considered. This allows the solution to achieve better subdivision and rendering effects in various scenarios with perspective changes (such as the constantly changing perspective in game scenes).
[0232] In some embodiments, when m is an integer greater than 1, sub-step 834 includes at least one of the following steps:
[0233] 1. Based on the position vector of the second vertex, the number of associated mesh faces of the second vertex, and the side length of each associated mesh face of the second vertex, determine the position vector of the first vertex among m vertices. The associated mesh face of a vertex is the mesh face that includes the vertex.
[0234] In some embodiments, the sum of the subdivision contribution vectors of each associated mesh face of the second vertex (by vector addition) is divided by the number of associated mesh faces of the second vertex to obtain the position vector of the first vertex out of m vertices. The subdivision contribution vector is determined based on the side length of the associated mesh face (such as the average side length) and the position vector of the second vertex.
[0235] In some embodiments, if the second vertex is vertex v, the position vector of the first vertex is calculated using the following formula:
[0236] G FAS (v)=1 / ∣T(v)∣∑ t∈T(v) S FAS (t,v), where G FAS (v) is the position vector of the first vertex, S FAS (t,v) is the subdivision contribution vector of the associated mesh surface t, which is determined based on the side length of the associated mesh surface t and the position vector of the second vertex.
[0237] For example, please refer to Figure 10 For the second vertex 121, the position vector of the first vertex 122 among the m vertices is determined based on the position vector of the second vertex 121, the number of associated mesh faces of the second vertex (the number is 3), and the side lengths of each associated mesh face (mesh face 120, mesh face 130 and mesh face 140) of the second vertex.
[0238] For example, please refer to Figure 10 If m = 1, then the adjusted 3D model includes not only the second vertex 121, but also the vertex 122 generated based on the second vertex 121.
[0239] 2. Based on the position vector of the i-th vertex among m vertices, the number of associated mesh faces of the i-th vertex, and the side length of each associated mesh face of the i-th vertex, determine the position vector of the (i+1)-th vertex among m vertices, where i is an integer greater than or equal to 1 and less than m.
[0240] The specific calculation method for this step can be found in step 1 above, and will not be repeated here.
[0241] For example, please refer to Figure 10 If m = 2, then based on the position vector of vertex 122, the number of associated mesh faces of vertex 122 (which is 3), and the side length of each associated mesh face of vertex 122, determine the second vertex among the m vertices. Figure 10 The position vector (not shown in the figure) in the adjusted 3D model includes not only the second vertex 121, but also the vertex 122 generated based on the second vertex 121 and the vertex generated based on vertex 122.
[0242] In the above embodiment, when m is an integer greater than 1, m vertices are generated successively based on the original second vertex. That is, the vertices generated in the previous step will affect the generation of subsequent vertices, ensuring the accuracy and effectiveness of vertex subdivision.
[0243] In some embodiments, when m equals 1, a vertex can be generated through step 1 described above.
[0244] In some embodiments, the feature data of the vertices further includes the corner measurement of the vertices, and step 830 further includes: optimizing the vertex distribution of the adjusted three-dimensional model according to the corner measurement corresponding to each vertex in the adjusted three-dimensional model.
[0245] The optimized 3D model is used to perform rendering to obtain the rendered 3D model.
[0246] In the above embodiment, using corner measurement to optimize the subdivided vertex distribution can further improve the subdivision accuracy in the corner area and improve the rendering quality.
[0247] In some embodiments, for a third vertex in the adjusted 3D model whose corner measurement satisfies the first condition, the position vector of the optimized vertex corresponding to the third vertex is determined based on the position vector of the third vertex, the number of associated edges of the third vertex, and the side length of each associated edge of the third vertex.
[0248] The edges associated with the third vertex include the third vertex.
[0249] In some embodiments, for each vertex in the adjusted 3D model that satisfies the first condition, the same processing as for the third vertex is performed.
[0250] The first condition is set by the technician as needed, and this application does not limit it. For example, the first condition is that the corner measurement is greater than or less than a certain threshold.
[0251] In some embodiments, the sum of the optimization contribution vectors of each associated edge of the third vertex (by vector addition) is divided by the number of associated edges of the third vertex to obtain the position vector of the optimized vertex corresponding to the third vertex. The optimization contribution vector is determined based on the edge lengths of the associated edges and the position vector of the third vertex.
[0252] In some embodiments, if the third vertex is vertex v, the position vector of the optimized vertex corresponding to the third vertex is calculated using the following formula:
[0253] O FAS (v)=1 / ∣Ed(v)∣∑ ed∈Ed(v) F opt (ed,v), where O FAS(v) is the optimized vertex position vector, F opt (ed,v) is the optimization contribution vector of the associated edge ed, which is determined based on the side length of the associated edge ed and the position vector of the third vertex.
[0254] The optimized 3D model includes the third vertex and the optimized vertex corresponding to the third vertex.
[0255] In the above embodiment, optimized vertices are generated only for vertices in the adjusted 3D model whose corner measurements meet the first condition. This means that selective subdivision optimization is performed on the adjusted 3D model, which not only ensures the subdivision accuracy for edges, corners, and other locations, but also controls the time consumption for optimizing the 3D model.
[0256] It should be noted that in the above embodiments, the coarse and fine subdivision of a single vertex is only used as an example. Those skilled in the art should understand that the coarse and fine subdivision process for a 3D model may include coarse and fine subdivision of multiple vertices or all vertices, and this application does not limit this.
[0257] Step 840: Render the adjusted 3D model based on the vertex distribution of the adjusted 3D model.
[0258] For a detailed description of step 840, please refer to step 330 in the above embodiment, which will not be repeated here.
[0259] The technical solution provided in this application divides the vertex adjustment process of a 3D model into two stages: coarse subdivision and fine subdivision. Both stages are controlled using vertex feature data. On the one hand, the coarse subdivision stage can omit some unnecessary vertices in the 3D model without destroying the details of edges, corners, and other areas, thereby improving rendering efficiency. On the other hand, the fine subdivision stage can improve the rendering accuracy of edges, corners, and other areas by subdividing vertices, thus optimizing the rendering effect. Furthermore, since control is based on vertex feature data, unnecessary subdivision is avoided in areas outside the aforementioned regions, ensuring rendering efficiency.
[0260] The following examples will provide further details on the rendering process of the adjusted 3D model.
[0261] In some embodiments, step 330 includes: step 332, rendering the adjusted 3D model based on the feature data of each vertex in the adjusted 3D model.
[0262] The feature data of the vertices in the adjusted 3D model are used to reflect the characteristics of the vertices' positions in the adjusted 3D model.
[0263] By using feature data as parameters to control the rendering of the adjusted 3D model, the rendering strategy for the adjusted 3D model can be dynamically adjusted based on the mesh structure of the adjusted 3D model, thereby optimizing the rendering effect.
[0264] In some embodiments, step 332 above includes at least one of the following sub-steps:
[0265] 1. Based on the feature data of each vertex in the adjusted 3D model, obtain the shading depth parameter of each vertex in the adjusted 3D model. The shading depth parameter of the vertex is used to indicate the shading depth of the associated mesh surface of the vertex (i.e., the specific depth of the color when shading the mesh surface with a certain color).
[0266] In some embodiments, the shading depth parameters of each vertex in the adjusted 3D model are obtained based on the corner measurements of each vertex in the adjusted 3D model.
[0267] In some embodiments, the shading depth parameter of vertex v is calculated using the following formula:
[0268] D color(v) =1 / (1+e) -γ(C(v)-δ) ), where D color(v) γ is the shading depth parameter of vertex v, C(v) is the corner measure of vertex v, and γ and δ are parameters set by the technician to control the shape of the function.
[0269] 2. Based on the shading depth parameters of each vertex in the adjusted 3D model, render the associated mesh surfaces of each vertex in the adjusted 3D model.
[0270] In some embodiments, the associated mesh surfaces of each vertex in the adjusted 3D model are rendered based on the shading depth parameters and shading parameters of each vertex in the adjusted 3D model.
[0271] In the embodiments of this application, rendering a certain vertex is equivalent to rendering all associated mesh faces of that vertex, which will not be described in detail here.
[0272] In the above embodiment, the rendering depth parameter for vertex rendering is determined based on feature data. This enables the rendering depth of the 3D model to be dynamically adjusted according to the adjusted geometry of the 3D model during the rendering process, making the color depth changes of the rendered 3D model more natural and smooth, thereby optimizing the rendering effect.
[0273] In some embodiments, parallel reference information for each vertex in the adjusted 3D model is obtained based on the feature data of the vertices of the associated mesh faces of each vertex in the adjusted 3D model. The parallel reference information is used to determine the vertices that are rendered in parallel in the adjusted 3D model.
[0274] In some embodiments, during the rendering of the adjusted 3D model, q vertices of parallel reference information that meet the parallel conditions are rendered in parallel, where q is an integer greater than 1.
[0275] Parallel rendering of q vertices means rendering the associated mesh faces of each of the q vertices in parallel.
[0276] In some embodiments, the parallel reference information of q vertices meets the parallel condition if the difference between the parallel reference information of any two vertices is less than the parallel threshold. The parallel threshold is set by the technician as needed, and this application does not limit it.
[0277] In some embodiments, for the fourth vertex in the adjusted 3D model, the sum of the parallel rendering contributions of each associated mesh face of the fourth vertex is divided by the number of associated mesh faces of the fourth vertex to obtain the parallel reference information of the fourth vertex. The parallel rendering contribution is determined based on the feature data of the vertices of the associated mesh faces.
[0278] In some embodiments, if the fourth vertex is vertex v, the parallel reference information of the fourth vertex is calculated using the following formula:
[0279] B color(v) =1 / ∣B(v)∣∑ b∈B(v) P color(b,v) Among them, B color(v) Let P be the parallel reference information of vertex v, B(v) be the set of associated mesh faces of vertex v, |B(v)| be the number of associated mesh faces of vertex v, and P be the parallel reference information of vertex v. color(b,v) It is the parallel rendering contribution of the associated mesh surface b to vertex v. The parallel rendering contribution is determined based on the feature data of the vertices of the associated mesh surface b (e.g., adding the corner measurements of each vertex of the associated mesh surface b).
[0280] In the above embodiment, parallel reference information is calculated based on the feature data of the vertices of the associated mesh face of the vertex, thereby realizing the geometric structure based on the adjusted 3D model and determining the vertices that can be rendered in parallel in the adjusted 3D model. On the one hand, this avoids the unsatisfactory rendering effect caused by rendering some vertices at the same time, and on the other hand, parallel rendering of multiple vertices improves rendering efficiency.
[0281] In some embodiments, during the rendering of the adjusted 3D model, for the n vertices in the adjusted 3D model that have not yet been rendered, the priority vertex to be rendered is determined from the n vertices based on the order reference information of each of the n vertices.
[0282] n is an integer greater than 1. The order reference information of vertices is determined based on the number of times each of the vertex’s associated mesh faces is rendered. The associated mesh face of a vertex is the mesh face that includes that vertex.
[0283] In some embodiments, for the fifth vertex among n vertices, the sum of the rendering contributions of each associated mesh face of the fifth vertex (in some embodiments, these associated mesh faces are all triangular mesh faces) is divided by the number of associated mesh faces of the fifth vertex to obtain the order reference information of the fifth vertex. The rendering contribution is determined based on the number of times the associated mesh faces are rendered.
[0284] In some embodiments, if the fifth vertex is vertex v, the order reference information of the fifth vertex is calculated using the following formula:
[0285] G color(v) =1 / ∣T(v)∣∑ t∈T(v) S color(t,v) Among them, G color(v) This is the order reference information for vertex v. T(v) is the set of associated mesh faces of vertex v. In some embodiments, T(v) is the set of triangular mesh faces among the associated mesh faces of vertex v. |T(v)| is the number of mesh faces in the set T(v). S color(t,v) It is the rendering contribution of the associated mesh face t to the vertex v. The rendering contribution is determined based on the number of times the associated mesh face t is rendered (e.g., equal to the number of times the associated mesh face t is rendered).
[0286] In some embodiments, the order reference information is negatively correlated with the number of times each associated mesh face is rendered; the greater the order reference information of a vertex, the higher the priority of rendering that vertex.
[0287] In some embodiments, the order reference information is positively correlated with the number of times each associated mesh face is rendered; the smaller the order reference information of a vertex, the higher the priority of rendering that vertex.
[0288] In some embodiments, during the rendering of the adjusted 3D model, for the n vertices in the adjusted 3D model that have not yet been rendered, the associated mesh surfaces of the priority vertex among the n vertices are rendered first.
[0289] It should be noted that each time a mesh face is rendered, the number of times that mesh face has been rendered needs to be updated. In other words, during the rendering of the adjusted 3D model, the determination of priority vertices is in real time.
[0290] In the above embodiment, the priority vertex among the n vertices is determined based on the number of times the associated mesh face is rendered. This can ensure that vertices whose associated mesh faces are rendered less often are rendered first, thereby optimizing the rendering order of the 3D model and improving rendering efficiency.
[0291] In some embodiments, during the rendering of the adjusted 3D model, for unrendered vertices in the adjusted 3D model, if the optimized reference information of the unrendered vertices does not meet the second condition, the step of rendering the unrendered vertices is skipped.
[0292] The optimization reference information for waiting vertices is determined based on the number of times each associated edge of the waiting vertex is rendered, and the associated edges of the waiting vertex include the waiting vertex itself.
[0293] A waiting vertex is any unrendered vertex in the adjusted 3D model.
[0294] In some embodiments, the sum of the rendering optimization contributions of each associated edge of the waiting vertex is divided by the number of associated edges of the waiting vertex to obtain the optimization reference information of the waiting vertex. The rendering optimization contribution is determined based on the number of times the associated edges are rendered.
[0295] In some embodiments, the optimization reference information for vertex v is calculated using the following formula:
[0296] O color(v) =1 / ∣Ed(v)∣∑ ed∈Ed(v) R color(ed,v) , of which O color(v) R is the optimization reference information for vertex v, Ed(v) is the set of edges associated with vertex v, |Ed(v)| is the number of edges associated with vertex v, and R is the set of edges associated with vertex v. color(ed,v) It is the rendering optimization contribution of the associated edge ed to vertex v. The rendering optimization contribution is determined based on the number of times the associated edge ed is rendered (e.g., equal to the number of times it is rendered).
[0297] The second condition is the condition for determining whether vertex rendering is required. In some embodiments, the second condition is that the optimized reference information is within a set range (such as greater than or less than a certain threshold). The set range is set by the technician as needed, and this application does not limit it.
[0298] It should be noted that each time a mesh face is rendered, the number of times the edges in that mesh face are rendered needs to be updated. In other words, during the rendering of the adjusted 3D model, the optimization reference information is updated in real time.
[0299] Additionally, it should be noted that in this embodiment, since rendering a vertex requires rendering all associated mesh faces of that vertex, and a mesh face has multiple vertices, even if a vertex has not yet been rendered, its associated mesh faces / associated mesh edges may have already been rendered.
[0300] In the above embodiment, the rendering of vertices is selectively skipped based on the optimization reference information of the vertices. This can effectively avoid unnecessary repeated rendering of a certain vertex during the rendering of the adjusted 3D model, thereby improving rendering efficiency, optimizing rendering effect, and reducing memory usage and resource consumption.
[0301] In some embodiments, the above model rendering method further includes:
[0302] Based on the visual effect evaluation results of each vertex in the rendered 3D model, the vertex distribution of the rendered 3D model is adjusted, or a re-render is performed on some vertices in the rendered 3D model. The visual effect evaluation results are determined based on the visual effect contribution of each vertex's associated mesh face.
[0303] The visual contribution of associated mesh surfaces is used to reflect at least one of the following: the overlap between associated mesh surfaces and other mesh surfaces, the rendering quality of associated mesh surfaces, and the color difference between associated mesh surfaces and adjacent mesh surfaces. The rendering quality of associated mesh surfaces can be quantified by the difference between the color of the associated mesh surface and a set ideal color (such as a difference in color depth). It should be noted that the visual contribution of associated mesh surfaces can also be quantified by other values that can reflect the visual effect of associated mesh surfaces, and this application does not limit this.
[0304] The visual effects evaluation results are used to reflect the quality of the visual effects of the rendering results for each associated mesh face of a vertex.
[0305] In some embodiments, for the sixth vertex in the rendered 3D model, the sum of the visual effect contributions of each associated mesh face of the sixth vertex is divided by the number of associated mesh faces of the sixth vertex to obtain the visual effect evaluation result of the sixth vertex.
[0306] In some embodiments, if the sixth vertex is vertex v, the visual effect evaluation result of the sixth vertex is calculated using the following formula:
[0307] V effect(v) =1 / ∣F(v)∣∑f ∈F(v) E visual(f,v) , where V effect(v) Let F(v) be the visual effect evaluation result of vertex v, where F(v) is the set of associated mesh faces of vertex v, |F(v)| is the number of associated mesh faces of vertex v, and E is the visual effect evaluation result of vertex v. visual(f,v)It is the visual contribution of the associated mesh surface f to vertex v.
[0308] In some embodiments, for each vertex whose visual effect evaluation result meets the adjustment criteria (such as being greater than or less than a certain threshold), the vertex distribution is adjusted, or a re-rendering is performed. The adjustment criteria are set as needed by those skilled in the art, and this application does not limit them.
[0309] In the above embodiment, after rendering is completed, the visual effect of the model rendering will be automatically evaluated, and adjustments will be made to vertices whose rendering effect does not meet expectations, thereby ensuring that the final rendering result meets expectations.
[0310] The following are embodiments of the apparatus described in this application, which can be used to execute the embodiments of the method described in this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the method described in this application.
[0311] Please refer to Figure 11 This diagram illustrates a block diagram of a model rendering apparatus according to an embodiment of this application. The apparatus has the function of implementing the above-described model rendering method; this function can be implemented in hardware or by hardware executing corresponding software. The apparatus can be a computer device or can be installed within a computer device. The apparatus 1100 may include: an acquisition module 1110, an adjustment module 1120, and a rendering module 1130.
[0312] The acquisition module 1110 is used to acquire the 3D model to be rendered.
[0313] The adjustment module 1120 is used to adjust the vertex distribution of the three-dimensional model to be rendered according to the feature data of each vertex in the three-dimensional model to be rendered, so as to obtain the adjusted three-dimensional model; wherein, the feature data of the vertices of the three-dimensional model is used to reflect the features of the position of the vertex in the three-dimensional model.
[0314] Rendering module 1130 is used to render the adjusted 3D model based on the vertex distribution of the adjusted 3D model.
[0315] In some embodiments, the feature data of the vertex is used to reflect the proximity between the position of the vertex in the 3D model and the key position of the 3D model; for a unit region in the adjusted 3D model, the number of vertices in the unit region is positively correlated with the proximity between the unit region and the key position of the adjusted 3D model; wherein, the key position of the 3D model includes at least one of the edges and corners of the 3D model.
[0316] In some embodiments, the adjustment module 1120 includes a coarse molecule module and a fine molecule submodule.
[0317] The coarse molecule module is used to adjust the vertex distribution of the 3D model to be rendered based on the feature data of each vertex in the 3D model to be rendered, so as to obtain a coarsely divided 3D model, wherein the number of vertices in the coarsely divided 3D model is less than the number of vertices in the 3D model to be rendered.
[0318] The subdivision submodule is used to adjust the vertex distribution of the coarsely subdivided 3D model based on the feature data of each vertex in the coarsely subdivided 3D model to obtain the adjusted 3D model, wherein the number of vertices in the adjusted 3D model is greater than the number of vertices in the coarsely subdivided 3D model.
[0319] In some embodiments, the feature data of the vertex includes the edge strength and corner measurement of the vertex, wherein the edge strength is used to reflect the proximity between the position of the vertex in the 3D model and the edge of the 3D model, and the corner measurement is used to reflect the proximity between the position of the vertex in the 3D model and the corner of the 3D model.
[0320] The coarse segmentation module is used to, for a first vertex in the 3D model to be rendered, obtain a coarse segmentation level for the first vertex based on the edge strength of the first vertex, the coarse segmentation level of the first vertex being used to reflect the length of the edge connected to the first vertex; obtain a feature preservation function value for the first vertex based on the coarse segmentation level and the corner measurement of the first vertex, the feature preservation function value of the first vertex being used to determine whether the coarse segmentation level of the first vertex is reasonable; if the feature preservation function value of the first vertex is not within a reasonable range, a first coarse segmentation vertex is determined based on the first vertex; wherein, if the feature preservation function value of the first coarse segmentation vertex is within the reasonable range, the coarsely segmented 3D model includes the first coarse segmentation vertex.
[0321] In some embodiments, the coarse molecule module is used to determine the position vector of the first coarse molecule vertex based on the position vectors of the vertices in the first mesh face of the 3D model to be rendered, where the feature preservation function values of all vertices in the first mesh face do not belong to the reasonable range, and the vertices in the first mesh face include the first vertex; or, when the feature preservation function values of the two vertices of the first associated edge in the 3D model to be rendered do not belong to the reasonable range, the module determines the position vector of the first coarse molecule vertex based on the position vectors of the two vertices in the first associated edge and the position vectors of the two adjacent face points of the first associated edge, where the two vertices of the first associated edge include the first vertex, and the adjacent face point is the center point of the mesh face in the 3D model that includes the first associated edge; or, when the feature preservation function value of the first vertex does not belong to the reasonable range, the module determines the position vector of the first coarse molecule vertex based on the position vector of the first vertex and the position vectors of the adjacent vertices of the first vertex.
[0322] In some embodiments, the coarse molecule module is further configured to obtain the edge strength of the first vertex based on the position vector of the first vertex, the number of adjacent vertices of the first vertex, and the position vectors of each adjacent vertex of the first vertex; and to obtain the corner metric of the first vertex based on the number of associated edges of the first vertex and the curvature of each associated edge of the first vertex, wherein the associated edges of the first vertex include the first vertex.
[0323] In some embodiments, the feature data of the vertex includes the edge strength of the vertex, which reflects the proximity of the vertex's position in the 3D model to the edge of the 3D model. A subdivision submodule is used to obtain a dynamic subdivision level for a second vertex in the coarsely subdivided 3D model, based on the edge strength of the second vertex and the viewpoint influence factor of the second vertex. The viewpoint influence factor of the second vertex is related to the distance between the second vertex and the virtual camera in the 3D space where the coarsely subdivided 3D model is located. The dynamic subdivision level of the second vertex indicates the number of vertices generated based on the second vertex. Based on the second vertex, m vertices are generated, where m is an integer greater than or equal to 0, and m is indicated by the dynamic subdivision level of the second vertex. The adjusted 3D model includes the second vertex and the m vertices.
[0324] In some embodiments, the subdivision submodule is configured to determine the position vector of the first vertex among the m vertices based on the position vector of the second vertex, the number of associated mesh faces of the second vertex, and the side length of each associated mesh face of the second vertex, wherein the associated mesh face of the vertex is a mesh face including the vertex; and to determine the position vector of the (i+1)th vertex among the m vertices based on the position vector of the i-th vertex among the m vertices, the number of associated mesh faces of the i-th vertex, and the side length of each associated mesh face of the i-th vertex, wherein i is an integer greater than or equal to 1 and less than m.
[0325] In some embodiments, the feature data of the vertex further includes the corner measure of the vertex, which reflects the proximity of the vertex's position in the 3D model to the corner of the 3D model. The subdivision submodule is further configured to optimize the vertex distribution of the adjusted 3D model based on the corner measures corresponding to each vertex in the adjusted 3D model.
[0326] In some embodiments, the subdivision submodule is used to determine the position vector of the optimized vertex corresponding to the third vertex in the adjusted 3D model, based on the position vector of the third vertex, the number of associated edges of the third vertex, and the side length of each associated edge of the third vertex; wherein the associated edges of the third vertex include the third vertex.
[0327] In some embodiments, the rendering module 1130 is used to render the adjusted three-dimensional model based on the feature data of each vertex in the adjusted three-dimensional model.
[0328] In some embodiments, the rendering module 1130 is configured to obtain the shading depth parameters of each vertex in the adjusted 3D model based on the feature data of each vertex in the adjusted 3D model, wherein the shading depth parameters of the vertex are used to indicate the shading depth of the associated mesh surface of the vertex, and the associated mesh surface of the vertex is a mesh surface including the vertex; and to render the associated mesh surface of each vertex in the adjusted 3D model based on the shading depth parameters of each vertex in the adjusted 3D model.
[0329] In some embodiments, the rendering module 1130 is further configured to obtain parallel reference information for each vertex in the adjusted 3D model based on the feature data of the vertices of the associated mesh surfaces of each vertex in the adjusted 3D model, wherein the parallel reference information is used to determine the vertices in the adjusted 3D model that are rendered in parallel.
[0330] In some embodiments, the rendering module 1130 is further configured to, during the rendering of the adjusted 3D model, determine, based on the order reference information of each of the n vertices that have not yet been rendered in the adjusted 3D model, a priority vertex to be rendered first from the n vertices; wherein, n is an integer greater than 1, the order reference information of the vertex is determined based on the number of times each associated mesh face of the vertex is rendered, and the associated mesh face of the vertex includes the mesh face of the vertex.
[0331] In some embodiments, the rendering module 1130 is further configured to, during the rendering of the adjusted 3D model, skip the step of rendering the waiting vertices that have not yet been rendered in the adjusted 3D model if the optimization reference information of the waiting vertices does not meet the second condition; wherein the optimization reference information of the waiting vertices is determined based on the number of times each associated edge of the waiting vertex is rendered, and the associated edges of the waiting vertex include the waiting vertex.
[0332] In some embodiments, the above-described device 1100 further includes: a feedback module ( Figure 11 (Not shown in the image).
[0333] The feedback module is used to adjust the vertex distribution of the rendered 3D model based on the visual effect evaluation results of each vertex in the rendered 3D model, or to re-render some vertices in the rendered 3D model. The visual effect evaluation results are determined based on the visual effect contribution of each associated mesh surface of the vertex, where the associated mesh surface of the vertex is a mesh surface that includes the vertex. The visual effect contribution of the associated mesh surface is used to reflect at least one of the following: the overlap between the associated mesh surface and other mesh surfaces, the rendering quality of the associated mesh surface, and the color difference between the associated mesh surface and adjacent mesh surfaces.
[0334] It should be noted that the apparatus provided in the above embodiments is only illustrated by the division of the above functional modules when implementing its functions. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus and method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.
[0335] Please refer to Figure 12 The diagram illustrates a structural block diagram of a computer device provided in one embodiment of this application.
[0336] Typically, computer device 1200 includes a processor 1201 and a memory 1202.
[0337] Processor 1201 may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc. Processor 1201 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field Programmable Gate Array), and PLA (Programmable Logic Array). Processor 1201 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 1201 may integrate a GPU, which is responsible for rendering and drawing the content required to be displayed on the screen. In some embodiments, processor 1201 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.
[0338] The memory 1202 may include one or more computer-readable storage media, which may be tangible and non-transitory. The memory 1202 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments, the non-transitory computer-readable storage media in the memory 1202 stores a computer program that is loaded and executed by the processor 1201 to implement the model rendering method described above.
[0339] Those skilled in the art will understand that Figure 12 The structure shown does not constitute a limitation on the computer device 1200 and may include more or fewer components than shown, or combine certain components, or use different component arrangements.
[0340] In some embodiments, a computer-readable storage medium is also provided, wherein a computer program is stored therein, the computer program being loaded and executed by a processor to implement the model rendering method described above.
[0341] Optionally, the computer-readable storage medium may include: ROM (Read-Only Memory), RAM (Random-Access Memory), SSD (Solid State Drives), or optical disc, etc. The random access memory may include ReRAM (Resistance Random Access Memory) and DRAM (Dynamic Random Access Memory).
[0342] In some embodiments, a computer program product is also provided, the computer program product including a computer program stored in a computer-readable storage medium, and a processor reading from the computer-readable storage medium and executing the computer program to implement the above-described model rendering method.
[0343] It should be understood that "multiple" as used herein refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. Furthermore, the step numbers described herein are merely illustrative of one possible execution order. In some other embodiments, the steps may not be executed in numerical order, such as two steps with different numbers being executed simultaneously, or two steps with different numbers being executed in the reverse order of the illustration. This application does not limit this.
[0344] The above are merely exemplary embodiments of this application and are not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application shall be included within the protection scope of this application.
Claims
1. A model rendering method, characterized in that, The method includes: Obtain the 3D model to be rendered; Based on the feature data of each vertex in the 3D model to be rendered, the vertex distribution of the 3D model to be rendered is adjusted to obtain the adjusted 3D model; wherein, the feature data of the vertices of the 3D model is used to reflect the features of the position of the vertex in the 3D model. The adjusted 3D model is rendered based on the vertex distribution of the adjusted 3D model.
2. The method according to claim 1, characterized in that, The feature data of the vertex is used to reflect the proximity between the position of the vertex in the 3D model and the key position of the 3D model; For a unit region in the adjusted 3D model, the number of vertices in the unit region is positively correlated with the proximity between the unit region and the key position of the adjusted 3D model. The key locations of the 3D model include at least one of the edges and corners of the 3D model.
3. The method according to claim 1 or 2, characterized in that, The step of adjusting the vertex distribution of the 3D model to be rendered based on the feature data of each vertex in the 3D model to be rendered, to obtain the adjusted 3D model, includes: Based on the feature data of each vertex in the 3D model to be rendered, the vertex distribution of the 3D model to be rendered is adjusted to obtain a coarsely divided 3D model, wherein the number of vertices in the coarsely divided 3D model is less than the number of vertices in the 3D model to be rendered. Based on the feature data of each vertex in the coarsely segmented 3D model, the vertex distribution of the coarsely segmented 3D model is adjusted to obtain the adjusted 3D model, wherein the number of vertices in the adjusted 3D model is greater than the number of vertices in the coarsely segmented 3D model.
4. The method according to claim 3, characterized in that, The feature data of the vertex includes the edge strength and corner measurement of the vertex. The edge strength is used to reflect the proximity between the position of the vertex in the 3D model and the edge of the 3D model. The corner measurement is used to reflect the proximity between the position of the vertex in the 3D model and the corner of the 3D model. The process of adjusting the vertex distribution of the 3D model to be rendered based on the feature data of each vertex in the 3D model to be rendered, to obtain a coarsely segmented 3D model, includes: For the first vertex in the 3D model to be rendered, the coarse subdivision level of the first vertex is obtained based on the edge strength of the first vertex. The coarse subdivision level of the first vertex is used to reflect the length of the edge connected to the first vertex. Based on the coarse segmentation level of the first vertex and the corner measurement of the first vertex, the feature preservation function value of the first vertex is obtained. The feature preservation function value of the first vertex is used to determine whether the coarse segmentation level of the first vertex is reasonable. If the feature preservation function value of the first vertex does not fall within a reasonable range, the first coarse segment vertex is determined based on the first vertex. Wherein, if the feature preservation function value of the first coarsely segmented vertex belongs to the reasonable range, the coarsely segmented 3D model includes the first coarsely segmented vertex.
5. The method according to claim 4, characterized in that, The step of determining the first coarse-segment vertex based on the first vertex when the feature preservation function value of the first vertex does not belong to a reasonable range includes: If the feature preservation function values of each vertex of the first mesh face in the 3D model to be rendered do not belong to the reasonable range, the position vector of the first coarse vertex is determined based on the position vector of each vertex in the first mesh face, wherein each vertex in the first mesh face includes the first vertex. or, If the feature preservation function values of the two vertices of the first associated edge in the 3D model to be rendered do not belong to the reasonable range, the position vector of the first coarse vertex is determined based on the position vectors of the two vertices of the first associated edge and the position vectors of the two adjacent face points of the first associated edge. The two vertices of the first associated edge include the first vertex, and the adjacent face points are the center points of the mesh faces in the 3D model that include the first associated edge. or, If the feature preservation function value of the first vertex does not fall within the reasonable range, the position vector of the first coarse-divided vertex is determined based on the position vector of the first vertex and the position vectors of the adjacent vertices of the first vertex.
6. The method according to claim 4 or 5, characterized in that, The method further includes: The edge strength of the first vertex is obtained based on the position vector of the first vertex, the number of adjacent vertices of the first vertex, and the position vectors of each adjacent vertex of the first vertex. The corner measure of the first vertex is obtained based on the number of associated edges of the first vertex and the curvature of each associated edge of the first vertex. The associated edges of the first vertex include the first vertex.
7. The method according to any one of claims 3 to 6, characterized in that, The feature data of the vertex includes the edge intensity of the vertex, which is used to reflect the proximity of the vertex's position in the 3D model to the edge of the 3D model; The process of adjusting the vertex distribution of the 3D model based on the feature data of each vertex in the coarsely segmented 3D model to obtain the adjusted 3D model includes: For the second vertex in the coarsely subdivided 3D model, the dynamic subdivision level of the second vertex is obtained based on the edge strength of the second vertex and the view influence factor of the second vertex. The view influence factor of the second vertex is related to the distance between the second vertex and the virtual camera in the 3D space where the coarsely subdivided 3D model is located. The dynamic subdivision level of the second vertex is used to indicate the number of vertices generated based on the second vertex. Based on the second vertex, generate m vertices, where m is an integer greater than or equal to 0, and m is indicated by the dynamic subdivision level of the second vertex; The adjusted 3D model includes the second vertex and the m vertices.
8. The method according to claim 7, characterized in that, When m is an integer greater than 1, generating m vertices based on the second vertex includes: Based on the position vector of the second vertex, the number of associated mesh faces of the second vertex, and the side length of each associated mesh face of the second vertex, determine the position vector of the first vertex among the m vertices, where the associated mesh face of the vertex is the mesh face that includes the vertex. The position vector of the (i+1)th vertex among the m vertices is determined based on the position vector of the i-th vertex, the number of associated mesh faces of the i-th vertex, and the side length of each associated mesh face of the i-th vertex, where i is an integer greater than or equal to 1 and less than m.
9. The method according to claim 7 or 8, characterized in that, The feature data of the vertex also includes the corner measurement of the vertex, which is used to reflect the proximity of the vertex's position in the three-dimensional model to the corner of the three-dimensional model; The method further includes: The vertex distribution of the adjusted 3D model is optimized based on the corner measurements of each vertex in the adjusted 3D model.
10. The method according to claim 9, characterized in that, The step of optimizing the vertex distribution of the adjusted 3D model based on the corner measurements of each vertex in the adjusted 3D model includes: For the third vertex in the adjusted 3D model whose corner measurement satisfies the first condition, the position vector of the optimized vertex corresponding to the third vertex is determined based on the position vector of the third vertex, the number of associated edges of the third vertex, and the side length of each associated edge of the third vertex. The associated edge of the third vertex includes the third vertex.
11. The method according to any one of claims 1 to 10, characterized in that, Rendering the adjusted 3D model based on the vertex distribution of the adjusted 3D model includes: The adjusted 3D model is rendered based on the feature data of each vertex in the adjusted 3D model.
12. The method according to claim 11, characterized in that, The step of rendering the adjusted 3D model based on the feature data of each vertex in the adjusted 3D model includes: Based on the feature data of each vertex in the adjusted 3D model, the shading depth parameter of each vertex in the adjusted 3D model is obtained. The shading depth parameter of the vertex is used to indicate the shading depth of the associated mesh surface of the vertex. The associated mesh surface of the vertex is the mesh surface that includes the vertex. Based on the shading depth parameters of each vertex in the adjusted 3D model, the associated mesh surfaces of each vertex in the adjusted 3D model are rendered.
13. The method according to any one of claims 1 to 12, characterized in that, The method further includes: Based on the feature data of the vertices of the associated mesh faces of each vertex in the adjusted 3D model, the parallel reference information of each vertex in the adjusted 3D model is obtained. The parallel reference information is used to determine the vertices that are rendered in parallel in the adjusted 3D model.
14. The method according to any one of claims 1 to 13, characterized in that, The method further includes: During the rendering of the adjusted 3D model, for the n vertices in the adjusted 3D model that have not yet been rendered, the priority vertex to be rendered is determined from the n vertices according to the order reference information of each of the n vertices; Wherein, n is an integer greater than 1, the order reference information of the vertices is determined according to the number of times each associated mesh face of the vertex is rendered, and the associated mesh face of the vertex includes the mesh face of the vertex.
15. The method according to any one of claims 1 to 14, characterized in that, The method further includes: During the rendering of the adjusted 3D model, for the unrendered vertices in the adjusted 3D model, if the optimization reference information of the unrendered vertices does not meet the second condition, the step of rendering the unrendered vertices is skipped. The optimization reference information for the waiting vertex is determined based on the number of times each associated edge of the waiting vertex is rendered, and the associated edges of the waiting vertex include the waiting vertex itself.
16. The method according to any one of claims 1 to 15, characterized in that, The method further includes: Based on the visual effect evaluation results of each vertex in the rendered 3D model, the vertex distribution of the rendered 3D model is adjusted, or a re-rendering is performed on some vertices in the rendered 3D model. The visual effect evaluation results are determined based on the visual effect contribution of each associated mesh surface of the vertex, and the associated mesh surface of the vertex is the mesh surface that includes the vertex. The visual effect contribution of the associated mesh surface is used to reflect at least one of the following: the overlap between the associated mesh surface and other mesh surfaces, the rendering quality of the associated mesh surface, and the color difference between the associated mesh surface and adjacent mesh surfaces.
17. A model rendering apparatus, characterized in that, The device includes: The acquisition module is used to acquire the 3D model to be rendered; An adjustment module is used to adjust the vertex distribution of the three-dimensional model to be rendered based on the feature data of each vertex in the three-dimensional model to be rendered, so as to obtain an adjusted three-dimensional model; wherein, the feature data of the vertices of the three-dimensional model is used to reflect the features of the position of the vertex in the three-dimensional model. The rendering module is used to render the adjusted 3D model based on the vertex distribution of the adjusted 3D model.
18. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing a computer program that is loaded and executed by the processor to implement the method as claimed in any one of claims 1 to 16.
19. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which is loaded and executed by a processor to implement the method as described in any one of claims 1 to 16.
20. A computer program product, characterized in that, The computer program product includes a computer program stored in a computer-readable storage medium, which a processor reads from and executes to implement the method as described in any one of claims 1 to 16.