CN116611991B - Processing method and system for drawing complex scene based on GPU - Google Patents
Processing method and system for drawing complex scene based on GPU Download PDFInfo
- Publication number
- CN116611991B CN116611991B CN202310889781.3A CN202310889781A CN116611991B CN 116611991 B CN116611991 B CN 116611991B CN 202310889781 A CN202310889781 A CN 202310889781A CN 116611991 B CN116611991 B CN 116611991B
- Authority
- CN
- China
- Prior art keywords
- image data
- sphere
- vertex
- gpu
- new
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T1/00—General purpose image data processing
- G06T1/20—Processor architectures; Processor configuration, e.g. pipelining
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T1/00—General purpose image data processing
- G06T1/60—Memory management
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T17/00—Three dimensional [3D] modelling, e.g. data description of 3D objects
- G06T17/20—Finite element generation, e.g. wire-frame surface description, tesselation
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Graphics (AREA)
- Geometry (AREA)
- Software Systems (AREA)
- Image Generation (AREA)
Abstract
The invention relates to the technical field of image drawing, in particular to a processing method and a processing system for drawing a complex scene based on a Graphic Processing Unit (GPU). The processing method comprises the following steps: the CPU module sends the first image data and the calculation instruction to the GPU module; the GPU module receives the first image data and the calculation instruction, executes the calculation instruction, performs calculation processing on the first image data, and generates second image data; the GPU module sends the second image data to the video memory for storage; and the CPU module reads second image data in the video memory and draws a new image according to the second image data. The processing method and the processing system provided by the invention are realized based on the GPU, and the intersecting condition of each old triangle and the sphere of the drawing sphere is calculated by using the GPU, so that the time consumption is only in the millisecond level, and the CPU operation is far better than that of the old triangle. In complex scenarios of millions of levels and above, the advantages of GPU operations over CPU operations can be better represented.
Description
Technical Field
The invention belongs to the technical field of image drawing, and particularly relates to a processing method and system for drawing a complex scene based on a Graphic Processing Unit (GPU).
Background
The field of industrial simulation requires the rendering of triangular faces of certain areas in a scene in different colours to label the different uses of these area faces. At present, a scheme for drawing triangle faces in different areas of a scene generally adopts a CPU to traverse triangle faces in all grids (meshes) in a scene tree, and then to cross with brushes (sphere faces) for drawing areas to generate all triangles tangent to the sphere faces. Finally, generating an independent grid (mesh) by all triangles in the sphere, and setting a single color by different materials to render a corresponding triangle area.
The CPU performs geometric operations on triangle surfaces of more than several millions of levels in a complex scene, which is very inefficient. Although the CPU can also perform parallel computation, compared with the parallel computing capability of the GPU, the performance and efficiency of the CPU are limited, and cannot meet the requirement of large-scale data processing.
Modern GPUs have a large number of processor units, each capable of performing a large number of computing tasks and supporting simultaneous processing of multiple data streams. This parallel computing capability may enable the GPU to complete computing tasks faster than the CPU when processing large-scale data. Therefore, there is a need to provide a processing method and system for rendering complex scenes based on GPU.
Disclosure of Invention
In view of the above problems, the present invention provides a processing method for rendering a complex scene based on a GPU, the processing method comprising:
the CPU module sends the first image data and the calculation instruction to the GPU module; wherein the first image data includes a first index number and a first vertex coordinate set; the computing instructions comprise a radius parameter depicting the sphere and a scanning sequence depicting the sphere;
the GPU module receives the first image data and the calculation instruction, executes the calculation instruction, performs calculation processing on the first image data, and generates second image data; wherein the second image data includes first new image data and second new image data; the first new image data comprises a first new image index number and a first new image vertex coordinate set; the second new image data comprises a second new image index number, a second vertex coordinate set and an intersection point coordinate set;
the GPU module sends the second image data to the video memory for storage;
and the CPU module reads second image data in the video memory and draws a new image according to the second image data.
Further, the first index number refers to a unique identifier of the old triangle face in the current scene; the first vertex coordinate set refers to a set of three vertex coordinates of the old triangle face.
Further, the calculating the first image data includes:
judging the position relation between each vertex of the old triangle surface corresponding to the first image data and the drawing sphere;
when all three vertexes of the old triangle face are not outside the drawing sphere, defining a first index number of the old triangle face as a first new image index number of the new triangle face; defining three vertex coordinates of the old triangle surface as a first new image vertex coordinate set of the new triangle surface;
when the vertex on the old triangle surface is outside the drawing sphere and the vertex is inside the drawing sphere, defining the first index number of the old triangle surface as the second new image index number of the new triangle surface; defining all vertex coordinates of the old triangle facet located within or on the delineating sphere as a second set of vertex coordinates; and calculating all intersection point coordinates of each side of the old triangle surface and the sphere of the drawing sphere, and defining all intersection point coordinates as an intersection point coordinate set.
Further, the method for judging the positional relationship between each vertex of the old triangle surface and the drawing sphere comprises the following steps:
according to the first vertex coordinate set, calculating the distance between each vertex of the old triangle surface and the sphere center of the drawing sphere;
if the distance between the vertex and the sphere center of the drawing sphere is larger than the radius of the drawing sphere, the vertex is outside the drawing sphere;
if the distance between the vertex and the sphere center of the drawing sphere is equal to the radius of the drawing sphere, the vertex is represented to be on the sphere of the drawing sphere;
if the distance between the vertex and the center of the drawing sphere is smaller than the radius of the drawing sphere, the vertex is indicated to be in the drawing sphere.
In order to achieve the above processing method for drawing a complex scene based on a GPU, the present invention also provides a processing system for drawing a complex scene based on a GPU, the processing system comprising:
the CPU module is used for sending the first image data and the calculation instruction to the GPU module; the method comprises the steps of reading second image data in a video memory, and drawing a new image according to the second image data; wherein the first image data includes a first index number and a first vertex coordinate set;
the GPU module is used for receiving the first image data and the calculation instruction sent by the CPU module, executing the calculation instruction, carrying out calculation processing on the first image data and generating second image data; transmitting the second image data to a display memory; wherein the second image data includes first new image data and second new image data; the first new image data comprises a first new image index number and a first new image vertex coordinate set; the second new image data comprises a second new image index number, a second vertex coordinate set and an intersection point coordinate set;
and a memory for storing the second image data.
Further, the first index number refers to a unique identifier of the old triangle face in the current scene; the first vertex coordinate set refers to a set of three vertex coordinates of the old triangle surface;
the computing instructions include a radius parameter describing the sphere and a scan order describing the sphere.
Further, the GPU module includes:
the receiving unit is used for receiving the first image data and the calculation instruction sent by the CPU module, executing the calculation instruction and sending the first image data to the judging unit;
the judging unit is used for receiving the first image data and carrying out calculation analysis on the position relationship between each vertex of the old triangle surface corresponding to the first image data and the drawing sphere surface; generating first new image data according to the analysis result, and sending and storing the first new image data into a video memory; or generating a second new image index number and a second vertex set, sending and storing the second new image index number and the second vertex set into a video memory, and sending the first image data to a computing unit;
the computing unit is used for receiving the first image data and computing and generating an intersection point coordinate set according to the first image data; and sending and storing the intersection point coordinate set into a display memory.
Further, the judging unit calculates and analyzes the position relationship between each vertex of the old triangle surface corresponding to the first image data and the depicted sphere, and the adopted formula is as follows:
wherein (C) x ,C y ,C z ) To describe the coordinates of the sphere center of the sphere; (x) 0 ,y 0 ,z 0 ) Coordinates for the vertex to be solved; d is the distance between the vertex to be solved and the center of the drawing sphere.
Further, the video memory comprises a plurality of pixels, and each pixel comprises a plurality of storage channels;
the second image data are stored in the memory channels of the pixels, each second image data requiring at least three consecutive pixels to be stored.
The beneficial effects of the invention are as follows:
the processing method and the processing system provided by the invention are realized based on the GPU, and the intersecting condition of each old triangle and the sphere of the drawing sphere is calculated by using the GPU, so that the time consumption is only in the millisecond level, and the CPU operation is far better than that of the old triangle. In complex scenarios of millions of levels and above, the advantages of GPU operations over CPU operations can be better represented. In addition, the technical scheme of the invention has low implementation cost and high reliability, and can be realized through the configuration of the display card of the common computer. The GPU operation can be operated in real time, the fluency is high, and the CPU operation cannot be achieved.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention may be realized and attained by the structure particularly pointed out in the written description and drawings.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 shows a flow diagram of a processing method according to an embodiment of the present invention;
FIG. 2 illustrates a schematic diagram of a processing system according to an embodiment of the present invention;
FIG. 3 shows an illustration of a first new triangle facet rendering scenario of an embodiment of the present invention;
FIG. 4 shows an illustration of a second new triangle facet rendering scenario of an embodiment of the present invention;
FIG. 5 shows an illustration of a third new triangle facet rendering scenario of an embodiment of the present invention;
FIG. 6 shows an illustration of a fourth new triangle facet rendering scenario of an embodiment of the present invention;
fig. 7 shows an illustration of a fifth new triangle facet rendering scenario of an embodiment of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Example 1
The embodiment of the invention provides a processing method for describing a complex scene based on a GPU (graphics processing Unit), which comprises the following steps of:
the CPU module sends the first image data and the calculation instruction to the GPU module;
the GPU module receives the first image data and the calculation instruction, executes the calculation instruction, performs calculation processing on the first image data, and generates second image data;
the GPU module sends the second image data to the video memory for storage;
and the CPU module reads second image data in the video memory and draws a new image according to the second image data.
Illustratively, the CPU module provides the first image data based on an open graphics library (Open Graphics Library, openGL) and sends the computing instructions to the GPU module via the open graphics library.
Specifically, the first image data includes, but is not limited to, a first index number and a first vertex coordinate set. The first index number refers to a unique identifier of the old triangle face in the current drawing scene; the first vertex coordinate set refers to a set of three vertex coordinates of the old triangle surface; each first index number and one first vertex coordinate set are in a unique corresponding relationship.
In particular, the computing instructions include, but are not limited to, a radius parameter describing the sphere and a scan order describing the sphere.
Illustratively, the GPU module determines radius parameters of the drawn sphere according to the calculation instructions sent by the CPU module; and a movement rule describing the coordinates of the sphere center of the sphere in the scanned scene is set.
Further, the GPU module calculates and analyzes the position relation between the old triangle surface corresponding to the first image data and the drawing sphere through the first image data to generate second image data. The second image data includes, but is not limited to, first new image data and second new image data.
Specifically, the first new image data includes a first new image index number and a first new image vertex coordinate set.
Further, the calculating the first image data includes:
judging the position relation between each vertex of the old triangle surface corresponding to the first image data and the drawing sphere;
when all three vertexes of the old triangle face are not outside the drawing sphere, defining a first index number of the old triangle face as a first new image index number of the new triangle face; the three vertex coordinates of the old triangle facet are defined as the first new image vertex coordinate set of the new triangle facet.
Specifically, the method for judging the positional relationship between the vertex of the old triangle surface and the drawing sphere comprises the following steps:
calculating the distance between each vertex of the old triangle surface and the center of the drawing sphere;
if the distance d between the vertex and the sphere center of the drawing sphere is larger than the radius R of the drawing sphere, the vertex is outside the drawing sphere;
if the distance d between the vertex and the sphere center of the drawing sphere is equal to the radius R of the drawing sphere, the vertex is on the sphere of the drawing sphere;
if the distance d between the vertex and the center of the drawing sphere is smaller than the radius R of the drawing sphere, this means that the vertex is within the drawing sphere.
Illustratively, the distance between the vertex of the old triangle face and the center of the sphere depicting the sphere is calculated as follows:
wherein (C) x ,C y ,C z ) To describe the coordinates of the sphere center of the sphere; (x) 0 ,y 0 ,z 0 ) Coordinates for the vertex to be solved; d is the distance between the vertex to be solved and the center of the drawing sphere.
Bringing the vertex coordinates of the old triangle facet in the first image data into (x) 0 ,y 0 ,z 0 ) The distance between the corresponding vertex and the center of the drawing sphere can be calculated.
Specifically, the second new image data includes a second new image index number, a second vertex coordinate set, and an intersection point coordinate set.
Further, the calculating the first image data further includes:
when the vertex on the old triangle surface is outside the drawing sphere and the other vertex is inside the drawing sphere, the old triangle surface is intersected with the sphere of the drawing sphere. Defining the first index number of the old triangle facet as the second new image index number of the new triangle facet; defining all vertex coordinates of the old triangle facet located within or on the delineating sphere as a second set of vertex coordinates; and calculating all intersection point coordinates of each side of the old triangle surface and the sphere of the drawing sphere, and defining all intersection point coordinates as an intersection point coordinate set.
Illustratively, the calculation of the coordinates of the intersection points of the sides of the old triangle surface and the sphere of the drawing sphere is as follows:
set O, E, F to the three vertices of the current old triangle face and line segment OE to one edge of the old triangle face.
Knowing the coordinates of vertices O and E, the direction vector D corresponding to line segment OE can be calculated.
The calculation formula of any point P on the line segment OE is as follows: p=o+td;
the conversion into a coordinate parameter equation is as follows:
wherein, (P) x ,P y ,P z ) Is the coordinates of the P point on line segment OE, (D) x ,D y ,D z ) For the coordinates of the direction vector D corresponding to OE, (O) x ,O y ,O z ) Is the coordinates of vertex O; the method comprises the steps of carrying out a first treatment on the surface of the t is a variable.
The coordinates C (C x ,C y ,C z ) And radius R, sphere formula:
(X-Cx) 2 +(Y-Cy) 2 +(Z-Cz) 2 =R 2 (3)
wherein (X, Y, Z) is any point coordinate on the sphere, (C) x ,C y ,C z ) The spherical center coordinates, and R is the radius of the sphere.
Simultaneous equations (2) (3) give:
(O x +D x *t-C x ) 2 +(O y +D y *t-C y ) 2 +(O z +D z *t-C z ) 2 =R 2 (4)
wherein, (O) x ,O y ,O z ) Is the coordinates of vertex O, (D) x ,D y ,D z ) The coordinates of the direction vector D corresponding to OE, (C) x ,C y ,C z ) To describe the spherical center coordinates of the sphere, R is the radius of the depicting sphere.
And (3) calculating a parameter t through a formula (4), and carrying the parameter t into a formula (2) to obtain the coordinates of the spherical intersection point P of the line segment OE and the drawing sphere.
And (3) repeating the calculation process on the other sides of the old triangle surface in turn to calculate all intersection points of the current old triangle surface and the sphere of the drawing sphere.
Further, the video memory comprises a plurality of pixels, and each pixel comprises a plurality of storage channels. The second image data are stored in the memory channels of the pixels, each second image data requiring at least three consecutive pixels to be stored.
For example, if none of the three vertices of the first old triangle facet is outside the delineating sphere, defining the first index number of the old triangle facet as the first new image index number of the new triangle facet; the three vertex coordinates of the old triangle facet are defined as the first new image vertex coordinate set of the new triangle facet. And storing the index number of the first new image and the vertex coordinate set of the first new image in four uint channels of the first pixel respectively. And (3) two continuous pixels after the first pixel are empty, namely, second image data corresponding to the new triangle surface are stored in three continuous pixels, and the using number of the ui channels of each pixel is respectively 4, 0 and 0.
For another example, a second old triangle facet having a vertex outside the drawing sphere and another vertex inside the drawing sphere indicates that the old triangle facet intersects the drawing sphere. Defining the first index number of the old triangle face as the second new image index number of the new triangle face; all vertex coordinates of the old triangle facet that lie within or on the delineating sphere are defined as a second set of vertex coordinates. And storing a second new image index number corresponding to the new triangle surface and a second vertex coordinate set in four ui channels of a fourth pixel respectively. And calculating all intersection point coordinates of each side of the old triangle surface and the sphere of the drawing sphere, and defining all intersection point coordinates as an intersection point coordinate set. Two intersection coordinates of the old triangle face and the sphere depicting the sphere are calculated. Storing one intersection point coordinate in three uint channels of the fifth pixel; another intersection coordinate is stored in three uint channels of the sixth pixel. That is, the second image data corresponding to the new triangle surface is stored in three consecutive pixels, and the number of the ui channels used in each pixel is 4, 3, and 3.
Further, the CPU module reads the second image data from the video memory to the memory according to the pixel sequence, and draws a new triangle surface according to the second image data.
Illustratively, the CPU module initially depicts an old triangle facet corresponding to the first image data. And reading the second image data from the video memory to the memory according to the pixel sequence, drawing a new triangle surface according to the second image data, and shifting the new triangle surface by a unit distance along the normal direction of the corresponding old triangle surface to cover the corresponding old triangle surface.
The new triangle facet depicted includes the following cases:
as shown in fig. 3, none of the three vertices of the old triangle face, which are the three vertices of the corresponding new triangle face, are outside the delineating sphere.
As shown in fig. 4, the old triangle facet has only one vertex within the delineating sphere and there are two intersections of the delineating sphere surface. One vertex and two intersections within the sphere are depicted as three vertices corresponding to the new triangle facet.
As shown in fig. 5, the old triangle facet has two vertices within the delineating sphere (including the sphere), and the delineating sphere has two intersections. Two vertices and two intersections within the drawing sphere form two new triangle faces that share one edge.
As shown in fig. 6, two vertices of the old triangle face are on the sphere of the delineating sphere and the other vertex is outside the delineating sphere. The new triangle surface drawn at this time is only a line segment located inside the scan sphere, and the two end points of the line segment are the two vertices of the old triangle surface on the sphere of the drawing sphere.
As shown in fig. 7, when the number of intersections between the old triangle surface and the sphere of the drawing sphere is four, another vertex is located in the drawing sphere. At this time, two intersections of the sphere surface of the drawing sphere and one vertex in the drawing sphere are three vertices corresponding to the new triangle surface.
It should be noted that, the method for selecting the new triangle vertex provided in the embodiment of the present invention may be adjusted according to actual situations, and is only illustrative and not specifically limited.
And finally, setting new colors for the triangle surface in the current drawing sphere according to the requirements to distinguish areas with different purposes.
The processing method provided by the invention is realized based on the GPU, and the intersecting condition of each old triangle and the sphere of the drawing sphere is calculated by using the GPU, so that the time consumption is only in the millisecond level, and the CPU operation is far better than that of the traditional triangle. In complex scenarios of millions of levels and above, the advantages of GPU operations over CPU operations can be better represented. In addition, the technical scheme of the invention has low implementation cost and high reliability, and can be realized through the configuration of the display card of the common computer. The GPU operation can be operated in real time, the fluency is high, and the CPU operation cannot be achieved.
Example 2
In order to achieve the above-mentioned processing method for drawing a complex scene based on a GPU, an embodiment of the present invention further provides a processing system for drawing a complex scene based on a GPU, as shown in fig. 2, the processing system includes:
the CPU module is used for sending the first image data and the calculation instruction to the GPU module; the method comprises the steps of reading second image data in a video memory, and drawing a new image according to the second image data;
the GPU module is used for receiving the first image data and the calculation instruction sent by the CPU module, executing the calculation instruction, carrying out calculation processing on the first image data and generating second image data; transmitting the second image data to a display memory;
and a memory for storing the second image data.
Specifically, the first image data includes, but is not limited to, a first index number and a first vertex coordinate set. The first index number refers to a unique identifier of the old triangle face in the current drawing scene; the first vertex coordinate set refers to a set of three vertex coordinates of the old triangle surface; each first index number and one first vertex coordinate set are in a unique corresponding relationship.
In particular, the computing instructions include, but are not limited to, a radius parameter describing the sphere and a scan order describing the sphere.
Further, the GPU module comprises a receiving unit, a judging unit and a calculating unit.
And the receiving unit is used for receiving the first image data and the calculation instruction sent by the CPU module, executing the calculation instruction and sending the first image data to the judging unit.
The judging unit is used for receiving the first image data and carrying out calculation analysis on the position relationship between the first image data and the drawing sphere; generating first new image data according to the calculation result, and sending and storing the first new image data into a video memory; or generating a second new image index number and a second vertex set, sending and storing the second new image index number and the second vertex set into a video memory, and sending the first image data to a computing unit.
Specifically, the judging unit calculates and analyzes the positional relationship between the current old triangle face and the drawing sphere through the first image data.
If all three vertexes of the current old triangle face are in the drawing sphere (including the sphere), defining a first index number of the old triangle face as a first new image index number of the new triangle face; defining three vertex coordinates of the old triangle surface as a first new image vertex coordinate set of the new triangle surface; and transmitting and storing the index number of the first new image and the vertex coordinate set of the first new image into a video memory.
If the current old triangle surface has the vertex outside the drawing sphere and the other vertex inside the drawing sphere, the old triangle surface is intersected with the sphere of the drawing sphere. Defining the first index number of the old triangle facet as a second new image index number and defining all vertex coordinates within the drawing sphere as a second set of vertex coordinates; transmitting and storing the index number of the second new image and the second vertex coordinate set into a video memory; and transmitting the first image data corresponding to the old triangle facet to a computing unit.
The computing unit is used for receiving the first image data and computing and generating an intersection point coordinate set according to the first image data; and sending and storing the intersection point coordinate set into a display memory.
Specifically, when there are vertices on the old triangle surface outside the drawing sphere and other vertices inside the drawing sphere, it means that the old triangle surface intersects with the drawing sphere. All intersection coordinates of each side of the old triangle face and the sphere of the drawing sphere are calculated, and all intersection coordinates are defined as an intersection coordinate set.
Further, the video memory comprises a plurality of pixels, and each pixel comprises a plurality of storage channels. The second image data are stored in the memory channels of the pixels, each second image data requiring at least three consecutive pixels to be stored.
Further, the CPU module reads the second image data from the video memory to the memory according to the pixel sequence, and draws a new triangle surface according to the second image data.
And finally, setting new colors for the triangle surface in the current drawing sphere according to the requirements to distinguish areas with different purposes.
The processing system provided by the invention is realized based on the GPU, and the intersecting condition of each old triangle and the sphere of the drawing sphere is calculated by using the GPU, so that the time consumption is only in the millisecond level, and the CPU operation is far better than that of the traditional triangle. In complex scenarios of millions of levels and above, the advantages of GPU operations over CPU operations can be better represented. In addition, the technical scheme of the invention has low implementation cost and high reliability, and can be realized through the configuration of the display card of the common computer. The GPU operation can be operated in real time, the fluency is high, and the CPU operation cannot be achieved.
Although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims (7)
1. A processing method for rendering a complex scene based on a GPU, the processing method comprising:
the CPU module sends the first image data and the calculation instruction to the GPU module; wherein the first image data includes a first index number and a first vertex coordinate set; the computing instructions comprise a radius parameter depicting the sphere and a scanning sequence depicting the sphere;
the GPU module receives the first image data and the calculation instruction, executes the calculation instruction, performs calculation processing on the first image data, and generates second image data; wherein the second image data includes first new image data and second new image data; the first new image data comprises a first new image index number and a first new image vertex coordinate set; the second new image data comprises a second new image index number, a second vertex coordinate set and an intersection point coordinate set;
the computing processing of the first image data includes: judging the position relation between each vertex of the old triangle surface in the first image data and the drawing sphere; when all three vertexes of the old triangle face are not outside the drawing sphere, defining a first index number of the old triangle face as a first new image index number of the new triangle face; defining three vertex coordinates of the old triangle surface as a first new image vertex coordinate set of the new triangle surface; when the vertex on the old triangle surface is outside the drawing sphere and the vertex is inside the drawing sphere, defining the first index number of the old triangle surface as the second new image index number of the new triangle surface; defining all vertex coordinates of the old triangle facet located within or on the delineating sphere as a second set of vertex coordinates; calculating all intersection point coordinates of each side of the old triangle surface and the sphere of the drawing sphere, and defining all intersection point coordinates as an intersection point coordinate set;
the GPU module sends the second image data to the video memory for storage;
and the CPU module reads second image data in the video memory and draws a new image according to the second image data.
2. The processing method for describing a complex scene based on a GPU according to claim 1, wherein the first index number refers to a unique identifier of an old triangle facet in a current scene; the first vertex coordinate set refers to a set of three vertex coordinates of the old triangle face.
3. The method for processing a complex scene depicted by a GPU according to claim 1, wherein the method for determining the positional relationship between each vertex of the old triangle surface and the depicted sphere comprises:
according to the first vertex coordinate set, calculating the distance between each vertex of the old triangle surface and the sphere center of the drawing sphere;
if the distance between the vertex and the sphere center of the drawing sphere is larger than the radius of the drawing sphere, the vertex is outside the drawing sphere;
if the distance between the vertex and the sphere center of the drawing sphere is equal to the radius of the drawing sphere, the vertex is represented to be on the sphere of the drawing sphere;
if the distance between the vertex and the center of the drawing sphere is smaller than the radius of the drawing sphere, the vertex is indicated to be in the drawing sphere.
4. A processing system for rendering a complex scene based on a GPU, the processing system comprising:
the CPU module is used for sending the first image data and the calculation instruction to the GPU module; the method comprises the steps of reading second image data in a video memory, and drawing a new image according to the second image data; wherein the first image data includes a first index number and a first vertex coordinate set;
the GPU module is used for receiving the first image data and the calculation instruction sent by the CPU module, executing the calculation instruction, carrying out calculation processing on the first image data and generating second image data; transmitting the second image data to a display memory; wherein the second image data includes first new image data and second new image data; the first new image data comprises a first new image index number and a first new image vertex coordinate set; the second new image data comprises a second new image index number, a second vertex coordinate set and an intersection point coordinate set;
the computing processing of the first image data includes: judging the position relation between each vertex of the old triangle surface in the first image data and the drawing sphere; when all three vertexes of the old triangle face are not outside the drawing sphere, defining a first index number of the old triangle face as a first new image index number of the new triangle face; defining three vertex coordinates of the old triangle surface as a first new image vertex coordinate set of the new triangle surface; when the vertex on the old triangle surface is outside the drawing sphere and the vertex is inside the drawing sphere, defining the first index number of the old triangle surface as the second new image index number of the new triangle surface; defining all vertex coordinates of the old triangle facet located within or on the delineating sphere as a second set of vertex coordinates; calculating all intersection point coordinates of each side of the old triangle surface and the sphere of the drawing sphere, and defining all intersection point coordinates as an intersection point coordinate set;
and a memory for storing the second image data.
5. The GPU-based complex scene rendering processing system of claim 4, wherein said first index number refers to a unique identification of an old triangle facet in a current scene; the first vertex coordinate set refers to a set of three vertex coordinates of the old triangle surface;
the computing instructions include a radius parameter describing the sphere and a scan order describing the sphere.
6. The processing system for describing a complex scene based on a GPU according to claim 4, wherein the determining unit in the GPU module calculates and analyzes the positional relationship between each vertex of the old triangle surface corresponding to the first image data and the describing sphere, and adopts the following formula:
wherein,,(C x ,C y ,C z ) To describe the coordinates of the sphere center of the sphere; (x) 0 ,y 0 ,z 0 ) Coordinates for the vertex to be solved; d is the distance between the vertex to be solved and the center of the drawing sphere.
7. The GPU-based complex scene rendering processing system of claim 4, wherein said video memory comprises a plurality of pixels, each pixel comprising a plurality of memory channels;
the second image data are stored in the memory channels of the pixels, each second image data requiring at least three consecutive pixels to be stored.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202310889781.3A CN116611991B (en) | 2023-07-20 | 2023-07-20 | Processing method and system for drawing complex scene based on GPU |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202310889781.3A CN116611991B (en) | 2023-07-20 | 2023-07-20 | Processing method and system for drawing complex scene based on GPU |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN116611991A CN116611991A (en) | 2023-08-18 |
| CN116611991B true CN116611991B (en) | 2023-10-03 |
Family
ID=87685729
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202310889781.3A Active CN116611991B (en) | 2023-07-20 | 2023-07-20 | Processing method and system for drawing complex scene based on GPU |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN116611991B (en) |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2001051674A (en) * | 1999-08-06 | 2001-02-23 | Hitachi Ltd | Drawing processing apparatus and drawing processing method |
| CN102254340A (en) * | 2011-07-29 | 2011-11-23 | 北京麒麟网信息科技有限公司 | Method and system for drawing ambient occlusion images based on GPU (graphic processing unit) acceleration |
| CN102834849A (en) * | 2011-03-31 | 2012-12-19 | 松下电器产业株式会社 | Image drawing device for drawing stereoscopic image, image drawing method, and image drawing program |
| CN110956673A (en) * | 2018-09-26 | 2020-04-03 | 北京高德云图科技有限公司 | Map drawing method and device |
| CN114897965A (en) * | 2022-07-12 | 2022-08-12 | 北京飞渡科技有限公司 | Method and system for analyzing three-dimensional scene openness |
Family Cites Families (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US11616909B2 (en) * | 2020-12-08 | 2023-03-28 | Aspeed Technology Inc. | Method of compensating for color differences between adjacent lens images in a panoramic image |
-
2023
- 2023-07-20 CN CN202310889781.3A patent/CN116611991B/en active Active
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2001051674A (en) * | 1999-08-06 | 2001-02-23 | Hitachi Ltd | Drawing processing apparatus and drawing processing method |
| CN102834849A (en) * | 2011-03-31 | 2012-12-19 | 松下电器产业株式会社 | Image drawing device for drawing stereoscopic image, image drawing method, and image drawing program |
| CN102254340A (en) * | 2011-07-29 | 2011-11-23 | 北京麒麟网信息科技有限公司 | Method and system for drawing ambient occlusion images based on GPU (graphic processing unit) acceleration |
| CN110956673A (en) * | 2018-09-26 | 2020-04-03 | 北京高德云图科技有限公司 | Map drawing method and device |
| CN114897965A (en) * | 2022-07-12 | 2022-08-12 | 北京飞渡科技有限公司 | Method and system for analyzing three-dimensional scene openness |
Non-Patent Citations (2)
| Title |
|---|
| 基于GPU的球面深度图实时绘制;朱鉴;吴恩华;;计算机学报(02);全文 * |
| 数控仿真中切削面计算的并行化研究;于珊;王子牛;赵鹏阳;;贵州大学学报(自然科学版)(01);全文 * |
Also Published As
| Publication number | Publication date |
|---|---|
| CN116611991A (en) | 2023-08-18 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US6600485B1 (en) | Polygon data generation method and image display apparatus using same | |
| CN102214369B (en) | Hierarchical bounding of displaced parametric surfaces | |
| Nießner et al. | Feature-adaptive GPU rendering of Catmull-Clark subdivision surfaces | |
| US5680525A (en) | Three-dimensional graphic system with an editor for generating a textrue mapping image | |
| US8624899B2 (en) | Arc spline GPU rasterization for cubic Bezier drawing | |
| US7760201B2 (en) | Transfer of attributes between geometric surfaces of arbitrary topologies with distortion reduction and discontinuity preservation | |
| US5040130A (en) | Computer graphics boundary--defined area clippping and extraneous edge deletion method | |
| JP2004348702A (en) | Image processing method, its apparatus, and its processing system | |
| KR20150041057A (en) | Gpu-accelerated path rendering | |
| US8471852B1 (en) | Method and system for tessellation of subdivision surfaces | |
| CN101714258B (en) | Graphics processing systems | |
| CN114375464A (en) | Ray tracing dynamic cells in virtual space using bounding volume representations | |
| JP2005100176A (en) | Image processing apparatus and method | |
| CN112184864A (en) | Real-time drawing method of million-magnitude three-dimensional situation target | |
| Sato et al. | Fast image generation of construcitve solid geometry using a cellular array processor | |
| JPH09330423A (en) | 3D shape data converter | |
| US6346939B1 (en) | View dependent layer ordering method and system | |
| CN111091620B (en) | Map dynamic road network processing method and system based on graphics and computer equipment | |
| CN115495938B (en) | Three-dimensional dynamic simulation and visualization method for sea surface waves | |
| CN116611991B (en) | Processing method and system for drawing complex scene based on GPU | |
| Fussell et al. | A vlsi-oriented architecture for real-time raster display of shaded polygons | |
| JPH04220781A (en) | Apparatus for decomposing small polygon into trapezoid in accelerating mode | |
| CN117557710B (en) | Texture rendering method, device, terminal equipment and storage medium | |
| CN111145299B (en) | Vector map solid line symbol corner drawing method considering line width consistency | |
| US20230215094A1 (en) | Computer Graphics Interface Using Visual Indicator Representing Object Global Volume and/or Global Volume Changes and Method Therefore |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |