Grid model processing method and device, storage medium and electronic equipment

By obtaining and processing the model information of the mesh model, determining the control parameters of the vertex, and generating stroke effects, the problems of poor stroke effects and low efficiency in the prior art are solved, and a more refined and natural stroke effect is achieved.

CN119579823APending Publication Date: 2025-03-07NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411506146.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-24
Publication Date
2025-03-07

AI Technical Summary

Technical Problem

In the prior art, the stroke effect of generating network models is poor and has low efficiency, and requires manual drawing, which is costly.

Method used

By obtaining the model information of the target grid model, the average normal of multiple vertices and the surface normal of multiple faces are determined, the control parameters of the vertices are determined based on these information, and a stroke effect is generated, where the width of the stroke effect is determined based on the control parameters.

Benefits of technology

A more accurate and adjustable stroke effect is achieved, and the width and shape of the stroke can be adjusted according to the control parameters, improving the fineness and nature of the stroke effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119579823A_ABST
    Figure CN119579823A_ABST
Patent Text Reader

Abstract

The invention discloses a grid model processing method and device, a storage medium and electronic equipment. The method comprises the steps of obtaining model information of a target grid model; based on the model information, determining an average normal of a plurality of vertexes and a surface normal of a plurality of surfaces on the target grid model; determining control parameters of the plurality of vertexes based on the average normal of the plurality of vertexes and the surface normal of the plurality of surfaces; and generating a stroking effect of the target grid model based on the control parameters of the plurality of vertexes and an average normal of the plurality of vertexes, the width of the stroking effect being determined based on the control parameters of the plurality of vertexes. According to the method and the device, the technical problems of relatively poor effect and relatively low efficiency of generating the stroking effect of the network model in related technologies are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of image processing, and in particular to a grid model processing method, device, storage medium and electronic device. Background Art

[0002] In computer graphics, the edges of three-dimensional network models are processed so that they can present clear and realistic contour lines when rendered, that is, the stroke effect of the network model is generated. It can help enhance the three-dimensional sense of the model and the recognizability of the shape, making it more vivid and realistic. The stroke effect is widely used in game development, animation production and other fields.

[0003] At present, the related technologies usually use an average normal algorithm and a normal expansion algorithm to generate the stroke effect of the network model. The average normal algorithm often obtains a misplaced mean normal due to the loss of normal weight, thereby obtaining a broken or incoherent stroke. In the normal expansion scheme, the stroke thickness is adjusted by often reducing the stroke thickness value of the place where it needs to be thinner through vertex color drawing. Each different object needs to be manually drawn, which is costly, resulting in poor effect and low efficiency of the stroke effect of the network model generated in the related technologies.

[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0005] At least some embodiments of the present disclosure provide a method, device, storage medium and electronic device for processing a mesh model to at least solve the technical problems of poor effect and low efficiency in generating stroke effects of network models in related technologies.

[0006] According to one embodiment of the present disclosure, a method for processing a mesh model is provided, comprising: obtaining model information of a target mesh model; determining, based on the model information, an average normal of multiple vertices and a surface normal of multiple faces on the target mesh model; determining control parameters of the multiple vertices based on the average normal of the multiple vertices and the surface normal of the multiple faces; generating a stroke effect of the target mesh model based on the control parameters of the multiple vertices and the average normal of the multiple vertices, wherein the width of the stroke effect is determined based on the control parameters of the multiple vertices.

[0007] According to one embodiment of the present disclosure, a mesh model processing device is also provided, including: an acquisition module, used to acquire model information of a target mesh model; a normal determination module, used to determine the average normal of multiple vertices and the surface normal of multiple faces based on the model information; a parameter determination module, used to determine the control parameters of multiple vertices based on the average normal of multiple vertices and the surface normal of multiple faces on the target mesh model; an effect generation module, used to generate a stroke effect of the target mesh model based on the control parameters of multiple vertices and the average normal of multiple vertices, wherein the width of the stroke effect is determined based on the control parameters of multiple vertices.

[0008] According to one embodiment of the present disclosure, a computer-readable storage medium is further provided, in which a computer program is stored, wherein the computer program is configured to execute the methods in various embodiments of the present disclosure when run.

[0009] According to one embodiment of the present disclosure, an electronic device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the methods in various embodiments of the present disclosure.

[0010] According to another aspect of the embodiments of the present disclosure, a computer program product is also provided, including a computer program, and when the computer program is executed by a processor, the method in each embodiment of the present disclosure is implemented.

[0011] According to another aspect of an embodiment of the present disclosure, a computer program product is also provided, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method in each embodiment of the present disclosure is implemented.

[0012] According to another aspect of the embodiments of the present disclosure, a computer program is further provided. When the computer program is executed by a processor, the methods in the various embodiments of the present disclosure are implemented.

[0013] In at least some embodiments of the present disclosure, model information of a target mesh model is obtained; based on the model information, average normals of multiple vertices and surface normals of multiple faces on the target mesh model are determined; based on the average normals of multiple vertices and surface normals of multiple faces, control parameters of multiple vertices are determined; based on the control parameters of multiple vertices and the average normals of multiple vertices, a stroke effect of the target mesh model is generated, wherein the width of the stroke effect is determined based on the control parameters of multiple vertices. It is easy to notice that by obtaining the model information of the target mesh model and calculating the average normals of multiple vertices and surface normals of multiple faces, the structure and characteristics of the target mesh model can be accurately understood, the surface geometric features of the target mesh model can be accurately described, and the control parameters of multiple vertices can be determined based on the average normals of multiple vertices and surface normals, so that the details and shapes of the stroke effect can be effectively controlled, the accuracy and adjustability of the stroke effect can be improved, and the width and shape of the stroke can be adjusted according to the control parameters, so as to achieve a more refined and natural stroke effect, thereby solving the technical problems of poor effect and low efficiency of generating the stroke effect of the network model in the related art. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] The drawings described herein are used to provide a further understanding of the present disclosure and constitute a part of the present application. The illustrative embodiments of the present disclosure and their descriptions are used to explain the present disclosure and do not constitute an improper limitation on the present disclosure. In the drawings:

[0015] Figure 1 It is a hardware structure block diagram of a mobile terminal of a grid model processing method according to an embodiment of the present disclosure;

[0016] Figure 2 is a flowchart of a method for processing a grid model according to one embodiment of the present disclosure;

[0017] Figure 3 is a schematic diagram of a user interface (UI) according to one embodiment of the present disclosure;

[0018] Figure 4 It is a schematic diagram of the effect of controlling the stroke thickness based on the vertex color (Alpha) channel according to one embodiment of the present disclosure;

[0019] Figure 5 is a schematic diagram of a stroke effect of a target mesh model generated by a mesh model-based processing method according to one embodiment of the present disclosure;

[0020] Figure 6 is a structural block diagram of a grid model processing device according to one embodiment of the present disclosure;

[0021] Figure 7 is a schematic diagram of an electronic device according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0022] In order to enable those skilled in the art to better understand the disclosed solution, the technical solution in the disclosed embodiment will be clearly and completely described below in conjunction with the drawings in the disclosed embodiment. Obviously, the described embodiment is only a part of the disclosed embodiment, not all of the embodiments. Based on the embodiments in the disclosed embodiment, all other embodiments obtained by ordinary technicians in the field without creative work should fall within the scope of protection of the disclosed embodiment.

[0023] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices.

[0024] In a possible implementation, the inventors have found, after practice and careful research, that the related art still has the technical problem of poor effect and low efficiency in generating the stroking effect of the network model, which is commonly used in the background of the computer image processing field. Based on this, the game scene applied to the embodiment of the present disclosure can be any game scene in the mobile terminal device game, and a method for processing a mesh model is proposed. The technical concept adopted is to obtain the model information of the target mesh model; based on the model information, determine the average normals of multiple vertices and the surface normals of multiple faces on the target mesh model; based on the average normals of the multiple vertices and the surface normals of the multiple faces, determine Control parameters of multiple vertices; based on the control parameters of multiple vertices and the average normals of multiple vertices, a stroke effect of a target mesh model is generated, wherein the width of the stroke effect is determined based on the control parameters of multiple vertices, the structure and characteristics of the target mesh model can be accurately understood, the surface geometric features of the target mesh model can be accurately described, the details and shape of the stroke effect can be effectively controlled, the accuracy and adjustability of the stroke effect can be improved, and the width and shape of the stroke can be adjusted according to the control parameters to achieve a more refined and natural stroke effect, thereby solving the technical problems of poor effect and low efficiency of generating the stroke effect of the network model in the related art.

[0025] The above method embodiments involved in the present disclosure can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, the mobile terminal can be a smart phone, a tablet computer, a handheld computer, a mobile Internet device, a PAD, a game console and other terminal devices. Figure 1 FIG. 1 is a hardware structure block diagram of a mobile terminal of a grid model processing method according to an embodiment of the present disclosure. Figure 1 As shown, the mobile terminal may include one or more ( Figure 1 The processor 102 (only one is shown) may include, but is not limited to, a central processing unit (CPU), a graphics processing unit (GPU), a digital signal processing (DSP) chip, a microprocessor (MCU), a field-programmable logic device (FPGA), a neural network processor (NPU), a tensor processing unit (TPU), an artificial intelligence (AI) type processor, etc.) and a memory 104 for storing data. In one embodiment of the present disclosure, it may also include: an input / output device 108 and a display device 110.

[0026] In some optional embodiments mainly based on game scenarios, the above-mentioned device can also provide a human-computer interaction interface with a touch-sensitive surface, which can sense finger contact and / or gestures to perform human-computer interaction with a graphical user interface. The human-computer interaction function may include the following interactions: creating web pages, drawing, word processing, making electronic documents, games, video conferencing, instant messaging, sending and receiving emails, call interface, playing digital videos, playing digital music and / or web browsing, etc. The executable instructions for executing the above-mentioned human-computer interaction functions are configured / stored in a computer program product or readable storage medium executable by one or more processors.

[0027] The grid model processing method in one embodiment of the present disclosure can be run on a local terminal device or a server. When the grid model processing method is run on a server, the method can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and a client device.

[0028] In an optional implementation, various cloud applications can be run under the cloud interaction system, such as cloud games. Taking cloud games as an example, cloud games refer to a game mode based on cloud computing. In the operation mode of cloud games, the operating body of the game program and the main body of the game screen presentation are separated. The storage and operation of the grid model processing method are completed on the cloud game server. The client device is used for receiving and sending data and presenting the game screen. For example, the client device can be a display device with data transmission function close to the user side, such as a mobile terminal, a TV, a computer, a handheld computer, etc.; but the cloud game server in the cloud is used for information processing. When playing the game, the player operates the client device to send an operation instruction to the cloud game server. The cloud game server runs the game according to the operation instruction, encodes and compresses the game screen and other data, and returns it to the client device through the network. Finally, the client device decodes and outputs the game screen.

[0029] In an optional implementation, taking a game as an example, the local terminal device stores the game program and is used to present the game screen. The local terminal device is used to interact with the player through a graphical user interface, that is, the game program is downloaded and installed and run by the conventional electronic device. The local terminal device can provide the graphical user interface to the player in a variety of ways, for example, it can be rendered and displayed on the display screen of the terminal, or provided to the player through holographic projection.

[0030] For example, the local terminal device can be a mobile terminal, a computer terminal or a similar computing device, which may include a display screen and a processor, wherein the display screen is used to present a graphical user interface, the graphical user interface includes a game screen, and the processor is used to run the game, generate the graphical user interface and control the display of the graphical user interface on the display screen.

[0031] Taking running on a mobile terminal as an example, the mobile terminal may be a smart phone, a tablet computer, a PDA, a mobile Internet device, a PAD, a game console, or other terminal devices. Figure 1 FIG. 1 is a hardware structure block diagram of a mobile terminal of a grid model processing method according to an embodiment of the present disclosure. Figure 1 As shown, the mobile terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 and a memory 104 for storing data. Optionally, the mobile terminal may further include a transmission device 106, an input and output device 108 and a display device 110.

[0032] Those skilled in the art will understand that Figure 1 The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0033] According to one embodiment of the present disclosure, an embodiment of a method for processing a grid model is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0034] In a possible implementation, an embodiment of the present disclosure provides a method for processing a grid model. Figure 2 is a flowchart of a method for processing a grid model according to one embodiment of the present disclosure, such as Figure 2 As shown, the method comprises the following steps:

[0035] Step S202, obtaining model information of the target grid model.

[0036] The above-mentioned target mesh model may refer to a modeling model used in the field of computer graphics to describe and represent the shape, structure, material and motion of a target object. The target mesh model may describe characters, cartoon characters and various objects. The target network model may be applied to fields such as three-dimensional modeling, animation and rendering in computer graphics. The specific types of the target network model may include three-dimensional modeling models, polygonal mesh models, surface models, voxel models and skeletal animation models, etc. By using the target network model, accurate description and simulation of the shape, structure, material and motion of the target object may be achieved. The specific type of the target mesh model may be determined according to actual needs and is not limited here.

[0037] The above-mentioned model information may refer to point information, line information and surface information in the target mesh model, among which the model information may specifically include actual position information, relative position relationship, connection and combination relationship, thickness information of line segments and color, texture, gradient and other information, shading information, shadow information, material information and other types of light and shadow information in the point information, line information and surface information. The model information may be specifically determined according to actual needs and is not limited here.

[0038] In an optional embodiment, the model information of the target mesh model can be obtained by reading the target mesh model file to load the model data into the computer memory, and the corresponding file parser can be used to read the vertex coordinates, triangle index and other information in the file, and then the model data can be parsed to extract the vertex coordinates, normal vectors, texture coordinates and other information; in the process of obtaining the model information, the model data can also be preprocessed, such as removing duplicate vertices, calculating normal vectors, performing coordinate transformation and other operations, so that subsequent processing is more efficient and accurate; the parsed model data can also be constructed into a data structure suitable for computer graphics processing, such as a vertex array, an index array, a bounding box, etc., which can facilitate subsequent data processing, and according to specific needs, the required information can be extracted from the model data, such as the surface area, volume, center of mass coordinates, bounding box size and other parameters of the model. The specific method of obtaining the model information of the target mesh model can also be determined according to actual needs and is not limited here.

[0039] Step S204: determining average normals of multiple vertices and surface normals of multiple surfaces on the target mesh model based on the model information.

[0040] The above-mentioned average normal may refer to the average normal of a vertex, that is, the average value of the normal vectors of each face around a vertex. For example, for a vertex, each face connected to the vertex has a normal vector, and these normal vectors may have different directions. The average value of these normal vectors can be calculated as the normal of the vertex.

[0041] In an optional embodiment, the average normals of multiple vertices and the surface normals of multiple faces can be determined based on the model information of the target mesh model to extract the surface normal information of the model. Specifically, the vertex normals can be calculated to determine the vertices in the target mesh model whose average normals need to be determined, which can be individual vertices in the target mesh model or multiple pre-selected vertices. For the determined vertices, their adjacent faces can be found. For each face, the surface normal can be calculated. The right-hand rule can be used to determine the direction of the normal, and then the normals of all adjacent faces can be averaged to obtain the average normal of the vertex. The vertex normals can also be normalized. Calculating the surface normals can determine the face in the target mesh model whose surface normal needs to be determined. For the face, its three vertices can be found. The normal vector of the face can be calculated based on the coordinates of the three vertices. For multiple faces sharing the same vertex, their normal vectors are averaged to obtain the surface normal of the vertex. Through the above steps, the average normals of multiple vertices and the surface normals of multiple faces on the model can be obtained, which is convenient for subsequent processing of the target mesh model to generate a stroking effect for the target mesh model.

[0042] Step S206, determining control parameters of the plurality of vertices based on average normals of the plurality of vertices and surface normals of the plurality of surfaces.

[0043] The above-mentioned control parameters may refer to parameters for controlling the stroke thickness in the stroke effect of the target mesh model. The expression form of the control parameters may be determined according to actual needs and is not limited here.

[0044] In an optional embodiment, the appearance of the mesh model can be determined by calculating the normal during processing of the target mesh model. The normal direction of each vertex can be determined using an average normal based on multiple vertices and surface normals of multiple faces, and control parameters of the multiple vertices can be further determined. The control parameters can be parameters for controlling the stroke thickness in the stroke effect of the target mesh model. Control parameters can be defined, such as the stroke thickness parameter, which can be expressed as a scalar. For each vertex, the degree of influence of the vertex in the stroke effect can be determined based on the average normal of each vertex and the surface normal. Through the above steps, the control parameters of multiple vertices can be determined based on the average normal of multiple vertices and the surface normal of multiple faces, thereby controlling the stroke effect of the target mesh model. This can help to more flexibly control its appearance when processing the mesh model and achieve more refined graphics processing.

[0045] Step S208, generating a stroke effect of the target mesh model based on the control parameters of the multiple vertices and the average normals of the multiple vertices; wherein the width of the stroke effect is determined based on the control parameters of the multiple vertices.

[0046] The above-mentioned stroke effect may include at least the stroke thickness of the target mesh model, and may also include the stroke color, material, texture and other effects of the target mesh model. The stroke effect may be determined according to actual needs and is not limited here.

[0047] In an optional embodiment, the stroke width can be determined according to control parameters, and the control parameters can be calculated according to specific properties of the model. For each vertex, a new vertex is generated along the direction of the average normal of each vertex. The distance between the vertex and the original vertex can be the width of the stroke, and adjacent new vertices can be connected to form stroked line segments. The generated stroked line segments can be connected into closed surfaces to form a final stroke effect. Through the above steps, the stroke effect of the target mesh model can be generated based on the control parameters of multiple vertices and the average normals of multiple vertices. The stroke width can be determined according to the control parameters, making the stroke effect more flexible and controllable.

[0048] In at least some embodiments of the present disclosure, model information of a target mesh model is obtained; based on the model information, average normals of multiple vertices and surface normals of multiple faces on the target mesh model are determined; based on the average normals of multiple vertices and surface normals of multiple faces, control parameters of multiple vertices are determined; based on the control parameters of multiple vertices and the average normals of multiple vertices, a stroke effect of the target mesh model is generated, wherein the width of the stroke effect is determined based on the control parameters of multiple vertices. It is easy to notice that by obtaining the model information of the target mesh model and calculating the average normals of multiple vertices and surface normals of multiple faces, the structure and characteristics of the target mesh model can be accurately understood, the surface geometric features of the target mesh model can be accurately described, and the control parameters of multiple vertices can be determined based on the average normals of multiple vertices and surface normals, so that the details and shapes of the stroke effect can be effectively controlled, the accuracy and adjustability of the stroke effect can be improved, and the width and shape of the stroke can be adjusted according to the control parameters, so as to achieve a more refined and natural stroke effect, thereby solving the technical problems of poor effect and low efficiency of generating the stroke effect of the network model in the related art.

[0049] According to the above-mentioned embodiments of the present disclosure, the model information includes: vertex information of multiple vertices, and the corresponding relationship between multiple faces and multiple vertices; based on the model information, the average normals of the multiple vertices and the face normals of the multiple faces are determined, including: based on the vertex information of the multiple vertices, the vectors of the multiple edges connected to any vertex are determined; based on the vectors of the multiple edges, the face normal of at least one face adjacent to any vertex is determined; based on the vectors of the multiple edges and the corresponding relationship, the weight value of at least one face is determined; based on the weight value of at least one face, the face normal of at least one face is weighted to obtain the average normal of any vertex.

[0050] In an optional embodiment, when the model information includes vertex information of multiple vertices and the correspondence between multiple faces and multiple vertices, the following steps can be performed: based on the vertex information of multiple vertices, the vectors of multiple edges connected to any vertex can be determined, multiple vertices can be traversed to find all edges connected to the vertex, and for multiple edges, their vectors are calculated, which can be the end point coordinate minus the start point coordinate. Based on the vectors of multiple edges, the face normal of at least one face adjacent to any vertex can be determined, and for multiple faces, their normal vectors are calculated, multiple vertices can be traversed to find all faces adjacent to the vertex, and for these adjacent faces, the normal vectors of these adjacent faces are taken. Based on the vectors and correspondence of multiple edges, the weight value of at least one face can be determined, and for multiple faces, the weight value can be calculated, which can be calculated based on indicators such as area or angle, and the faces corresponding to multiple vertices can be determined based on the correspondence between vertices and faces, and weight values ​​can be taken for these faces. Based on the weight value of at least one face, the face normal of at least one face can be weighted to obtain the average normal of any vertex. For multiple vertices, the normals of these faces are weighted summed according to the weight values ​​of their corresponding faces. Finally, the summation result is normalized to obtain the average normal of the vertex. Through the above steps, the vertices in the mesh model can be normalized to achieve a more realistic stroking effect. By performing fine weighted processing on the average normal of the vertex and the face normal of the face, the geometric features and curvature changes of the model surface can be more accurately reflected when generating the stroking effect, thereby improving the realism and realism of the stroking effect.

[0051] According to the above-mentioned embodiments of the present disclosure, based on the vertex information of multiple vertices, the vectors of multiple edges connected to any vertex are determined, including: based on the vertex information of multiple vertices, multiple target vertices adjacent to any vertex are determined; based on the vertex information of any vertex and the vertex information of any target vertex, the vector of the edge connected between any vertex and any target vertex is determined.

[0052] In an optional embodiment, multiple target vertices adjacent to any vertex can be determined, which can be achieved by traversing the adjacent faces of the vertex. For a given vertex, other vertices adjacent to the vertex can be obtained by finding the face to which the vertex belongs, and then all vertices of these adjacent faces are traversed, and all vertices of these adjacent faces are added to a target vertex list. In the process of determining the vector of the edge connected between any vertex and any target vertex, it can be achieved by calculating the vector between two vertices. First, according to the coordinate information of a given vertex and a target vertex, the vector between them can be calculated. This vector can be obtained by subtracting the coordinates of the given vertex from the coordinates of the target vertex to represent the direction of the edge connected between the given vertex and the target vertex. Through the above steps, it is possible to determine multiple target vertices adjacent to any vertex based on the vertex information of multiple vertices, and determine the vector of the edge connected between any vertex and any target vertex based on the vertex information of any vertex and the vertex information of any target vertex, which can effectively help determine and describe the relationship and connection between vertices. By determining multiple target vertices adjacent to any vertex, a complete vertex connection network can be established, and then the vector of the edge can be determined by the connection relationship between vertices. At the same time, by comparing the vertex information of any vertex with the vertex information of the adjacent target vertex, the vector of the edge connecting the two vertices can be calculated, thereby obtaining a more accurate stroking effect, which can accurately analyze and calculate the connection relationship between multiple vertices, thereby determining the vector of the edge between the vertices, thereby achieving a more precise and accurate stroking effect generation.

[0053] According to the above-mentioned embodiment of the present disclosure, based on the vectors and corresponding relationships of multiple edges, the face normal of at least one face adjacent to any vertex is determined, including: in response to the number of multiple edges being less than or equal to a preset number, performing cross product processing on the vectors of the multiple edges to obtain the face normal of the face composed of the multiple edges; in response to the number of multiple edges being greater than a preset number, performing cross product processing on the vectors of two adjacent edges among the multiple edges to obtain the face normal of the face composed of the two adjacent edges.

[0054] The above-mentioned preset number can be a predetermined value, which can be 2 or other values. The preset number can be determined according to actual needs and is not limited here.

[0055] In an optional embodiment, different methods may be adopted for calculating the normal of a face according to different situations. In response to the situation where the number of multiple edges is less than or equal to a preset number, the vectors of the multiple edges may be cross-producted to obtain the face normal of the face composed of the multiple edges. Specifically, the vectors of every two adjacent edges may be calculated based on the given multiple edges. Assuming there are n edges, there are n adjacent edge vectors that need to be calculated. For the vectors of every two adjacent edges, a cross product operation is performed to obtain the normal vector of the face they constitute. The normal vectors of all faces may be averaged or weighted summed to obtain the final face normal. In response to the situation where the number of multiple edges is greater than a preset number, the following method can be used to calculate the normal of the surface. Specifically, based on the given multiple edges, a preset number of adjacent two edges can be selected. These adjacent two edges can be selected according to a certain rule, such as selecting the two adjacent edges with the smallest angle with the normal vector. For the selected two adjacent edges, a cross multiplication operation can be performed to obtain the normal vector of the surface formed by the two adjacent edges. The above steps can be repeated until the normal vectors of all surfaces are calculated. Through the above method, the normal vectors of each surface can be effectively calculated in the stroking process of the mesh model, thereby achieving a more realistic and accurate rendering effect. The normal calculation of the surface can be adopted according to different situations. Different methods, when the number of multiple edges is less than or equal to the preset number, the face normals of the faces formed by these edges can be obtained by cross-producting the vectors of these edges, which can effectively calculate the normal directions of the faces around the vertices, providing an accurate reference for the subsequent generation of stroke effects; when the number of multiple edges is greater than the preset number, the vectors of two adjacent edges among these edges are cross-producted to obtain the face normals of the faces formed by these two adjacent edges, which can avoid excessive face normal calculations, improve calculation efficiency, and ensure the accuracy of the stroke effect. Through the above steps, the face normals of at least one face adjacent to any vertex can be effectively determined, thereby realizing the generation of stroke effects for the mesh model.

[0056] According to the above-mentioned embodiment of the present disclosure, the weight value of at least one face is determined based on the vectors and corresponding relationships of multiple edges, including: based on the corresponding relationship, determining two target edges belonging to any one face; performing dot multiplication processing on the vectors of the two target edges to obtain the angle between the two target edges; based on the angle between the two target edges, determining the weight value of any one face.

[0057] In an optional embodiment, the determination of the boundary line and the calculation of the weight value can be achieved through the following steps: the correspondence between the faces to which each vertex belongs can be determined based on the information of the vertices, edges and faces in the mesh model, so that the two target edges belonging to any face can be determined based on the relationship between the vertices and the faces; for the two target edges on each face, the vector representation of the two target edges on each face can be calculated, and the angle between the two target edges can be obtained by calculating the dot product of the two vectors. The size of the dot product result is proportional to the cosine of the angle, which can be used to determine whether the two edges are continuous or form a broken line. Finally, based on the angle between the two target edges, the weight value of any face can be determined. For example, two edges with a smaller angle may be considered to be closer to a straight line, and therefore can be considered to be closer to a straight line. A higher weight value is assigned, while two edges with a larger angle may form an acute angle, and a lower weight value can be assigned. In this way, the fineness and smoothness of the boundary line can be adjusted according to the size of the angle, thereby obtaining a more practical stroking effect. By calculating the vectors of multiple edges and the angle between them, the weight value of each face is determined, thereby achieving a more accurate and natural stroking effect. Specifically, the weight value of the face can be determined according to the size of the angle. The smaller the angle, the closer the two edges are to parallel, which may be a smooth boundary. At this time, the weight value of the face may be higher; a larger angle may indicate a large change in the boundary, and the weight value of the face may be lower. Through the above steps, the weight value of each face can be determined according to the geometric characteristics of the edge, thereby achieving a more accurate and natural stroking effect.

[0058] According to the above-mentioned embodiment of the present disclosure, based on the weight value of at least one face, the face normal of at least one face is weightedly processed to obtain the average normal of any vertex, including: obtaining the sum of the weight values ​​of at least one face to obtain the total weight sum; obtaining the ratio of the weight value of any one face to the total weight sum to obtain the normalized weight of any one face; based on the normalized weight of at least one face, the face normal of at least one face is weightedly processed to obtain the average normal of any one vertex.

[0059] In an optional embodiment, the sum of the weight values ​​of at least one face can be obtained to obtain the total weight sum, the weight value of each face can be calculated, and indicators such as the area of ​​the face or the normal length can be used as the weight value, and then the weight values ​​of all faces are added to obtain the total weight sum. The ratio of the weight value of any face to the total weight sum can be obtained to obtain the normalized weight of any face: for each face, its weight value is divided by the total weight sum to obtain the normalized weight of the face, so that the sum of the weight values ​​of all faces can be guaranteed to be 1. Finally, based on the normalized weight of at least one face, the face normal of at least one face can be weighted to obtain the average normal of any vertex. For each vertex, the normalized weights of its adjacent faces can be multiplied by the normal vectors of their respective faces, and then all weighted normal vectors are added and normalized to obtain the average normal of the vertex. The normal of the vertex can be calculated according to the weights of the adjacent faces to achieve a smooth edge effect. Through the above steps, the mesh model can be stroked so that the model can present a more realistic and smooth appearance when rendered. By weighting the face normals, the average normal of each vertex can be calculated more accurately, thereby presenting a more realistic surface effect during the rendering process, which helps to improve the visual effect of the graphics. By calculating the average normal of each vertex, a smoother surface effect can be achieved while maintaining the surface features of the model, making the model visually more natural and smooth.

[0060] According to the above-mentioned embodiment of the present disclosure, control parameters of multiple vertices are determined based on average normals of multiple vertices and surface normals of multiple surfaces, including: based on the average normal of any vertex and the surface normal of at least one target surface adjacent to any vertex, determining the angle between the average normal of any vertex and the surface normal of at least one target surface to obtain at least one angle; obtaining the average value of at least one angle to obtain an average angle; and smoothly interpolating the average angle to obtain the control parameter of any vertex.

[0061] In an optional embodiment, the following steps can be used to determine the control parameters of any vertex based on the average normal of any vertex and the face normal of at least one adjacent face. Specifically, for each vertex in the mesh model, the face normal of the adjacent face of the vertex can be calculated first. This can be done by calculating the vertex position of the adjacent face of the vertex to determine the normal of the adjacent face, and then performing normalization to obtain the face normal. For any vertex, the angle between the face normal of its adjacent face and the average normal of the vertex can be calculated. The angle can be obtained by calculating the dot product of two vectors, and then the angle value is calculated using the inverse cosine function. Then, the average value of at least one angle can be obtained, that is, all the calculated angles are added together and divided by the number of angles to obtain the average angle. Finally, the average angle is smoothly interpolated to obtain the control parameter of any vertex. The smooth interpolation can use the weighted average method, that is, the angle of each vertex is multiplied by a weight coefficient and then added, and then divided by the sum of all weight coefficients to obtain the control parameter. Through the above steps, the control parameter of the vertex can be determined based on the average normal of the vertex and the surface normal of the adjacent surface, thereby realizing the stroke processing of the mesh model. The control parameter of the vertex is determined by using the average normal of multiple vertices and the surface normal of multiple surfaces, so as to achieve a more accurate and smooth stroke effect generation. Specifically, by calculating the angle between the average normal of any vertex and the surface normal of the target surface adjacent to the vertex, at least one angle is obtained, and then the average value of these angles is obtained to obtain the average angle. Then, the average angle is smoothly interpolated to obtain the control parameter of the vertex, which can ensure that the stroke effect is more natural and coherent. Through the above method, the normal changes between vertices can be effectively processed to avoid the breakage or discontinuity in the stroke effect. By smoothly interpolating the average angle, the stroke effect can be made smoother and more delicate, thereby improving the overall visual quality.

[0062] According to the above-mentioned embodiment of the present disclosure, a stroke effect of a target mesh model is generated based on control parameters of multiple vertices and average normals of multiple vertices, including: converting the average normals of multiple vertices according to a preset numerical range to obtain first normals of multiple vertices; adjusting the axial directions of the first normals of multiple vertices based on the skinning requirements of the target mesh model to obtain second normals of multiple vertices; storing the second normal of any vertex and the control parameters of any vertex into a target color set of any vertex; and generating a stroke effect based on the color set of multiple vertices.

[0063] In an optional embodiment, for a target mesh model, the normals of the vertices of the target mesh model may be processed to generate a stroke effect. First, the normals of multiple vertices may be averaged within a preset numerical range to obtain first normals of multiple vertices, which may improve the accuracy and smoothness of the stroke effect. Next, based on the skinning requirements of the target mesh model, the axial directions of the first normals of multiple vertices may be adjusted to obtain second normals of multiple vertices, which may make the stroke effect more consistent with the geometric features of the model surface and improve the realism of the stroke effect. Subsequently, the second normal of any vertex and the control parameters of any vertex may be stored in the target color set of any vertex, so that when generating a stroke effect, the color and intensity of the stroke may be determined according to the normals and control parameters of the vertex, thereby making the stroke effect richer and more diverse. Finally, a stroke effect may be generated based on the color sets of multiple vertices. By fusing and interpolating the color sets of different vertices, a stroke effect can be generated for the entire model surface, making it look more three-dimensional and vivid. Through the processing of the above steps, the generation and optimization of the stroke effect of the mesh model can be achieved, making it more in line with the needs and performance of the actual scene. By converting the normal, the stroke effect can be made more in line with the preset needs, making the stroke smoother and more natural. By adjusting the normal according to the skinning requirements, the continuity and consistency of the stroke effect in different parts can be ensured, making the stroke effect more accurate and realistic. By combining the normal and the control parameters and storing them in the color set, the color and transparency of the stroke effect can be better controlled, and a more personalized and diversified stroke effect can be achieved. By generating the stroke effect through the vertex color set, different styles of stroke effects can be generated according to the attributes and needs of different vertices, making the stroke effect more flexible and diversified. Therefore, when generating the stroke effect, the normal information and control parameters of multiple vertices are combined. Through fine conversion and adjustment, a more accurate, natural and diversified stroke effect is achieved, and the visual performance of the target mesh model is improved.

[0064] According to the above embodiment of the present disclosure, after acquiring the model information of the target mesh model, the method further includes: clearing the original color sets of the plurality of vertices and adding the target color set.

[0065] The aforementioned original color set may refer to the colors originally possessed by multiple vertices in the target mesh model.

[0066] The above-mentioned target color set may refer to a preset default setting color. The colors in the target color set may be determined according to actual needs of the user and are not limited here.

[0067] In an optional embodiment, the model information of the target mesh model can be obtained, the original color sets of multiple vertices can be cleared, and the target color set can be added. Specifically, the vertex information of the target mesh model can be obtained first, which can include vertex coordinates and vertex color information, which can be obtained by reading a model file or by calculation. Next, for each vertex, the original color set can be cleared, which can be achieved by setting the original color value to a transparent color or a specific color value. Then, the target color set can be added as needed, which can be a set of predefined color values ​​or a color value generated according to a certain algorithm. Finally, the updated vertex information can be applied to the mesh model to achieve the effect of clearing the original color sets of multiple vertices and adding the target color set. Clearing the original color set of the vertices of the target mesh model can eliminate the interference of the original color on the stroke effect and ensure that the stroke color can be accurately covered on the model surface. Then, the target color set is added, and the color and style of the stroke can be customized as needed to make the stroke effect more personalized and visually attractive.

[0068] According to the above embodiment of the present disclosure, the method further includes: traversing all virtual models in the preset scene to determine multiple geometric models in the preset scene; screening out mesh-type geometric models from the multiple geometric models to obtain a target mesh model.

[0069] In an optional embodiment, all virtual models in a preset scene can be traversed and multiple geometric models can be determined. Specifically, first, the virtual models in the preset scene can be traversed by a program, which can be achieved by setting a loop in the program. The program can check each virtual model one by one to determine its type and attributes; then, mesh-type geometric models can be screened out based on the multiple geometric models in the preset scene, which can be achieved by checking the attributes of each geometric model. The mesh-type geometric models can contain information about their mesh structure and topological relationships, such as the relationship between vertices, edges and faces. This information can be checked to determine which geometric models are of mesh type. Finally, the target mesh model can be obtained, that is, the screened The target mesh model is a geometric model of a mesh type that meets the conditions and can be further used for stroking or other graphics processing operations. By traversing the virtual models in the preset scene, determining and screening out the geometric models of the mesh type, the target mesh model can be obtained, which provides a basis for subsequent graphics processing operations. Screening out the geometric models of the mesh type from multiple geometric models can effectively filter out the models that do not need to generate the stroking effect, reducing the workload and time of subsequent processing and improving the processing efficiency. After determining the multiple geometric models in the preset scene, the target mesh model that needs to generate the stroking effect can be accurately located and identified, ensuring that subsequent operations are performed only on the models that need to be processed, reducing the possibility of misoperation.

[0070] According to the above embodiment of the present disclosure, the method further includes: acquiring target material information corresponding to the target mesh model; and rendering the target mesh model based on the target material information.

[0071] In an optional embodiment, target material information corresponding to the target mesh model can be obtained and the target mesh model can be rendered based on the information. Specifically, first, the file data of the target mesh model can be loaded, which can include vertex information, normal information, texture coordinates, etc., and the material information corresponding to each vertex can be obtained; the color or texture map of each vertex can be determined based on the obtained material information, and the lighting properties of the material, such as diffuse reflection, specular reflection, etc., can be determined; for each face, such as a triangle or a quadrilateral, the color or texture coordinates of the face can be calculated based on the material information of its vertices. Then, the surface can be rendered on the screen using a rasterization algorithm according to the color or texture coordinates of the surface, and the final color of the surface can be calculated according to the lighting properties. For the boundary between adjacent surfaces, the color or texture coordinates of the boundary can be determined according to the stroke processing algorithm, and the boundary can be stroked and rendered. Finally, all the surface and stroke rendering results can be synthesized into a final image to show the rendering effect of the target mesh model. Through the above steps, the target mesh model can be rendered according to its material information, and stroke processing can be performed during the rendering process, so that the target mesh model presents a more realistic and three-dimensional effect in graphics. By obtaining the target material information corresponding to the target mesh model, the surface material characteristics of the mesh model, such as color, reflectivity and other information, can be understood. Based on these target material information, the target mesh model can be rendered so that it can accurately show the characteristics of the material during the rendering process, thereby presenting a more realistic appearance in the final rendering result.

[0072] The technical solution proposed in the present application is described below in combination with an optional embodiment. First, some nouns or terms that appear in the process of describing the embodiment of the present application are applicable to the following explanations:

[0073] 3D Animation and Modeling Software File (MAYA), usually with the extension (.exe), can be a file containing program code that can be directly executed by a computer system. In an operating system (Windows), an executable file is usually a binary file generated by an editor that compiles source code into machine code. It contains instructions that can be directly executed by a computer.

[0074] Normal expansion can be a technique in computer graphics and 3D modeling, which is used to move vertices along the surface normal direction. This operation can be used to generate two-dimensional strokes, etc.

[0075] Modeling software (Digital Content Creation software, DCC) can be a kind of professional tools for creating digital content. They are widely used in film, animation, game development, architectural design, industrial design and other fields. These software provide rich functions and tools for creating and editing 3D models, animation, special effects, rendering, synthesis and other digital content.

[0076] Averaging normals is a common operation in 3D computer graphics and modeling to generate smoother visual effects. Specifically, averaging normals is to obtain a smoother normal by weighted averaging the normals of vertices. This is important in model display and lighting calculations because it can produce a smoother and more natural surface.

[0077] Edge detection can be a basic technique in image processing and computer vision, which is used to identify edges or contours in images. Edges are usually areas in an image where pixel intensity changes significantly, representing the boundaries of objects, texture changes, or other significant features.

[0078] Programming language (MAYA Python) can refer to a method of using a programming language (Python) for scripting and automation tasks in software (Autodesk Maya).

[0079] The programming interface (Open Maya API) can be a programming interface (API) of the software (Autodesk Maya), which provides deep access to the internal data structure and functions of the file (MAYA). It allows developers to extend and customize the functions of the file (MAYA) with programming languages ​​(Python or C++). The programming interface (Open Maya API) is a lower-level programming interface (API). Compared with the process-oriented programming language (`maya.cmds` API), it provides higher performance and more fine-grained control.

[0080] An Application Programming Interface (API) is a set of definitions and protocols used to build and integrate software applications. It defines how different software components communicate and interact with each other, and provides a standard method that makes it easier for software developers to use external or internal services and functions.

[0081] Directed Acyclic Graph Path (DagPath) is a term in computer graphics and 3D modeling, usually used to describe the path of a node in a scene graph. A scene graph is a hierarchical structure in which each node represents an object or transformation, and the connections between nodes represent parent-child relationships. A directed acyclic graph path is a path from the root node to a specific node in this hierarchical structure.

[0082] Normalization is a concept widely used in mathematics, computer graphics, machine learning, and data processing. The main purpose of normalization is to convert data into a standard range, making the data easier to process and compare.

[0083] A face normal is a vector perpendicular to a polygonal face, usually a triangle or quadrilateral, and is used to indicate the direction of the face in three-dimensional space.

[0084] A vertex normal can be a vector associated with a polygon vertex, indicating the direction of the vertex in three-dimensional space. The vertex normal is usually a weighted average of multiple face normals and is used to smooth lighting effects.

[0085] A shader is a program used to control how graphics hardware draws images. Shaders play a key role in the graphics rendering process. By defining the properties and behaviors of vertices, pixels, and other graphic elements, they make three-dimensional models and effects vivid and realistic.

[0086] Specifically, the implementation steps can be as follows: install the open source library (numpy), obtain the corresponding version of the open source library (numpy) according to the programming language (python) version of the current file (MAYA) version, place it in the corresponding path of the file (MAY A) installation address, and configure the plug-in running environment, wherein the open source library (numpy) can be an open source library for scientific computing, mainly used to process multidimensional array and matrix calculations, and it provides rich mathematical functions and tools.

[0087] Then you can write a user (UI) interface. Specifically, you can define a function (BuidUI) to draw a user panel. The main module you can use is the module (`maya.cmds` in mayaAPI), which is the main module for creating and operating files (MAYA) user interfaces. This module provides many commands to create interface elements, such as text and buttons. For example, cmds.button(l = 'Select all Mesh', ann = 'Select all Mesh in the scene'.align = 'center'.h = 40.w = 2.command = sel f.SelectAllMesh), "1" represents the label, which is used to set the text displayed on the button; "ann" represents "annotation", which is the prompt information displayed when the user hovers the mouse on the interface; "align" represents the alignment format of the text displayed on the button, "center" means centering, "h" and "w" represent the length and width of the drawn button respectively; "common" is used to associate which parameter will be called back when the button is clicked. Taking this button as an example, it is the function (SelectAllMesh).

[0088] Next, you can write a program to automatically select all Mesh meshes in the scene of the file (MAYA). Clicking it will traverse all objects in the scene. When you encounter a Mesh type, select it. This is the function of this button. The corresponding function called is the function (SelectAllMesh). Mesh can be a function of the developed function. Think of it as clicking the button to select all meshes. The algorithm function of Mesh will be executed. In order to traverse all the geometric bodies in the scene that meet the conditions for the next calculation, Mesh is an algorithm for generating 3D model meshes, which can be used in computer graphics and computational fluid dynamics. In the fields of science and technology, it is used to decompose a 3D object into multiple small triangular or quadrilateral meshes for subsequent analysis and simulation. Meshes can generate meshes of different densities and precisions according to different requirements. The function (SelectAllMesh) can be a function used to select all meshes. In 3D graphics software, a mesh is composed of many vertices and edges connecting these vertices, which are used to build the basic structure of an object. By calling the function (SelectAllMesh), users can select all mesh objects in the scene for easy editing, moving or deleting. "cmd.select(clear=True)" e)" means clearing all selections in the file (MAYA) to prevent selecting components that are not meshes (Mesh). "geometry = cmds.ls (geometry = True)" can then be used to obtain all geometries in the scene by setting the flag (geometry) to (True), that is, the file (Maya) will set the flag (Flag) to "geometry" for the created geometric object. By reading the flag (Flag), it is "geometry" to "true", indicating that the current object is a geometry and is added to the list (geometry). Finally, the geometry in the list (geometry) can be traversed to find the geometry when the type is "mesh" (to prevent selecting geometries such as curves that are not "mesh"). What is selected here is the object level, which can be understood as the entire model object, because most character models are not a whole, and may be divided into multiple parts such as head, hair, and clothing. This algorithm can select all the parts of the character model that need to be calculated to obtain their paths and add them to the selection, that is, add selection, that is, keep the previously selected objects and add new selected objects.

[0089] Next, you can initialize the vertex colors of all selected meshes. Clear the original color setting (ColorSet) on the mesh (Mesh), create and name a new one, and the creation of a button can correspond to the called function (CreateColorSet). Specifically, first of all, this operation must be performed on all selected meshes (Mesh) in sequence, so traverse each mesh (Mesh) and perform the following operations: "colorsetList = cmds.polyColorSet(model,query = True,allColorSets = True), that is, by setting the flags (query and allColorSets) to "True", it means to query all color sets on the current mesh (Mesh) and record them in the list (colorsetList). If the list (col orsetList) is not "None", it means that a color set exists on the mesh itself, so traverse the list (colorsetList). In the setList list, use "cmds.polyColorSet(model,delete=True,colorSet=colorset0)" to delete each color set. After clearing it, add a color set named (ColorSet) with the type (RGBA type) and set the A channel to 1 to be visible. This traverses the initialization of all Mesh color sets and deletes the initial colors of each vertex traversed to prevent the model itself from having some strange initial color values.

[0090] Next, you can write a recalculated face normal algorithm. The average normal algorithm (SaveNtVC) is called through this button. The class (radioButtonGrp) is created to select whether the mesh is skinned, which affects the subsequent average normal calculation and writing the color set result. The adjacent points are queried based on the spatial position of the vertex, that is, the adjacent vertices, and the edges are constructed through the adjacent points. The face normal perpendicular to the face is calculated based on the cross product of the adjacent edge vectors. Among them, based on the current vertex a, the adjacent vertices x1.....xn are queried, and the adjacent edges are a-x1, a-x2.....a-xn; the list (SelectModel) records all meshes (Mesh), and the list (SelectModel) can be A function provided by the programming interface (OpenMayaAPI) is used to obtain the value (DagPath) of the current mesh (Mesh), which is used to obtain the object path and more detailed information. The array (VertNColors) is also a class in the programming interface (OpenMayaAPI) used to create and operate color arrays, which can be used to store values ​​in color sets. You can use "itVerts = newom.MItMeshVertex (dagPath) and itFaceVerts = newom.MItMeshFaceVertex (dagPath)" to obtain the information of each vertex and the detailed information of each vertex on each face; you can use "VertNColors.setLength(fnMesh.numFaceVertices)" to obtain the total number of each vertex on each face, which is used to create a color array. The number of color digits required to record the number of vertices is as many as possible. The internal content can be cleared before each creation to prevent contamination in the loop). The algorithm mainly used to record the average normal can be implemented using the function (CalculateANor mal).

[0091] Next, you can write a function (CornerAverageNormal) to calculate and get the average normal of each vertex. The normal refers to a vector perpendicular to the surface. For the vertex normal, it represents the direction of the surface around the vertex. The average normal is because a vertex is often shared by multiple faces. Different faces have different face normals. It is necessary to calculate the contribution weights of different faces to the vertex to average the final vertex normal result. In this way, when calculating the stroke effect such as normal expansion, the stroke will not be broken, and the effect will be smoother. And the face normal of each face after normalization, that is, the modulus length of the normal vector is normalized to 1, so that subsequent calculations will not be affected by the inconsistent modulus length.

[0092] Next, the color value (Alpha) of each vertex color can be calculated through the function (ComputeAlpha) to control the thickness of the stroke. The smaller the color value (Alpha) is, the thinner the stroke is; since the calculated normal value range is in [-1, 1], the value can be converted to the range of [0, 1] through "0.5*(vtNormal+1)", and depending on whether it is skinned or not, there will be differences in the axis direction. The corresponding value is written into the vector class (MVector) and passed to the class (MColor) In the color (averageColor), "i" is the serial number of each vertex, and the corresponding "i" and vertex color value (averageColor) are written into the vertex color list (VertNColors) in sequence, and the vertex color corresponding to each vertex is set through "fnMesh.setColors(VertNColors, rep=4)". The list (VertNColors) is a list that records colors. The color refers to the final value obtained by subsequent calculation, which is equivalent to the serial number and color of the corresponding vertex. "rep=4" is equivalent to setting the four channels of RGBA.

[0093] Next, we can calculate the accurate face normal weights and re-average the vertex normal calculation function. The overall definition is as follows. This function operates on the basis of traversing vertices. First, the first part is to obtain the vectors of all edges diverging from this vertex. All vertices adjacent to this vertex are obtained in the list (connectVerte xPos), and then the vector is calculated by the difference between the vertices and recorded in the list (connectEdge), where the coordinates of each vertex can be a three-dimensional value of "xyz".

[0094] Next, all the face normals of the adjacent faces of the current vertex can be calculated. When there are only two adjacent edges, it means that only one of the adjacent faces of this vertex is located on the edge of the model. If there are more than two, traverse each edge and obtain the next edge through the edge serial number "+1" to obtain the face normal perpendicular to the two edges through the cross multiplication function provided by the function (numpy), and normalize the face normal through the function (unit_vector); input the two edge vectors through the inner point multiplication function (comput_weight), that is, the modulus of the two vectors multiplied by the cosine of the angle between the two vectors, and reversely obtain the angle between the two vectors to calculate the weight value of the face normal contribution to the vertex normal. If the angle between the adjacent edges is large, the composed face is larger, and the weight contributed to the intersection vertex normal is greater.

[0095] Next, you can get the sum of the weights (weight_sum) calculated for the adjacent faces of the vertex. The weight of each face is divided by the total weight sum (weight_sum) to normalize and get a percentage weight. If this vertex has only one connected face, the vertex normal is 100% equal to the face normal of this face. If this vertex has more than two adjacent faces, then multiply the normalized normal of each face by the weight, and then add them up in sequence to get the final accurate averaged vertex normal.

[0096] Next, we can use the stroke thickness algorithm. The main calculation is defined in the function (ComputeAlpha). The average angle between the surface normals of adjacent faces and the average normal of the vertex is calculated. The larger the angle, the more prominent or concave the vertex is. If the average angle approaches 0, it is equivalent to the surface normals of adjacent faces being parallel to the average normal of the vertex, which means it is located on a smooth plane. Next, the calculated result is smoothed by smooth interpolation (smoothstep), and the value that controls the stroke thickness is recorded in the color value (Alpha) of the vertex color. The larger the value, the thicker the stroke, and the smaller the value, the smaller the stroke.

[0097] Next, the average angle between the face normals adjacent to each vertex and the average normal of the vertex can be calculated. If the average angle is larger, it means that the vertex is in a sharper position, and a smaller value is obtained through smooth interpolation calculation. The larger the angle, the smaller the cosine value obtained by the dot product of the two edge vectors, which is written into the color value (Alpha) of the vertex color to control the stroke width to be smaller in the sharp parts of the model.

[0098] Next, in order to better preview the stroke results and make corresponding adjustments in the software (dcc), we will analyze the function of batch adding materials to the model. The added material (shader), that is, the plug-in (dx11shader), can be used to preview the stroke effect and the result of controlling the stroke thickness calculated by the color value (Alpha) channel, so as to achieve better results through manual subsequent fine-tuning.

[0099] You can open the plug-in (dx11shader) in the plug-in manager to batch apply materials to the model later, and to observe and modify the vertex color value (Alpha); create a text box to enter the specific address of the shader. Click the button to call the function (AddDX11Shader) to add materials to all selected objects; the format can be normalized into a format that can be read by the programming language (python) according to the input address, through "cmds.shadingNode('dx11Shader',asShader=True)"; create a material node and rename it, create a node (shadingEngine) for each model through "shading_engine=cmds.sets(renderabl e=True,noSurfaceShader=True,empty=True)", connect the plug-in (dx11shader) node to the node through "cmds.connectAttr(dx11shader+'.outColor',shading_engine+'.surfaceShader')", determine the final presentation effect through the material (shader) in the plug-in (dx11shader) format, and get a complete plug-in (dx11shader).

[0100] Finally, you can traverse each model and assign the shader plug-in (dx11shader) to the current model through the function (hyperShade). The shader is the material added to the model. The main effect here is color. In order to visualize the smooth normals and thick areas, the shader is a specific program used to generate images in computer graphics. They run on the graphics processing unit (GPU) and are responsible for processing vertices, pixels, and other graphics data to generate the final rendered image. The color channel (RGB) in the rendering is used to store the average normal vector value of each vertex; then write a program (MAYA) plug-in based on the application program interface (MAYAPython, OpenMaya), etc., to achieve the effect of fast batch calculation of smooth normals to obtain correct smooth strokes. The approximate changes in stroke thickness can be quickly calculated to reduce manual repetitive work.

[0101] Figure 3 is a schematic diagram of a user interface (UI) according to one embodiment of the present disclosure, such as Figure 3As shown, an optional vertex color tool (VertexColor Tool) interface in the present application is shown, which may include a clickable "Select all meshes (Mesh)" control, a background prompt "Step 1 Initialize color set <Support multiple selections>", a clickable "Initialize" control, a background prompt "Step 2 Store normals into vertex colors (RGB values) <Support multiple selections>", an optional "Is the model skinned:" control, which can select "Skinned" or "Non-skinned", a clickable "Store Normal IN Vertex Colors (Store Normal IN VC)" control, background prompt "The third step is to modify the transparency value (Alpha) of the vertex color", the "Input (.fx) material file address:" control for input content, the clickable "Batch apply materials to all objects" control, the control for dragging blocks to adjust the "Transparency value:", the example in the figure is "Transparency value: 1.00", the control for dragging blocks to adjust the "Brush size:", the example in the figure is "Brush size: 0.5", the control for dragging blocks to adjust the "Brush strength:", the example in the figure is "Brush strength: 1.00", the selectable "Brush:" control, you can choose "Gaussian blur effect" or "Pure color effect", the clickable "Fill the entire area, tile color (Flood)" control, the clickable "Painting (Pa int)" control, clickable "Reset" control, clickable "Smooth Vertex Color" control, selectable "Smooth Vertex Color:" control, you can choose "Red, Green and Blue Channels (RGB)" or "Color Four Channel Information (RGBA)" or "Color Transparency Channel (A)", clickable "Smooth Processing (Smooth)" control, background prompt "Click the "Paint" button before the first drawing" and background prompt "Click the "Reset" button before exporting the model after the last drawing". The specific settings of the user (UI) interface can also be determined according to actual needs and are not limited here.

[0102] Figure 4 FIG. 1 is a schematic diagram of the effect of controlling the thickness of the stroke based on the vertex color (Alpha) channel according to one embodiment of the present disclosure. Figure 4 As shown, it shows the effect of controlling the stroke thickness based on the vertex color (Alpha) channel.

[0103] Figure 5 is a schematic diagram of the stroke effect of a target mesh model generated by a mesh model-based processing method according to one embodiment of the present disclosure, such as Figure 5 As shown, the stroke effect of the target mesh model generated by the mesh model processing method proposed in this application is demonstrated. The target mesh model can be specifically determined according to actual needs and is not limited here.

[0104] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present disclosure, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present disclosure.

[0105] In this embodiment, a processing device for a grid model is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the terms "unit" and "module" can implement a combination of software and / or hardware for a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0106] Figure 6 is a structural block diagram of a grid model processing device according to one embodiment of the present disclosure, wherein a graphical user interface is provided through a terminal device, and the content displayed by the graphical user interface includes a touch area, such as Figure 6 As shown, the device comprises:

[0107] An acquisition module 62 is used to acquire model information of a target mesh model; a normal determination module 64 is used to determine average normals of multiple vertices and surface normals of multiple faces based on the model information; a parameter determination module 66 is used to determine control parameters of multiple vertices based on the average normals of multiple vertices and surface normals of multiple faces on the target mesh model; an effect generation module 68 is used to generate a stroke effect of the target mesh model based on the control parameters of multiple vertices and the average normal of multiple vertices, wherein the width of the stroke effect is determined based on the control parameters of multiple vertices.

[0108] According to the above-mentioned embodiments of the present disclosure, the model information includes: vertex information of multiple vertices, and the corresponding relationship between multiple faces and multiple vertices; the normal determination module is also used to determine the vectors of multiple edges connected to any vertex based on the vertex information of multiple vertices; based on the vectors of multiple edges, determine the face normal of at least one face adjacent to any vertex; based on the vectors of multiple edges and the corresponding relationship, determine the weight value of at least one face; based on the weight value of at least one face, perform weighted processing on the face normal of at least one face to obtain the average normal of any vertex.

[0109] According to the above-mentioned embodiment of the present disclosure, the normal determination module is also used to determine multiple target vertices adjacent to any vertex based on the vertex information of multiple vertices; and to determine the vector of the edge connecting any vertex and any target vertex based on the vertex information of any vertex and the vertex information of any target vertex.

[0110] According to the above-mentioned embodiments of the present disclosure, the normal determination module is also used to, in response to the number of multiple edges being less than or equal to a preset number, perform cross product processing on the vectors of the multiple edges to obtain the surface normal of the face formed by the multiple edges; in response to the number of multiple edges being greater than a preset number, perform cross product processing on the vectors of two adjacent edges among the multiple edges to obtain the surface normal of the face formed by the two adjacent edges.

[0111] According to the above-mentioned embodiment of the present disclosure, the normal determination module is also used to determine two target edges belonging to any one face based on the corresponding relationship; perform dot multiplication on the vectors of the two target edges to obtain the angle between the two target edges; and determine the weight value of any one face based on the angle between the two target edges.

[0112] According to the above-mentioned embodiment of the present disclosure, the normal determination module is also used to obtain the sum of the weight values ​​of at least one face to obtain the total weight sum; obtain the ratio of the weight value of any one face to the total weight sum to obtain the normalized weight of any one face; based on the normalized weight of at least one face, perform weighted processing on the face normal of at least one face to obtain the average normal of any vertex.

[0113] According to the above-mentioned embodiment of the present disclosure, the parameter determination module is also used to determine the angle between the average normal of any vertex and the surface normal of at least one target surface adjacent to any vertex based on the average normal of any vertex and the surface normal of at least one target surface adjacent to any vertex, so as to obtain at least one angle; obtain the average value of at least one angle to obtain the average angle; and smoothly interpolate the average angle to obtain the control parameter of any vertex.

[0114] According to the above-mentioned embodiment of the present disclosure, the effect generation module is also used to convert the average normals of multiple vertices according to a preset numerical range to obtain the first normals of multiple vertices; adjust the axial direction of the first normals of multiple vertices based on the skinning requirements of the target mesh model to obtain the second normals of multiple vertices; store the second normal of any vertex and the control parameters of any vertex into the target color set of any vertex; and generate a stroke effect based on the color sets of multiple vertices.

[0115] According to the above embodiment of the present disclosure, after acquiring the model information of the target mesh model, the acquisition module is further used to clear the original color sets of multiple vertices and add the target color set.

[0116] According to the above embodiment of the present disclosure, the acquisition module is further used to traverse all virtual models in the preset scene, determine multiple geometric models in the preset scene; filter out geometric models of mesh type from the multiple geometric models, and obtain the target mesh model.

[0117] According to the above embodiment of the present disclosure, the acquisition module is further used to acquire target material information corresponding to the target mesh model; and render the target mesh model based on the target material information.

[0118] It should be noted that the above-mentioned units and modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to this: the above-mentioned units and modules are all located in the same processor; or, the above-mentioned units and modules are located in different processors in any combination.

[0119] An embodiment of the present disclosure further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any one of the above method embodiments when running.

[0120] Optionally, in this embodiment, the above-mentioned computer-readable storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.

[0121] Optionally, in this embodiment, the computer-readable storage medium may be located in any one of the computer terminals in a computer terminal group in a computer network, or in any one of the mobile terminals in a mobile terminal group.

[0122] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:

[0123] Acquire model information of a target mesh model; determine average normals of multiple vertices and surface normals of multiple faces on the target mesh model based on the model information; determine control parameters of multiple vertices based on the average normals of multiple vertices and the surface normals of multiple faces; generate a stroke effect of the target mesh model based on the control parameters of multiple vertices and the average normal of multiple vertices, wherein the width of the stroke effect is determined based on the control parameters of multiple vertices.

[0124] Optionally, the model information includes: vertex information of multiple vertices, and a corresponding relationship between multiple faces and multiple vertices; based on the model information, determining the average normals of the multiple vertices and the face normals of the multiple faces, including: based on the vertex information of the multiple vertices, determining the vectors of multiple edges connected to any vertex; based on the vectors of the multiple edges, determining the face normal of at least one face adjacent to any vertex; based on the vectors of the multiple edges and the corresponding relationship, determining the weight value of at least one face; based on the weight value of at least one face, performing weighted processing on the face normal of at least one face to obtain the average normal of any vertex.

[0125] Optionally, based on the vertex information of multiple vertices, vectors of multiple edges connected to any vertex are determined, including: based on the vertex information of multiple vertices, multiple target vertices adjacent to any vertex are determined; based on the vertex information of any vertex and the vertex information of any target vertex, the vector of the edge connected between any vertex and any target vertex is determined.

[0126] Optionally, based on the vectors and corresponding relationships of multiple edges, the face normal of at least one face adjacent to any vertex is determined, including: in response to the number of multiple edges being less than or equal to a preset number, performing cross product processing on the vectors of the multiple edges to obtain the face normal of the face constituted by the multiple edges; in response to the number of multiple edges being greater than a preset number, performing cross product processing on the vectors of two adjacent edges among the multiple edges to obtain the face normal of the face constituted by the two adjacent edges.

[0127] Optionally, based on the vectors and correspondences of multiple edges, the weight value of at least one face is determined, including: based on the correspondence, determining two target edges belonging to any one face; performing dot multiplication on the vectors of the two target edges to obtain the angle between the two target edges; and determining the weight value of any one face based on the angle between the two target edges.

[0128] Optionally, based on the weight value of at least one face, the face normal of at least one face is weighted to obtain the average normal of any vertex, including: obtaining the sum of the weight values ​​of at least one face to obtain the total weight sum; obtaining the ratio of the weight value of any one face to the total weight sum to obtain the normalized weight of any one face; based on the normalized weight of at least one face, the face normal of at least one face is weighted to obtain the average normal of any vertex.

[0129] Optionally, control parameters of multiple vertices are determined based on average normals of multiple vertices and surface normals of multiple surfaces, including: based on the average normal of any vertex and the surface normal of at least one target surface adjacent to any vertex, determining the angle between the average normal of any vertex and the surface normal of at least one target surface to obtain at least one angle; obtaining the average value of at least one angle to obtain an average angle; and smoothly interpolating the average angle to obtain the control parameter of any vertex.

[0130] Optionally, based on the control parameters of multiple vertices and the average normals of multiple vertices, a stroke effect of the target mesh model is generated, including: converting the average normals of multiple vertices according to a preset numerical range to obtain first normals of multiple vertices; adjusting the axial directions of the first normals of multiple vertices based on the skinning requirements of the target mesh model to obtain second normals of multiple vertices; storing the second normal of any vertex and the control parameters of any vertex in the target color set of any vertex; and generating a stroke effect based on the color set of multiple vertices.

[0131] Optionally, after acquiring the model information of the target mesh model, the method further includes: clearing original color sets of multiple vertices and adding the target color set.

[0132] Optionally, the method further includes: traversing all virtual models in a preset scene to determine a plurality of geometric models in the preset scene; and screening out a mesh type geometric model from the plurality of geometric models to obtain a target mesh model.

[0133] Optionally, the method further includes: acquiring target material information corresponding to the target mesh model; and rendering the target mesh model based on the target material information.

[0134] In at least some embodiments of the present disclosure, model information of a target mesh model is obtained; based on the model information, average normals of multiple vertices and surface normals of multiple faces on the target mesh model are determined; based on the average normals of multiple vertices and surface normals of multiple faces, control parameters of multiple vertices are determined; based on the control parameters of multiple vertices and the average normals of multiple vertices, a stroke effect of the target mesh model is generated, wherein the width of the stroke effect is determined based on the control parameters of multiple vertices. It is easy to notice that by obtaining the model information of the target mesh model and calculating the average normals of multiple vertices and surface normals of multiple faces, the structure and characteristics of the target mesh model can be accurately understood, the surface geometric features of the target mesh model can be accurately described, and the control parameters of multiple vertices can be determined based on the average normals of multiple vertices and surface normals, so that the details and shapes of the stroke effect can be effectively controlled, the accuracy and adjustability of the stroke effect can be improved, and the width and shape of the stroke can be adjusted according to the control parameters, so as to achieve a more refined and natural stroke effect, thereby solving the technical problems of poor effect and low efficiency of generating the stroke effect of the network model in the related art.

[0135] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a computer-readable storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present disclosure.

[0136] In an exemplary embodiment of the present disclosure, a program product capable of implementing the above method of the present embodiment is stored on a computer-readable storage medium. In some possible implementations, various aspects of the embodiments of the present disclosure may also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary implementations of the present disclosure described in the above “Exemplary Method” section of the present embodiment.

[0137] According to the program product for implementing the above method in the embodiment of the present disclosure, it can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the embodiment of the present disclosure is not limited to this. In the embodiment of the present disclosure, the computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.

[0138] The program product may be in any combination of one or more computer-readable media. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination thereof. More specific examples (non-exhaustive) of computer-readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.

[0139] It should be noted that the program code contained in the computer-readable storage medium can be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the above.

[0140] An embodiment of the present disclosure further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0141] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0142] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:

[0143] Acquire model information of a target mesh model; determine average normals of multiple vertices and surface normals of multiple faces on the target mesh model based on the model information; determine control parameters of multiple vertices based on the average normals of multiple vertices and the surface normals of multiple faces; generate a stroke effect of the target mesh model based on the control parameters of multiple vertices and the average normal of multiple vertices, wherein the width of the stroke effect is determined based on the control parameters of multiple vertices.

[0144] Optionally, the model information includes: vertex information of multiple vertices, and a corresponding relationship between multiple faces and multiple vertices; based on the model information, determining the average normals of the multiple vertices and the face normals of the multiple faces, including: based on the vertex information of the multiple vertices, determining the vectors of multiple edges connected to any vertex; based on the vectors of the multiple edges, determining the face normal of at least one face adjacent to any vertex; based on the vectors of the multiple edges and the corresponding relationship, determining the weight value of at least one face; based on the weight value of at least one face, performing weighted processing on the face normal of at least one face to obtain the average normal of any vertex.

[0145] Optionally, based on the vertex information of multiple vertices, vectors of multiple edges connected to any vertex are determined, including: based on the vertex information of multiple vertices, multiple target vertices adjacent to any vertex are determined; based on the vertex information of any vertex and the vertex information of any target vertex, the vector of the edge connected between any vertex and any target vertex is determined.

[0146] Optionally, based on the vectors and corresponding relationships of multiple edges, the face normal of at least one face adjacent to any vertex is determined, including: in response to the number of multiple edges being less than or equal to a preset number, performing cross product processing on the vectors of the multiple edges to obtain the face normal of the face constituted by the multiple edges; in response to the number of multiple edges being greater than a preset number, performing cross product processing on the vectors of two adjacent edges among the multiple edges to obtain the face normal of the face constituted by the two adjacent edges.

[0147] Optionally, based on the vectors and correspondences of multiple edges, the weight value of at least one face is determined, including: based on the correspondence, determining two target edges belonging to any one face; performing dot multiplication on the vectors of the two target edges to obtain the angle between the two target edges; and determining the weight value of any one face based on the angle between the two target edges.

[0148] Optionally, based on the weight value of at least one face, the face normal of at least one face is weighted to obtain the average normal of any vertex, including: obtaining the sum of the weight values ​​of at least one face to obtain the total weight sum; obtaining the ratio of the weight value of any one face to the total weight sum to obtain the normalized weight of any one face; based on the normalized weight of at least one face, the face normal of at least one face is weighted to obtain the average normal of any vertex.

[0149] Optionally, control parameters of multiple vertices are determined based on average normals of multiple vertices and surface normals of multiple surfaces, including: based on the average normal of any vertex and the surface normal of at least one target surface adjacent to any vertex, determining the angle between the average normal of any vertex and the surface normal of at least one target surface to obtain at least one angle; obtaining the average value of at least one angle to obtain an average angle; and smoothly interpolating the average angle to obtain the control parameter of any vertex.

[0150] Optionally, based on the control parameters of multiple vertices and the average normals of multiple vertices, a stroke effect of the target mesh model is generated, including: converting the average normals of multiple vertices according to a preset numerical range to obtain first normals of multiple vertices; adjusting the axial directions of the first normals of multiple vertices based on the skinning requirements of the target mesh model to obtain second normals of multiple vertices; storing the second normal of any vertex and the control parameters of any vertex in the target color set of any vertex; and generating a stroke effect based on the color set of multiple vertices.

[0151] Optionally, after acquiring the model information of the target mesh model, the method further includes: clearing original color sets of multiple vertices and adding the target color set.

[0152] Optionally, the method further includes: traversing all virtual models in a preset scene to determine a plurality of geometric models in the preset scene; and screening out a mesh type geometric model from the plurality of geometric models to obtain a target mesh model.

[0153] Optionally, the method further includes: acquiring target material information corresponding to the target mesh model; and rendering the target mesh model based on the target material information.

[0154] In at least some embodiments of the present disclosure, model information of a target mesh model is obtained; based on the model information, average normals of multiple vertices and surface normals of multiple faces on the target mesh model are determined; based on the average normals of multiple vertices and surface normals of multiple faces, control parameters of multiple vertices are determined; based on the control parameters of multiple vertices and the average normals of multiple vertices, a stroke effect of the target mesh model is generated, wherein the width of the stroke effect is determined based on the control parameters of multiple vertices. It is easy to notice that by obtaining the model information of the target mesh model and calculating the average normals of multiple vertices and surface normals of multiple faces, the structure and characteristics of the target mesh model can be accurately understood, the surface geometric features of the target mesh model can be accurately described, and the control parameters of multiple vertices can be determined based on the average normals of multiple vertices and surface normals, so that the details and shapes of the stroke effect can be effectively controlled, the accuracy and adjustability of the stroke effect can be improved, and the width and shape of the stroke can be adjusted according to the control parameters, so as to achieve a more refined and natural stroke effect, thereby solving the technical problems of poor effect and low efficiency of generating the stroke effect of the network model in the related art.

[0155] Figure 7 is a schematic diagram of an electronic device according to an embodiment of the present disclosure. Figure 7 As shown, the electronic device 700 is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0156] like Figure 7 As shown, the electronic device 700 is in the form of a general computing device. The components of the electronic device 700 may include but are not limited to: at least one processor 710, at least one memory 720, a bus 730 connecting different system components (including the memory 720 and the processor 710), and a display 740.

[0157] The memory 720 stores program codes, which can be executed by the processor 710, so that the processor 710 executes the steps described in the method part of the embodiment of the present disclosure according to various exemplary embodiments of the present disclosure.

[0158] The memory 720 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 7201 and / or a cache memory unit 7202, and may further include a read-only memory unit (ROM) 7203, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory.

[0159] In some examples, the memory 720 may also include a program / utility 7204 having a set (at least one) of program modules 7205, such program modules 7205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination thereof may include the implementation of a network environment. The memory 720 may further include a memory remotely disposed relative to the processor 710, and these remote memories may be connected to the electronic device 700 via a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0160] Bus 730 may represent one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a local bus of processor 710, or any of a variety of bus architectures.

[0161] The display 740 may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the electronic device 700 .

[0162] Optionally, the electronic device 700 may also communicate with one or more external devices 800 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), one or more devices that enable a user to interact with the electronic device 700, and / or any device that enables the electronic device 700 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed through an input / output (I / O) interface 750. Furthermore, the electronic device 700 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through a network adapter 760. Figure 7 As shown, the network adapter 760 communicates with other modules of the electronic device 700 via the bus 730. It should be understood that although Figure 7Not shown, other hardware and / or software modules may be used in conjunction with electronic device 700, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0163] The electronic device 700 may further include: a keyboard, a cursor control device (such as a mouse), an input / output interface (I / O interface), a network interface, a power supply and / or a camera.

[0164] It can be understood by those skilled in the art that Figure 7 The structure shown is for illustration only and does not limit the structure of the above electronic device. Figure 7 More or fewer components as shown, or with Figure 7 The memory 720 may be used to store computer programs and corresponding data, such as the computer programs and corresponding data corresponding to the grid model processing method in the embodiment of the present disclosure. The processor 710 executes various functional applications and data processing by running the computer programs stored in the memory 720, that is, implements the above-mentioned grid model processing method.

[0165] The embodiment of the present disclosure further provides a computer program product. Optionally, in this embodiment, the computer program product may include a computer program, and the computer program implements the method provided in the embodiment when executed by a processor.

[0166] Optionally, the computer program included in the above-mentioned computer program product is used by a processor to execute the following steps: obtain model information of the target mesh model; based on the model information, determine the average normal of multiple vertices and the surface normal of multiple faces on the target mesh model; based on the average normal of multiple vertices and the surface normal of multiple faces, determine control parameters of multiple vertices; based on the control parameters of multiple vertices and the average normal of multiple vertices, generate a stroke effect of the target mesh model, wherein the width of the stroke effect is determined based on the control parameters of multiple vertices.

[0167] The embodiments of the present disclosure also provide a computer program product. Optionally, the computer program product may include a non-volatile computer-readable storage medium, which may be used to store a computer program, and when the computer program is executed by a processor, the method provided in the embodiments is implemented.

[0168] Optionally, the computer program stored in the above-mentioned non-volatile computer-readable storage medium is used by the processor to execute the following steps: obtain model information of the target mesh model; determine the average normal of multiple vertices and the surface normal of multiple faces on the target mesh model based on the model information; determine control parameters of multiple vertices based on the average normal of multiple vertices and the surface normal of multiple faces; generate a stroke effect of the target mesh model based on the control parameters of multiple vertices and the average normal of multiple vertices, wherein the width of the stroke effect is determined based on the control parameters of multiple vertices.

[0169] The embodiment of the present disclosure further provides a computer program. Optionally, in this embodiment, when the computer program is executed by a processor, the method provided in the above embodiment is implemented.

[0170] Optionally, the above-mentioned computer program is executed by the processor to perform the following steps: obtain model information of the target mesh model; based on the model information, determine the average normal of multiple vertices and the surface normal of multiple faces on the target mesh model; based on the average normal of multiple vertices and the surface normal of multiple faces, determine the control parameters of multiple vertices; based on the control parameters of multiple vertices and the average normal of multiple vertices, generate a stroke effect of the target mesh model, wherein the width of the stroke effect is determined based on the control parameters of multiple vertices.

[0171] In the above embodiments of the present disclosure, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0172] In the several embodiments provided in the present disclosure, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0173] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0174] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0175] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present disclosure is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program code.

[0176] The above is only a preferred embodiment of the present disclosure. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present disclosure. These improvements and modifications should also be regarded as the scope of protection of the present disclosure.

Claims

1. A method for processing a mesh model, characterized in that: include: Get the model information of the target mesh model; Based on the model information, determining average normals of a plurality of vertices and surface normals of a plurality of surfaces on the target mesh model; Determining control parameters of the plurality of vertices based on average normals of the plurality of vertices and surface normals of the plurality of surfaces; A stroke effect of the target mesh model is generated based on the control parameters of the plurality of vertices and the average normals of the plurality of vertices, wherein a width of the stroke effect is determined based on the control parameters of the plurality of vertices.

2. The method according to claim 1, characterized in that The model information includes: vertex information of the plurality of vertices, and correspondences between the plurality of faces and the plurality of vertices; and determining, based on the model information, average normals of the plurality of vertices and surface normals of the plurality of faces, includes: Based on the vertex information of the plurality of vertices, determining vectors of a plurality of edges connected to any vertex; Determine, based on the vectors of the plurality of edges, a surface normal of at least one surface adjacent to the any one vertex; Determining a weight value of the at least one face based on the vectors of the plurality of edges and the corresponding relationship; Based on the weight value of the at least one face, weighted processing is performed on the face normal of the at least one face to obtain an average normal of the any one vertex.

3. The method according to claim 2, characterized in that The step of determining the vectors of the plurality of edges connected to any one of the vertices based on the vertex information of the plurality of vertices comprises: Based on the vertex information of the multiple vertices, determining multiple target vertices adjacent to the any one vertex; Based on the vertex information of the arbitrary vertex and the vertex information of the arbitrary target vertex, a vector of an edge connecting the arbitrary vertex and the arbitrary target vertex is determined.

4. The method according to claim 2, characterized in that: The determining, based on the vectors of the plurality of edges and the corresponding relationship, a surface normal of at least one surface adjacent to the arbitrary vertex comprises: In response to the number of the plurality of edges being less than or equal to a preset number, performing a cross product process on the vectors of the plurality of edges to obtain a surface normal of a surface formed by the plurality of edges; In response to the number of the multiple edges being greater than the preset number, a cross product process is performed on the vectors of two adjacent edges among the multiple edges to obtain a surface normal of a surface formed by the two adjacent edges.

5. The method according to claim 2, characterized in that: The determining the weight value of the at least one face based on the vectors of the plurality of edges and the corresponding relationship comprises: Based on the corresponding relationship, determine two target edges belonging to any one face; Performing a dot multiplication process on the vectors of the two target edges to obtain an angle between the two target edges; A weight value of the arbitrary face is determined based on the angle between the two target edges.

6. The method according to claim 2, characterized in that The step of performing weighted processing on the surface normal of the at least one surface based on the weight value of the at least one surface to obtain the average normal of any one vertex includes: Obtaining the sum of the weight values ​​of the at least one face to obtain a total weight sum; Obtaining a ratio of a weight value of any one face to the total weight sum to obtain a normalized weight of the any one face; Based on the normalized weight of the at least one face, weighted processing is performed on the face normal of the at least one face to obtain an average normal of the any one vertex.

7. The method according to claim 1, characterized in that The determining the control parameters of the plurality of vertices based on the average normals of the plurality of vertices and the surface normals of the plurality of surfaces comprises: Based on the average normal of any vertex and the surface normal of at least one target surface adjacent to the any vertex, determine the angle between the average normal of the any vertex and the surface normal of the at least one target surface to obtain at least one angle; Obtaining an average value of the at least one angle to obtain an average angle; The average angle is smoothly interpolated to obtain the control parameter of any vertex.

8. The method according to claim 1, characterized in that The step of generating a stroke effect of the target mesh model based on the control parameters of the plurality of vertices and the average normals of the plurality of vertices comprises: Convert the average normals of the plurality of vertices according to a preset value range to obtain first normals of the plurality of vertices; Adjusting the axial direction of the first normals of the plurality of vertices based on the skinning requirement of the target mesh model to obtain the second normals of the plurality of vertices; storing the second normal of any vertex and the control parameter of any vertex into the target color set of any vertex; The stroke effect is generated based on the color sets of the multiple vertices.

9. The method according to any one of claims 1 to 8, characterized in that After acquiring the model information of the target grid model, the method further includes: The original color sets of the multiple vertices are cleared and the target color sets are added.

10. The method according to any one of claims 1 to 8, characterized in that The method further comprises: Traversing all virtual models in a preset scene to determine a plurality of geometric models in the preset scene; A mesh type geometric model is selected from the plurality of geometric models to obtain the target mesh model.

11. The method according to any one of claims 1 to 8, characterized in that The method further comprises: Obtaining target material information corresponding to the target mesh model; The target mesh model is rendered based on the target material information.

12. A grid model processing device, characterized in that: include: An acquisition module, used to acquire model information of a target grid model; A normal determination module, used for determining an average normal of the plurality of vertices and a surface normal of the plurality of surfaces based on the model information; A parameter determination module, configured to determine control parameters of the plurality of vertices based on average normals of the plurality of vertices and surface normals of the plurality of surfaces on the target mesh model; The effect generation module is used to generate a stroke effect of the target mesh model based on the control parameters of the multiple vertices and the average normals of the multiple vertices, wherein the width of the stroke effect is determined based on the control parameters of the multiple vertices.

13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program is configured to execute the method according to any one of claims 1 to 11 when executed by a processor.

14. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 11.

15. A computer program product, characterized in that The invention comprises a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 11.