Grid model rendering method and device, equipment and medium

By optimizing the mesh model rendering method and optimizing the transparency value using line segment distance, the poor rendering effect caused by uneven distribution of grid lines is solved, and good rendering effect and efficient rendering execution are achieved when reducing the display.

CN119478192AActive Publication Date: 2025-02-18SHENZHEN YUNBO SOFTWARE TECHNOLOGY CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411584392.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-05
Publication Date
2025-02-18
Estimated Expiration
2044-11-05

AI Technical Summary

Technical Problem

The existing three-dimensional model rendering method has poor rendering effects after the model with uneven distribution of grid lines is reduced, affecting the overall rendering effect and appearance.

Method used

By obtaining the surface data and vertex data of the mesh model, extracting the three-dimensional coordinates and color information of the first and second vertices of each line segment, converting them into screen coordinates, calculating the distance between line segments and optimizing the transparency value, and drawing line objects to generate a mesh model.

Benefits of technology

When the mesh model is reduced and displayed, whether the line segments are uniform or uneven, it can present a good rendering effect, clearly displaying the relationship between each part, improving the user's impression and improving the rendering execution efficiency inside the computer.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119478192A_ABST
    Figure CN119478192A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computer three-dimensional model rendering and visual interaction, and discloses a grid model rendering method, device and equipment and a medium, and the method comprises the steps: obtaining grid model data; drawing a surface object; extracting three-dimensional coordinates and color information of the first vertex and the second vertex; converting into screen coordinates; calculating the distance between the first vertex and the second vertex; calculating a target transparency value of each line segment; and drawing a line object, and generating a grid model. The method comprises the steps of firstly drawing an opposite object and further drawing a line object. When the line object is drawn, the transparency value of each line segment is optimized through the distance between the first vertex and the second vertex; therefore, when the model is shrunk and the line segments are distributed uniformly or non-uniformly, a good rendering effect can be presented, non-uniform color in vision is avoided, and the impression of a user is improved. By using the method for rendering, the rendering efficiency of the computer is further improved, and the computer performance is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer three-dimensional model rendering and visualization interaction technology, and in particular to a grid model rendering method, device, equipment and medium. Background Art

[0002] 3D model rendering is a core concept in computer graphics processing, specifically referring to the technology of generating 2D images or videos from models in 3D scenes (such as 3D models of mechanical parts) according to the set environment, lighting, materials and rendering parameters. 3D model rendering often requires presenting the model's outline, borders, etc., especially the rendering of mesh models, which requires the presentation of mesh lines to assist user interactive modeling, option settings and presentation expressions.

[0003] The most common way to render grid lines is to use black line primitives. One feature of line primitives is that their width is in pixels, which means that they are not affected by matrix transformations and viewport transformations in 3D model rendering. This leads to a problem that when we reduce the size of the model in 3D software (i.e., increase the viewport range), the model presented as surface primitives will be reduced accordingly, while the outline frame (including grid lines) presented as line primitives will not be reduced in width (in pixels), causing the entire model to become black, which greatly affects the overall rendering effect. Figure 1 As shown in the figure, this is the presentation effect after the model is gradually reduced. It can be clearly found that the display effect is very poor after the model is reduced, and it is almost impossible to see the relationship between the various parts of the model.

[0004] In order to solve the above problem, the existing method is to dynamically modify the depth of the grid line drawing, that is, its transparency, according to the scale of the model. However, when the grid line drawing distribution of the model is uneven (such as the model after the grid is divided according to the surface curvature characteristics of the model), after using this method, the rendering effect of the model after reduction is still poor. Summary of the invention

[0005] The present invention provides a grid model rendering method, device, equipment and medium, which solves the problem that after the existing three-dimensional model rendering method renders a model with uneven grid line distribution, the model has a poor presentation effect after being reduced, affecting the overall rendering effect and viewing experience.

[0006] To solve the above technical problems, the technical solution adopted by the present invention is to provide a mesh model rendering method, comprising the steps of: obtaining mesh model data, wherein the mesh model data includes face data and vertex data; using the face data to draw multiple face objects of the mesh model; extracting the three-dimensional coordinates and color information of the first vertex and the second vertex of each line segment in the vertex data; converting the three-dimensional coordinates of the first vertex and the second vertex into screen coordinates; calculating the distance between the first vertex and the second vertex according to the screen coordinates of the first vertex and the second vertex; calculating the target transparency value of each line segment according to the distance between the first vertex and the second vertex of each line segment and the color information; drawing the corresponding line object according to the target transparency value, red component, green component, blue component of each line segment, and the screen coordinates of the first vertex and the second vertex to generate the mesh model.

[0007] In some embodiments, the extracting of the three-dimensional coordinates and color information of the first vertex and the second vertex of each line segment in the vertex data includes: arranging the vertex data in sequence into a vertex buffer, and establishing an index ID of the first vertex of each line segment in the vertex data; according to the index ID, searching and obtaining the three-dimensional coordinates and color information of the first vertex and the second vertex of each line segment from the vertex buffer.

[0008] In some embodiments, the index ID includes a storage location of the first vertex in the vertex buffer.

[0009] In some embodiments, converting the three-dimensional coordinates of the first vertex and the second vertex into screen coordinates includes: obtaining a model view matrix and a projection matrix under a current rendering perspective; and converting the three-dimensional coordinates of the first vertex and the second vertex in the world space into the screen coordinates in the NDC space through the model view matrix and the projection matrix.

[0010] In some embodiments, the target transparency value of each line segment is calculated based on the distance between the first vertex and the second vertex of each line segment and the color information, including: the color information includes the original transparency value, the red component, the green component and the blue component; using the distance between the first vertex and the second vertex of each line segment, the original transparency values ​​of the first vertex and the second vertex are calculated and converted into the target transparency values; according to the target transparency values ​​of the first vertex and the second vertex, the target transparency value of the corresponding line segment is obtained.

[0011] In some embodiments, drawing the corresponding line object according to the target transparency value, red component, green component, blue component of each line segment, and the screen coordinates of the first vertex and the second vertex includes: splitting each line segment into a corresponding plurality of pixels; filling the pixels corresponding to each line segment with color according to the target transparency value, red component, green component, blue component of each line segment, and the screen coordinates of the first vertex and the second vertex.

[0012] The present invention also provides a mesh model rendering device, comprising: an acquisition unit, used to acquire mesh model data, wherein the mesh model data includes face data and vertex data; a face drawing unit, used to draw multiple face objects of the mesh model using the face data; an extraction unit, used to extract the three-dimensional coordinates and color information of the first vertex and the second vertex of each line segment in the vertex data; a conversion unit, used to convert the three-dimensional coordinates of the first vertex and the second vertex into screen coordinates; a calculation unit, used to calculate the distance between the first vertex and the second vertex according to the screen coordinates of the first vertex and the second vertex; and also used to calculate the target transparency value of each line segment according to the distance between the first vertex and the second vertex of each line segment and the color information; a line drawing unit, used to draw the corresponding line object according to the target transparency value, red component, green component, blue component of each line segment, and the screen coordinates of the first vertex and the second vertex to generate the mesh model.

[0013] In some embodiments, the extraction unit includes: an establishment subunit for arranging the vertex data in sequence into a vertex buffer and establishing an index ID of the first vertex of each of the line segments in the vertex data; and a search subunit for searching and obtaining the three-dimensional coordinates and color information of the first vertex and the second vertex of each of the line segments from the vertex buffer according to the index ID.

[0014] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.

[0015] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.

[0016] The beneficial effects of the present invention are as follows: the present invention discloses a mesh model rendering method, device, equipment and medium, the method comprising the steps of: obtaining mesh model data, wherein the mesh model data comprises face data and vertex data; using the face data, drawing multiple face objects of the mesh model; extracting the three-dimensional coordinates and color information of the first vertex and the second vertex of each line segment in the vertex data; converting the three-dimensional coordinates of the first vertex and the second vertex into screen coordinates; calculating the distance between the first vertex and the second vertex according to the screen coordinates of the first vertex and the second vertex; calculating the target transparency value of each line segment according to the distance and color information between the first vertex and the second vertex of each line segment; drawing the corresponding line object according to the target transparency value, red component, green component, blue component of each line segment, and the screen coordinates of the first vertex and the second vertex, and generating a mesh model. When rendering a mesh model, the present application first draws the face object, and then further draws the line object. When drawing a line object, the transparency value of each line segment is optimized by the distance between the first vertex and the second vertex of the line segment; when the mesh model is reduced and displayed, whether the line segments are evenly distributed or unevenly distributed, a good rendering effect can be presented. When reduced, the relationship between the various parts of the mesh model can be clearly seen, avoiding the visual uneven color of the various parts, and improving the user's perception. Using this method to render the mesh model can also further improve the rendering execution efficiency inside the computer and improve the computer performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 It is a schematic diagram of the presentation effect of the model being gradually reduced after being rendered in the prior art;

[0018] Figure 2 This is a flow chart of an embodiment of a grid model rendering method of the present application;

[0019] Figure 3 is a schematic diagram of a mesh model in an embodiment of a mesh model rendering method of the present application;

[0020] Figure 4 This is a schematic diagram of drawing a surface object in an embodiment of a grid model rendering method of the present application;

[0021] Figure 5 It is a schematic diagram of the arrangement of the vertex buffer in an embodiment of a mesh model rendering method of the present application;

[0022] Figure 6 This is a schematic diagram of obtaining three-dimensional coordinates and color information of a first vertex and a second vertex in an embodiment of a mesh model rendering method of the present application;

[0023] Figure 7It is a schematic diagram of calculating the distance between a first vertex and a second vertex in an embodiment of a mesh model rendering method of the present application;

[0024] Figure 8 It is a comparative schematic diagram of the same mesh model after being rendered by the rendering method of the prior art and the rendering method of the present application;

[0025] Fig. 9 It is a structural block diagram of an embodiment of a grid model rendering device of the present application;

[0026] Fig.10 This is a structural block diagram of an extraction unit in an embodiment of a grid model rendering device of the present application;

[0027] Fig.11 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present application;

[0028] Fig.12 It is a schematic block diagram of an embodiment of a computer-readable storage medium of the present application. DETAILED DESCRIPTION

[0029] In order to facilitate the understanding of the present invention, the present invention is described in more detail below in conjunction with the accompanying drawings and specific embodiments. Preferred embodiments of the present invention are provided in the accompanying drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described in this specification. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present invention more thorough and comprehensive.

[0030] It should be noted that, unless otherwise defined, all technical and scientific terms used in this specification have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used in this specification includes any and all combinations of one or more related listed items.

[0031] Figure 2 The following is a flowchart of the mesh model rendering method provided by the present application, including the following steps:

[0032] S1: Obtain mesh model data, wherein the mesh model data includes face data and vertex data.

[0033] S2: Use the surface data to draw multiple surface objects of the mesh model.

[0034] S3: Extract the three-dimensional coordinates and color information of the first vertex and the second vertex of each line segment in the vertex data.

[0035] S4: Convert the three-dimensional coordinates of the first vertex and the second vertex into screen coordinates.

[0036] S5: Calculate the distance between the first vertex and the second vertex according to the screen coordinates of the first vertex and the second vertex; calculate the target transparency value of each line segment according to the distance between the first vertex and the second vertex and the color information of each line segment.

[0037] S6: Draw a corresponding line object according to the target transparency value, the red component, the green component, the blue component, and the screen coordinates of the first vertex and the second vertex of each line segment to generate a mesh model.

[0038] Among them, face data and vertex data are the basic data constituting the mesh model. The combination of these data can form mesh models of various shapes and sizes. The computer processing in this application is the processing of these mesh models.

[0039] When the computer renders the mesh model, the present application first draws the surface object, and then draws the line object. When drawing the line object, the transparency value of each line segment is optimized by the distance between the first vertex and the second vertex of the line segment; when the computer zooms out and displays the mesh model, no matter whether the line segments are evenly distributed or unevenly distributed, a good rendering effect can be presented. When zoomed out, the relationship between the various parts of the mesh model can be clearly seen, avoiding the visual color unevenness of the various parts, and improving the user's perception. When the computer uses this method to render the mesh model, because the network model is processed consistently, the rendering execution efficiency inside the computer can be further improved, avoiding processing differences caused by different mesh models, and improving computer performance.

[0040] Combine the following Figures 2 to 12 , this application is described in detail with specific embodiments.

[0041] like Figure 2 As shown, the grid model rendering method of the present application includes the steps of:

[0042] S1: Obtain mesh model data, wherein the mesh model data includes face data and vertex data.

[0043] The mesh model is a three-dimensional model. The face data includes the shape, color, and drawing order of each face of the mesh model to be rendered; the vertex data includes the three-dimensional coordinates, color information, and line segment drawing order of each line segment of the mesh model to be rendered.

[0044] The color information of the vertex includes the original transparency value, the red component, the green component and the blue component. In this embodiment, the color information can be represented by a 32-bit unsigned integer; wherein, each 8 bits represent one of the components of the color, for example: the highest 8 bits represent the Alpha value, that is, the original transparency value, and the second highest 8 bits to the lowest 8 bits represent the red component, the green component and the blue component respectively; wherein, an unsigned integer is a computer term, indicating an integer type that can only represent positive numbers and zero. In some other embodiments, the color information can also use 4 single-precision floating-point numbers to represent the 4 components (original transparency value, red component, green component and blue component) respectively. Single-precision floating-point numbers are used to represent real numbers with decimal parts and occupy 4 bytes (32 bits) of storage space.

[0045] Specifically, in this embodiment, Figure 3 Take the mesh model shown in FIG. 1 as an example. It can be seen that the mesh model is a typical cubic model, including 6 rectangular faces (i.e., face 1234, face 1456, face 5687, face 2378, face 3457, and face 1286) and 18 line segments (i.e., line segment 12, line segment 23, line segment 34, line segment 41, line segment 13, line segment 16, line segment 65, line segment 54, line segment 64, line segment 28, line segment 87, line segment 73, line segment 83, line segment 68, line segment 62, line segment 57, line segment 53, and line segment 67). Each line segment has two endpoints (i.e., the first vertex and the second vertex), so the 18 line segments have a total of 36 vertices of three-dimensional coordinates and color information. Each line segment needs to be drawn according to the line segment drawing order in the vertex data.

[0046] S2: Use the surface data to draw multiple surface objects of the mesh model.

[0047] Specifically, multiple surface objects of the mesh model are drawn using information such as the shape, color, and drawing order of each surface of the mesh model to be rendered in the surface data.

[0048] In this embodiment, continue with Figure 3 Taking the mesh model shown in FIG. 1 as an example, the six rectangular faces of the mesh model (i.e., face 1234, face 1456, face 5687, face 2378, face 3457, and face 1286) are drawn. Figure 4 shown.

[0049] Next, we prepare to draw multiple line objects of the mesh model.

[0050] S3: Extract the three-dimensional coordinates and color information of the first vertex and the second vertex of each line segment in the vertex data.

[0051] The first vertex and the second vertex represent two endpoints of the line segment respectively.

[0052] Specifically, firstly, vertex data (three-dimensional coordinates and color information of vertices of each line segment) are arranged in a vertex buffer (such as a shader storage buffer of an OpenGL (Open Graphics Library) environment) according to the line segment drawing order.

[0053] by Figure 3 Take the mesh model shown in the figure as an example, and arrange the vertex data according to the set line segment drawing order (which can be adjusted as needed) as follows Figure 5 As shown. It can be seen that the first position of the vertex buffer stores the three-dimensional coordinates and color information of the first vertex 1 of the line segment 12, the second position of the vertex buffer stores the three-dimensional coordinates and color information of the second vertex 2 of the line segment 12, and so on. The 36th position (i.e., the last position) of the vertex buffer stores the three-dimensional coordinates and color information of the second vertex 7 of the line segment 67.

[0054] Furthermore, an index ID of the first vertex of each line segment in the vertex data is established; wherein the index ID includes the storage position of the first vertex in the vertex buffer. For example, the index ID of the first vertex 1 of line segment 14 is established, and the index ID is 3, which means that the first vertex 1 of line segment 14 and its related information are stored in the third position of the vertex buffer.

[0055] Furthermore, according to the established index ID, the three-dimensional coordinates and color information of the first vertex and the second vertex of each line segment are searched and obtained from the vertex buffer.

[0056] Specifically, the index ID is passed from the vertex shader to the geometry shader. The vertex shader and the geometry shader are both special graphics processing units. In the geometry shader, according to the index ID, the three-dimensional coordinates and color information of the first vertex and the second vertex of each line segment are searched and obtained from the vertex buffer.

[0057] In this embodiment, Figure 6 For example, if the currently drawn line segment is line segment 13, then according to the index ID of the first vertex 1 of line segment 13 (5 at this time), the first vertex 1 is found from the 5th position of the vertex buffer, and the three-dimensional coordinates and color information of the first vertex 1 are obtained; since the storage positions of the first vertex 1 and the second vertex 3 of line segment 13 in the vertex buffer are adjacent, the second vertex 3 can be further found from the 6th position of the vertex buffer, and the three-dimensional coordinates and color information of the second vertex 3 can be obtained.

[0058] S4: Convert the three-dimensional coordinates of the first vertex and the second vertex into screen coordinates.

[0059] Specifically, first obtain the model view matrix and projection matrix under the current rendering perspective, and pass them into the geometry shader.

[0060] Among them, the Model-View Matrix consists of the Model Matrix and the View Matrix. The Model Matrix is ​​used to transform vertices from the local coordinate system to the world coordinate system, while the View Matrix is ​​used to transform vertices from the world coordinate system to the view space. The function of the Model-View Matrix is ​​to transform vertices from the local coordinate system to the view space. This process involves two main transformations: model transformation and view transformation. The Projection Matrix is ​​used to transform vertices from the view space to the clipping space (i.e., NDC, Normalized Device Coordinate space). In the 3D model rendering process, the projection matrix is ​​responsible for projecting the 3D scene onto the 2D screen, which usually includes two types: perspective projection and orthogonal projection. Perspective projection simulates the visual effect of the human eye, making distant objects appear smaller and nearby objects appear larger; orthogonal projection keeps the size of the object unchanged.

[0061] Furthermore, through the model view matrix (recording the position, posture and orientation of the camera under the current rendering perspective) and the projection matrix (recording the intrinsic and extrinsic parameters of the camera), the three-dimensional coordinates of the first vertex and the second vertex in the world space are converted into screen coordinates in the NDC space.

[0062] S5: Calculate the distance between the first vertex and the second vertex according to the screen coordinates of the first vertex and the second vertex; calculate the target transparency value of each line segment according to the distance between the first vertex and the second vertex and the color information of each line segment.

[0063] Specifically, Figure 7 Taking the figure as an example, according to the screen coordinates (2, 5) of the first vertex 1 of the line segment 13 to be drawn and the screen coordinates (7, 2) of the second vertex 3, the distance d between the first vertex 1 and the second vertex 3, that is, the length of the line segment 13, is calculated.

[0064] Furthermore, the distance between the first vertex and the second vertex of each line segment is used to convert the original transparency value in the color information of the first vertex and the second vertex into the target transparency value. The above process can be expressed by the following formula:

[0065]

[0066] Among them, color.a represents the target transparency value of the first vertex and the second vertex, 1.0f, 0.0f, and 50.0f represent empirical values, modelWidth represents the width of the entire mesh model displayed on the screen, screenWidth represents the screen width, length(screenPos1-screenPos2) represents the distance between the first vertex and the second vertex, and clamp(length(screenPos1-screenPos2)×50.0f, 0.0, 1.0) represents setting the distance between the first vertex and the second vertex to between [0, 1].

[0067] Furthermore, in this embodiment, the target transparency values ​​of the first vertex and the second vertex are also used as the target transparency values ​​of the corresponding line segments. That is, if the target transparency values ​​of the first vertex 1 and the second vertex 3 of the line segment 13 are 20, the target transparency value of the line segment 13 is also 20.

[0068] The target transparency value of the line segment is optimized through the distance between the first vertex and the second vertex of the line segment, so that the longer the line segment, the higher the opacity, and the shorter the line segment, the higher the transparency. This can effectively improve the problem of color difference in the display effect of each line segment due to uneven distribution of line segments after the mesh model is reduced, further improving the overall rendering effect.

[0069] S6: Draw a corresponding line object according to the target transparency value, the red component, the green component, the blue component, and the screen coordinates of the first vertex and the second vertex of each line segment to generate a mesh model.

[0070] Specifically, each line segment is split into corresponding multiple pixels. Figure 3 As shown, the line segment 14 displayed on the screen may correspond to multiple pixels. According to the set data, the line segment 14 is split into multiple pixels, such as 15 pixels; then the target transparency value, red component, green component and blue component of the line segment 14 are also the target transparency value, red component, green component and blue component of these 15 pixels.

[0071] Furthermore, the target transparency value, red component, green component, and blue component of the corresponding pixel are passed to the fragment shader, where the fragment shader is the stage in the graphics rendering pipeline that processes pixel-level rendering. In the fragment shader, according to the corresponding target transparency value, red component, green component, blue component, and the screen coordinates of the first and second vertices of the line segment, the pixel corresponding to each line segment is filled with color to complete the drawing of the line object and generate a mesh model (for example, Figure 3 The mesh model shown).

[0072] In summary, if Figure 8 As shown, Figure 8 is rendered by the existing technology (i.e. Figure 8 Before optimization) and the rendering method of this application (i.e. Figure 8 A comparison diagram of the same mesh model after rendering (after optimization in ).

[0073] With the help of Figure 8 As shown in the mesh model, it is obvious that the rendering method using the prior art (i.e. Figure 8 The mesh model is rendered before optimization in the middle. After being gradually reduced, the rendering effect of the mesh model is very poor. Large black areas appear in the parts where the line segments (i.e., grid lines) are densely distributed, which greatly affects the viewing experience.

[0074] The rendering method of this application (i.e. Figure 8 The mesh model is rendered (after optimization in the middle). After being gradually reduced, the rendering effect of the mesh model is very good. Even in the part where the line segments (i.e., grid lines) are densely distributed, the rendering color is basically consistent with other areas without difference, which effectively improves the overall rendering effect and enhances the user's viewing experience.

[0075] Based on the same inventive concept, Fig. 9 As shown, the present application also provides a grid model rendering device, the device comprising:

[0076] The acquisition unit 101 is used to acquire mesh model data, wherein the mesh model data includes face data and vertex data.

[0077] The surface drawing unit 102 is used to draw multiple surface objects of the mesh model using the surface data.

[0078] The extraction unit 103 is used to extract the three-dimensional coordinates and color information of the first vertex and the second vertex of each line segment in the vertex data.

[0079] The conversion unit 104 is used to convert the three-dimensional coordinates of the first vertex and the second vertex into screen coordinates.

[0080] The calculation unit 105 is used to calculate the distance between the first vertex and the second vertex according to the screen coordinates of the first vertex and the second vertex; it is also used to calculate the target transparency value of each line segment according to the distance between the first vertex and the second vertex and the color information of each line segment.

[0081] The line drawing unit 106 is used to draw the corresponding line object according to the target transparency value, red component, green component, blue component, and screen coordinates of the first vertex and the second vertex of each line segment to generate a mesh model.

[0082] Further, such as Fig.10As shown, the extraction unit 103 includes a creation subunit 107 and a retrieval subunit 108. The creation subunit 107 is used to arrange the vertex data in sequence to the vertex buffer, and to create an index ID of the first vertex of each line segment in the vertex data. The retrieval subunit 108 is used to search and obtain the three-dimensional coordinates and color information of the first vertex and the second vertex of each line segment from the vertex buffer according to the index ID.

[0083] Other technical features in the grid model rendering device are the same as the features disclosed in the above-mentioned embodiment method. Please refer to the description in the above-mentioned corresponding method embodiments and will not be repeated here.

[0084] Based on the same inventive concept, the present application also provides an electronic device, which includes a processor, a memory and a communication circuit, and the processor is connected to the memory and the communication circuit respectively; wherein the communication circuit is used for communication connection, the memory is used to store a computer program, and the processor is used to execute the computer program to implement the above-mentioned mesh model rendering method.

[0085] See also Fig.11 The electronic device described in the embodiment of the present application may specifically include a processor 210 and a memory 220. The memory 220 is coupled to the processor 210.

[0086] The processor 210 is used to control the operation of the electronic device. The processor 210 may also be referred to as a CPU (Central Processing Unit). The processor 210 may be an integrated circuit chip having the ability to process signals. The processor 210 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. A general-purpose processor may be a microprocessor or the processor 210 may also be any conventional processor, etc.

[0087] The memory 220 is used to store computer programs, and may be a RAM, a ROM, or other types of storage terminals. Specifically, the memory 220 may include one or more computer-readable storage media, which may be non-transitory or transient. The memory 220 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage terminals, flash memory storage terminals. In some embodiments, the non-transitory computer-readable storage medium in the memory 220 is used to store at least one program code.

[0088] The processor 210 is used to execute the computer program stored in the memory 220 to implement the methods described in the various method embodiments of the present application.

[0089] In some embodiments, the electronic device may further include: a peripheral terminal interface 230 and at least one peripheral terminal. The processor 210, the memory 220 and the peripheral terminal interface 230 may be connected via a bus or a signal line. Each peripheral terminal may be connected to the peripheral terminal interface 230 via a bus, a signal line or a circuit board. Specifically, the peripheral terminal includes: at least one of a radio frequency circuit 240, a display screen 250, an audio circuit 260 and a power supply 270.

[0090] The peripheral terminal interface 230 may be used to connect at least one peripheral terminal related to I / O (Input / output) to the processor 210 and the memory 220. In some embodiments, the processor 210, the memory 220, and the peripheral terminal interface 230 are integrated on the same chip or circuit board; in some other implementations, any one or two of the processor 210, the memory 220, and the peripheral terminal interface 230 may be implemented on a separate chip or circuit board, which is not limited in this embodiment.

[0091] The radio frequency circuit 240 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 240 communicates with the communication network and other IoT devices through electromagnetic signals, and the radio frequency circuit 240 is the communication circuit of the electronic device. The radio frequency circuit 240 converts the electrical signal into an electromagnetic signal for transmission, or converts the received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 240 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, an operator identity module card, and the like. The radio frequency circuit 240 can communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes, but is not limited to: the World Wide Web, a metropolitan area network, an intranet, various generations of mobile communication networks (2G, 3G, 4G and 5G), a wireless local area network and / or a WiFi (Wireless Fidelity) network. In some embodiments, the radio frequency circuit 240 may also include circuits related to NFC (Near Field Communication), which is not limited in this application.

[0092] The display screen 250 is used to display the UI (User Interface). The UI may include graphics, text, icons, videos, and any combination thereof. When the display screen 250 is a touch display screen, the display screen 250 also has the ability to collect touch signals on the surface or above the surface of the display screen 250. The touch signal can be input to the processor 210 as a control signal for processing. At this time, the display screen 250 can also be used to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards. In some embodiments, the display screen 250 can be one, set on the front panel of the electronic device; in other embodiments, the display screen 250 can be at least two, respectively set on different surfaces of the electronic device or in a folding design; in other embodiments, the display screen 250 can be a flexible display screen, set on a curved surface or a folding surface of the electronic device. Even, the display screen 250 can also be set to a non-rectangular irregular shape, that is, a special-shaped screen. The display screen 250 can be made of materials such as LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode, organic light-emitting diode).

[0093] The audio circuit 260 may include a microphone and a speaker. The microphone is used to collect sound waves from the operator and the environment, and convert the sound waves into electrical signals and input them into the processor 210 for processing, or input them into the radio frequency circuit 240 to achieve voice communication. For the purpose of stereo acquisition or noise reduction, there may be multiple microphones, which are respectively arranged in different parts of the electronic device. The microphone may also be an array microphone or an omnidirectional acquisition microphone. The speaker is used to convert the electrical signal from the processor 210 or the radio frequency circuit 240 into sound waves. The speaker may be a traditional film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert the electrical signal into sound waves audible to humans, but also convert the electrical signal into sound waves inaudible to humans for purposes such as ranging. In some embodiments, the audio circuit 260 may also include a headphone jack.

[0094] The power supply 270 is used to power various components in the electronic device. The power supply 270 can be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power supply 270 includes a rechargeable battery, the rechargeable battery can be a wired rechargeable battery or a wireless rechargeable battery. A wired rechargeable battery is a battery that is charged through a wired line, and a wireless rechargeable battery is a battery that is charged through a wireless coil. The rechargeable battery can also be used to support fast charging technology.

[0095] For a detailed description of the functions and execution processes of each functional module or component in the electronic device embodiment of the present application, reference can be made to the description in the above-mentioned method embodiments of the present application, which will not be repeated here.

[0096] In the several embodiments provided in the present application, it should be understood that the disclosed electronic devices and methods can be implemented in other ways. For example, the various embodiments of the electronic devices described above are only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation, such as 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 an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0097] 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 network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0098] In addition, each functional unit in each embodiment of the present application 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.

[0099] Based on the same inventive concept, the present application also provides a computer-readable storage medium storing a computer program, which can be executed by a processor to implement the above-mentioned mesh model rendering method.

[0100] See also Fig.12 , if the above-mentioned 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 300. Based on this understanding, the technical solution of the present application 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 several instructions / computer programs to enable an IoT device (which can be a personal computer, server, or network terminal, etc.) or a processor (processor) to perform all or part of the steps of each implementation method of the present application. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks or optical disks, and electronic terminals such as computers, mobile phones, laptops, tablet computers, cameras, etc. having the above-mentioned storage media.

[0101] The description of the execution process of the program data in the computer-readable storage medium can refer to the description in the above-mentioned method embodiments of the present application, and will not be repeated here.

[0102] It can be seen that the present invention discloses a mesh model rendering method, device, equipment and medium, the method comprising the steps of: obtaining mesh model data, wherein the mesh model data includes face data and vertex data; using the face data to draw multiple face objects of the mesh model; extracting the three-dimensional coordinates and color information of the first vertex and the second vertex of each line segment in the vertex data; converting the three-dimensional coordinates of the first vertex and the second vertex into screen coordinates; calculating the distance between the first vertex and the second vertex according to the screen coordinates of the first vertex and the second vertex; calculating the target transparency value of each line segment according to the distance and color information between the first vertex and the second vertex of each line segment; drawing the corresponding line object according to the target transparency value, red component, green component, blue component of each line segment, and the screen coordinates of the first vertex and the second vertex to generate a mesh model. When rendering a mesh model, the present application first draws the face object, and then further draws the line object. When drawing a line object, the transparency value of each line segment is optimized by the distance between the first vertex and the second vertex of the line segment; when the mesh model is reduced and displayed, whether the line segments are evenly distributed or unevenly distributed, a good rendering effect can be presented. When reduced, the relationship between the various parts of the mesh model can be clearly seen, avoiding the visual color unevenness of the various parts, and improving the user's perception of computer processing and display. Using this method to render the mesh model can also further improve the rendering execution efficiency inside the computer and improve the computer performance.

[0103] The above are only embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Any equivalent structural transformations made using the contents of the present invention description and drawings, or directly or indirectly applied in other related technical fields, are included in the protection scope of the present invention.

Claims

1. A mesh model rendering method, characterized in that: Includes steps: Acquire mesh model data, wherein the mesh model data includes face data and vertex data; Using the surface data, drawing a plurality of surface objects of a mesh model; Extracting the three-dimensional coordinates and color information of the first vertex and the second vertex of each line segment in the vertex data; Convert the three-dimensional coordinates of the first vertex and the second vertex into screen coordinates; According to the screen coordinates of the first vertex and the second vertex, calculate and obtain the distance between the first vertex and the second vertex; according to the distance between the first vertex and the second vertex of each line segment and the color information, calculate and obtain the target transparency value of each line segment; According to the target transparency value, the red component, the green component, the blue component of each line segment, and the screen coordinates of the first vertex and the second vertex, a corresponding line object is drawn to generate the mesh model.

2. The mesh model rendering method according to claim 1, characterized in that: The extracting of the three-dimensional coordinates and color information of the first vertex and the second vertex of each line segment in the vertex data includes: Arrange the vertex data in sequence to a vertex buffer, and establish an index ID of the first vertex of each line segment in the vertex data; According to the index ID, the three-dimensional coordinates and color information of the first vertex and the second vertex of each of the line segments are searched and obtained from the vertex buffer.

3. The mesh model rendering method according to claim 2, characterized in that: The index ID includes the storage location of the first vertex in the vertex buffer.

4. The mesh model rendering method according to claim 1, characterized in that: The converting the three-dimensional coordinates of the first vertex and the second vertex into screen coordinates comprises: Get the model view matrix and projection matrix under the current rendering perspective; The three-dimensional coordinates of the first vertex and the second vertex in the world space are converted into the screen coordinates in the NDC space through the model view matrix and the projection matrix.

5. The mesh model rendering method according to claim 1, characterized in that: The step of calculating the target transparency value of each line segment according to the distance between the first vertex and the second vertex of each line segment and the color information includes: The color information includes an original transparency value, a red component, a green component, and a blue component; Using the distance between the first vertex and the second vertex of each line segment, the original transparency values ​​of the first vertex and the second vertex are calculated and converted into the target transparency values; The target transparency value of the corresponding line segment is obtained according to the target transparency values ​​of the first vertex and the second vertex.

6. The mesh model rendering method according to claim 1, characterized in that: Drawing a corresponding line object according to the target transparency value, the red component, the green component, the blue component of each line segment, and the screen coordinates of the first vertex and the second vertex includes: Splitting each of the line segments into a corresponding plurality of pixels; The pixels corresponding to each of the line segments are filled with color according to the target transparency value, the red component, the green component, the blue component of each of the line segments, and the screen coordinates of the first vertex and the second vertex.

7. A mesh model rendering device, characterized in that: include: An acquisition unit, used for acquiring mesh model data, wherein the mesh model data includes face data and vertex data; A surface drawing unit, used for drawing a plurality of surface objects of a mesh model using the surface data; An extraction unit, used for extracting the three-dimensional coordinates and color information of the first vertex and the second vertex of each line segment in the vertex data; A conversion unit, used for converting the three-dimensional coordinates of the first vertex and the second vertex into screen coordinates; a calculation unit, configured to calculate the distance between the first vertex and the second vertex according to the screen coordinates of the first vertex and the second vertex; and to calculate the target transparency value of each line segment according to the distance between the first vertex and the second vertex of each line segment and the color information; The line drawing unit is used to draw the corresponding line object according to the target transparency value, red component, green component, blue component of each line segment, and the screen coordinates of the first vertex and the second vertex to generate the mesh model.

8. The grid model rendering device according to claim 7, characterized in that: The extraction unit comprises: Establishing a subunit, used for arranging the vertex data into a vertex buffer in sequence, and establishing an index ID of the first vertex of each line segment in the vertex data; The retrieval subunit is used to search and obtain the three-dimensional coordinates and color information of the first vertex and the second vertex of each line segment from the vertex buffer according to the index ID.

9. An electronic device, characterized in that: The method comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method according to any one of claims 1 to 6 when executing the computer program.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Rendering method and device of three-dimensional grid body

    CN111508052A

  • Efficient three-dimensional space grid rendering method and device

    CN112085826A

  • Feature line rendering method and device, electronic equipment and storage medium

    CN116681860A

  • Volume rendering image generation method and device based on generative network

    CN118096984A