CN-122023631-A - Polygonal model rendering method, system, equipment and storage medium
Abstract
The application discloses a polygonal model rendering method, a system, equipment and a storage medium, which relate to the technical field of real-time graphic rendering and comprise the steps of obtaining a polygonal grid model to be rendered, performing index removal processing on the polygonal grid model to obtain an independent triangular surface sequence without shared vertexes, generating unique point identifiers for the independent vertexes of all triangular surfaces in the independent triangular surface sequence, constructing a common edge relation between all triangular surfaces and undirected edges, calculating normal angles corresponding to all undirected edges, judging an outer contour edge of each triangular surface based on the common edge relation and the normal angles, encoding classification information of the outer contour edge into vertex attributes, and adaptively rendering the encoded polygonal grid model to a target game engine to realize real-time edge tracing of the outer contour. The application can accurately distinguish the internal edge generated by the triangularization of the real external contour and the model, avoid wrong edge tracing and improve the external contour recognition precision.
Inventors
- HAN JIAQI
- TAN HAOXIANG
- Cui Guanchu
- LI MENGDI
Assignees
- 丝路视觉科技股份有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20251224
Claims (10)
- 1. A polygonal model rendering method, comprising: obtaining a polygonal mesh model to be rendered, and performing index removal treatment on the polygonal mesh model to obtain an independent triangular surface sequence without shared vertexes; Generating unique point marks for independent vertexes of all triangular faces in the independent triangular face sequence, constructing a common-edge relation between all the triangular faces and undirected edges, and calculating normal angles corresponding to all the undirected edges; for any triangular surface, judging the outer contour edge of the triangular surface based on the co-edge relation and the normal angle; and encoding the classification information of the outline edges into vertex attributes, and adaptively rendering the encoded polygonal grid model to a target game engine to realize real-time outline edge tracing.
- 2. The method of claim 1, wherein the performing the de-indexing process on the polygon mesh model to obtain the independent triangular surface sequence without shared vertices comprises: traversing all triangular surface indexes in the polygonal grid model, and identifying shared vertexes with shared relations in the triangular surface indexes; Copying vertex data corresponding to the shared vertex, and reconstructing a vertex array comprising position, normal and texture coordinates; And generating an independent triangular surface sequence with independent vertexes on each triangular surface in the independent triangular surface sequence based on the reconstructed vertex array.
- 3. The method of rendering a polygon model as claimed in claim 1, wherein said generating a unique point identifier for each of the independent vertices of each triangular surface in the sequence of independent triangular surfaces, constructing a co-edge relationship between each triangular surface and an undirected edge, and calculating a normal angle corresponding to each undirected edge, includes: acquiring space coordinate information of each independent vertex; Generating unique point identifiers of the independent vertexes based on the bit patterns of the space coordinate information, extracting undirected edges corresponding to the triangular faces, and constructing unique edge identifiers for the undirected edges to construct a topology table; Recording triangular surface information corresponding to each undirected edge through a hash table to form a co-edge relationship; And calculating normal vectors of all triangular surfaces based on the topological table and the co-edge relation, and calculating normal included angles between the normal vectors of the triangular surfaces with the relation.
- 4. The polygonal model rendering method of claim 3, wherein the triangle surface information includes triangle surface identifications and relative vertex identifications; the method for forming the co-edge relationship by recording triangular surface information corresponding to each undirected edge through a hash table comprises the following steps: storing unique edge identifiers of the undirected edges as key values into a hash table; Storing triangular face identifiers and relative vertex identifiers associated with the undirected edges as values into a hash table; And constructing a hash table by traversing undirected edges of the triangular faces to form a co-edge relationship.
- 5. The polygonal model rendering method according to claim 1, wherein the determining the outer contour edge of the triangular surface based on the co-edge relationship and the normal angle includes: Determining the number of triangular faces associated with each undirected edge in the co-edge relationship; for any undirected edge, if the number of the triangular faces is one, judging that the undirected edge is the outer contour edge of the triangular face; If the number of the triangular faces is two, a preset angle threshold is obtained, and the normal included angle is compared with the angle threshold; And if the normal included angle is larger than the angle threshold, judging that the undirected edge is the outer contour edge of the triangular surface.
- 6. The method for rendering the polygon model according to claim 1, wherein the encoding the classification information of the outline edge into the vertex attribute, and adaptively rendering the encoded polygon mesh model to the target game engine, to implement real-time outline tracing, includes: Distributing gravity center coding sequences for three vertexes of each triangular surface, and writing component information corresponding to the gravity center coding sequences into texture coordinate attributes of the vertexes; generating an outer contour edge mask, writing the outer contour edge mask into the color attribute of the vertex, and finishing classification information coding; According to the type of the target game engine, a coding model file of the coded polygonal mesh model is exported, the coding model file is imported into the target game engine, and the adaptive rendering materials are loaded; and reading the coding information in the vertex attributes through the rendering materials, identifying the outline edges, and adjusting rendering parameters to realize real-time outline edge tracing.
- 7. The polygonal model rendering method of claim 6, wherein the deriving the encoded model file of the encoded polygonal mesh model according to the type of the target game engine comprises: Obtaining model format support information of the target game engine; if the model format supporting information does not contain an open source model format, a description file containing model topology information and coding information is derived, and the description file is used for being converted into a model file supported by a target game engine through a plug-in; And if the model format supporting information comprises an open source model format, an open source format model file comprising coding information is exported.
- 8. A polygonal model rendering system, comprising: The system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a polygonal grid model to be rendered, and performing index removal processing on the polygonal grid model to obtain an independent triangular surface sequence without shared vertexes; The calculation module is used for generating unique point marks for independent vertexes of all triangular surfaces in the independent triangular surface sequence, constructing a common-edge relation between all the triangular surfaces and undirected edges, and calculating normal included angles corresponding to all the undirected edges; the judging module is used for judging the outer contour edge of any triangular surface based on the common-edge relation and the normal included angle; And the rendering module is used for encoding the classification information of the outline edges into vertex attributes, and adaptively rendering the encoded polygonal grid model to a target game engine to realize real-time outline edge tracing.
- 9. A polygon model rendering device, characterized in that it comprises a memory, a processor and a computer program stored on the memory and executable on the processor, the computer program being configured to implement the steps of the polygon model rendering method according to any one of claims 1 to 7.
- 10. A storage medium, characterized in that the storage medium is a computer-readable storage medium, on which a computer program is stored, which computer program, when being executed by a processor, realizes the steps of the polygon model rendering method according to any one of claims 1 to 7.
Description
Polygonal model rendering method, system, equipment and storage medium Technical Field The present application relates to the field of real-time graphics rendering technologies, and in particular, to a method, a system, an apparatus, and a storage medium for rendering a polygon model. Background The three-dimensional real-time rendering technology is widely applied to a plurality of scenes such as a game engine (such as Unity and Unreal Engine), virtual Reality (VR), digital twinning and the like, and the outline drawing is used as a common requirement in non-realistic rendering, can effectively highlight the outline of an object, enhance the visual emphasis effect or realize cartoon rendering, and is an important means for improving the visual presentation quality. However, the prior art has a plurality of defects that internal auxiliary edges are generated after the polygon model is automatically triangulated by an engine, the edges cannot be distinguished from real outline edges, internal messy lines and wrong tracing are often caused, the problem of multi-line display of the internal edges can occur on the polygonal surfaces such as fan-shaped in the figures referring to fig. 1 and 2, the existing rendering pipeline has no primary recognition mechanism, all the current algorithms cannot effectively distinguish 'outer edges/inner edges' at the vertex level, the expansion method of a geometric shader has extremely poor performance and is not supported by a mobile terminal, the edges of a screen have more detection noise points, serious jitter and easy misjudgment of the internal folding lines, the simple Barycentric tracing algorithm is completely ineffective in a shared vertex model, and the internal auxiliary edges cannot be filtered, and the problems commonly cause poor outline tracing effect and insufficient stability, so that the high-precision rendering requirement is difficult to meet. Disclosure of Invention The application mainly aims to provide a polygonal model rendering method, a system, equipment and a storage medium, which aim to accurately distinguish a real outer contour from an inner edge generated by model triangularization, avoid wrong edge tracing and improve the outer contour recognition precision. In order to achieve the above object, the present application provides a polygon model rendering method, which includes: obtaining a polygonal mesh model to be rendered, and performing index removal treatment on the polygonal mesh model to obtain an independent triangular surface sequence without shared vertexes; Generating unique point marks for independent vertexes of all triangular faces in the independent triangular face sequence, constructing a common-edge relation between all the triangular faces and undirected edges, and calculating normal angles corresponding to all the undirected edges; for any triangular surface, judging the outer contour edge of the triangular surface based on the co-edge relation and the normal angle; and encoding the classification information of the outline edges into vertex attributes, and adaptively rendering the encoded polygonal grid model to a target game engine to realize real-time outline edge tracing. In one possible implementation manner, the performing the de-indexing processing on the polygon mesh model to obtain an independent triangular surface sequence without shared vertices includes: traversing all triangular surface indexes in the polygonal grid model, and identifying shared vertexes with shared relations in the triangular surface indexes; Copying vertex data corresponding to the shared vertex, and reconstructing a vertex array comprising position, normal and texture coordinates; And generating an independent triangular surface sequence with independent vertexes on each triangular surface in the independent triangular surface sequence based on the reconstructed vertex array. In one possible implementation manner, the generating a unique point identifier for each independent vertex of each triangular surface in the independent triangular surface sequence, constructing a co-edge relationship between each triangular surface and an undirected edge, and calculating a normal angle corresponding to each undirected edge includes: acquiring space coordinate information of each independent vertex; Generating unique point identifiers of the independent vertexes based on the bit patterns of the space coordinate information, extracting undirected edges corresponding to the triangular faces, and constructing unique edge identifiers for the undirected edges to construct a topology table; Recording triangular surface information corresponding to each undirected edge through a hash table to form a co-edge relationship; And calculating normal vectors of all triangular surfaces based on the topological table and the co-edge relation, and calculating normal included angles between the normal vectors of the triangular surfaces with the relation. In one possible im