Determination method of vertex gravity center data and wireframe generation method and device

By determining the center of gravity data of the vertex in graphics rendering and generating wireframe data, the problem of wireframe mesh taking up too much storage space is solved, and the effect of reducing storage space and reducing network load is achieved.

CN119478188APending Publication Date: 2025-02-18GLODON CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311001378.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-09
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

During the graphics rendering process, the generated wireframe mesh takes up a large storage space, resulting in an increase in network load and affecting load performance.

Method used

By determining the vertex center of gravity data, determine the common edges based on the multiple triangles in the Mesh grid data and the vertex data of each triangle, determine whether the common edge is on the wireframe, generate wireframe data, and use the index and common of the multiple triangles. Edge determines the vertex center of gravity data for each triangle.

Benefits of technology

This method only adds several bytes of center of gravity data to the vertex data, reducing the storage space usage, avoiding additional rendering overhead, reducing network load, and improving load performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119478188A_ABST
    Figure CN119478188A_ABST
Patent Text Reader

Abstract

The invention discloses a vertex gravity center data determination method and a wireframe generation method and device, and the method comprises the steps: obtaining Mesh grid data which comprises a plurality of triangles and vertex data of each triangle; determining common edges of all two adjacent triangles according to the plurality of triangles and the vertex data of each triangle, judging whether each common edge is located on a wireframe corresponding to the Mesh grid data, and counting all the common edges located on the wireframe to generate first wireframe data, the first wireframe data comprising N common edges, the N common edges are shared by the M triangles, and vertex gravity center data of each triangle is determined according to the indexes of the M triangles and the N common edges; and sending the vertex gravity center data to the GPU. According to the method, only the gravity center data of a plurality of bytes are added in the vertex data, and a small amount of other storage space is added, so that compared with an existing additional generation wireframe Mesh, the storage data can be greatly reduced, and the storage space is saved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing and graphics rendering, and in particular to a method for determining vertex centroid data, a wireframe generation method and a device. Background Art

[0002] A mesh is composed of a series of triangular facets, each of which contains the index of the three points of the triangle. The index is used to find the position, normal, color, etc. of the corresponding point in the vertex list. In building construction and simulation, BIM (Building Information Modeling) contains a large amount of 3D model data, which is composed of a large number of Meshes. At the same time, in order to distinguish the relationship between geometric bodies in the massive 3D model data, it is necessary to extract the contour lines of the Mesh when generating the model, and generate a batch of wireframe Meshes. And the primitive type is linear and rendered separately.

[0003] Currently, the process of contour generation and rendering takes up a lot of storage space on the server. In addition, the server also generates wireframe meshes, which also takes up extra storage space, causing excessive network load and affecting loading performance. Summary of the invention

[0004] Therefore, in order to solve the technical problem that the wireframe Mesh generated during the graphics rendering process occupies a large storage space and causes an increase in network load, the embodiments of the present invention provide a method for determining vertex centroid data, a wireframe generation method and device, and specifically disclose the following technical solutions:

[0005] In a first aspect, an embodiment of the present invention discloses a method for determining vertex centroid data, which can be applied to a processor CPU or a processing chip, and includes:

[0006] Obtain Mesh data, which includes multiple triangles and vertex data of each triangle; determine the common edges of all two adjacent triangles based on the multiple triangles and the vertex data of each triangle, where the number of common edges is one or more; determine whether each common edge is located on a wireframe corresponding to the Mesh data, and count all common edges located on the wireframe to generate first wireframe data, which includes N common edges, which are shared by M triangles, where N≥1 and M≥2; determine the vertex centroid data of each triangle based on the indices of the M triangles and the N common edges; and send the vertex centroid data to a graphics processor GPU when the client loads the data.

[0007] In combination with the first aspect, in a possible implementation, determining whether each common edge is located on a wireframe corresponding to the Mesh data includes: determining whether a first common edge is located on the wireframe, the first common edge being shared by a first triangle and a second triangle.

[0008] Determining whether the first common edge is located on the wireframe includes: determining whether an angle between a normal line of the first triangle and a normal line of the second triangle is within a preset range; if so, determining that the first common edge is located on the wireframe.

[0009] In combination with the first aspect, in another possible implementation, the vertex centroid data of each triangle is determined based on the indices and N common edges of the M triangles, including: according to the vertex centroid allocation rule, according to the indices and N common edges of the M triangles, traversing the M triangles, and allocating vertex centroid data for each triangle.

[0010] In combination with the first aspect, in another possible implementation, after determining the vertex centroid data of each triangle based on the indices of M triangles and N common edges, it also includes: determining whether there is a conflict between all the vertex centroid data; if so, adding new vertex centroid data to the conflicting vertex centroid data and reallocating them.

[0011] In a second aspect, an embodiment of the present invention further discloses a wireframe generation method based on vertex centroid data, which can be applied to an image processor, such as a GPU, and includes:

[0012] When loading data on the client, vertex centroid data is received, and the vertex centroid data is determined by the indices of M triangles and their corresponding N common edges; the centroid coordinates of each triangle in the M triangles are determined based on the vertex centroid data; the difference in distance between the vertex centroid data of each triangle and the centroid coordinates of the current triangle is compared; if the distance difference is within a preset range, it is determined that the current vertex centroid data is located on the wireframe of the fragment, and the wireframe of the fragment is colored.

[0013] In a third aspect, an embodiment of the present invention further discloses a device for determining vertex centroid data, the device comprising:

[0014] The acquisition module is used to acquire Mesh data, which includes multiple triangles and vertex data of each triangle;

[0015] A first determining module, used for determining common edges of all two adjacent triangles according to the plurality of triangles and vertex data of each triangle, where the number of common edges is one or more;

[0016] The detection module is used to determine whether each common edge is located on the wireframe corresponding to the Mesh data.

[0017] A generation module, used for counting all common edges on the wireframe to generate first wireframe data, wherein the first wireframe data includes N common edges, the N common edges are shared by M triangles, N≥1, M≥2, and both M and N are positive integers;

[0018] The first determination module is further used to determine the vertex centroid data of each triangle according to the indexes of the M triangles and the N common edges;

[0019] The sending module is used to send vertex centroid data to the graph processor GPU when the client loads data.

[0020] In a fourth aspect, an embodiment of the present invention further discloses a wireframe generation device based on vertex centroid data, the device comprising:

[0021] A receiving module, used for receiving vertex centroid data when loading data on the client, where the vertex centroid data is determined by the indices of M triangles and their corresponding N common edges;

[0022] A second determination module is used to determine the centroid coordinates of each triangle in the M triangles according to the vertex centroid data;

[0023] A comparison module, used for comparing the difference between the vertex centroid data of each triangle and the centroid coordinates of the current triangle;

[0024] The second determination module is further used to determine that the current vertex centroid data is located on the wireframe of the fragment and color the wireframe of the fragment when the difference between the distances compared by the comparison module is within a preset range.

[0025] In a fifth aspect, an embodiment of the present invention further discloses a wireframe generation system, the system comprising a central processing unit (CPU) and a graphics processing unit (GPU), wherein:

[0026] The CPU is used to obtain Mesh data, determine the common edges of all two adjacent triangles according to multiple triangles and vertex data of each triangle, and the number of common edges is one or more; determine whether each common edge is located on the wireframe corresponding to the Mesh data, and count all common edges located on the wireframe to generate first wireframe data, determine the vertex centroid data of each triangle according to the indexes of M triangles and N common edges; and when the client loads the data, send the vertex centroid data to the GPU;

[0027] The GPU is used to receive the vertex centroid data sent by the CPU when loading data on the client, and determine the centroid coordinates of each triangle in the M triangles based on the vertex centroid data; compare the difference in distance between the vertex centroid data of each triangle and the centroid coordinates of the current triangle; if the distance difference is within a preset range, determine that the current vertex centroid data is located on the wireframe of the fragment, and color the wireframe of the fragment.

[0028] The Mesh data includes multiple triangles and vertex data of each triangle, and the first wireframe data includes N common edges, which are shared by M triangles, and N≥1 and M≥2.

[0029] In the sixth aspect, an embodiment of the present invention further discloses an electronic device, comprising a processor and a memory, wherein the memory is coupled to the processor; computer-readable program instructions are stored on the memory, and when the instructions are executed by the processor, the method for determining the vertex centroid data as described in the first aspect above, and the method for generating a wireframe based on the vertex centroid data as described in the second aspect above are implemented.

[0030] In addition, this embodiment also discloses a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method for determining vertex centroid data as described in the first aspect above and the steps of the wireframe generation method based on vertex centroid data as described in the second aspect above are implemented.

[0031] In view of the above technical problems, for BIM models, an embodiment of the present invention proposes a method for determining vertex centroid data, a wireframe generation method and a device, which determines the common edges of all two adjacent triangles according to multiple triangles in Mesh data and the vertex data of each triangle, and then generates wireframe data according to whether each common edge is located on the wireframe corresponding to the Mesh data. Finally, the vertex centroid data of each triangle is determined according to the indexes of multiple triangles and the common edges of these triangles, and the wireframe is determined using the vertex center data of these triangles. This method only adds several bytes of centroid data in the vertex data, and adds a small amount of other storage space. Compared with the existing additional generation of wireframe Mesh, it can greatly reduce the storage data and save storage space.

[0032] In addition, this method does not require a separate rendering operation, because this method can generate wireframes in real time when rendering Mesh data, and basically does not generate additional CPU overhead, so it also correspondingly greatly reduces the GPU overhead, thereby avoiding a large network load and affecting loading performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0034] Figure 1A schematic diagram of a mesh provided by an embodiment of the present invention;

[0035] Figure 2 A schematic diagram of the software structure of an electronic device provided by an embodiment of the present invention;

[0036] Figure 3 A schematic diagram of an image rendering process provided by an embodiment of the present invention;

[0037] Figure 4 A flowchart of a method for determining vertex centroid data provided by an embodiment of the present invention;

[0038] Figure 5 A schematic diagram of a triangular fragment provided by an embodiment of the present invention;

[0039] Figure 6 A schematic diagram of a triangle vertex centroid data provided by an embodiment of the present invention;

[0040] Figure 7 A flowchart of a wireframe generation method based on vertex centroid data provided by an embodiment of the present invention;

[0041] Figure 8 A structural block diagram of a device for determining vertex centroid data provided by an embodiment of the present invention;

[0042] Fig. 9 A structural block diagram of a wireframe generation device provided by an embodiment of the present invention;

[0043] Fig.10 A schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0044] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0045] First, the technical terms involved in the technical solution of this application are explained.

[0046] Mesh, literally translated as "mesh", is composed of a series of triangular patches. A triangular patch contains the index of the three points of the triangle. Through the index, the position, normal, color, etc. of the corresponding point can be found in the vertex list. Figure 1As shown, a dog-shaped three-dimensional model is shown, which includes a series of triangular facets. Each triangular facet can be composed of three vertices to form a triangle, and the vertices are associated with information such as position, normal, and color.

[0047] Rendering instruction. In the application stage, after the CPU prepares the data and completes the transmission task, the CPU sends a rendering instruction to the GPU. This rendering instruction is called a "Draw Call". The so-called Draw Call is a pointer to a list of primitives that need to be rendered, including the material information corresponding to the primitive list; that is, the CPU calls the graphics API interface and instructs the GPU to perform rendering operations.

[0048] like Figure 2 The figure is a schematic diagram of the software structure of an electronic device provided by an embodiment of the present invention. Taking the terminal device of the Android system as an example, the layered architecture divides the software into several layers, and each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. Figure 2 In some embodiments, the Android system in the software structure of the terminal device is divided into an application layer (APP), a rendering layer and a data processing layer from top to bottom. In addition, after the data processing layer, a hardware abstraction layer (HAL) is also included (in Figure 2 not shown).

[0049] Furthermore, the application layer may include a series of application packages, such as Web APP, calendar APP, H5 (5th generation HTML, Hypertext Markup Language), PC, mobile phone, etc. In this embodiment, Web APP is an application presented on the web page.

[0050] The rendering layer may be a framework layer. The framework layer provides an application programming interface (API) and a programming framework for the application program of the application layer. The framework layer includes some predefined functions.

[0051] like Figure 2 As shown, the rendering layer can be used to perform operations such as model loading, mesh loading, vertex data loading, material loading, as well as model rendering, mesh rendering, and outline rendering.

[0052] The data processing layer includes at least one functional module for executing functions such as mesh batching, vertex data generation, outline vertex center of gravity data generation, material saving, texture saving, and material attribute saving to data texture.

[0053] In addition, the main function of the hardware abstraction layer HAL is to abstract the hardware. It puts all the actions of controlling the hardware into the Android HAL. In this embodiment, the HAL includes a graphics card, and the graphics card includes components such as a vertex shader, a fragment shader, and a memory.

[0054] Among them, the fragment shader (Fragment Shader) can also be called the pixel shader (Pixel Shader), which is used to calculate the color for each fragment and use operations such as texture sampling. Specifically, the fragment shader runs the fragment shader for each pixel that needs to be rendered, sets the color of the pixel, and finally renders it on the screen. Each pixel needs to be called once.

[0055] It should be understood that the above software architecture diagram may also include other more or fewer modules, and this embodiment does not limit this.

[0056] Usually, the image generation and processing process includes the following processing steps: application stage, geometry stage and rasterization stage. Figure 3 As shown in the figure, in the application stage, the CPU is mainly responsible and can be controlled by the developer. At this stage, the CPU will decide to pass some data to the GPU, such as data texture, polygon mesh, polygon mesh vertices, framing settings and light source data, such as the lights in the rendering target scene, the model of the scene, the position of the camera, etc. In addition, the data passed to the GPU also includes the rendering status of the data, such as texture data, vertex center of gravity data, material, etc.

[0057] The geometry stage and rasterization stage are mainly executed by the GPU. In the geometry stage, the GPU will further process the data sent by the CPU in the application stage (such as vertex centroid data). This stage includes multiple steps. For example, geometric transformations are performed in sequence through primitive data, vertex shaders, tessellation shaders, collection shaders, projection, clipping, screen mapping, etc. These processing processes can be understood as the processes on a factory assembly line.

[0058] In the rasterization stage, the main operations performed are rasterization processing and lighting calculation. Specifically, the GPU processes the vertex information collected in the video memory through primitive assembly, triangle traversal, fragment shader, and fragment-by-fragment operations, and finally generates an image and displays it on the monitor.

[0059] The method provided in this embodiment involves the vertex centroid data processing process in the aforementioned "application stage", as well as the process of generating images by rendering by the fragment shader in the geometry stage and rasterization node.

[0060] Mainly used to solve the following technical problems:

[0061] 1. During the rasterization stage, rendering requires additional wireframe Mesh data to be generated. The storage space occupied by these Mesh data is approximately 35% to 300% of the original Mesh. As a result, the BIM model lightweight engine, as a network real-time rendering engine, occupies a large storage space, increases the network load, and affects the loading performance.

[0062] 2. The wireframe mesh data in the current solution needs to be rendered separately, which will increase the CPU and GPU overhead, affecting the rendering performance and the smoothness of the operation.

[0063] In order to solve the technical problems in the above-mentioned rendering process, an embodiment of the present invention proposes a technical solution for real-time generation of a wireframe (outline) during rendering based on vertex centroid data. The technical solution provided by the embodiment of the present application is described in detail below.

[0064] The technical solution of the present application can be applied to an electronic device, such as a mobile phone. The mobile phone can also be other terminal devices, which can be a portable device, such as a smart phone, a tablet computer, a personal computer (PC), a foldable terminal, a user device or a user equipment (UE), etc. This embodiment does not limit the specific device form of the terminal device.

[0065] In addition, the above-mentioned various terminal devices are equipped with an Android operating system and / or an Android-compatible system.

[0066] See also Figure 4 , which is a method for determining vertex centroid data proposed in an embodiment of the present invention. The method is based on the real-time wireframe generation technology in the BIM model lightweight engine, and a technical solution for realizing real-time wireframe generation by means of vertex centroid data, rasterization, edge search and other principles.

[0067] The method is executed by the CPU in the application stage. Specifically, the method includes:

[0068] Step 101, obtaining Mesh data, wherein the Mesh data includes a plurality of triangles and vertex data of each triangle.

[0069] Among them, the mesh data is as described above. Figure 1The triangular mesh data shown. Specifically, one way to obtain the Mesh data is that the CPU of the terminal device first obtains the three-dimensional model data, such as the three-dimensional model data of a building (such as BIM model data), and then parses the three-dimensional model data to obtain the Mesh data. The specific process of parsing to obtain the Mesh data can be achieved by a lightweight method or other methods, which will not be described in detail in this embodiment.

[0070] After parsing, multiple triangles and vertex data of each triangle are obtained, and the vertex data can be represented by x, y, and z coordinates. It should be understood that the vertex data includes but is not limited to vertex coordinates.

[0071] Step 102: determining common edges of all two adjacent triangles based on the multiple triangles and vertex data of each triangle, where the number of the common edges is one or more.

[0072] Among them, two adjacent triangles generate a common edge, which is also called a "shared edge" (Creaseedge).

[0073] A crease edge is an edge shared by two triangles, but the angle between them exceeds a certain value (dihedral angle, usually 60 degrees). For example, a cube contains multiple crease edges.

[0074] Specifically, whether a common edge is included can be determined by the vertex index of each triangle. For example, if the three vertex indexes of the first triangle are 123, and the three vertex indexes of the second triangle are 234, then there is a common edge 23 between the two triangles.

[0075] Step 103, determining whether each of the common edges is located on the wireframe corresponding to the Mesh grid data, and counting all the common edges located on the wireframe to generate first wireframe data.

[0076] The first wireframe data includes N common edges, and the N common edges are shared by M triangles, where N≥1, M≥2, and both M and N are positive integers. In this embodiment, it is assumed that there is at least one common edge, that is, the common edge is shared by two triangles.

[0077] Step 104: Determine the vertex centroid data of each triangle according to the indices of the M triangles and the N common edges.

[0078] Among them, vertex data includes Position (position, three-dimensional space), Color (color), Normal (normal), UV (texture coordinates), etc. The image graphics are generated by rendering the vertex data. The vertex data includes vertex centroid data.

[0079] Specifically, one implementation is to traverse the M triangles according to the vertex centroid allocation rule, according to the indices of the M triangles and the N common edges, allocate vertex centroid data to each triangle, and write the vertex center data into the mesh data.

[0080] Step 105: When the client loads the data, the vertex centroid data is sent to the graphics processor GPU.

[0081] When the client is detected loading data, the CPU transfers the mesh with the written vertex center data to the GPU for rasterization and image rendering.

[0082] When rastering (rendering pipeline), each triangle is stroked, so it is necessary to determine how far the current fragment (pixel) is from the three sides of the triangle. Once it is less than the width of the border, the current fragment is colored with the color of the upper border. Currently, the barycentric coordinate system is constructed with the three vertices of the triangle, and the barycentric coordinates corresponding to the current fragment can be obtained by interpolation of the fragment shader. And in the rasterization process, the barycentric coordinates are used as weights to determine the color of the fragment.

[0083] See also Figure 5 As shown, among the three vertices C1, C2 and C3 of a triangle, the weight values ​​corresponding to λ1, λ2 and λ3 are determined respectively. According to these three weight values, the color of the centroid data point P is determined as: C1·λ1+C2·λ2+C3·λ3.

[0084] like Figure 6 As shown, in a triangle, the three vertices are A1, A2 and A3, where A1's vertex index is 0, and the vertex centroid data is (1,0,0), A2's vertex index is 2, and the vertex centroid data is (0,0,1), and A3's vertex index is 1, and the vertex centroid data is (0,1,0). To determine whether the three edges A1A2, A1A3, and A2A3 of the triangle are on the wireframe, the following method can be used:

[0085] In a specific implementation, the above step 103: determining whether each common edge is located on the wireframe corresponding to the Mesh data includes: taking the first common edge as an example, determining whether the first common edge is located on the wireframe, and the first common edge is shared by the first triangle and the second triangle.

[0086] Then step 103: determine whether the first common edge is located on the wireframe, including: determine whether the angle between the normal of the first triangle and the normal of the second triangle is within a preset range; if so, determine that the first common edge is located on the wireframe; otherwise, it is not on the wireframe.

[0087] For example, Crease edge 1 is the common edge of triangle 1 and triangle 2. It is determined whether Crease edge 1 is located on the wireframe based on triangle 1 and triangle 2. If so, it is determined that Crease edge 1 is part of the wireframe. According to the angle between the normals of the triangles, the determination method is given with an example; if the angle is within a preset range, such as 45° to 135°, it is determined that Crease edge 1 is on the wireframe of the entire model; otherwise, it is not on the wireframe. In addition, it also includes: if it is, that is, on the wireframe, then the relationship between triangle 1, triangle 2, and Crease edge 1 is recorded.

[0088] Similarly, this method can also be used to determine whether other common edges, such as crease edges, belong to the border. This embodiment does not give examples one by one.

[0089] In another embodiment, whether the common edge Crease edge1 is located on the wireframe can also be determined by calculating the distance, comparing whether the distance between a point Q on the current Crease edge1 and the vertex centroid coordinates is within a preset distance. If so, it is determined that the point Q of the current Crease edge1 is located on the wireframe, otherwise, it is not on the wireframe.

[0090] This embodiment proposes a method for determining vertex centroid data, which determines the common edges of all two adjacent triangles based on multiple triangles in Mesh data and the vertex data of each triangle, and then generates wireframe data based on whether each common edge is located on the wireframe corresponding to the Mesh data. Finally, the vertex centroid data of each triangle is determined based on the indexes of the multiple triangles and the common edges of these triangles, and the wireframe is determined using the vertex center data of these triangles. This method only adds several bytes of centroid data to the vertex data, and adds a small amount of other storage space. The total increased storage space is 10% to 20%. Compared with the existing additionally generated wireframe Mesh, the storage space occupies 35-300% of the original Mesh. This method can greatly reduce the storage data and save storage space.

[0091] In addition, this method does not require a separate rendering operation, because this method can generate wireframes in real time when rendering Mesh data, and basically does not generate additional CPU overhead, so it also correspondingly greatly reduces the GPU overhead, thereby avoiding a large network load and affecting loading performance.

[0092] In addition, in the above step 104, after determining the vertex centroid data of each triangle based on the indices of M triangles and N common edges, the method also includes: determining whether there is a conflict between all the vertex centroid data; if so, adding new vertex centroid data to the conflicting vertex centroid data and reallocating them.

[0093] After the above-mentioned vertex position P of the triangle through the vertex centroid data, it is still necessary to determine whether the vertex centroid data allocation conflicts; that is, the same vertex data is allocated to two or more triangles. If there is a conflict, for example, the first vertex of triangle 1 and the second vertex of triangle 2 are the same point A1; but the vertex centroid data of A1 in triangle 1 is (1,0,0), and the vertex centroid data of A1 in triangle 2 is (1,1,0), and the two are different, then copy point A1 to get B1, and assign the vertex centroid data of A1 (1,0,0) to triangle 1, and assign the vertex centroid data of point B1 (1,1,0) to triangle 2, thereby avoiding the conflict.

[0094] If the vertex centroid data do not conflict, the vertex centroid data is generated and saved for subsequent loading.

[0095] The method provided in this embodiment uses a solution of adding vertices after allocating vertex centroid data to solve the conflict problem of vertex centroid allocation, ensures that the allocated vertex centroid data is reasonable and not reused, and improves the accuracy of using these Mesh data in subsequent image rendering.

[0096] The above-mentioned embodiment is the data processing process of the geometry stage, and the processing process of the rasterization stage is introduced below.

[0097] See also Figure 7 As shown, a wireframe generation method based on vertex centroid data provided by this embodiment can be applied to a GPU, and a wireframe is generated in real time on the GPU side using vertex centroid data determined by a CPU. The GPU includes a fragment shader, and the fragment shader uses the centroid coordinates as weights to determine the color of the fragment.

[0098] like Figure 7 As shown, the method includes:

[0099] Step 201: When loading data on the client, vertex centroid data is received.

[0100] The vertex centroid data is determined by the indices of the M triangles and their corresponding N common edges. Specifically, the vertex centroid data can be data written into the mesh after being determined by the CPU, and obtained through the written data. Further, the determination process of the vertex centroid data can refer to the aforementioned Figure 3The method steps shown are not repeated in this embodiment.

[0101] Step 202: Determine the centroid coordinates of each of the M triangles according to the vertex centroid data.

[0102] The GPU parses the vertex centroid data in the mesh data to obtain M triangles and the centroid coordinates of each triangle.

[0103] Step 203: Compare the difference between the vertex centroid data of each triangle and the centroid coordinates of the current triangle.

[0104] The center of gravity coordinates of the current triangle, during the rasterization process, the graphics card will interpolate the three vertex data of the triangle to obtain the vertex data of the current fragment, and the vertex data includes the center of gravity coordinates of the current triangle. The graphics card generates the vertex data in real time.

[0105] The vertex centroid data of each triangle may be determined by the method of steps 101 to 105 of the above embodiment and sent by the GPU to the fragment shader.

[0106] Step 204: If the distance difference is within a preset range, determine that the current vertex centroid data is located on the wireframe of the fragment, and color the wireframe of the fragment.

[0107] Compare each distance difference calculated in step 203 with the preset range d 设 If the size relationship between them is less than or equal to d 设 , then it is determined that the vertex center data is on the wireframe; otherwise, it is not on the wireframe.

[0108] When rendering an image, this method rasterizes the vertex centroid data and passes it to the pixel shader. Based on the passed vertex centroid data, the distance between the current fragment and the three edges of the triangle can be calculated. If it is less than the given border width (i.e. the preset range d 设 ), then the current fragment is painted with the preset border color to complete the real-time wireframe generation.

[0109] In the GPU image rendering stage, this embodiment designs a real-time wireframe generation solution in the BIM model lightweight engine, which greatly reduces the storage space of wireframe data and improves the efficiency of data loading and scheduling; it generates wireframes in real time during rendering, which improves the rendering efficiency of wireframes.

[0110] In addition, this method does not need to generate more mesh data additionally, does not need to bind the wireframe and the original Mesh, but draws it together with the original Mesh data to improve rendering efficiency.

[0111] In the present embodiment, a method for determining vertex centroid data is also provided, and the device is used to implement the method for determining vertex centroid data in the above-mentioned embodiment, which has been described and will not be repeated. As used below, the term "unit" or "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware is also possible and conceived.

[0112] This embodiment provides a device for determining vertex centroid data, such as Figure 8 As shown, the device comprises:

[0113] The acquisition module 801 is used to acquire Mesh data, where the Mesh data includes a plurality of triangles and vertex data of each triangle.

[0114] The first determining module 802 is used to determine the common edges of all two adjacent triangles according to the multiple triangles and the vertex data of each triangle, where the number of the common edges is one or more.

[0115] The detection module 803 is used to determine whether each of the common edges is located on the wireframe corresponding to the Mesh grid data.

[0116] The generation module 804 is used to count all common edges on the wireframe to generate first wireframe data, where the first wireframe data includes N common edges, where the N common edges are shared by M triangles, N≥1, M≥2, and M and N are positive integers.

[0117] The first determination module 802 is further configured to determine vertex centroid data of each triangle according to the indices of the M triangles and the N common edges.

[0118] The sending module 805 is used to send the vertex centroid data to the graphics processor GPU when the client loads the data.

[0119] In a specific implementation of this embodiment, the detection module 803 is specifically used to determine whether a first common edge is located on the wireframe, and the first common edge is shared by the first triangle and the second triangle.

[0120] Furthermore, the detection module 803 is further specifically configured to determine whether the angle between the normal line of the first triangle and the normal line of the second triangle is within a preset range; if so, determining that the first common edge is located on the wireframe.

[0121] Optionally, in another specific implementation of the present embodiment, the first determination module 802 is further specifically used to traverse the M triangles according to the vertex centroid allocation rule, according to the indices of the M triangles and the N common edges, and allocate vertex centroid data to each triangle.

[0122] Optionally, in another specific implementation of the present embodiment, the detection module 803 is further used to determine whether there is a conflict between all the vertex centroid data; if so, for the conflicting vertex centroid data, new vertex centroid data is added and redistributed.

[0123] Furthermore, in another embodiment, Fig. 9 As shown, a wireframe generation device based on vertex centroid data is also provided, which is used to implement the function of the aforementioned wireframe generation method based on vertex centroid data, and the device includes:

[0124] The receiving module 901 is used to receive vertex centroid data when loading data on the client, where the vertex centroid data is determined by the indices of M triangles and their corresponding N common edges.

[0125] The second determination module 902 is used to determine the centroid coordinates of each triangle in the M triangles according to the vertex centroid data.

[0126] The comparison module 903 is used to compare the difference between the vertex centroid data of each triangle and the centroid coordinates of the current triangle.

[0127] The second determination module 904 is further configured to determine that the current vertex centroid data is located on the wireframe of the fragment and color the wireframe of the fragment when the difference between the distances compared by the comparison module is within a preset range.

[0128] In addition, the above-mentioned device also includes other more or fewer units / modules, such as a sending module, a storage module, etc., which is not limited in this embodiment.

[0129] It should be noted that the vertex centroid data determination device and wireframe generation device in the above embodiments are presented in the form of functional units, where the units refer to ASIC circuits, processors and memories that execute one or more software or fixed programs, and / or other devices that can provide the above functions.

[0130] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0131] The embodiment of the present invention also provides an electronic device having the above Figure 8 The device for determining the vertex center of gravity data shown in FIG. Fig. 9 The wireframe generating device shown.

[0132] See also Fig.10 , is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention, the electronic device includes: a CPU, a bridge, a system memory, a GPU (Graphics Processing Unit) and at least one video memory.

[0133] The CPU is connected to the GPU via a bridge, and the CPU is also connected to the system memory via the bridge. The GPU is connected to at least one video memory via an internal switching bus.

[0134] See also Fig.10 The GPU includes a driver interface, a data input assembly module, a vertex task distribution module, a pixel task distribution module, a computing task distribution module, several SMs (streaming multiprocessors), an internal switching bus, a Raster Operations Unit (ROP) and an L2 cache.

[0135] Specifically, the CPU is used to obtain Mesh data, determine the common edges of all two adjacent triangles based on multiple triangles and vertex data of each triangle, and the number of common edges is one or more; determine whether each common edge is located on the wireframe corresponding to the Mesh data, and count all common edges located on the wireframe to generate the first wireframe data, determine the vertex centroid data of each triangle based on the indices of M triangles and N common edges; and when the client loads the data, send the vertex centroid data to the GPU.

[0136] The GPU is used to receive the vertex centroid data sent by the CPU when loading data on the client, and determine the centroid coordinates of each triangle in the M triangles based on the vertex centroid data; compare the difference in distance between the vertex centroid data of each triangle and the centroid coordinates of the current triangle; if the distance difference is within a preset range, determine that the current vertex centroid data is located on the wireframe of the fragment, and color the wireframe of the fragment.

[0137] Among them, the CPU sends the Mesh mesh data to the data input assembly module through the driver interface, and then distributes the data to various task distribution modules, such as vertex task distribution module, pixel task distribution module, calculation task distribution module, etc. These task distribution modules send the data to be processed to one or more SM stream processors, and one or more SM stream processors are used to perform processing operations such as viewport / clipping / rasterization / depth test.

[0138] In one embodiment, each SM stream processor includes: structural functions such as vertex shader, pixel shader and texture unit, which are used to process vertex coordinates, pixel values ​​and texture data. The processed data is sent to ROP and L2 through the internal exchange bus. The SM stream processor also includes the extraction and identification of different materials in the model.

[0139] In addition, ROP indicates the number of ROP raster operation processing units that the display GPU has. The rendering process of the ROP unit includes: first, the picked-up materials and the pixels processed by the SM stream processor will be transmitted to the corresponding z / stencil buffer. The ROP unit will perform z / stencil checks on these textures and pixels (i.e., front and back occlusion relationship checks). The judgment of depth and template information enables ROP to decide which pixels to display, thereby avoiding completely occluded pixels from being mistakenly displayed in front, and also reducing the pressure on the subsequent output part.

[0140] Finally, the image data after ROP processing is stored in a video memory, which includes but is not limited to DRAM (Dynamic Random Access Memory).

[0141] The above, Fig.10 The CPU (Central Processing Unit) shown may be a central processing unit. The CPU may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0142] The system memory stores computer program instructions executable by the CPU, so that the CPU can execute the vertex centroid data determination method shown in the above embodiment.

[0143] The system memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the system memory may optionally include a memory remotely arranged relative to the CPU, and these remote memories may be connected to the electronic device 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.

[0144] The system memory may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as flash memory, a hard disk or a solid state drive; the system memory may also include a combination of the above types of memory.

[0145] The electronic device also includes an input device and an output device. The input device includes but is not limited to a touch screen, a keypad, a mouse, a track pad, a touch pad, a pointer, one or more mouse buttons, a track ball, a joystick, etc. The output device may include a display device, etc. The display device includes but is not limited to a liquid crystal display, a light emitting diode, a display, and a plasma display.

[0146] The embodiment of the present invention also provides a computer-readable storage medium, and the method according to the embodiment of the present invention can be implemented in hardware, firmware, or implemented as a computer code that can be recorded in a storage medium, or downloaded through a network and originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state drive, etc.; further, the storage medium can also include a combination of the above-mentioned types of memory.

[0147] It can be understood that a computer, processor, microprocessor controller or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by the computer, processor or hardware, the method shown in the above embodiment is implemented.

[0148] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A method for determining vertex centroid data, characterized in that: The method comprises: Acquire Mesh data, wherein the Mesh data includes a plurality of triangles and vertex data of each triangle; Determine common edges of all two adjacent triangles according to the plurality of triangles and vertex data of each triangle, where the number of the common edges is one or more; Determine whether each of the common edges is located on a wireframe corresponding to the Mesh data, and count all the common edges located on the wireframe to generate first wireframe data, wherein the first wireframe data includes N common edges, and the N common edges are shared by M triangles, where N≥1 and M≥2; Determine vertex centroid data of each triangle according to the indices of the M triangles and the N common edges; When the client loads the data, the vertex centroid data is sent to the graphics processor GPU.

2. The method according to claim 1, characterized in that The determining whether each of the common edges is located on a wireframe corresponding to the Mesh data includes: determining whether a first common edge is located on the wireframe, the first common edge being shared by a first triangle and a second triangle; The determining whether the first common edge is located on the wireframe includes: Determining whether an angle between a normal line of the first triangle and a normal line of the second triangle is within a preset range; If yes, it is determined that the first common edge is located on the wireframe.

3. The method according to claim 1, characterized in that Determining the vertex centroid data of each triangle according to the indexes of the M triangles and the N common edges includes: According to the vertex centroid allocation rule, according to the indices of the M triangles and the N common edges, the M triangles are traversed to allocate vertex centroid data to each triangle.

4. The method according to any one of claims 1 to 3, characterized in that: After determining the vertex centroid data of each triangle according to the indexes of the M triangles and the N common edges, the method further includes: Determine whether there is a conflict between all the vertex centroid data; If so, for the conflicting vertex centroid data, new vertex centroid data is added and redistributed.

5. A wireframe generation method based on vertex centroid data, characterized in that: The method comprises: When loading data on the client, vertex centroid data is received, where the vertex centroid data is determined by the indices of M triangles and their corresponding N common edges; Determine the centroid coordinates of each triangle in the M triangles according to the vertex centroid data; Compare the difference between the vertex centroid data of each triangle and the centroid coordinates of the current triangle; If the difference between the distances is within a preset range, it is determined that the current vertex centroid data is located on the wireframe of the fragment, and the wireframe of the fragment is colored.

6. A device for determining vertex centroid data, characterized in that: The device comprises: An acquisition module is used to acquire Mesh data, wherein the Mesh data includes a plurality of triangles and vertex data of each triangle; A first determining module, configured to determine common edges of all two adjacent triangles according to the plurality of triangles and vertex data of each triangle, wherein the number of the common edges is one or more; A detection module is used to determine whether each of the common edges is located on the wireframe corresponding to the Mesh grid data, A generating module, configured to count all common edges on the wireframe to generate first wireframe data, wherein the first wireframe data includes N common edges, and the N common edges are shared by M triangles, where N≥1 and M≥2; The first determination module is further used to determine the vertex centroid data of each triangle according to the indexes of the M triangles and the N common edges; The sending module is used to send the vertex centroid data to the graphics processor GPU when the client loads the data.

7. A wireframe generation device based on vertex centroid data, characterized in that: The device comprises: A receiving module, used for receiving vertex centroid data when loading data on a client, wherein the vertex centroid data is determined by indices of M triangles and their corresponding N common edges; A second determination module, used to determine the centroid coordinates of each triangle in the M triangles according to the vertex centroid data; A comparison module, used for comparing the difference between the vertex centroid data of each triangle and the centroid coordinates of the current triangle; The second determination module is further configured to determine that the current vertex centroid data is located on the wireframe of the fragment and color the wireframe of the fragment when the difference between the distances compared by the comparison module is within a preset range.

8. A wireframe generation system, characterized in that: It includes a central processing unit (CPU) and a graphics processing unit (GPU), among which: The CPU is used to obtain Mesh data, wherein the Mesh data includes a plurality of triangles and vertex data of each triangle; The CPU is also used to determine the common edges of all two adjacent triangles according to the multiple triangles and the vertex data of each triangle, where the number of the common edges is one or more; determine whether each of the common edges is located on the wireframe corresponding to the Mesh grid data, and count all the common edges located on the wireframe to generate first wireframe data, and determine the vertex centroid data of each triangle according to the indexes of the M triangles and the N common edges; and when the client loads the data, send the vertex centroid data to the GPU, where the first wireframe data includes N common edges, and the N common edges are shared by the M triangles, and N≥1, M≥2; The GPU is used to receive the vertex centroid data sent by the CPU when loading data on the client, determine the centroid coordinates of each triangle in M ​​triangles based on the vertex centroid data; compare the difference in distance between the vertex centroid data of each triangle and the centroid coordinates of the current triangle; if the distance difference is within a preset range, determine that the current vertex centroid data is located on the wireframe of the fragment, and color the wireframe of the fragment.

9. An electronic device, characterized in that: comprising a processor and a memory, the memory being coupled to the processor; The memory stores computer-readable program instructions, and when the instructions are executed by the processor, the method according to any one of claims 1 to 4 or claim 5 is implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 4 or claim 5 is implemented.