Graphics rendering method and device, storage medium and electronic device
By determining and deleting the geometric figures to be deleted from the target perspective, the problem of low graphics rendering efficiency in the prior art is solved, and efficient graphics rendering and the effect of reducing computing overhead is achieved.
Patent Information
- Application Number
- CN202110356461.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-01
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2041-04-01
AI Technical Summary
In the prior art, the graphics rendering efficiency is low, especially in scenes where a large number of graphics are rendered with wide field of view, the deletion efficiency is not high, and the fine-grained deletion method has greater requirements for customization of the rendering pipeline, which increases the difficulty of engineering changes.
By obtaining the graphic model to be processed and the target deletion parameters from the target perspective, the geometric figure to be deleted from the target perspective is determined, and deleted in the GPU pipeline, obtain the second graphic model and render it.
It improves the efficiency of graphics rendering, reduces the computing overhead, and solves the problem of low efficiency in related technologies.
Smart Images

Figure CN112927339B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computers, and in particular to a graphics rendering method and device, a storage medium and an electronic device. Background Art
[0002] In the field of graphics rendering research and industry applications, occlusion removal solutions are mainly divided into two categories: one is to use CPU real-time or offline calculation to remove occlusion at the model granularity, and the other is to achieve pixel-based removal by changing the GPU pipeline.
[0003] Among the current related technologies, the ones with low runtime overhead, such as pre-calculated occlusion removal technology and efficient online soft raster removal technology, are based on the model granularity, which is not efficient in scenes with a wide field of view rendering a large number of graphics. The fine-grained removal methods are concentrated in the customization of the rendering pipeline. This type of method has a large impact on the engineering changes. It is based on the pixel level. The fine-grained method is to find pixels that do not need to be retained on the screen and remove them. It is often determined in the early stage of the product through product requirements and hardware environment. In the first stage, all vertices of the model will be drawn. Since the leaves are transparent materials, the transparent map needs to be read in the pixel shader, which still has a large overhead and needs further optimization.
[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0005] The embodiments of the present invention provide a graphics rendering method and device, a storage medium and an electronic device, so as to at least solve the technical problem of low efficiency of graphics rendering existing in the related art.
[0006] According to one aspect of an embodiment of the present invention, there is provided a graphics rendering method, comprising:
[0007] Acquire a first graphic model to be processed, wherein the first graphic model includes a set of geometric figures;
[0008] Obtaining a target viewing angle and a target deletion parameter under the target viewing angle;
[0009] Determining, according to the target deletion parameter, a geometric figure to be deleted in the first graphic model at the target viewing angle;
[0010] Deleting the geometric figure to be deleted in the first graphic model to obtain a second graphic model;
[0011] The second graphic model is rendered under the target viewing angle.
[0012] According to another aspect of an embodiment of the present invention, there is further provided a graphics rendering device, comprising:
[0013] A first acquisition module, used for acquiring a first graphic model to be processed, wherein the first graphic model includes a group of geometric figures;
[0014] A second acquisition module is used to acquire a target viewing angle and a target deletion parameter under the target viewing angle;
[0015] A determination module, configured to determine, according to the target deletion parameter, the geometric figure to be deleted in the first graphic model at the target viewing angle;
[0016] A deleting module, used for deleting the geometric figure to be deleted in the first graphic model to obtain a second graphic model;
[0017] A rendering module is used to render the second graphic model under the target viewing angle.
[0018] Optionally, the deletion module includes:
[0019] A first search unit is used to search the geometric figure to be deleted in the first graphic model according to the target deletion parameter, wherein the number of vertices in the geometric figure to be deleted that are located inside a target hypersurface is greater than a predetermined threshold, and the target hypersurface is a closed hypersurface represented by the target deletion parameter.
[0020] Optionally, the deletion module includes:
[0021] A second search unit is used to search for the triangle to be deleted in the first graphic model according to the target deletion parameter when the geometric figure includes a triangle and the target hypersurface is a three-dimensional sphere, wherein the number of vertices in the triangle to be deleted that are located inside the three-dimensional sphere is greater than 1.
[0022] Optionally, the device is used to obtain a target viewing angle and a target deletion parameter under the target viewing angle in the following manner:
[0023] Acquire the target viewing angle and the target deletion parameter from a set of pre-stored data, wherein the set of data includes a plurality of pairs of viewing angles and deletion parameters under the viewing angles having a corresponding relationship;
[0024] The target viewing angle and the target deletion parameter are input into the GPU, wherein the GPU is used to determine the geometric figures to be deleted in the first graphic model under the target viewing angle according to the target deletion parameter, and delete the geometric figures to be deleted in the first graphic model to obtain a second graphic model.
[0025] Optionally, the device is also used for:
[0026] The target deletion parameter is determined based on the total pixel amount and effective pixel amount of the geometric figures in the group of geometric figures at the target viewing angle, wherein the total pixel amount represents the pixel amount consumed by the geometric figures during the rendering process, and the effective pixel amount represents the pixel amount of the geometric figures drawn on the screen.
[0027] Optionally, the device is used to determine the target deletion parameter according to the total pixel quantity and effective pixel quantity of the geometric figures in the set of geometric figures at the target viewing angle in the following manner:
[0028] Under the target constraint conditions determined according to the total pixel quantity and the effective pixel quantity, the target deletion parameter is determined, wherein the target deletion parameter represents the target hypersurface, and the target constraint conditions include: under the restriction that the sum of the effective pixel quantities of the geometric figures located inside the target hypersurface is equal to a preset allowable error value, the sum of the total pixel quantities of the geometric figures located inside the target hypersurface is maximized.
[0029] Optionally, the device is used to determine the target deletion parameter under the target constraint condition determined according to the total pixel quantity and the effective pixel quantity in the following manner:
[0030] When the target hypersurface is a three-dimensional spherical surface and the target deletion parameters include the coordinates of the center of the three-dimensional spherical surface and the radius of the sphere, the coordinates of the center of the spherical surface are determined according to the sum of the effective pixel quantities of the geometric figures located inside the three-dimensional spherical surface and the sum of the total pixel quantities of the geometric figures located inside the three-dimensional spherical surface;
[0031] The radius of the sphere is determined according to the coordinates of the sphere center and the allowable error value.
[0032] Optionally, the device is used to determine the coordinates of the sphere center according to the sum of the effective pixel quantities of the geometric figures located inside the three-dimensional sphere and the sum of the total pixel quantities of the geometric figures located inside the three-dimensional sphere in the following manner:
[0033] When the geometric figure is a triangle, the center coordinates of the sphere are determined under the restriction that the sum of the effective pixels of the triangle located inside the three-dimensional sphere is the allowable error value, wherein the center coordinates of the sphere are used to maximize the sum of the total pixels of the triangle located inside the three-dimensional sphere.
[0034] Optionally, the device is used to determine the coordinates of the sphere center under the restriction that the sum of the effective pixel quantities of the triangles located inside the three-dimensional sphere is the allowable error value in the following manner:
[0035] Under the restriction that the sum of the effective pixels of the triangle located inside the three-dimensional sphere is the allowable error value, the coordinates of the center of the sphere are determined near the extension line from the target center to the target viewing angle in the target relationship diagram, wherein the target center is the center of the target relationship diagram, and the target relationship diagram represents the relationship between the sum of the total pixel amounts and the three-dimensional space coordinates.
[0036] Optionally, the device is used to determine the radius of the sphere according to the sphere center coordinates and the allowable error value in the following manner:
[0037] Obtaining assumed sphere center coordinates λx, λy, and λz, wherein λx is used to represent the coordinate of the sphere center coordinate on the x-axis corresponding to the sphere center coordinate in the three-dimensional space coordinate, λy is used to represent the coordinate of the sphere center coordinate on the y-axis corresponding to the sphere center coordinate in the three-dimensional space coordinate, and λz is used to represent the coordinate of the sphere center coordinate on the z-axis corresponding to the sphere center coordinate in the three-dimensional space coordinate;
[0038] Under the restriction that the sum of the effective pixel quantities of the triangles located inside the three-dimensional spherical surface is the allowable error value, the sphere radius λr is determined according to the allowable error value and the sphere center coordinates.
[0039] Optionally, the device is also used for:
[0040] In the case where the spherical center coordinates include λx, λy, and λz, the spherical center coordinates are converted into λθ represented by a spherical coordinate system. λd;
[0041] When the target viewing angle is determined, a two-dimensional vector is used to store λ(E) the target deletion parameter, wherein the target deletion parameter is λ(E)=span{λd,λr}, wherein λd represents the offset of the target center to the target viewing angle, λr represents the radius of the sphere, the span function is used to represent the parameter space including the two parameters λd and λr, and E is the target viewing angle.
[0042] Optionally, the device is also used for:
[0043] When the target deletion parameter λ(E) is a discrete parameter, obtaining a target viewing angle E and a target deletion parameter λ(E) corresponding to the target viewing angle;
[0044] The discrete target deletion parameter λ'(E) is calculated as follows:
[0045] The target viewing angle E is converted into spherical parameter coordinates using inverse trigonometric functions
[0046] Obtaining the sampling coordinates (x, y) of the spherical parameter coordinates;
[0047] Solving the integer part and the decimal part of the sampling coordinates respectively, wherein the integer part is obtained by rounding up or down;
[0048] Using the integer part sampling to obtain multiple groups of deletion parameters λ;
[0049] The decimal part is used as an interpolation coefficient to solve λ'(E) to output the λ'(E) in a target material engine, and a deletion parameter λ'(E) is determined for directly determining in the target material engine the geometric figures to be deleted in the first graphic model at the target perspective.
[0050] Optionally, the device is used to delete the geometric figure to be deleted in the first graphic model in the following manner to obtain the second graphic model:
[0051] In the GPU pipeline, the to-be-deleted geometric figure is deleted by a geometry shader; or
[0052] In the GPU pipeline, the geometric figures to be deleted are deleted through the vertex shader.
[0053] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned graphics rendering method when running.
[0054] According to another aspect of an embodiment of the present invention, there is provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the graphics rendering method through the computer program.
[0055] In an embodiment of the present invention, a first graphic model to be processed is obtained, wherein the first graphic model includes a group of geometric figures, a target perspective and a target deletion parameter under the target perspective are obtained, and according to the target deletion parameter, the geometric figures to be deleted in the first graphic model under the target perspective are determined, and the geometric figures to be deleted in the first graphic model are deleted to obtain a second graphic model. Under the target perspective, the second graphic model is rendered in a manner that the target deletion parameter under the target perspective is obtained by precalculating the target deletion parameter under the target perspective so as to delete the geometric figures to be deleted in the first graphic model under the target perspective, thereby achieving the purpose of efficiently rendering the second graphic model, thereby realizing the technical effect of improving the efficiency of graphics rendering and reducing the computational overhead of graphics rendering, and further solving the technical problem of low efficiency of graphics rendering existing in the related art. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0057] Figure 1 is a schematic diagram of an application environment of an optional graphics rendering method according to an embodiment of the present invention;
[0058] Figure 2 is a flowchart of an optional graphics rendering method according to an embodiment of the present invention;
[0059] Figure 3 is a schematic diagram of an optional graphics rendering method according to an embodiment of the present invention;
[0060] Figure 4 is a schematic diagram of another optional graphics rendering method according to an embodiment of the present invention;
[0061] Figure 5 is a schematic diagram of another optional graphics rendering method according to an embodiment of the present invention;
[0062] Figure 6 is a schematic diagram of another optional graphics rendering method according to an embodiment of the present invention;
[0063] Figure 7 is a schematic diagram of another optional graphics rendering method according to an embodiment of the present invention;
[0064] Figure 8 is a schematic diagram of another optional graphics rendering method according to an embodiment of the present invention;
[0065] Fig. 9 is a schematic diagram of another optional graphics rendering method according to an embodiment of the present invention;
[0066] Fig.10 is a schematic diagram of another optional graphics rendering method according to an embodiment of the present invention;
[0067] Fig.11 is a schematic structural diagram of an optional graphics rendering device according to an embodiment of the present invention;
[0068] Fig.12 It is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0069] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. 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 should fall within the scope of protection of the present invention.
[0070] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0071] First, some nouns or terms that appear in the description of the embodiments of the present application are subject to the following interpretation:
[0072] Spatial equation: An equation specified in space. The n+1-dimensional surface equation F(χ)=0 specified in n-dimensional space can be used as a decision surface for n-dimensional spatial data. By substituting the n-dimensional data point v into the F(χ) decision symbol, it can be confirmed whether it is inside or outside the surface, thereby performing the role.
[0073] Rendering optimization: There are many performance bottlenecks in graphics rendering. Find these performance bottlenecks and make targeted optimizations to improve program efficiency. Common optimization methods include model optimization, deletion, multithreading, caching, etc.
[0074] Offline stage: In rendering optimization, many solutions have large-scale intensive calculations that will be pre-calculated before actual operation. This process is the offline stage of the optimization solution.
[0075] Real-time rendering: refers to the real-time operation stage in graphics products. The device usually needs to complete the rendering of the picture and submit it to the display in a very short time. The number of pictures submitted per second is called the frame rate. Generally, 30 frames, 60 frames or even more frame rates are required to ensure the smoothness of dynamic pictures.
[0076] GPU: Graphics Processing Unit, a dedicated chip used in modern personal computers, servers, mobile devices, game consoles, etc. for graphics image processing.
[0077] Rendering pipeline: The graphics rendering process running in the GPU. Generally, we discuss its vertex shader, rasterization, and pixel shader. By writing code in the shader, the GPU can be flexibly controlled to draw and render the rendering components.
[0078] Vertex shader: A required part of the GPU rendering pipeline. The program will calculate the vertices of the model one by one according to the code and output the results to the next stage.
[0079] Geometry shader: An optional part of the GPU rendering pipeline. After the vertex shader, the program will add, modify, and delete vertices obtained in the previous stage according to the code, and output the results into rasterization.
[0080] Rasterization: A non-codable link in the GPU rendering pipeline. The program automatically assembles the output results of the vertex shader or geometry shader into triangles and rasterizes them into discrete pixels according to the configuration, and outputs them to the pixel shader.
[0081] Pixel shader: A required part of the GPU rendering pipeline. The program will perform shading calculations on the rasterized pixels according to the code, and output them to the frame buffer after testing, completing a rendering pipeline process.
[0082] Depth buffer: A buffer in the GPU that records the depth information corresponding to the pixels in the frame buffer. It is usually used to ensure the order of pixel drawing and the correctness of the rendering results. Developers can specify the depth buffer switch, test method and write switch through instructions to flexibly meet rendering requirements.
[0083] Base Pass: The most basic Pass (stage) in the rendering of a frame. The model goes through the normal shading rendering pipeline and outputs the color.
[0084] Overdrawing: Due to the inconsistent order of rendering object submission and the GPU's disordered pixel shading, pixels close to the viewing angle may be drawn last, causing some pixels in the screen to be repeatedly erased and rewritten, resulting in redundant drawing, which is overdrawing.
[0085] Pre Pass: The rendering of a frame may include multiple Passes. Pre Pass is the stage of drawing depth information before the rendering component draws and colors. After obtaining the closest distance of all pixels in this frame to the viewing angle, the Base Pass is called for coloring to reduce over-drawing.
[0086] Occlusion Query: A query function supported on the GPU side that can query the actual number of pixels generated by a draw call within a certain interval and return the query results to the CPU side.
[0087] The present invention will be described below in conjunction with embodiments:
[0088] According to one aspect of an embodiment of the present invention, a graphics rendering method is provided. Optionally, in this embodiment, the graphics rendering method can be applied to Figure 1 In the hardware environment composed of the server 101 and the user terminal 103 shown in FIG. Figure 1 As shown, the server 101 is connected to the terminal 103 through a network, and can be used to provide services for the user terminal or the client installed on the user terminal. The client can be a video client, an instant messaging client, a browser client, an education client, a game client, etc. A database 105 can be set on the server or independently of the server to provide data storage services for the server 101, for example, a graphic data storage server. The above network can include but is not limited to: a wired network, a wireless network, wherein the wired network includes: a local area network, a metropolitan area network and a wide area network, and the wireless network includes: Bluetooth, WIFI and other networks that realize wireless communication. The user terminal 103 can be a terminal configured with a media information application and / or a target game application, and can include but is not limited to at least one of the following: a mobile phone (such as an Android phone, an iOS phone, etc.), a laptop, a tablet computer, a handheld computer, a MID (Mobile Internet Devices), a PAD, a desktop computer, a smart TV and other computer devices. The above server can be a single server, or a server cluster composed of multiple servers, or a cloud server. The application 107 using the above graphics rendering method is displayed through the user terminal 103.
[0089] Combination Figure 1 As shown, the above-mentioned graphics rendering method can be implemented in the user terminal 103 through the following steps:
[0090] S1, obtaining a first graphic model to be processed, wherein the first graphic model includes a set of geometric figures;
[0091] S2, obtaining the target perspective and the target deletion parameters under the target perspective;
[0092] S3, determining the geometric figure to be deleted in the first graphic model at the target viewing angle according to the target deletion parameter;
[0093] S4, deleting the geometric figure to be deleted in the first graphic model to obtain a second graphic model;
[0094] S5, rendering the second graphic model at the target viewing angle.
[0095] Optionally, in this embodiment, the above-mentioned graphics rendering method can also be used by a client including but not limited to being configured on a server.
[0096] Optionally, in this embodiment, the above-mentioned graphics rendering method may include but is not limited to being used asynchronously by the application 107 on the user terminal 103 and the client of the server 101 .
[0097] The above is only an example and is not specifically limited in this embodiment.
[0098] Optionally, as an optional implementation, as Figure 2 As shown, the above-mentioned graphics rendering method includes:
[0099] S202, obtaining a first graphic model to be processed, wherein the first graphic model includes a group of geometric figures;
[0100] S204, obtaining a target viewing angle and a target deletion parameter under the target viewing angle;
[0101] S206, determining the geometric figure to be deleted in the first graphic model at the target viewing angle according to the target deletion parameter;
[0102] S208, deleting the geometric figure to be deleted in the first graphic model to obtain a second graphic model;
[0103] S210: Rendering a second graphic model at a target viewing angle.
[0104] Optionally, in this embodiment, the application scenarios of the above-mentioned graphics rendering may include but are not limited to medical, finance, credit reporting, banking, government affairs, government, games, energy, education, security, buildings, games, transportation, Internet of Things, industry and other application scenarios.
[0105] Optionally, in this embodiment, the first graphic model may include but is not limited to graphic models such as tree models and flower models composed of virtual triangles that require a large amount of rendering in an open field of view, and may also include but is not limited to graphic models of vegetation without transparent materials or other components similar to vegetation rendering. The above-mentioned set of geometric figures may include but is not limited to a set of virtual triangles, the above-mentioned target perspective may include but is not limited to being obtained from the parameters of the GPU currently used for graphics rendering, the above-mentioned target perspective is the currently observed perspective in a set of perspectives, and a set of perspectives is a predetermined perspective to be observed.
[0106] Optionally, in this embodiment, the obtaining of the first graphic model to be processed may include but is not limited to obtaining the first graphic model to be processed from a material database used for graphics rendering.
[0107] Optionally, in this embodiment, the above-mentioned graphics rendering method may include but is not limited to providing support for the graphics rendering development process in the form of a plug-in or external tool of the rendering engine. The developer calls the human-computer interface in the engine to send a pre-calculation command to the plug-in. The plug-in reads the graphics model and project settings, performs pre-calculation for a period of time, calculates and outputs the culling parameter set and saves it in the material file corresponding to the model. When the graphics are rendered, the material will read the parameters and cull in real time in the shader. There is no other human-computer interaction in the production process, and there is a high degree of automation.
[0108] Figure 3 is a schematic diagram of an optional graphics rendering method according to an embodiment of the present invention, such as Figure 3 As shown, taking the above application scenario as a game scene, the above first graphic model is a tree, including a leaf group 302 and a trunk 304, wherein tree 306 is a schematic diagram of the first graphic model, and tree 308 is a schematic diagram of the second graphic model. The light-colored part 310 included in the tree 308 is the position of the above geometric figure to be deleted. By deleting the above geometric figure, the above second graphic model is obtained and rendered.
[0109] The above is only an example, and this embodiment does not make any specific limitation.
[0110] Figure 4 is a schematic diagram of another optional graphics rendering method according to an embodiment of the present invention. Figure 4As shown, taking the above application scenario as a game scene, the above first graphic model is a tree, including a leaf group 402 and a trunk 404, wherein tree 406 is a schematic diagram of the second graphic model marking the deleted geometric figures, and tree 408 is a schematic diagram of the second graphic model finally rendered, and the light-colored part 410 included in the tree 406 is the position of the above geometric figures to be deleted. By deleting the above geometric figures, the above second graphic model is obtained and rendered, thereby achieving the technical effect of improving the efficiency of graphics rendering and reducing the computational overhead of rendering.
[0111] The above is only an example, and this embodiment does not make any specific limitation.
[0112] Optionally, in this embodiment, obtaining the target viewing angle and the target deletion parameters under the target viewing angle may include but are not limited to being determined according to the configuration parameters of the current business scenario, for example, may include but are not limited to the vertex array, texture coordinate array, triangle index array, material number array, leaf transparent map, etc. of the model, and may also include but are not limited to deleting the viewing angle range, deleting the parameter sampling rate, deleting the allowed error, the projection matrix and screen resolution used for the final rendering, etc.
[0113] Optionally, in this embodiment, the target deletion parameters may include but are not limited to being pre-determined by pre-calculation according to the configuration parameters of the above-mentioned business scenario, and stored in a corresponding database, and the above-mentioned target deletion parameters correspond to the above-mentioned target perspectives, that is, each target perspective corresponds to one or more target deletion parameters, and the above-mentioned target deletion parameters are used to represent including but not limited to three-dimensional spheres, three-dimensional planes or other high-dimensional hypersurfaces.
[0114] Optionally, in this embodiment, the process of determining the above-mentioned target deletion parameters by a three-dimensional plane or other high-dimensional hypersurface may include but is not limited to the process of establishing and parameterizing the space equation by using a three-dimensional plane or a multi-surface combination generated by projecting a hypersurface in three dimensions to replace the space equation.
[0115] Optionally, in this embodiment, the above-mentioned acquisition target perspective and target deletion parameters under the target perspective may include but are not limited to the following exemplary descriptions:
[0116] For example, taking the application scenario of the above-mentioned graphics rendering as a game application as an example, the above-mentioned first graphics model is a tree including leaves, and it may include but is not limited to representing the above-mentioned target deletion parameters as a three-dimensional sphere, including the coordinates of the center of the three-dimensional sphere and the radius of the sphere, and may include but is not limited to using a spatial test equation to determine the above-mentioned target deletion parameters in rendering.
[0117] The above-mentioned method of determining the above-mentioned target deletion parameter in rendering by using the spatial test equation may include but is not limited to the following methods:
[0118] The spatial test equation F(λ,v) is used to determine the deletion relationship in rendering, where λ is the deletion parameter (corresponding to the target deletion parameter mentioned above) and v is the vertex coordinate of the leaf. Since the deletion relationship is a positive or negative decision quantity, F can be set as a decision surface in three-dimensional space, which is expressed in the form of a hypersurface as follows:
[0119] F(λ,χ)=0;
[0120] If F(λ,v)<0, it means that point v is inside the hypersurface, and v is judged to be invisible and needs to be deleted; otherwise, if F(λ,v)≥0, it means that point v is outside the hypersurface, and v is judged to be visible and retained for rendering.
[0121] In actual engineering, the spatial test equation can be set to a three-dimensional sphere, a three-dimensional plane or other high-dimensional hypersurface according to the occlusion relationship spatial characteristics of the geometric figures to be deleted. Specifically, the type of hypersurface corresponding to the occlusion relationship spatial characteristics corresponding to the above-mentioned target deletion parameters can be determined according to the complexity of the deletion calculation during real-time rendering.
[0122] For example, when using a three-dimensional sphere as the decision surface for deletion testing, λ=span{λ x ,λ y ,λ z ,λ r}, then the solution space is the deleted parameter three-dimensional coordinates and radius respectively.
[0123] Through this embodiment, a first graphic model to be processed is obtained, wherein the first graphic model includes a group of geometric figures, a target perspective and a target deletion parameter under the target perspective are obtained, and according to the target deletion parameter, the geometric figures to be deleted in the first graphic model under the target perspective are determined, and the geometric figures to be deleted in the first graphic model are deleted to obtain a second graphic model, and the second graphic model is rendered under the target perspective. The target deletion parameter under the target perspective is obtained by pre-calculating the target deletion parameter to delete the geometric figures to be deleted in the first graphic model under the target perspective, and then, the second graphic model with the geometric figures deleted is rendered, so as to achieve the purpose of efficient graphics rendering, thereby realizing the technical effect of improving the efficiency of graphics rendering and reducing the computational overhead of graphics rendering, and then solving the technical problem of low efficiency of graphics rendering existing in the related art.
[0124] As an optional solution, determining the geometric figure to be deleted in the first graphic model at the target viewing angle according to the target deletion parameter includes:
[0125] According to the target deletion parameter, a geometric figure to be deleted is searched in the first graphic model, wherein the number of vertices in the geometric figure to be deleted that are located inside the target hypersurface is greater than a predetermined threshold, and the target hypersurface is a closed hypersurface represented by the target deletion parameter.
[0126] Optionally, in this embodiment, searching for the geometric figure to be deleted in the first graphic model according to the target deletion parameter may include but is not limited to obtaining the relative position relationship between the vertices inside the target hypersurface and the target hypersurface.
[0127] Taking the target hypersurface as a three-dimensional sphere, the geometric figure to be deleted as a virtual triangle, and the predetermined threshold equal to 1 as an example, the relative position relationship between the three vertices of the virtual triangle and the three-dimensional sphere is obtained, and the virtual triangle with at least two of the three vertices inside the three-dimensional sphere is determined as the geometric figure to be deleted.
[0128] Optionally, in this embodiment, Figure 5 is a schematic diagram of another optional graphics rendering method according to an embodiment of the present invention, such as Figure 5 As shown, the target hypersurface is a three-dimensional sphere, the geometric figure to be deleted is a virtual triangle, and the sphere divides the vertices into vertices 502 outside the sphere, vertices 504 inside the sphere, and vertices 506 on the surface of the sphere. Then:
[0129] F(λ,χ)=(χ x -λ x ) 2 +(χ y -λ y ) 2 +(χ z -λ z ) 2 -λ r 2 =0;
[0130] Here, χ is used to represent the vertex 506 on the spherical surface.
[0131] The deletion relation F(λ,v) during deletion is:
[0132] F(λ,v)=(v x -λ x ) 2 +(v y -λ y ) 2 +(v z -λ z ) 2 -λ r 2 ;
[0133] When F(λ, v) is greater than 0, v represents vertex 502 , and when F(λ, v) is less than 0, v represents vertex 504 .
[0134] The positive or negative value of F(λ,v) can be used to determine whether to delete the virtual triangle corresponding to the vertex. The above calculation can be completed by vector subtraction, vector dot multiplication and scalar comparison, and can be efficiently executed in the GPU.
[0135] In other words, the geometric figures to be deleted are the virtual triangle 508 including at least two vertices located inside the sphere, while the virtual triangle 510 having only one vertex located inside the sphere, or other virtual triangles having no vertex located inside the sphere are geometric figures that do not need to be deleted.
[0136] The above is only an example, and this embodiment does not make any specific limitation.
[0137] Through this embodiment, the geometric figures to be deleted are searched in the first graphic model according to the target deletion parameters, wherein the number of vertices located inside the target hypersurface in the geometric figures to be deleted is greater than a predetermined threshold, and the target hypersurface is a closed hypersurface represented by the target deletion parameters. By finding out the geometric figures to be deleted, the part of the geometric figures can be directly deleted in the subsequent rendering process, thereby avoiding the rendering of the above-mentioned geometric figures to be deleted, achieving the purpose of efficient graphics rendering, thereby realizing the technical effect of improving the efficiency of graphics rendering and reducing the computational overhead of graphics rendering, thereby solving the technical problem of low efficiency of graphics rendering existing in the related art.
[0138] As an optional solution, searching for the geometric figure to be deleted in the first graphic model according to the target deletion parameter includes:
[0139] When the geometric figure includes a triangle and the target hypersurface is a three-dimensional sphere, the triangle to be deleted is searched in the first graphic model according to the target deletion parameter, wherein the number of vertices in the triangle to be deleted that are located inside the three-dimensional sphere is greater than 1.
[0140] Optionally, in this embodiment, when the geometric figure includes a triangle and the target hypersurface is a three-dimensional spherical surface, searching for the triangle to be deleted in the first graphic model according to the target deletion parameter may include but is not limited to the following steps: Figure 5 As shown, the above-mentioned geometric figure is predetermined to be a virtual triangle constituting the above-mentioned first graphic model, and the above-mentioned target hypersurface is a three-dimensional spherical surface. When the target deletion parameters represent the coordinates of the center of the three-dimensional spherical surface and the radius of the sphere, it is determined whether the vertices of the virtual triangle of the above-mentioned first graphic model are inside the three-dimensional spherical surface. When the number of vertices in the above-mentioned virtual triangle that are inside the above-mentioned three-dimensional spherical surface is greater than 1, the virtual triangle is determined as the above-mentioned geometric figure to be deleted.
[0141] Through this embodiment, when the geometric figure includes triangles and the target hypersurface is a three-dimensional sphere, the triangles to be deleted are searched in the first graphic model according to the target deletion parameters, wherein the number of vertices in the triangles to be deleted that are located inside the three-dimensional sphere is greater than 1. By finding out the virtual triangles to be deleted, the part of the virtual triangles can be directly deleted in the subsequent rendering process, thereby avoiding rendering the above-mentioned geometric figures to be deleted during the rendering of the above-mentioned graphics, and only rendering the required unobstructed triangles, thereby achieving the purpose of efficient graphics rendering, thereby realizing the technical effect of improving the efficiency of graphics rendering and reducing the computational overhead of graphics rendering, thereby solving the technical problem of low efficiency of graphics rendering existing in the related art.
[0142] As an optional solution, the target perspective and target deletion parameters under the target perspective are obtained, including:
[0143] Obtaining a target viewing angle and a target deletion parameter from a set of pre-stored data, wherein the set of data includes a plurality of pairs of viewing angles and deletion parameters under the viewing angles having a corresponding relationship;
[0144] The target viewing angle and the target deletion parameter are input into the GPU, wherein the GPU is used to determine the geometric figures to be deleted in the first graphic model under the target viewing angle according to the target deletion parameter, and delete the geometric figures to be deleted in the first graphic model to obtain the second graphic model.
[0145] Optionally, in this embodiment, the above-mentioned pre-stored set of data may include but is not limited to a set of pre-calculated viewing angles and a set of target deletion parameters, wherein each viewing angle in the above-mentioned set of viewing angles corresponds to one or more target deletion parameters.
[0146] Optionally, in this embodiment, after the GPU obtains the target viewing angle and the corresponding target deletion parameter, it deletes the geometric figure to be deleted from the first graphic model according to the target deletion parameter to obtain the second graphic model.
[0147] Specifically, taking the application scenario of the above-mentioned graphics rendering as a game application as an example, the above-mentioned first graphic model is a tree including leaves, and the above-mentioned target perspective is obtained by subtracting the current viewpoint from the center vector of the leaf group and normalizing it. After obtaining the target perspective, the target deletion parameters corresponding to the above-mentioned target perspective are determined from the pre-stored data.
[0148] Among them, for discrete deletion parameters, it can include but is not limited to discretizing the target perspective, and obtaining the corresponding above-mentioned target deletion parameters by linear interpolation, which can be completed by including but not limited to calculating in the CPU and uploading to the GPU, and can also be completed by including but not limited to reading maps, arrays or static code data through vertex shaders in the GPU.
[0149] Taking the execution of the above-mentioned graphics rendering method in the Unreal Engine engine as an example, it can include but is not limited to being implemented in a material function (material ball), for example, Figure 6 is a schematic diagram of another optional graphics rendering method according to an embodiment of the present invention, such as Figure 6 As shown, the input is the vector corresponding to the target perspective, the output is the target deletion parameter, the node UV_To_Index is a custom node, which is implemented as U×V_PART+V; the Sphere node is a discrete deletion parameter array node, which may include but is not limited to rounding down the input value Index and returning the corresponding element to obtain the above-mentioned target deletion parameter.
[0150] The above is only an example, and this embodiment does not make any specific limitation.
[0151] Through this embodiment, a target perspective and a target deletion parameter are obtained from a set of pre-stored data, wherein the set of data includes a plurality of pairs of perspectives and deletion parameters under the corresponding perspectives, and the target perspective and the target deletion parameter are input into the GPU, wherein the GPU is used to determine the geometric figures to be deleted in the first graphic model under the target perspective according to the target deletion parameter, and delete the geometric figures to be deleted in the first graphic model to obtain a second graphic model. By inputting the target perspective and the target deletion parameter into the GPU, the GPU determines the geometric figures to be deleted in the first graphic model under the target perspective according to the target deletion parameter, and deletes the geometric figures to be deleted in the first graphic model to obtain the second graphic model, thereby avoiding rendering the above-mentioned geometric figures to be deleted in the rendering process of the above-mentioned graphics, and only rendering the second graphic model composed of the required unobstructed triangles, thereby achieving the purpose of efficient graphics rendering, thereby realizing the technical effect of improving the efficiency of graphics rendering and reducing the computational overhead of graphics rendering, thereby solving the technical problem of low efficiency of graphics rendering existing in the related art.
[0152] As an optional solution, the above method also includes:
[0153] The target deletion parameter is determined based on the total pixel amount and effective pixel amount of the geometric figures in a group of geometric figures at the target viewing angle, wherein the total pixel amount represents the pixel amount consumed by the geometric figures during the rendering process, and the effective pixel amount represents the pixel amount of the geometric figures drawn on the screen.
[0154] Optionally, in this embodiment, the total number of pixels of the geometric figures in the above-mentioned group of geometric figures at the target viewing angle is the total number of pixels corresponding to the above-mentioned first graphic model during the rendering process, and the effective number of pixels of the geometric figures in the above-mentioned group of geometric figures at the target viewing angle is the total number of pixels corresponding to the above-mentioned second graphic model during the rendering process.
[0155] Optionally, in this embodiment, the total number of pixels and the effective number of pixels of the geometric figures in the above-mentioned set of geometric figures at the target viewing angle may include but are not limited to being requested by the CPU and determined in the GPU. The drawing buffer needs to enable high-precision depth buffering. When drawing, opaque leaves directly output any color, while transparent leaves need to read the alpha channel from the transparent map. If it is lower than 0.5, the pixel is discarded, otherwise any color is output. Due to the simple shading, the GPU can efficiently handle the entire process.
[0156] Specifically, Figure 7 is a schematic diagram of another optional graphics rendering method according to an embodiment of the present invention. Figure 7 As shown, the following steps may be included but not limited to:
[0157] S1, traverse all the perspectives within the pre-calculated range;
[0158] S2, obtaining the amount of self-drawn pixels and the amount of effective drawn pixels of each geometric figure in a group of geometric figures under the target viewing angle.
[0159] Taking the first graphic model as a tree and the geometric figure as a leaf triangle as an example, the above-mentioned acquisition of the self-drawn pixel amount and the effective drawn pixel amount of each geometric figure is implemented by the following steps:
[0160] S1, start;
[0161] S2, input screen parameters;
[0162] S3, adjust the GPU depth test parameter to "nearby" and turn on the "depth write" function to draw opaque tree trunks and transparent leaves to record the depth information corresponding to each leaf triangle;
[0163] S4, adjust the depth test parameter of the GPU to "equal" and turn off the "depth write" function to draw the leaf triangle with transparency and obtain the corresponding pixel quantity;
[0164] S5, determining whether to traverse all leaf triangles to obtain the effective pixel quantity ε corresponding to the first graphic model in the rendering process i If the judgment result is yes, execute step S6, otherwise, execute step S4;
[0165] S6, adjust the GPU depth test parameter to "always" and turn off the "depth write" function to draw the leaf triangle with transparency and obtain its corresponding pixel volume;
[0166] S7, determining whether to traverse all leaf triangles to obtain the total pixel quantity P corresponding to the first graphic model in the rendering process i If the judgment result is yes, execute step S8, otherwise, execute step S6;
[0167] S8, saving the effective pixel amount ε corresponding to the first graphic model during the rendering process i And the total number of pixels P i ;
[0168] S9, end.
[0169] When the screen resolution, projection matrix and target viewing angle are determined, the pixels of the leaf triangle on the screen can be determined. The total number of pixels of each triangle is P i Represents the number of pixels consumed by a triangle during rendering, the effective pixel count ε i Represents the number of pixels that can ultimately be drawn on the screen. i ≤P i , when the leaves are not completely blocked, the equality holds. On the contrary, when the leaves are completely blocked, ε i =0, then this part of leaf triangles is the amount that needs to be deleted.
[0170] Figure 8 is a schematic diagram of another optional graphics rendering method according to an embodiment of the present invention. Figure 8 As shown, according to the total pixel quantity and effective pixel quantity of the geometric figures in a set of geometric figures at the target viewing angle, determining the target deletion parameter includes but is not limited to the following steps:
[0171] S1, start;
[0172] S2, input model and settings;
[0173] S3, obtaining the drawing pixel amount and effective drawing pixel amount of all leaf triangles under the viewing angle E0;
[0174] S4, determining whether all viewing angles within the pre-calculation range have been traversed, if the determination result is yes, executing step S5, otherwise, executing step S3;
[0175] S5, calculating λ(E0) of viewing angle E0;
[0176] S6, determining whether all viewing angles within the pre-calculation range have been traversed. If the determination result is yes, executing step S7, otherwise, executing step S5;
[0177] S7, calculate the λ(E) function;
[0178] S8, save the preprocessing result λ(E);
[0179] S9, end.
[0180] The above is only an example, and this embodiment does not make any specific limitation.
[0181] Through this embodiment, the target deletion parameter is determined according to the total pixel amount and effective pixel amount of the geometric figures in a group of geometric figures under the target viewing angle, wherein the total pixel amount represents the pixel amount consumed by the geometric figures in the rendering process, and the effective pixel amount represents the pixel amount of the geometric figures drawn on the screen. By obtaining the total pixel amount and effective pixel amount of the geometric figures in a group of geometric figures under the target viewing angle, the target deletion parameter is determined, thereby avoiding rendering the above-mentioned geometric figures to be deleted during the rendering of the above-mentioned graphics, and only rendering the second graphic model composed of the required unobstructed triangles, thereby achieving the purpose of efficient graphics rendering, thereby realizing the technical effect of improving the efficiency of graphics rendering and reducing the computational overhead of graphics rendering, thereby solving the technical problem of low efficiency of graphics rendering existing in the related art.
[0182] As an optional solution, the target deletion parameter is determined according to the total pixel quantity and effective pixel quantity of the geometric figures in a group of geometric figures at the target viewing angle, including:
[0183] Under the target constraint conditions determined according to the total pixel quantity and the effective pixel quantity, the target deletion parameter is determined, wherein the target deletion parameter represents the target hypersurface, and the target constraint conditions include: under the constraint that the sum of the effective pixel quantities of the geometric figures located inside the target hypersurface is equal to the preset allowable error value, the sum of the total pixel quantities of the geometric figures located inside the target hypersurface is maximized.
[0184] Optionally, in this embodiment, the target deletion parameter represents the target hypersurface and may include but is not limited to configuring the target deletion parameter to λ(E). Taking the target hypersurface as a three-dimensional spherical surface as an example, λ(E) includes {λ x ,λ y ,λ z}Three parameters used to represent the coordinates of the center of the three-dimensional sphere, and λ r Used to represent the radius of a three-dimensional sphere.
[0185] Then the target constraint conditions may include but are not limited to the sum of the effective pixel quantities of the geometric figures located inside the target hypersurface ε(λ(E0))=Σ(ε i ) is equal to the predetermined allowable error value εmax, that is, by means of the given allowable error value εmax, while controlling ε(λ(E0))≈εmax, it is hoped to obtain the optimal λ(E0) so that P(λ(E0)) (corresponding to the sum of the total number of pixels of the aforementioned geometric figures located inside the target hypersurface P(λ(E0))=Σ(Pi)) is maximized.
[0186] Through this embodiment, the target deletion parameter is determined under the target constraint condition determined according to the total pixel amount and the effective pixel amount, wherein the target deletion parameter represents the target hypersurface, and the target constraint condition includes: under the restriction that the sum of the effective pixel amounts of the geometric figures located inside the target hypersurface is equal to the preset error allowable value, the total pixel amount of the geometric figures located inside the target hypersurface is maximized, and according to the sum of the effective pixel amounts of the geometric figures located inside the three-dimensional sphere and the predetermined target constraint condition, the total pixel amount of the geometric figures located inside the three-dimensional sphere is maximized, so as to determine the deletion parameter at the current viewing angle, avoid rendering the above-mentioned geometric figures to be deleted in the process of rendering the above-mentioned graphics, and only render the second graphic model composed of the required unobstructed triangles, thereby achieving the purpose of efficient graphics rendering, thereby realizing the technical effect of improving the efficiency of graphics rendering and reducing the computational overhead of graphics rendering, and further solving the technical problem of low efficiency of graphics rendering existing in the related art.
[0187] As an optional solution, under the target constraint condition determined according to the total pixel quantity and the effective pixel quantity, the target deletion parameter is determined, including:
[0188] When the target hypersurface is a three-dimensional spherical surface and the target deletion parameters include the coordinates of the center of the three-dimensional spherical surface and the radius of the sphere, the coordinates of the center of the spherical surface are determined according to the sum of the effective pixel quantities of the geometric figures located inside the three-dimensional spherical surface and the sum of the total pixel quantities of the geometric figures located inside the three-dimensional spherical surface;
[0189] Determine the radius of the sphere based on the coordinates of the sphere center and the allowable error value.
[0190] Optionally, in this embodiment, when the target hypersurface is a three-dimensional spherical surface and the target deletion parameters include the coordinates of the center of the three-dimensional spherical surface and the radius of the sphere, the coordinates of the center of the sphere may be determined according to the sum of the effective pixel quantities of the geometric figures located inside the three-dimensional spherical surface and the sum of the total pixel quantities of the geometric figures located inside the three-dimensional spherical surface, including but not limited to the following methods:
[0191] Taking the target viewing angle as E0 and the target deletion parameter as λ(E0), the total number of pixels P of each triangle is obtained. i and the effective pixel count ε i Thereafter, a deletion parameter λ(E) with respect to the viewing angle E is determined.
[0192] Assume that when E=E0, λ(E0)=span{λ x ,λ y ,λ z ,λ r}, the total amount of pixels deleted is:
[0193] P(λ(E0))=Σ(P i ),{i|F(λ(E0),v i1 )<0 and F(λ(E0),v i2 )<0 and F(λ(E0),v i3 )<0};
[0194] At the same time, the amount of pixels affected on the final rendering result is:
[0195] ε(λ(E0))=Σ(ε i ),{i|F(λ(E0),v i1 )<0 and F(λ(E0),v i2 )<0 and F(λ(E0),v i3 )<0}
[0196] Among them, i represents the geometric figure, v i1 、v i2 、v i3 Represents the three-dimensional coordinate values of the three vertices of a geometric figure.
[0197] Furthermore, Fig. 9 is a schematic diagram of another optional graphics rendering method according to an embodiment of the present invention. Fig. 9 As shown, the solution is simplified in the following way to reduce the number of parameters to be solved. The simplification method is as follows:
[0198] By giving the error tolerance εmax, we control ε(λ(E0))≈εmax and determine the optimal λ(E0) to maximize P(λ(E0)). That is, for any given sphere center parameter span{λ x ,λ y ,λ z}, since ε(λ(E0)) has been determined, the radius parameter λ can be obtained r Combining λ(E0) and obtaining P(λ(E0)), P(λ(E0)) can be regarded as only about the center parameter span{λ x ,λy ,λ z} of the function P~P(λ x ,λ y ,λ z ).
[0199] In order to find the best deletion ball center to maximize the benefit P. The experiment shows that based on the deletion relationship, the center P(λ x ,λ y ,λ z ) has obvious three-dimensional spatial features. The center and radius of the three-dimensional spherical surface can be determined based on the three-dimensional spatial features of the three-dimensional spherical surface.
[0200] The above is only an example, and this embodiment does not make any specific limitation.
[0201] Through this embodiment, when the target hypersurface is a three-dimensional sphere and the target deletion parameters include the center coordinates of the three-dimensional sphere and the radius of the sphere, the center coordinates are determined according to the sum of the effective pixels of the geometric figures located inside the three-dimensional sphere and the sum of the total pixels of the geometric figures located inside the three-dimensional sphere, and the radius of the sphere is determined according to the center coordinates and the allowable error value. The target hypersurface is determined according to the sum of the effective pixels of the geometric figures located inside the three-dimensional sphere and the sum of the total pixels of the geometric figures located inside the three-dimensional sphere, and then the deletion parameters at the current viewing angle are determined, thereby avoiding rendering the above-mentioned geometric figures to be deleted during the rendering of the above-mentioned graphics, and only rendering the second graphic model composed of the required unobstructed triangles, thereby achieving the purpose of efficient graphics rendering, thereby realizing the technical effect of improving the efficiency of graphics rendering and reducing the computational overhead of graphics rendering, and then solving the technical problem of low efficiency of graphics rendering existing in the related art.
[0202] As an optional solution, the coordinates of the sphere center are determined according to the sum of the effective pixel quantities of the geometric figures located inside the three-dimensional sphere and the sum of the total pixel quantities of the geometric figures located inside the three-dimensional sphere, including:
[0203] When the geometric figure is a triangle, the coordinates of the center of the sphere are determined under the constraint that the sum of the effective pixels of the triangles located inside the three-dimensional sphere is the allowable error value, wherein the coordinates of the center of the sphere are used to maximize the sum of the total pixels of the triangles located inside the three-dimensional sphere.
[0204] Optionally, in this embodiment, the above-mentioned error allowable value εmax is determined by parameters obtained before pre-calculation, and may include but is not limited to being configured in advance by staff according to business scenarios, or may be adaptively configured according to GPU parameters.
[0205] Optionally, in this embodiment, the spherical center coordinates determined above indicate that the three-dimensional spherical surface corresponding to the spherical center coordinates includes the largest number of triangles, thereby achieving the technical effect of improving culling efficiency.
[0206] Through this embodiment, when the geometric figure is a triangle, the center coordinates of the sphere are determined under the restriction that the sum of the effective pixels of the triangles located inside the three-dimensional sphere is the allowable error value, wherein the center coordinates of the sphere are used to maximize the sum of the total pixels of the triangles located inside the three-dimensional sphere. According to the sum of the effective pixels of the geometric figure located inside the three-dimensional sphere and the sum of the total pixels of the geometric figure located inside the three-dimensional sphere, the target hypersurface is determined, and then the deletion parameters at the current viewing angle are determined, and then it is judged whether the triangle is inside the hypersurface corresponding to the deletion parameters to determine the triangle to be deleted, thereby avoiding rendering the above-mentioned geometric figure to be deleted during the rendering of the above-mentioned graphics, and only rendering the second graphic model composed of the required unobstructed triangles, thereby achieving the purpose of efficient graphics rendering, thereby realizing the technical effect of improving the efficiency of graphics rendering and reducing the computational overhead of graphics rendering, and thus solving the technical problem of low efficiency of graphics rendering existing in the related art.
[0207] As an optional solution, under the restriction that the sum of the effective pixel quantities of the triangles located inside the three-dimensional sphere is the allowable error value, the coordinates of the sphere center are determined, including:
[0208] Under the restriction that the sum of the effective pixels of the triangles located inside the three-dimensional sphere is the allowable error value, the coordinates of the center of the sphere are determined near the extension line from the target center to the target viewing angle in the target relationship diagram, where the target center is the center of the target relationship diagram, and the target relationship diagram represents the relationship between the sum of the total pixels and the three-dimensional space coordinates.
[0209] Optionally, in this embodiment, the target relationship graph is used to represent a relationship graph of the first graphic model under the target perspective. Taking the first graphic model as a tree as an example, the target relationship graph represents a group of leaves, and the target center is the center of the group of leaves. The target relationship graph represents the relationship between the sum of the total pixel quantity and the three-dimensional space coordinates. By controlling ε(λ(E0))≈εmax through a given error allowable value εmax, to determine the optimal λ(E0) so that P(λ(E0)) is maximized, P(λ(E0)) is regarded as only about the sphere center parameter span{λ x ,λ y ,λ z} of the function P~P(λ x ,λ y ,λ z ).
[0210] In order to find the best deletion ball center to maximize the benefit P. The experiment shows that based on the deletion relationship, the center P(λ x ,λ y ,λ z ) has obvious three-dimensional spatial features. The center and radius of the three-dimensional spherical surface can be determined based on the three-dimensional spatial features of the three-dimensional spherical surface.
[0211] Fig.10 is a schematic diagram of another optional graphics rendering method according to an embodiment of the present invention. Fig.10 As shown, the above-mentioned determination of the sphere center coordinates near the extension line from the target center to the target viewing angle in the target relationship diagram may include but is not limited to the following exemplary steps:
[0212] S1, defines the center point C of the leaf cluster, that is, Fig.10 Show the center of the cone. For a leaf group, solve the axis-aligned bounding box AABB of all vertices V of all leaves in it, and get the two diagonal points AABBMax and AABBMin of the bounding box as follows:
[0213] AABBMax=max(v)
[0214] AABBMin=min(v)
[0215] At this point, the center point of the leaf group is the center point of the bounding box AABBCenter:
[0216] AABBCenter=(AABBMax+AABBMin) / 2
[0217] S2, when the viewing angle E is fixed, P(λ x ,λ y ,λ z ) is shown in the following three-dimensional visualization results: Fig.10 As shown in the figure, the value intervals are distinguished by different colors, and it can be concluded that the gain (corresponding to the sum of the total number of pixels mentioned above) increases as the center point of the leaf group shrinks toward the rear of the visual angle, and the maximum value is most likely to appear in the direction extending backward in the visual direction.
[0218] Assuming that the angle of the three-dimensional cone is α and the center of the leaf group is C, the sampling point i is:
[0219]
[0220] Take the maximum benefit value of several sampling points (set as n) as λ(E) to complete the calculation. That is:
[0221] λ(E)=max(P[Sample(i)]), 1≤i≤n
[0222] Through the above formula, under the restriction that the sum of the effective pixels of the triangles located inside the three-dimensional sphere is the allowable error value, the coordinates of the center of the sphere and the corresponding radius of the sphere can be determined near the extension line from the target center to the target viewing angle in the target relationship diagram, and then the target deletion parameters corresponding to the above target viewing angle can be determined.
[0223] Through this embodiment, the coordinates of the center of the sphere are determined near the extension line from the target center to the target viewing angle in the target relationship graph, under the restriction that the sum of the effective pixel quantities of the triangles located inside the three-dimensional sphere is the allowable error value, wherein the target center is the center of the target relationship graph, and the target relationship graph represents the relationship between the sum of the total pixel quantities and the three-dimensional space coordinates. The coordinates of the center of the sphere are determined near the extension line from the target center to the target viewing angle in the target relationship graph to achieve determination of the deletion parameters at the current viewing angle, and then determine whether the triangle is inside the hypersurface corresponding to the deletion parameters to determine the triangle to be deleted, thereby avoiding rendering the above-mentioned geometric figures to be deleted during the rendering of the above-mentioned graphics, and only rendering the second graphic model composed of the required unobstructed triangles, thereby achieving the purpose of efficient graphics rendering, thereby achieving the technical effect of improving the efficiency of graphics rendering and reducing the computational overhead of graphics rendering, and further solving the technical problem of low efficiency of graphics rendering existing in the related art.
[0224] As an optional solution, the radius of the sphere is determined according to the coordinates of the sphere center and the allowable error value, including:
[0225] Get the assumed sphere center coordinates λx, λy, λz, where λx is used to represent the coordinates on the x-axis corresponding to the sphere center coordinates in the three-dimensional space, λy is used to represent the coordinates on the y-axis corresponding to the sphere center coordinates in the three-dimensional space, and λz is used to represent the coordinates on the z-axis corresponding to the sphere center coordinates in the three-dimensional space;
[0226] Under the constraint that the sum of the effective pixels of the triangles inside the three-dimensional sphere is the allowable error value, the radius of the sphere λ is determined according to the allowable error value and the coordinates of the sphere center. r .
[0227] Optionally, in this embodiment, under the restriction that the sum of the effective pixel quantities of the triangles located inside the three-dimensional sphere is the allowable error value, the radius of the sphere λr is determined according to the allowable error value and the coordinates of the center of the sphere, that is, according to the given, ε(λ(E0))≈εmax is controlled, and the optimal λ(E0) is determined so that P(λ(E0)) is maximized, and P(λ(E0)) is regarded as only about the center parameter span{λ x ,λ y ,λ z} of the function P~P(λ x ,λ y ,λz ).
[0228] In other words, when P(λ(E0)) is determined to be the maximum, Fig.10 A set of coordinate points are randomly selected from the perspective shown in the figure, and are substituted into the above P(λ(E0)). The coordinate point in the set of coordinate points corresponding to the maximum value of P(λ(E0)) is the above sphere center coordinate, and the sphere radius λ corresponding to the sphere center coordinate is r , after determining that P(λ(E0)) is the maximum value, the radius λ of the sphere can also be determined based on P(λ(E0)) r .
[0229] As an optional solution, the method further includes:
[0230] When the sphere center coordinates include λx, λy, λz, the sphere center coordinates are converted to λθ, λd;
[0231] When the target viewing angle is determined, a two-dimensional vector is used to store the λ(E) target deletion parameter, where the target deletion parameter is λ(E)=span{λd,λr}, where λd represents the offset of the target center to the target viewing angle, λr represents the radius of the sphere, and the span function is used to represent the parameter space containing the two parameters λd and λr, and E is the target viewing angle.
[0232] Optionally, in this embodiment, the above-mentioned target deletion parameters can be simplified, including but not limited to, in the following manner: the deletion parameter λ = span{λx,λy,λz,λr}, and the amount to be stored is a 4-dimensional vector. For example, if for any viewing angle E, only the optimal deletion sphere center is found from the center of the leaf group toward the viewing angle E, then the deletion sphere center span{λx,λy,λz} can be expressed as span{λθ,λφ,λd} using a spherical coordinate system. Since λθ and λφ are determined by the viewing angle E, λ(E) = span{λd,λr}, where λd represents the offset of the center of the leaf group toward the viewing angle E, and λr represents the size of the deletion sphere, so as to greatly reduce the amount of pre-calculation, and use a two-dimensional vector to store λ(E).
[0233] For some leaves with weak spatial features, a similar method can be used to solve the simplified method, or the optimal culling sphere parameters can be directly solved for the bounding box sampling space points.
[0234] The above is only an example, and this embodiment does not make any specific limitation.
[0235] As an optional solution, the method further includes:
[0236] When the target deletion parameter λ(E) is a discrete parameter, a target viewing angle E and a target deletion parameter λ(E) corresponding to the target viewing angle are obtained;
[0237] The discrete target deletion parameter λ'(E) is calculated as follows:
[0238] Use inverse trigonometric functions to convert the target viewing angle E into spherical parameter coordinates
[0239] Get the sampling coordinates (x, y) of the spherical parameter coordinates;
[0240] Solve the integer part and the decimal part of the sampling coordinates respectively, where the integer part is obtained by rounding up or down;
[0241] Multiple groups of deletion parameters λ are obtained by sampling the integer part;
[0242] The decimal part is used as an interpolation coefficient to solve λ'(E) to output λ'(E) in the target material engine, and a deletion parameter λ'(E) is determined for directly determining in the target material engine the geometry to be deleted in the first graphic model at the target perspective.
[0243] Optionally, in this embodiment, the following exemplary descriptions may be included but are not limited to:
[0244] For discrete λ(E), the view angle E needs to be discretized and linear interpolation is performed to obtain λ'(E). The above process can be calculated in the CPU and uploaded to the GPU, or it can be completed in the GPU by reading textures, arrays or static code data through the vertex shader. The process is as follows:
[0245] S1, use inverse trigonometric functions to convert the viewing angle E into spherical parameter coordinates (φ, θ);
[0246] S2, calculate the sampling coordinates (x, y) of the spherical parameter angle;
[0247] S3, respectively solve the upper and lower integers and decimal parts of the sampling coordinates;
[0248] S4, four groups of λ are obtained by sampling the coordinates with rounding up and down;
[0249] S5, using the decimal part as the interpolation coefficient to solve λ'(E).
[0250] Through this embodiment, discrete target deletion parameters can be obtained through linear interpolation to obtain deletion parameters that can be used in the material engine, thereby achieving the technical effect of graphics rendering efficiency.
[0251] As an optional solution, the geometric figure to be deleted in the first graphic model is deleted to obtain the second graphic model, including:
[0252] In the GPU pipeline, the geometry to be deleted is deleted through the geometry shader; or
[0253] In the GPU pipeline, the geometry to be deleted is deleted through the vertex shader.
[0254] Optionally, in this embodiment, the geometric figures to be deleted may be deleted by a geometry shader in the GPU pipeline in the following manners, including but not limited to:
[0255] In the GPU pipeline, the geometry shader comes after the vertex shader. For each triangle, each vertex is brought into F(λ(E),v) for testing. If the test result shows that two or three vertices are less than 0, the triangle is abandoned and deleted.
[0256] The geometry to be deleted can be deleted through the vertex shader in the GPU pipeline, including but not limited to the following methods:
[0257] Since some graphics rendering engines have difficulty supporting geometry shader features, you can choose to implement deletion in the vertex shader. However, the vertex shader does not have the function of abandoning vertices or primitives, so it is necessary to gather the vertices of the primitives to a certain vertex to ensure that no pixels are generated after rasterization, so as to achieve the purpose of deleting pixels. This requires calculating the convergence point of the leaves during pre-calculation, encoding and storing it in the vertex color or other vertex data. For example, use a union-find set to divide the leaves into clusters, and use the center point of the cluster as the convergence point.
[0258] In the vertex shader, if F(λ(E), v) < 0, the vertex color is decoded into local space coordinates, and then the original local space coordinates of the vertex are replaced to complete the deletion.
[0259] This embodiment is compatible with most existing graphics production processes and is scalable to different operating platforms, and can be applied to different graphics rendering products in the industry.
[0260] It should be noted that the method for calculating the target deletion parameters in the present application may also include but is not limited to using other non-traversal methods such as clustering algorithms to calculate the optimal culling ball parameters.
[0261] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence, because according to the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0262] According to another aspect of the embodiments of the present invention, a graphics rendering device for implementing the above-mentioned graphics rendering method is also provided. Fig.11 As shown, the device comprises:
[0263] A first acquisition module 1102 is used to acquire a first graphic model to be processed, wherein the first graphic model includes a set of geometric figures;
[0264] The second acquisition module 1104 is used to acquire a target viewing angle and a target deletion parameter under the target viewing angle;
[0265] A determination module 1106, configured to determine, according to the target deletion parameter, the geometric figure to be deleted in the first graphic model at the target viewing angle;
[0266] A deleting module 1108, configured to delete the geometric figure to be deleted in the first graphic model to obtain a second graphic model;
[0267] The rendering module 1110 is configured to render the second graphic model at the target viewing angle.
[0268] As an optional solution, the deleting module 1108 includes:
[0269] A first search unit is used to search the geometric figure to be deleted in the first graphic model according to the target deletion parameter, wherein the number of vertices in the geometric figure to be deleted that are located inside a target hypersurface is greater than a predetermined threshold, and the target hypersurface is a closed hypersurface represented by the target deletion parameter.
[0270] As an optional solution, the deleting module 1108 includes:
[0271] A second search unit is used to search for the triangle to be deleted in the first graphic model according to the target deletion parameter when the geometric figure includes a triangle and the target hypersurface is a three-dimensional sphere, wherein the number of vertices in the triangle to be deleted that are located inside the three-dimensional sphere is greater than 1.
[0272] As an optional solution, the device is used to obtain the target viewing angle and the target deletion parameter under the target viewing angle in the following manner:
[0273] Acquire the target viewing angle and the target deletion parameter from a set of pre-stored data, wherein the set of data includes a plurality of pairs of viewing angles and deletion parameters under the viewing angles having a corresponding relationship;
[0274] The target viewing angle and the target deletion parameter are input into the GPU, wherein the GPU is used to determine the geometric figures to be deleted in the first graphic model under the target viewing angle according to the target deletion parameter, and delete the geometric figures to be deleted in the first graphic model to obtain a second graphic model.
[0275] As an optional solution, the device is also used for:
[0276] The target deletion parameter is determined based on the total pixel amount and effective pixel amount of the geometric figures in the group of geometric figures at the target viewing angle, wherein the total pixel amount represents the pixel amount consumed by the geometric figures during the rendering process, and the effective pixel amount represents the pixel amount of the geometric figures drawn on the screen.
[0277] As an optional solution, the device is used to determine the target deletion parameter according to the total pixel quantity and effective pixel quantity of the geometric figures in the set of geometric figures at the target viewing angle in the following manner:
[0278] Under the target constraint conditions determined according to the total pixel quantity and the effective pixel quantity, the target deletion parameter is determined, wherein the target deletion parameter represents the target hypersurface, and the target constraint conditions include: under the restriction that the sum of the effective pixel quantities of the geometric figures located inside the target hypersurface is equal to a preset allowable error value, the sum of the total pixel quantities of the geometric figures located inside the target hypersurface is maximized.
[0279] As an optional solution, the device is used to determine the target deletion parameter under the target constraint condition determined according to the total pixel quantity and the effective pixel quantity in the following manner:
[0280] When the target hypersurface is a three-dimensional spherical surface and the target deletion parameters include the coordinates of the center of the three-dimensional spherical surface and the radius of the sphere, the coordinates of the center of the spherical surface are determined according to the sum of the effective pixel quantities of the geometric figures located inside the three-dimensional spherical surface and the sum of the total pixel quantities of the geometric figures located inside the three-dimensional spherical surface;
[0281] The radius of the sphere is determined according to the coordinates of the sphere center and the allowable error value.
[0282] As an optional solution, the device is used to determine the coordinates of the sphere center according to the sum of the effective pixel quantities of the geometric figures located inside the three-dimensional sphere and the sum of the total pixel quantities of the geometric figures located inside the three-dimensional sphere in the following manner:
[0283] When the geometric figure is a triangle, the center coordinates of the sphere are determined under the restriction that the sum of the effective pixels of the triangle located inside the three-dimensional sphere is the allowable error value, wherein the center coordinates of the sphere are used to maximize the sum of the total pixels of the triangle located inside the three-dimensional sphere.
[0284] As an optional solution, the device is used to determine the coordinates of the sphere center under the restriction that the sum of the effective pixel quantities of the triangles located inside the three-dimensional sphere is the error allowable value in the following manner:
[0285] Under the restriction that the sum of the effective pixels of the triangle located inside the three-dimensional sphere is the allowable error value, the coordinates of the center of the sphere are determined near the extension line from the target center to the target viewing angle in the target relationship diagram, wherein the target center is the center of the target relationship diagram, and the target relationship diagram represents the relationship between the sum of the total pixel amounts and the three-dimensional space coordinates.
[0286] As an optional solution, the device is used to determine the radius of the sphere according to the sphere center coordinates and the allowable error value in the following manner:
[0287] Obtaining assumed sphere center coordinates λx, λy, and λz, wherein λx is used to represent the coordinate of the sphere center coordinate on the x-axis corresponding to the sphere center coordinate in the three-dimensional space coordinate, λy is used to represent the coordinate of the sphere center coordinate on the y-axis corresponding to the sphere center coordinate in the three-dimensional space coordinate, and λz is used to represent the coordinate of the sphere center coordinate on the z-axis corresponding to the sphere center coordinate in the three-dimensional space coordinate;
[0288] Under the restriction that the sum of the effective pixel quantities of the triangles located inside the three-dimensional spherical surface is the allowable error value, the sphere radius λr is determined according to the allowable error value and the sphere center coordinates.
[0289] As an optional solution, the device is also used for:
[0290] In the case where the spherical center coordinates include λx, λy, and λz, the spherical center coordinates are converted into λθ represented by a spherical coordinate system. λd;
[0291] When the target viewing angle is determined, a two-dimensional vector is used to store λ(E) the target deletion parameter, wherein the target deletion parameter is λ(E)=span{λd,λr}, wherein λd represents the offset of the target center to the target viewing angle, λr represents the radius of the sphere, the span function is used to represent the parameter space including the two parameters λd and λr, and E is the target viewing angle.
[0292] As an optional solution, the device is also used for:
[0293] When the target deletion parameter λ(E) is a discrete parameter, obtaining a target viewing angle E and a target deletion parameter λ(E) corresponding to the target viewing angle;
[0294] The discrete target deletion parameter λ'(E) is calculated as follows:
[0295] The target viewing angle E is converted into spherical parameter coordinates using inverse trigonometric functions
[0296] Obtaining the sampling coordinates (x, y) of the spherical parameter coordinates;
[0297] Solving the integer part and the decimal part of the sampling coordinates respectively, wherein the integer part is obtained by rounding up or down;
[0298] Using the integer part sampling to obtain multiple groups of deletion parameters λ;
[0299] The decimal part is used as an interpolation coefficient to solve λ'(E) to output the λ'(E) in a target material engine, and a deletion parameter λ'(E) is determined for directly determining in the target material engine the geometric figures to be deleted in the first graphic model at the target perspective.
[0300] As an optional solution, the device is used to delete the geometric figure to be deleted in the first graphic model in the following manner to obtain the second graphic model:
[0301] In the GPU pipeline, the to-be-deleted geometric figure is deleted by a geometry shader; or
[0302] In the GPU pipeline, the geometric figures to be deleted are deleted through the vertex shader.
[0303] According to another aspect of the embodiments of the present invention, an electronic device for implementing the above-mentioned graphics rendering method is also provided. The electronic device may be Figure 1 The terminal device or server shown in the figure. This embodiment is described by taking the electronic device as a server as an example. Fig.12 As shown, the electronic device includes a memory 1202 and a processor 1204. The memory 1202 stores a computer program, and the processor 1204 is configured to execute the steps in any of the above method embodiments through the computer program.
[0304] Optionally, in this embodiment, the electronic device may be located in at least one network device among a plurality of network devices of a computer network.
[0305] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0306] S1, obtaining a first graphic model to be processed, wherein the first graphic model includes a set of geometric figures;
[0307] S2, obtaining the target perspective and the target deletion parameters under the target perspective;
[0308] S3, determining the geometric figure to be deleted in the first graphic model at the target viewing angle according to the target deletion parameter;
[0309] S4, deleting the geometric figure to be deleted in the first graphic model to obtain a second graphic model;
[0310] S5, rendering the second graphic model at the target viewing angle.
[0311] Alternatively, a person skilled in the art may understand that: Fig.12 The structure shown is for illustration only, and the electronic device may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (MID), a PAD, and other terminal devices. Fig.12 The electronic device and the electronic equipment described above are not limited in structure. Fig.12 More or fewer components (such as network interfaces, etc.) as shown in, or with Fig.12 Different configurations are shown.
[0312] Among them, the memory 1202 can be used to store software programs and modules, such as the program instructions / modules corresponding to the graphics rendering method and device in the embodiment of the present invention. The processor 1204 executes various functional applications and data processing by running the software programs and modules stored in the memory 1202, that is, realizing the above-mentioned graphics rendering method. The memory 1202 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 1202 may further include a memory remotely located relative to the processor 1204, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Among them, the memory 1202 can be specifically, but not limited to, used for information such as target deletion parameters. As an example, if Fig.12As shown, the memory 1202 may include, but is not limited to, the first acquisition module 1102 , the second acquisition module 1104 , the determination module 1106 , the deletion module 1108 and the rendering module 1110 in the graphics rendering device.
[0313] In addition, other module units in the above-mentioned graphics rendering device may also be included but not limited to, which will not be described in detail in this example.
[0314] Optionally, the transmission device 1206 is used to receive or send data via a network. Specific examples of the network may include a wired network and a wireless network. In one example, the transmission device 1206 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device 1206 is a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0315] In addition, the electronic device further includes: a display 1208 for displaying the rendered graphic model; and a connection bus 1210 for connecting various module components in the electronic device.
[0316] In other embodiments, the terminal device or server may be a node in a distributed system, wherein the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting the multiple nodes through network communication. Among them, the nodes may form a peer-to-peer (P2P, Peer To Peer) network, and any form of computing device, such as a server, terminal and other electronic devices, may become a node in the blockchain system by joining the peer-to-peer network.
[0317] According to one aspect of the present application, a computer program product or computer program is provided, the computer program product or computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the method provided in various optional implementations of the above-mentioned graphics rendering. The computer program is configured to perform the steps of any of the above-mentioned method embodiments when it is run.
[0318] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:
[0319] S1, obtaining a first graphic model to be processed, wherein the first graphic model includes a set of geometric figures;
[0320] S2, obtaining the target perspective and the target deletion parameters under the target perspective;
[0321] S3, determining the geometric figure to be deleted in the first graphic model at the target viewing angle according to the target deletion parameter;
[0322] S4, deleting the geometric figure to be deleted in the first graphic model to obtain a second graphic model;
[0323] S5, rendering the second graphic model at the target viewing angle.
[0324] Optionally, in this embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing hardware related to the terminal device through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.
[0325] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0326] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which can be personal computers, servers or network devices, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention.
[0327] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0328] In the several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0329] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0330] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0331] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A graphics rendering method, characterized in that: include: Acquire a first graphic model to be processed, wherein the first graphic model includes a set of geometric figures; Obtaining a target viewing angle and a target deletion parameter under the target viewing angle; Determining, according to the target deletion parameter, a geometric figure to be deleted in the first graphic model at the target viewing angle; Deleting the geometric figure to be deleted in the first graphic model to obtain a second graphic model; The second graphic model is rendered under the target viewing angle.
2. The method according to claim 1, characterized in that The step of determining the geometric figure to be deleted in the first graphic model at the target viewing angle according to the target deletion parameter includes: According to the target deletion parameters, the geometric figure to be deleted is searched in the first graphic model, wherein the number of vertices in the geometric figure to be deleted that are located inside a target hypersurface is greater than a predetermined threshold, and the target hypersurface is a closed hypersurface represented by the target deletion parameters.
3. The method according to claim 2, characterized in that The step of searching the first graphic model for the geometric figure to be deleted according to the target deletion parameter comprises: When the geometric figure includes a triangle and the target hypersurface is a three-dimensional sphere, the triangle to be deleted is searched in the first graphic model according to the target deletion parameter, wherein the number of vertices in the triangle to be deleted that are located inside the three-dimensional sphere is greater than 1.
4. The method according to claim 1, characterized in that The acquiring of the target viewing angle and the target deletion parameter under the target viewing angle includes: Acquire the target viewing angle and the target deletion parameter from a set of pre-stored data, wherein the set of data includes a plurality of pairs of viewing angles and deletion parameters under the viewing angles having a corresponding relationship; The target viewing angle and the target deletion parameter are input into the GPU, wherein the GPU is used to determine the geometric figures to be deleted in the first graphic model under the target viewing angle according to the target deletion parameter, and delete the geometric figures to be deleted in the first graphic model to obtain a second graphic model.
5. The method according to claim 1, characterized in that The method further comprises: The target deletion parameter is determined based on the total pixel amount and effective pixel amount of the geometric figures in the group of geometric figures at the target viewing angle, wherein the total pixel amount represents the pixel amount consumed by the geometric figures during the rendering process, and the effective pixel amount represents the pixel amount of the geometric figures drawn on the screen.
6. The method according to claim 5, characterized in that Determining the target deletion parameter according to the total pixel quantity and the effective pixel quantity of the geometric figures in the set of geometric figures at the target viewing angle includes: Under the target constraint conditions determined according to the total pixel quantity and the effective pixel quantity, the target deletion parameter is determined, wherein the target deletion parameter represents the target hypersurface, and the target constraint conditions include: under the restriction that the sum of the effective pixel quantities of the geometric figures located inside the target hypersurface is equal to a preset allowable error value, the sum of the total pixel quantities of the geometric figures located inside the target hypersurface is maximized.
7. The method according to claim 6, characterized in that The step of determining the target deletion parameter under the target constraint condition determined according to the total pixel quantity and the effective pixel quantity comprises: When the target hypersurface is a three-dimensional spherical surface and the target deletion parameters include the coordinates of the center of the three-dimensional spherical surface and the radius of the sphere, the coordinates of the center of the spherical surface are determined according to the sum of the effective pixel quantities of the geometric figures located inside the three-dimensional spherical surface and the sum of the total pixel quantities of the geometric figures located inside the three-dimensional spherical surface; The radius of the sphere is determined according to the coordinates of the sphere center and the allowable error value.
8. The method according to claim 7, characterized in that Determining the spherical center coordinates according to the sum of effective pixel quantities of the geometric figures located inside the three-dimensional spherical surface and the sum of total pixel quantities of the geometric figures located inside the three-dimensional spherical surface comprises: When the geometric figure is a triangle, the center coordinates of the sphere are determined under the restriction that the sum of the effective pixels of the triangle located inside the three-dimensional sphere is the allowable error value, wherein the center coordinates of the sphere are used to maximize the sum of the total pixels of the triangle located inside the three-dimensional sphere.
9. The method according to claim 8, characterized in that The determining of the coordinates of the sphere center under the restriction that the sum of the effective pixel quantities of the triangles located inside the three-dimensional sphere is the allowable error value comprises: Under the restriction that the sum of the effective pixels of the triangle located inside the three-dimensional sphere is the allowable error value, the coordinates of the center of the sphere are determined near the extension line from the target center to the target viewing angle in the target relationship diagram, wherein the target center is the center of the target relationship diagram, and the target relationship diagram represents the relationship between the sum of the total pixel amounts and the three-dimensional space coordinates.
10. The method according to claim 9, characterized in that The method further comprises: The spherical center coordinates include λ x ,λ y ,λ z In the case of , the spherical center coordinates are converted to λ based on the spherical coordinate system θ ,λ φ ,λ d ; When the target viewing angle is determined, the target deletion parameter is stored using a two-dimensional vector, wherein the target deletion parameter is λ(E)=span{λ d ,λ r }, where λ d represents the offset of the target center to the target viewing angle, λ r represents the radius of the sphere, and the span function is used to represent the area containing λ d ,λ r The parameter space of the two parameters, E is the target viewing angle.
11. The method according to claim 8, characterized in that The step of determining the radius of the sphere according to the sphere center coordinates and the allowable error value includes: Get the assumed sphere center coordinates λ x ,λ y ,λ z , where the λ x It is used to represent the coordinates on the x-axis corresponding to the coordinates of the sphere center in the three-dimensional space coordinates, and the λ y It is used to represent the coordinates on the y-axis corresponding to the coordinates of the sphere center in the three-dimensional space coordinates, and the λ z Used to represent the coordinates on the z-axis corresponding to the coordinates of the sphere center in the three-dimensional space; Under the restriction that the sum of the effective pixel quantities of the triangles located inside the three-dimensional sphere is the allowable error value, the radius λ of the sphere is determined according to the allowable error value and the coordinates of the sphere center. r .
12. The method according to claim 7, characterized in that The method further comprises: When the target deletion parameter λ(E) is a discrete parameter, obtaining a target viewing angle E and a target deletion parameter λ(E) corresponding to the target viewing angle; The discrete target deletion parameter λ'(E) is calculated as follows: The target viewing angle E is converted into spherical parameter coordinates (φ, θ) using inverse trigonometric functions; Obtaining the sampling coordinates (x, y) of the spherical parameter coordinates; Solving the integer part and the decimal part of the sampling coordinates respectively, wherein the integer part is obtained by rounding up or down; Using the integer part sampling to obtain multiple groups of deletion parameters λ; The decimal part is used as an interpolation coefficient to solve λ'(E) to output the λ'(E) in a target material engine, and a deletion parameter λ'(E) is determined for directly determining in the target material engine the geometric figures to be deleted in the first graphic model at the target perspective.
13. The method according to any one of claims 1 to 12, characterized in that The step of deleting the geometric figure to be deleted in the first graphic model to obtain a second graphic model includes: In the GPU pipeline, the to-be-deleted geometric figure is deleted by a geometry shader; or In the GPU pipeline, the geometric figures to be deleted are deleted through the vertex shader.
14. A graphics rendering device, characterized in that: include: A first acquisition module, used for acquiring a first graphic model to be processed, wherein the first graphic model includes a group of geometric figures; A second acquisition module is used to acquire a target viewing angle and a target deletion parameter under the target viewing angle; A determination module, configured to determine, according to the target deletion parameter, the geometric figure to be deleted in the first graphic model at the target viewing angle; A deleting module, used for deleting the geometric figure to be deleted in the first graphic model to obtain a second graphic model; A rendering module is used to render the second graphic model under the target viewing angle.
15. The device according to claim 14, characterized in that The deletion module comprises: A first search unit is used to search the geometric figure to be deleted in the first graphic model according to the target deletion parameter, wherein the number of vertices in the geometric figure to be deleted that are located inside a target hypersurface is greater than a predetermined threshold, and the target hypersurface is a closed hypersurface represented by the target deletion parameter.
16. The device according to claim 15, characterized in that The deletion module comprises: A second search unit is used to search for the triangle to be deleted in the first graphic model according to the target deletion parameter when the geometric figure includes a triangle and the target hypersurface is a three-dimensional sphere, wherein the number of vertices in the triangle to be deleted that are located inside the three-dimensional sphere is greater than 1.
17. The device according to claim 14, characterized in that The device is used to obtain a target viewing angle and a target deletion parameter under the target viewing angle in the following manner: Acquire the target viewing angle and the target deletion parameter from a set of pre-stored data, wherein the set of data includes a plurality of pairs of viewing angles and deletion parameters under the viewing angles having a corresponding relationship; The target viewing angle and the target deletion parameter are input into the GPU, wherein the GPU is used to determine the geometric figures to be deleted in the first graphic model under the target viewing angle according to the target deletion parameter, and delete the geometric figures to be deleted in the first graphic model to obtain a second graphic model.
18. The device according to claim 14, characterized in that The device is also used for: The target deletion parameter is determined based on the total pixel amount and effective pixel amount of the geometric figures in the group of geometric figures at the target viewing angle, wherein the total pixel amount represents the pixel amount consumed by the geometric figures during the rendering process, and the effective pixel amount represents the pixel amount of the geometric figures drawn on the screen.
19. The device according to claim 18, characterized in that The device is used to determine the target deletion parameter according to the total pixel quantity and the effective pixel quantity of the geometric figures in the set of geometric figures at the target viewing angle in the following manner: Under the target constraint conditions determined according to the total pixel quantity and the effective pixel quantity, the target deletion parameter is determined, wherein the target deletion parameter represents the target hypersurface, and the target constraint conditions include: under the restriction that the sum of the effective pixel quantities of the geometric figures located inside the target hypersurface is equal to a preset allowable error value, the sum of the total pixel quantities of the geometric figures located inside the target hypersurface is maximized.
20. The device according to claim 19, characterized in that The device is used to determine the target deletion parameter under the target constraint condition determined according to the total pixel quantity and the effective pixel quantity in the following manner: When the target hypersurface is a three-dimensional spherical surface and the target deletion parameters include the coordinates of the center of the three-dimensional spherical surface and the radius of the sphere, the coordinates of the center of the spherical surface are determined according to the sum of the effective pixel quantities of the geometric figures located inside the three-dimensional spherical surface and the sum of the total pixel quantities of the geometric figures located inside the three-dimensional spherical surface; The radius of the sphere is determined according to the coordinates of the sphere center and the allowable error value.
21. The device according to claim 20, characterized in that The device is used to determine the coordinates of the sphere center according to the sum of the effective pixel quantities of the geometric figures located inside the three-dimensional sphere and the sum of the total pixel quantities of the geometric figures located inside the three-dimensional sphere in the following manner: When the geometric figure is a triangle, the center coordinates of the sphere are determined under the restriction that the sum of the effective pixels of the triangle located inside the three-dimensional sphere is the allowable error value, wherein the center coordinates of the sphere are used to maximize the sum of the total pixels of the triangle located inside the three-dimensional sphere.
22. The device according to claim 21, characterized in that The device is used to determine the coordinates of the sphere center under the restriction that the sum of the effective pixel quantities of the triangles located inside the three-dimensional sphere is the error allowable value in the following manner: Under the restriction that the sum of the effective pixels of the triangle located inside the three-dimensional sphere is the allowable error value, the coordinates of the center of the sphere are determined near the extension line from the target center to the target viewing angle in the target relationship diagram, wherein the target center is the center of the target relationship diagram, and the target relationship diagram represents the relationship between the sum of the total pixel amounts and the three-dimensional space coordinates.
23. The device according to claim 22, characterized in that The device is also used for: When the sphere center coordinates include λx, λy, λz, converting the sphere center coordinates into λθ, λφ, λd represented based on a spherical coordinate system; When the target viewing angle is determined, a two-dimensional vector is used to store the target deletion parameter, wherein the target deletion parameter is λ(E)=span{λd,λr}, wherein λd represents the offset of the target center to the target viewing angle, λr represents the radius of the sphere, and the span function is used to represent a parameter space including two parameters, λd and λr, and E is the target viewing angle.
24. The device according to claim 21, characterized in that The device is used to determine the radius of the sphere according to the sphere center coordinates and the error allowable value in the following manner: Obtaining assumed sphere center coordinates λx, λy, and λz, wherein λx is used to represent the coordinate of the sphere center coordinate on the x-axis corresponding to the sphere center coordinate in the three-dimensional space coordinate, λy is used to represent the coordinate of the sphere center coordinate on the y-axis corresponding to the sphere center coordinate in the three-dimensional space coordinate, and λz is used to represent the coordinate of the sphere center coordinate on the z-axis corresponding to the sphere center coordinate in the three-dimensional space coordinate; Under the restriction that the sum of the effective pixel quantities of the triangles located inside the three-dimensional spherical surface is the allowable error value, the sphere radius λr is determined according to the allowable error value and the sphere center coordinates.
25. The device according to claim 20, characterized in that The device is also used for: When the target deletion parameter λ(E) is a discrete parameter, obtaining a target viewing angle E and a target deletion parameter λ(E) corresponding to the target viewing angle; The discrete target deletion parameter λ'(E) is calculated as follows: The target viewing angle E is converted into spherical parameter coordinates (φ, θ) using inverse trigonometric functions; Obtaining the sampling coordinates (x, y) of the spherical parameter coordinates; Solving the integer part and the decimal part of the sampling coordinates respectively, wherein the integer part is obtained by rounding up or down; Using the integer part sampling to obtain multiple groups of deletion parameters λ; The decimal part is used as an interpolation coefficient to solve λ'(E) to output the λ'(E) in a target material engine, and a deletion parameter λ'(E) is determined for directly determining in the target material engine the geometric figures to be deleted in the first graphic model at the target perspective.
26. The device according to any one of claims 14 to 25, characterized in that The device is used to delete the geometric figure to be deleted in the first graphic model in the following manner to obtain a second graphic model: In the GPU pipeline, the to-be-deleted geometric figure is deleted by a geometry shader; or In the GPU pipeline, the geometric figures to be deleted are deleted through the vertex shader.
27. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program can be executed by a terminal device or a computer to execute the method described in any one of claims 1 to 13.
28. An electronic device, comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 13 through the computer program.
Citation Information
Patent Citations
Novel multifunctional atmospheric science data graphic rendering engine
CN103295258A
Image rendering method and device, storage medium and electronic device
CN110163943A