Method and device for obtaining performance index of particle special effect, equipment and storage medium
By overlaying preset values in the rendering process to determine the performance indicators of particle effects, the problem of low accuracy in existing technologies is solved, and precise evaluation of particle effect performance is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TENCENT TECHNOLOGY (SHENZHEN) CO LTD
- Filing Date
- 2023-05-09
- Publication Date
- 2026-07-31
AI Technical Summary
In existing technologies, it is difficult to accurately estimate the number of repeated renderings by visually observing the overlapping of triangular faces in particle effects, resulting in low accuracy in obtaining particle effect performance indicators.
By acquiring particle effect files and calling the rendering program to render them, the performance indicators of the particle effects are determined based on the color values of pixels in the rendered image frames and preset values, including the number of redraws, screen ratio, pixel fill rate, etc.
It improves the accuracy of particle effect performance metrics, can accurately determine repeated rendering, and reduces the processing pressure on the GPU.
Smart Images

Figure CN118941683B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, device, and storage medium for obtaining performance indicators of particle effects. Background Technology
[0002] Particle effects are special effects techniques in computer graphics used to simulate specific phenomena or visual effects. They can achieve realistic, natural, and randomized effects and have wide applications in image processing, video editing, game effects, and other fields. Before applying particle effects, developers can analyze their performance by obtaining performance metrics, one of which is the number of redraws.
[0003] In related technologies, the number of times particle effects are repeatedly drawn is estimated by visually observing the overlapping of triangular faces in the particle effects through the view mode of the rendering editor. However, it is difficult to obtain an accurate number of repeated draws, resulting in low accuracy in obtaining performance metrics. Summary of the Invention
[0004] This application provides a method, apparatus, device, and storage medium for obtaining performance indicators of particle effects, which can accurately determine the performance indicators of particle effects and improve the accuracy of obtaining these indicators. The technical solution is as follows:
[0005] On the one hand, a method for obtaining performance indicators of particle effects is provided, the method comprising:
[0006] Obtain a particle effect file, which is used to generate particle effects, and the particle effects include multiple particles;
[0007] The rendering program is invoked to render the particle effect file to obtain the dynamic resources of the particle effect. The dynamic resources include multiple image frames for presenting the particle effect. When the rendering program draws the color of the pixel where the particle is located in the image frame, it superimposes a preset value on the color value of the pixel.
[0008] Based on the color values of multiple pixels in the rendered image frame and the preset values, the performance index of the particle effect is determined, and the performance index is used to indicate the performance of the particle effect.
[0009] On the other hand, a device for obtaining performance indicators of particle effects is provided, the device comprising:
[0010] The file acquisition module is used to acquire particle effect files, which are used to generate particle effects, and the particle effects include multiple particles.
[0011] The rendering module is used to call the rendering program to render based on the particle effect file to obtain the dynamic resources of the particle effect. The dynamic resources include multiple image frames for presenting the particle effect. The rendering program is used to overlay a preset value on the color value of the pixel when drawing the color of the pixel where the particle is located in the image frame.
[0012] The performance index determination and acquisition module is used to determine the performance index of the particle effect based on the color values of multiple pixels in the image frame after rendering and the preset value. The performance index is used to indicate the performance of the particle effect.
[0013] Optionally, the rendering program further includes a first adjustment factor and a second adjustment factor, wherein the first adjustment factor is used to adjust the proportion of the color value of the pixel itself, and the second adjustment factor is used to adjust the proportion of the color value of the pixel in this superimposed state.
[0014] The rendering module is used for:
[0015] For any image frame rendered based on the particle effect file, the rendering program is invoked, and based on the first adjustment factor and the second adjustment factor, the current color value of the pixel in the image frame is weighted and summed with the preset value, and the weighted sum is determined as the color value of the pixel after this rendering.
[0016] Wherein, both the first adjustment factor and the second adjustment factor are equal to 1.
[0017] Optionally, the performance metric includes the number of times the particle effect is repeatedly rendered in each image frame; the performance metric determination and acquisition module is used for:
[0018] The ratio between the color value of each pixel in the rendered image frame and the preset value is determined as the number of times each pixel in the image frame is drawn repeatedly.
[0019] The average number of times multiple pixels in the image frame are repeatedly drawn is determined as the number of times the image frame is repeatedly drawn.
[0020] Optionally, the rendering module is used for:
[0021] Create an empty scene that contains no objects;
[0022] The rendering program is invoked to render the particle effect file in the empty scene, thereby obtaining the dynamic resource of the particle effect. The image frame in the dynamic resource is a frame of the particle effect in the empty scene.
[0023] Optionally, the performance metrics of the particle effects also include the screen-to-body ratio of the particle effects in each image frame; the performance metric determination and acquisition module is further configured to:
[0024] For any image frame, a first quantity and a second quantity are determined, where the first quantity is the number of rendered pixels in the image frame and the second quantity is the total number of pixels in the image frame.
[0025] The ratio between the second quantity and the first quantity is determined as the screen ratio of the particle effect in the image frame, where the screen ratio represents the proportion of the particle effect in the image frame.
[0026] Optionally, the performance metrics of the particle effect also include the pixel fill rate of each image frame of the particle effect; the performance metric determination and acquisition module is further configured to:
[0027] For any image frame, a first quantity is determined, which is the number of rendered pixels in the image frame;
[0028] The first quantity is determined as the pixel fill rate of the image frame, whereby the pixel fill rate represents the number of pixels rendered per unit time.
[0029] Optionally, the file acquisition module is used for:
[0030] Search for files belonging to the target format in the specified directory, where any particle effect file belongs to the target format;
[0031] Among the files found that belong to the target format, files containing particle components are identified, the particle components being used to generate particles;
[0032] The file containing the particle component is identified as the particle effect file.
[0033] Optionally, the performance metrics further include at least one of the following: the number of vertices, the number of triangles, or the number of rendering passes for the particle effect; the performance metric determination and acquisition module is further configured to:
[0034] Obtain a data acquisition script, the data acquisition script including object declaration code, the object declaration code being used to indicate the acquisition of at least one of the number of vertices, the number of triangles, or the number of rendering times;
[0035] During the rendering process based on the particle effect file, the data acquisition script is executed to sequentially obtain at least one of the following in each image frame: the number of vertices, the number of triangles, or the number of rendering iterations.
[0036] Optionally, the performance metric further includes the number of particles in the particle effect; the performance metric determination and acquisition module is further configured to:
[0037] Determine a particle processing function, which is used to calculate the number of particles generated based on the particle effects file;
[0038] A data acquisition device is generated and bound to the particle processing function. The data acquisition device is used to acquire the data generated by the particle processing function.
[0039] During the rendering process based on the particle effect file, the data acquisition device is invoked to obtain the number of particles calculated by the particle processing function.
[0040] Optionally, the device further includes a data display module for:
[0041] The performance metrics of the particle effects in the multiple image frames are obtained. The performance metrics include at least one of the following: number of redraws, screen ratio, pixel fill rate, number of vertices, number of triangles, number of renderings, number of particles, and number of particle components.
[0042] Based on the performance indicators of the multiple image frames, out-of-standard image frames are identified. An out-of-standard image frame is an image frame that meets at least one out-of-standard condition, which means that the performance indicators of the image frame do not meet the standard performance indicators.
[0043] The display shows the performance metrics of the multiple image frames and the conditions for exceeding the limits met by the image frames that exceeded the limits.
[0044] Optionally, the data display module is used for:
[0045] Determine the priority of multiple exceeding conditions;
[0046] According to the priority order of the multiple exceeding conditions, display the performance indicators and the exceeding conditions satisfied by multiple exceeding image frames;
[0047] Displays the performance metrics of the image frames other than the multiple over-standard image frames.
[0048] On the other hand, a computer device is provided, the computer device including a processor and a memory, the memory storing at least one computer program, the at least one computer program being loaded and executed by the processor to perform the operations performed by the particle effect performance index acquisition method as described above.
[0049] On the other hand, a computer-readable storage medium is provided, wherein at least one computer program is stored therein, the at least one computer program being loaded and executed by a processor to perform the operations performed by the particle effect performance index acquisition method as described above.
[0050] On the other hand, a computer program product is provided, including a computer program loaded and executed by a processor to perform the operations performed by the particle effect performance index acquisition method as described above.
[0051] The solution provided in this application embodiment demonstrates the performance of particle effects by repeatedly drawing pixels during particle rendering. To obtain performance metrics of particle effects, a rendering program is called to render the particle effects based on the particle effect file. Since the rendering program adds a fixed preset value to the pixel's color value when drawing the color of the pixel, the number of times the preset value is added to the pixel can be determined based on the final color value of the pixel in the rendered particle effect image frame. In other words, the number of times the pixel is repeatedly drawn can be determined. Therefore, the performance metrics of particle effects related to repeated drawing can be accurately determined based on the pixel's color value and the preset value after rendering, improving the accuracy of obtaining particle effect performance metrics. Attached Figure Description
[0052] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0053] Figure 1 This is a schematic diagram of an implementation environment provided in an embodiment of this application;
[0054] Figure 2 This is a flowchart of a method for obtaining the number of times a particle effect is repeatedly drawn, provided in an embodiment of this application;
[0055] Figure 3 This is a flowchart of a method for obtaining performance indicators of particle effects provided in an embodiment of this application;
[0056] Figure 4 This is a schematic diagram of a hybrid rendering method for particle effects provided in an embodiment of this application;
[0057] Figure 5 This is a schematic diagram of a scene parameter setting method provided in an embodiment of this application;
[0058] Figure 6 This is a schematic diagram of a particle effects rendering method provided in an embodiment of this application;
[0059] Figure 7 This is a schematic diagram illustrating one method of obtaining performance metric dimensions according to an embodiment of this application;
[0060] Figure 8 This is a schematic diagram of a method for obtaining the number of repeated draws provided in an embodiment of this application;
[0061] Figure 9 This is a schematic diagram of a method for obtaining performance indicators of particle effects provided in an embodiment of this application;
[0062] Figure 10 This is a flowchart provided in an embodiment of the present application for determining the number of repeated draws, screen occupancy, and pixel fill rate;
[0063] Figure 11 This is a flowchart illustrating how to determine the number of vertices, the number of triangles, and the number of rendering iterations, as provided in an embodiment of this application.
[0064] Figure 12 This is a flowchart of another method for obtaining performance indicators of particle effects provided in an embodiment of this application;
[0065] Figure 13 This is a flowchart of another method for obtaining performance indicators of particle effects provided in an embodiment of this application;
[0066] Figure 14 This is a schematic diagram of a performance indicator display interface provided in an embodiment of this application;
[0067] Figure 15 This is a schematic diagram of another performance indicator display interface provided in an embodiment of this application;
[0068] Figure 16 This is a schematic diagram of another performance indicator display interface provided in an embodiment of this application;
[0069] Figure 17 This is a flowchart of a performance index display method provided in an embodiment of this application;
[0070] Figure 18 This is a flowchart of another method for obtaining performance indicators of particle effects provided in an embodiment of this application;
[0071] Figure 19 This is a flowchart of another method for obtaining performance indicators of particle effects provided in an embodiment of this application;
[0072] Figure 20This is a schematic diagram of the structure of a particle effect performance index acquisition device provided in an embodiment of this application;
[0073] Figure 21 This is a schematic diagram of another particle effect performance index acquisition device provided in this application embodiment;
[0074] Figure 22 This is a schematic diagram of the structure of a terminal provided in an embodiment of this application;
[0075] Figure 23 This is a schematic diagram of the structure of a server provided in an embodiment of this application. Detailed Implementation
[0076] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.
[0077] It is understood that the terms "first," "second," etc., used in this application may be used to describe various concepts herein, but unless otherwise stated, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another. For example, without departing from the scope of this application, a first adjustment factor may be referred to as a second adjustment factor, and similarly, a second adjustment factor may be referred to as a first adjustment factor.
[0078] "At least one" refers to one or more images. For example, at least one image frame can be any integer number of image frames greater than or equal to one, such as one image frame, two image frames, three image frames, etc. "Multiple" refers to two or more images. For example, multiple image frames can be any integer number of image frames greater than or equal to two, such as two image frames, three image frames, etc. "Each" refers to each of the at least one images. For example, each image frame refers to each of the multiple image frames. If the multiple image frames are three image frames, then each image frame refers to each of the three image frames.
[0079] It is understood that the embodiments of this application involve particle effect files and related data such as particle effect performance indicators. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0080] This application provides a method for obtaining performance indicators of particle effects, with a computer device as the executing entity. In one possible implementation, the computer device is a terminal, which can be various types of devices such as smartphones, tablets, laptops, desktop computers, smart speakers, smartwatches, and in-vehicle terminals. In another possible implementation, the computer device is a server, which can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.
[0081] Figure 1 This is a schematic diagram of an implementation environment provided in an embodiment of this application, such as... Figure 1 As shown, the implementation environment includes a resource processing device 101 and a resource display device 102. The resource processing device 101 and the resource display device 102 establish a communication connection through wired or wireless means. The resource processing device 101 can be a server or a terminal, and the resource display device 102 can be a terminal.
[0082] The resource processing device 101 is used to acquire particle effect files, call the rendering program, and perform rendering based on the particle effect files. During the rendering process, it collects the performance indicators of the particle effects, such as the number of redraws, screen ratio, pixel fill rate, number of vertices, number of triangles, number of renderings, number of particles, and number of particle components. After collecting the performance indicators, the resource processing device 101 sends the performance indicators of the particle effects to the resource display device 102, which displays the performance indicators of the particle effects for users to view.
[0083] The method for obtaining performance indicators of particle effects provided in this application embodiment can be applied to any scenario where it is necessary to obtain performance indicators of particle effects.
[0084] Particle effects are special effects techniques in computer graphics used to simulate specific phenomena or visual effects. They can achieve realistic, natural, and randomized effects and have wide applications in image processing, video editing, and game effects. For example, particle effects can be used to simulate abstract visual effects such as fire, explosions, smoke, water flow, sparks, falling leaves, clouds, fog, snow, dust, meteor trails, or luminous trajectories. After creating particle effects, developers can obtain performance metrics to analyze their performance before actually applying them, allowing for further optimization and adjustments. Therefore, the method provided in this application embodiment can be used to collect particle effect performance metrics during the rendering process, enabling developers to understand the performance of the particle effects based on these metrics.
[0085] Figure 2 This is a flowchart illustrating a method for obtaining the number of repetitions of particle effects according to an embodiment of this application. This embodiment is executed by a computer device. See also... Figure 2 The method includes:
[0086] 201. The computer device acquires the particle effect file, which is used to generate particle effects. The particle effects include multiple particles.
[0087] Particle effects are special effects techniques in computer graphics used to simulate specific phenomena or visual effects. They can achieve realistic, natural, and randomized effects, and have wide applications in image processing, video editing, game effects, and other fields. A particle effect consists of multiple dynamic particles. Optionally, the particles in a particle effect may overlap during movement.
[0088] Particle effect files are used to generate particle effects. For example, the particle effect file specifies the size, number, position, trajectory, and shape of the particles in the particle effect.
[0089] 202. The computer device calls the rendering program to render based on the particle effect file, and obtains the dynamic resources of the particle effect. The dynamic resources include multiple image frames used to present the particle effect. When the rendering program draws the color of the pixel where the particle is located in the image frame, it superimposes a preset value on the color value of the pixel.
[0090] The computer device determines a rendering program, which is used to color-draw the pixels in the image frame during the rendering of particle effects. This rendering program is also called a shader. The computer device generates particle effects based on the particle effect file and calls the rendering program to color-draw the generated particle effects. Since the particle effect is a dynamic effect, the rendering program needs to color-draw the particle effect for each frame, thus obtaining multiple image frames. These multiple image frames are the dynamic resources of the particle effect. By playing these multiple image frames continuously, the dynamic particle effect can be presented.
[0091] The rendering program needs to color-draw the pixel of each particle in the image frame. For example, if two particles overlap in the same pixel out of 10 particles, the rendering program needs to color-draw the first particle in the pixel first, and then color-draw the second particle in the pixel, so the pixel will be drawn twice.
[0092] In one possible implementation, the particle effect file itself corresponds to a rendering program, which is used to render based on the particle effect file to obtain particle effects with the desired colors. The purpose of this application embodiment is to obtain the performance indicators of the particle effects during the rendering process. Therefore, there is no need to focus on the color of the rendered particle effects. Thus, a custom rendering program can be defined so that each time the rendering program draws the color of the pixel where the particle is located, a fixed preset value is superimposed on the current color value. This custom rendering program is used instead of the rendering program of the particle effect file itself to perform rendering, so as to grasp the change of the color value of the pixel when drawing the color of the pixel.
[0093] 203. The computer device determines the performance index of the particle effect based on the color values and preset values of multiple pixels in the rendered image frame. The performance index is used to indicate the performance of the particle effect.
[0094] In the process of rendering particle effects, the repeated drawing of pixels can reflect the performance of particle effects. Since in this embodiment, when drawing color on the pixels where the particles are located in the image frame, a fixed preset value is superimposed on the color value of the pixel, the repeated drawing of pixels in the image frame can be determined based on the final rendered color value and the preset value, thereby determining the performance index of particle effects.
[0095] The method provided in this application embodiment reflects the performance of particle effects by repeatedly drawing pixels during particle rendering. To obtain the performance indicators of particle effects, a rendering program is called to render the particle effects based on the particle effect file. Since the rendering program adds a fixed preset value to the color value of the pixel where the particle is located, the number of times the preset value is added to the pixel can be determined based on the final color value of the pixel in the rendered particle effect image frame. In other words, the number of times the pixel is repeatedly drawn can be determined. Therefore, the performance indicators of particle effects related to repeated drawing can be accurately determined based on the color value of the pixel and the preset value after rendering, improving the accuracy of obtaining the performance indicators of particle effects.
[0096] The above Figure 3 The embodiment briefly illustrates the process of obtaining particle effect performance metrics. These performance metrics may include the number of redraws, screen ratio, pixel fill rate, number of vertices, number of triangles, number of renders, number of particles, and number of particle components. The process of obtaining these performance metrics is detailed below. Figure 3 The example shown.
[0097] Figure 3 This is a flowchart illustrating a method for obtaining performance indicators of particle effects according to an embodiment of this application. This embodiment is executed by a computer device. (See also...) Figure 3 The method includes:
[0098] 301. The computer device acquires particle effect files, which are used to generate particle effects, which include multiple particles.
[0099] In one possible implementation, after generating the particle effect file, the computer device stores it in a designated directory, which also stores other types of files. When the computer device receives a request to obtain performance metrics for the particle effect, it searches for files belonging to the target format in the designated directory. Among the found files in the target format, it identifies the file containing a particle component used to generate particles. The computer device then determines the file containing the particle component as the particle effect file.
[0100] Among these, any particle effect file must belong to the target format, for example, the file extension of this target format is ".prefab". Besides particle effect files, other file types may also belong to this target format. Considering that the particles in particle effects are generated by particle components, the particle effect file must contain particle components. Therefore, after locating a file belonging to the target format, the computer device needs to determine whether the file contains particle components. If the file contains particle components, it can be determined that the file is a particle effect file; if the file does not contain particle components, it can be determined that the file is not a particle effect file.
[0101] Optionally, the computer device iterates through a specified directory. For each file being iterated, if the file is in the target format and includes particle components, the computer device determines that the file is a particle effect file. Upon finding a particle effect file, the computer device adds it to the particle queue to be processed, until all files in the specified directory have been traversed. Subsequently, the computer device processes each particle effect file in the particle queue sequentially to collect the performance metrics of the particle effects generated by each file.
[0102] 302. The computer device calls the rendering program to render based on the particle effect file, and obtains the dynamic resources of the particle effect. The dynamic resources include multiple image frames used to present the particle effect. When the rendering program draws the color of the pixel where the particle is located in the image frame, it superimposes a preset value on the color value of the pixel.
[0103] After acquiring the particle effect file, the computer device determines the designated rendering program. This rendering program overlays a fixed preset value each time it performs a color rendering. Since the purpose of this embodiment is to obtain the performance indicators of the particle effect, and the rendered particle effect will not be used in actual applications, there is no need to concern oneself with the color of the rendered particle effect. Therefore, the preset value can be any value, and developers can flexibly set it according to their own needs. Furthermore, for a single rendered image frame, the number of times the rendering program performs color rendering is unrelated to this preset value, but rather related to the number of pixels where the particles are located. If two particles are covered on a pixel, then that pixel needs to be rendered twice, meaning that pixel is repeatedly rendered. Repeated rendering of a pixel refers to repeatedly rendering the same pixel within an image frame. During the rendering process of particle effects, if pixels are repeatedly rendered, it will put a significant processing load on the GPU (Graphics Processing Unit). Therefore, the repeated rendering situation can reflect the performance of the particle effect.
[0104] In one possible implementation, the computer device can use UE4 (Unreal Engine 4) or Unity3D (game engine) to render based on particle effect files, but this application embodiment does not limit this.
[0105] In one possible implementation, the rendering program further includes a first adjustment factor and a second adjustment factor. The first adjustment factor is used to adjust the proportion of the pixel's own color value, and the second adjustment factor is used to adjust the proportion of the pixel's current superimposed color value. Both the first and second adjustment factors are equal to 1. For any image frame rendered based on a particle effect file, the computer device calls the rendering program, and based on the first and second adjustment factors, performs a weighted summation of the current color value of the pixel in the image frame with a preset value. The weighted summation value is then determined as the pixel's color value after this rendering.
[0106] Optionally, this rendering program is a custom rendering program, mainly setting the rendering channel for particle effects, setting adjustment factors, and setting the color values generated by the pixel shader so that the rendering program overlays a fixed preset value for each color draw. Specifically, the rendering channel can be set to the alpha channel, the first and second adjustment factors can be set to 1, and the color values generated by the pixel shader can be set to fixed preset values for subsequent counting of color draws. This rendering program can be used to render any particle effect. The color drawing process can be represented by the following formula:
[0107] Colar1 = M*a + Colar2*b;
[0108] Color1 represents the color value after this color rendering, M represents the preset value, a represents the first adjustment factor, Color2 represents the original color value of the pixel, and b represents the second adjustment factor. Since both the first and second adjustment factors are set to 1 in this embodiment, the color rendering process is equivalent to adding the preset value to the original color value.
[0109] The color values of pixels after color rendering can be stored in the frame buffer. The process of blending particle effects in this embodiment can be found in [reference needed]. Figure 4 The flowchart shown illustrates, for example, that the pixel color value is an RGB color value, the first and second adjustment factors in the rendering program are both set to 1, and the preset value generated by the pixel shader in the rendering program is (40,0,0), which means the R channel color value is increased by 40, the G channel color value is increased by 0, and the B channel color value is increased by 0. Figure 4As shown, after the first rendering, the R channel color value in the buffer is 40; after the second rendering, it is 80; after the third rendering, it is 120; after the fourth rendering, it is 160; and after the fifth rendering, it is 200. By passing a fixed R channel color value to the rendering program and combining it with the above color rendering operations, the final color values of each pixel in the image frame are obtained.
[0110] In this embodiment of the application, the two adjustment factors of the rendering program are set to 1. Then, during the rendering process, each time the color of a pixel is drawn, a fixed preset value is superimposed on the original color value. Since the color drawing method is simple and straightforward, this color drawing method is beneficial for subsequent statistics on the number of times each pixel in the image frame is repeatedly drawn.
[0111] In one possible implementation, the computer device creates an empty scene that contains no objects. The computer device then invokes a rendering program to render the empty scene based on particle effect files, resulting in dynamic resources of the particle effects. The image frames in these dynamic resources represent a single frame of the particle effects within the empty scene.
[0112] Particle effects rendering requires a scene. The computer device creates an empty scene to render particle effects. This empty scene does not contain any objects. When creating an empty scene, you only need to set the parameters related to scene management and the parallel lights in the scene. Figure 5 This is a schematic diagram of a scene parameter setting method provided in an embodiment of this application, such as... Figure 5 As shown, developers can add scene management parameters and directional lights to empty scenes in the settings menu.
[0113] In this embodiment of the application, the computer device renders the particle effect in an empty scene, so that the rendering process of the particle effect is not affected by other objects in the scene. Therefore, when obtaining the performance indicators of the particle effect during the rendering process, it is not affected by other objects in the scene, which helps to ensure the accuracy of the obtained performance indicators.
[0114] Figure 6 This is a schematic diagram of a particle effects rendering method provided in an embodiment of this application, as shown below. Figure 6 As shown, the computer device first instantiates the particle effect based on the particle effect file, then binds the particle effect to a performance acquisition script. During the rendering process, the performance acquisition script collects performance data, that is, it acquires the performance indicators of the particle effect. During the rendering process, it determines in real time whether the rendering is complete. If the rendering is not complete, it continues to collect the performance data of the particle effect. If the rendering is complete, it processes and stores the collected performance data separately, and then destroys the instantiated particle effect.
[0115] The performance acquisition script is used to automatically acquire the performance metrics of particle effects during the rendering process. For example, the performance acquisition script can be automatically bound to each instantiated particle effect as a component. After the particle effect is instantiated, it is automatically bound by the program. As the particle effect is rendered, the performance metrics of the particle effect are collected in real time for each frame until the rendering of the particle effect is completed. Then, the collected performance metrics are analyzed and stored. After completion, it is destroyed along with the instantiated particle effect.
[0116] Figure 7 This is a schematic diagram illustrating one method of obtaining performance metric dimensions provided in an embodiment of this application, such as... Figure 7 As shown, the performance acquisition script is divided into three main functions: acquiring the number of repeated draws, screen ratio, and pixel fill rate from the performance metrics of particle effects; acquiring the number of vertices, number of triangles, and number of renders from the performance metrics of particle effects; and acquiring the number of particles and number of particle components from the performance metrics of particle effects. For details, please refer to the following steps.
[0117] 303. The computer device determines the number of times each image frame of the particle effect is redrawn based on the color values of multiple pixels in the rendered image frame and the preset values.
[0118] The performance metrics for particle effects include the number of times the particle effect is redrawn per image frame. The number of times an image frame is redrawn refers to the average number of times multiple pixels within that frame are redrawn. The number of times a pixel is redrawn refers to the number of times its color is drawn within an image frame. The computer device determines the number of times each pixel is redrawn based on its color value and preset values in the rendered image frame. The average of the number of times multiple pixels in the image frame are then used to determine the total number of times the image frame is redrawn.
[0119] In one possible implementation, during the rendering process, for any image frame being rendered, the computer device invokes the rendering program. Based on a first adjustment factor and a second adjustment factor, it performs a weighted summation of the current color value of a pixel in the image frame with a preset value. The weighted sum is then determined as the color value of the pixel after this rendering. Both the first and second adjustment factors are equal to 1. Therefore, the color rendering process can be understood as directly superimposing preset values onto the current color value. The number of preset values superimposed is equal to the number of color rendering operations.
[0120] Therefore, the process by which the computer device determines the number of redraws is as follows: The computer device determines the number of redraws for each pixel in the rendered image frame as the ratio between the color value of each pixel and the preset value, and determines the average number of redraws for multiple pixels in the image frame as the total number of redraws for the image frame.
[0121] With both adjustment factors set to 1, each color drawing operation adds a fixed preset value to the current color value. Since the initial value for color drawing at a pixel is 0, the number of times the color is repeated is determined by dividing the rendered pixel's color value by this preset value. Figure 4 Taking the color rendering process shown as an example, by passing a fixed R channel color value to the rendering program and combining it with the color rendering operations described above, the final color value of each pixel in the image frame is obtained. Dividing the pixel's color value by the passed-in fixed preset value gives the number of times the pixel was redrawn. For example, if the preset value is (40,0,0), and the pixel's rendered color value is (200,0,0), then the number of times the pixel was redrawn is 200 divided by 40, which is 5 times.
[0122] In this embodiment, since the effect of the rendered particle effect does not need to be considered when determining the number of times the particle effect is repeatedly drawn, this application first uses a custom rendering program to render the particle effect. The color value of the custom rendering program in a single drawing is a fixed value. Then, based on the color value obtained in the final rendering and the fixed value, the number of times the particle effect is repeatedly drawn can be determined, thus ensuring the accuracy of the number of times the particle effect is repeatedly drawn.
[0123] Figure 8 This is a schematic diagram of a method for obtaining the number of repeated draws provided in an embodiment of this application, as shown below. Figure 8 As shown, the method includes the following steps: Step 1, specify the RT (Render to Texture) format of the frame buffer as RGBA8; Step 2, pass fixed color values to the rendering program; Step 3, set the blending state to color value overlay and the semi-transparent state to color value overlay; Step 4, copy the color values of the pixels in the frame buffer from the GPU to the CPU (Central Processing Unit) and calculate the number of times each pixel is drawn repeatedly.
[0124] 304. Computer equipment determines the screen occupancy of particle effects in each image frame.
[0125] The performance metrics for particle effects also include the screen-to-body ratio of particle effects in each image frame. Screen-to-body ratio refers to the ratio between the pixels in an image frame that display particle effects and the total number of pixels in that image frame. For any given image frame, the computer device determines a first quantity and a second quantity. The first quantity is the number of rendered pixels in the image frame, and the second quantity is the total number of pixels in the image frame. The ratio between the second quantity and the first quantity is determined as the screen-to-body ratio of the particle effects in the image frame, representing the proportion of the image frame occupied by the particle effects.
[0126] In this embodiment, since the particle effect is rendered in an empty scene, there are no other objects in the empty scene. Therefore, only the pixel where the particle effect is located is rendered in the empty scene. So, the rendered pixels in the final image frame must be the pixels where the particle effect is located, and the unrendered pixels are not the pixels where the particle effect is located. Therefore, the ratio of the number of rendered pixels to the total number of pixels is the screen ratio of the particle effect in the image frame.
[0127] 305. Computer equipment determines the pixel fill rate for each image frame of the particle effect.
[0128] The performance metrics for particle effects also include the pixel fill rate for each image frame. For any given image frame, the computer device determines a first quantity, which is the number of pixels rendered in the image frame. The computer device then determines this first quantity as the pixel fill rate of the image frame, which represents the number of pixels rendered per unit of time.
[0129] Figure 9 This is a schematic diagram of a method for obtaining performance indicators of particle effects provided in an embodiment of this application, as shown below. Figure 9 As shown, first, a custom rendering program is defined, then particle effects are instantiated based on particle effect files, the particle effect rendering program is replaced with the custom rendering program, a new rendering unit (RT) is created, and the particle effects are rendered to the RT. After rendering is complete, the RT is read, and the performance metrics of the particle effects are calculated, such as the number of redraws, screen ratio, and pixel fill rate.
[0130] Figure 10 This application provides a flowchart for determining the number of repeated draws, screen occupancy, and pixel fill rate, as illustrated in the embodiments of this application. Figure 10 As shown, after rendering is complete, the computer device reads the rendering unit (RT), traverses each pixel in the RT, and counts the number of times each pixel is drawn repeatedly, its screen ratio, and its pixel fill rate. If the traversal is not completed, it continues to traverse the next pixel. If the traversal is completed, it organizes and stores the data such as the number of times each pixel is drawn repeatedly, its screen ratio, and its pixel fill rate.
[0131] 306. During the rendering process based on particle effect files, the computer equipment determines at least one of the following: the number of vertices, the number of triangles, or the number of rendering passes for the particle effect.
[0132] Performance metrics also include at least one of the following: the number of vertices, the number of triangles, or the number of renders for the particle effect. The number of vertices refers to the total number of vertices in the particle effect model; the number of triangles refers to the total number of triangles in the particle effect model (each triangle is composed of three connected vertices); and the number of renders refers to the number of times the CPU calls the graphics programming interface (DirectX or OpenGL) to instruct the GPU to perform rendering operations.
[0133] The computer device acquires a data acquisition script, which includes object declaration code. The object declaration code is used to indicate at least one of the following: the number of vertices, the number of triangles, or the number of renderings. During the rendering process based on the particle effect file, the data acquisition script is executed to sequentially acquire at least one of the following: the number of vertices, the number of triangles, or the number of renderings in each image frame of the particle effect.
[0134] The rendering engine provides a Profiler Recorder API (API) for computer devices. This API provides a data acquisition script for recording particle effect performance. The computer device uses this API to retrieve the data acquisition script from the rendering engine, adding object declaration code to the script to indicate which performance metrics of the particle effects to acquire. During rendering based on the particle effect file, the computer device executes this data acquisition script synchronously. Each time an image frame is rendered, the data acquisition script acquires the declared performance metrics for that image frame.
[0135] Figure 11 This is a flowchart provided in an embodiment of the present application for determining the number of vertices, the number of triangles, and the number of rendering passes, such as... Figure 11 As shown, Awake() indicates waking up the data acquisition function, OnDisable() indicates declaring the performance metrics object, that is, specifying which performance metrics need to be collected, Start() indicates starting to execute the data acquisition function, using a static method to initialize a new instance of the data acquisition script and start data collection, Update() indicates collecting the performance metrics of each image frame, refreshing and recording each performance metric, and OnDisable() indicates releasing the performance metric acquisition resources using the Disposable interface after rendering is complete.
[0136] 307. During the rendering process based on particle effect files, the computer equipment determines the number of particles in the particle effect.
[0137] Performance metrics also include the number of particles in the particle effects, which refers to the total number of particles that make up the particle effect. The computer device determines a particle processing function, which calculates the number of particles generated based on the particle effect file. A data acquisition method is generated and bound to the particle processing function. This data acquisition method is used to acquire the data generated by the particle processing function. During the rendering process based on the particle effect file, the data acquisition method is called to retrieve the particle number calculated by the particle processing function.
[0138] In this embodiment, the process of obtaining the particle count utilizes a reflection mechanism. Based on reflection, member information of each type in the assembly can be obtained at runtime. A Getmethod method (data acquisition method) of a Type class (a type-based class) is defined, which can access information of a given data type. The computer device locates the particle processing function used to calculate the particle count in the source code of the rendering engine, declares the data acquisition method of the Type class and binds it to the particle processing function. During the rendering of particle effects, the number of particles generated by each particle component calculated by the particle processing function is read in real time through the data acquisition method. The sum of the number of particles generated by all particle components in the particle effect file is the particle count of the particle effect.
[0139] 308. Computer equipment determines the number of particle components for particle effects.
[0140] Performance metrics also include the number of particle components in a particle effect. The particle effect file contains particle components used to generate particles. Computer devices can determine the number of particle components in a particle effect by collecting the number of particle components in each image frame.
[0141] Figure 12 This is a flowchart of another method for obtaining performance indicators of particle effects provided in an embodiment of this application, such as... Figure 12As shown, the computer device polls and executes the following steps: First, it checks if the computer device has a scanning task. This task involves scanning a specified directory for particle effect files. If a scanning task exists, an empty scene is opened, and emission objects are generated within it. These emission objects are used to trigger particle effects. The computer device sets the rendering method, such as render channel and RT format. The computer device iterates through the particle effects, triggering them through the emission objects. It then determines if the current particle effect has finished rendering. If not, it continues to acquire performance metrics for the particle effects, such as particle count, number of redraws, screen ratio, pixel fill rate, number of particle components, number of renders, number of triangles, and number of vertices. If rendering is complete, it checks if all particle effects have been traversed. If not, it continues to traverse the next particle effect. If all traversals are complete, the acquired performance metrics are uploaded to the server. The server then distributes these performance metrics to the resource display device, which displays them for user viewing.
[0142] This application provides a technical solution for automatically identifying particle effect files in a specified directory, automatically rendering particle effect files, and automatically collecting performance indicators such as the number of rendering times, number of vertices, number of triangles, number of particle components, number of particles, number of repeated draws, screen ratio, and pixel fill rate of particle effects. This solution collects performance indicators for each image frame during the particle effect rendering process and finally outputs a live performance update of the particle effects in the specified directory. This solution is fully automated and requires only a short time (limited by the duration of the particle effects) to complete the performance data collection, greatly saving manpower and time and improving the efficiency of obtaining performance indicators. Furthermore, the performance indicators of each image frame of the particle effect can describe the overall performance of the particle effect throughout the entire rendering process. Compared to analyzing the performance indicators of a single frame by extracting individual frames, the performance indicators obtained in this application are more comprehensive and accurate.
[0143] 309. Performance indicators of particle effects stored in computer equipment.
[0144] In one possible implementation, a computer device acquires performance metrics for multiple related particle effects, which can be different particle effects within the same project. Based on the acquired performance metrics, the computer device generates a first performance metric file and a second performance metric file, and stores both files. The first performance metric file includes the maximum values of performance metrics for multiple particle effects, such as the number of redraws, screen ratio, pixel fill rate, number of vertices, number of triangles, number of renders, number of particles, and number of particle components. The second performance metric file includes the same performance metrics for each particle effect, including the number of redraws, screen ratio, pixel fill rate, number of vertices, number of triangles, number of renders, number of particles, and number of particle components. Both the first and second performance metric files can be chart files or CSV (Comma-Separated Values) files, thus representing the trend of performance metrics across multiple image frames of the particle effects, facilitating developers in identifying and optimizing performance issues.
[0145] The method provided in this application embodiment reflects the performance of particle effects by demonstrating the repeated rendering of pixels during particle rendering. To obtain performance metrics of particle effects, a rendering program is invoked to render the particle effects based on the particle effect file. Since the rendering program adds a fixed preset value to the color value of the pixel where the particle is located, the number of times the preset value is added to the pixel can be determined based on the final color value of the pixel in the rendered particle effect image frame. In other words, the number of times the pixel is repeatedly rendered can be determined. Therefore, based on the pixel color value and the preset value after rendering, the performance metrics of particle effects related to repeated rendering can be accurately determined, improving the accuracy of obtaining particle effect performance metrics.
[0146] After obtaining the performance metrics of the particle effects, you can also display the performance metrics of the particle effects. See the following for details. Figure 13 The example shown. Figure 13 This is a flowchart of another method for obtaining performance indicators of particle effects provided in this application embodiment. This application embodiment is executed by a computer device. See also... Figure 13 The method includes:
[0147] 1301. A computer device acquires performance metrics of particle effects across multiple image frames. The performance metrics include at least one of the following: number of redraws, screen ratio, pixel fill rate, number of vertices, number of triangles, number of renders, number of particles, and number of particle components.
[0148] For details on how to obtain the above performance indicators, please refer to the above. Figure 3The embodiment shown, Figure 3 In the illustrated embodiment, after obtaining the performance metrics of particle effects, the computer device uses a script to upload the generated performance metric file to a resource display device (e.g., Figure 13 The computer device in the illustrated embodiment scans and analyzes the performance index file, and displays the performance index of the particle effects in multiple image frames to the user.
[0149] The performance metrics of particle effects in image frames can also include maximum number of re-renders, average number of re-renders, and re-render ratio. The performance metrics of particle effects across multiple image frames are shown in Table 1 below.
[0150] Table 1
[0151]
[0152] Frame rate refers to the number of frames rendered for the particle effect, or the sequence number of the rendered image frames. Maximum redraw count refers to the maximum number of times all pixels in the current image frame are redrawn. Average redraw count refers to the average number of times all pixels in the current image frame are redrawn. Redraw ratio refers to the proportion of pixels that are redrawn out of all pixels drawn in the current image frame.
[0153] 1302. Computer equipment determines out-of-standard image frames based on the performance indicators of multiple image frames. An out-of-standard image frame is an image frame that meets at least one out-of-standard condition. An out-of-standard condition is a condition in which the performance indicators of the image frame do not meet the standard performance indicators.
[0154] The conditions for exceeding the standard can be flexibly set by the developers according to their own needs. For example, in the game development scenario, the performance indicators of the image frames can be customized to meet the standard performance indicators based on the image quality requirements of the models supported by the game. The image frames that exceed the standard can be filtered out according to the conditions for exceeding the standard, thereby determining the particle effects that exceed the standard. For example, the conditions for exceeding the standard can be that the number of renderings exceeds the first value, the number of particles exceeds the second value, the number of repeated renderings exceeds the third value, etc.
[0155] 1303. Performance indicators of computer equipment displaying multiple image frames and the conditions for exceeding the standard for image frames.
[0156] After filtering out out-of-standard image frames, the computer equipment can display the performance parameters of multiple image frames, as well as the out-of-standard image frames and the out-of-standard conditions they meet. This allows users to quickly locate which image frames have performance problems and, based on the out-of-standard conditions they meet, quickly determine which performance indicators of the image frames have problems, so as to carry out targeted optimization and adjustment.
[0157] Figure 14 This is a schematic diagram of a performance indicator display interface provided in an embodiment of this application, such as... Figure 14 As shown, the computer device displays the performance metrics of four out-of-specification image frames and the out-of-specification conditions they meet. Performance metrics include the number of vertices, the number of triangles, the number of renders, the number of redraws, the number of particle components, the number of particles, the screen ratio, and the redraw ratio. For example, image frame 1 meets the out-of-specification condition of having more than 5000 triangles; image frame 2 meets the out-of-specification condition of having more than 5000 triangles, with at least 4 redraws and at least 15 renders; image frame 3 meets the out-of-specification condition of having more than 5000 triangles and at least 4 redraws; and image frame 4 meets the out-of-specification condition of having more than 5000 triangles.
[0158] Figure 15 This is a schematic diagram of another performance indicator display interface provided in an embodiment of this application, such as... Figure 15 As shown, the computer device displays a graph of performance metrics for multiple image frames. The horizontal axis of the graph represents different image frames, and the vertical axis represents performance metrics such as the number of vertices, the number of triangles, the number of renderings, the number of redraws, the number of particle components, the number of particles, the screen ratio, and the redraw ratio. According to the graph, the changing trends of performance metrics in multiple image frames of the same particle effect can be observed intuitively.
[0159] In one possible implementation, the computer device determines the priority of multiple out-of-specification conditions, displays the performance indicators and satisfied out-of-specification conditions of multiple out-of-specification image frames according to the priority order of the multiple out-of-specification conditions, and displays the performance indicators of other image frames besides the multiple out-of-specification image frames.
[0160] In addition to setting the exceedance conditions according to their own needs, developers can also set priorities for different exceedance conditions. Exceedance conditions that have a greater impact on particle effect performance are given higher priority, while those that have a smaller impact on particle effect performance are given higher priority. Subsequently, the performance indicators of exceedance image frames that meet the exceedance conditions are displayed in order of priority, making it easier for developers to quickly locate image frames with more serious performance problems.
[0161] For example, the first priority condition for exceeding the limit is a rendering count of at least 14, the second priority condition is a rendering count exceeding 5000 triangles, and the third priority condition is a screen ratio of at least 0.7. Then, if... Figure 16 As shown, Figure 16This is a schematic diagram of another performance index display interface provided in the embodiments of this application. The computer device displays the performance index of the image frame according to the priority of the over-limit conditions. The performance index of the image frame that hits the first priority over-limit condition is displayed at the top, the performance index of the image frame that hits the second priority over-limit condition is displayed below, and then the performance index of the image frame that hits the third priority over-limit condition is displayed below.
[0162] Figure 17 This is a flowchart of a performance indicator display method provided in an embodiment of this application, such as... Figure 17 As shown, the computer device reads the performance indicators of particle effects, reads the conditions for particle effects to exceed the limits, traverses the performance indicators of particle effects, marks the image frames that exceed the limits and their corresponding images. If the traversal is complete, the image frames that exceed the limits are sorted according to the priority of the conditions that exceed the limits, and each image frame and its performance indicators are displayed.
[0163] In one possible implementation, the computer device determines the number of times multiple image frames of the particle effect are repeatedly drawn, and displays the multiple image frames after annotation based on the number of times the particle effect is repeatedly drawn, for example, annotating the multiple image frames in red, and the higher the number of times the image frames are repeatedly drawn, the darker the red annotation on the image frames, so that users can intuitively understand the repeated drawing situation of multiple image frames.
[0164] The method provided in this application embodiment allows a computer device to display performance parameters of multiple image frames, as well as display image frames that exceed the standard and the conditions that exceed the standard met by the image frames that exceed the standard. This facilitates users in quickly locating which image frames have performance problems and in quickly determining which performance indicators of the image frames have problems based on the conditions that exceed the standard met by the image frames, so as to carry out targeted optimization and adjustment.
[0165] Figure 18 This is a flowchart of another method for obtaining performance indicators of particle effects provided in an embodiment of this application, such as... Figure 18 As shown, the resource processing device maps particle effect files to a specified directory, initiates the performance acquisition function, automatically identifies the particle effect files in the specified directory, traverses the particle effect files, collects performance metrics, analyzes the performance metrics, and stores them. For example, the resource processing device generates a performance metric file by analyzing the performance metrics and stores the performance metric file, which can be a CSV file, thus saving the performance metrics of the image frames generated by the particle effects during the rendering process. After completing the traversal, the performance metrics are uploaded to the resource display device, which then displays the performance metrics.
[0166] Figure 19 This is a flowchart of another method for obtaining performance indicators of particle effects provided in an embodiment of this application, such as... Figure 19As shown, the resource processing device starts scanning, identifies particle effect files, renders particle effects based on the particle effect files, and collects performance metrics. After collecting the performance metrics for each particle effect file, the performance metrics are uploaded to the resource display device, which then displays the performance metrics.
[0167] Figure 20 This is a schematic diagram of a device for obtaining performance indicators of particle effects according to an embodiment of this application. See also... Figure 20 The device includes:
[0168] The file acquisition module 2001 is used to acquire particle effect files, which are used to generate particle effects. The particle effects include multiple particles.
[0169] The rendering module 2002 is used to call the rendering program to render based on the particle effect file and obtain the dynamic resources of the particle effect. The dynamic resources include multiple image frames used to present the particle effect. When the rendering program draws the color of the pixel where the particle is located in the image frame, it overlays a preset value on the color value of the pixel.
[0170] The performance index determination and acquisition module 2003 is used to determine the performance index of the particle effect based on the color values and preset values of multiple pixels in the rendered image frame. The performance index is used to indicate the performance of the particle effect.
[0171] The particle effect performance indicator acquisition device provided in this application embodiment can reflect the performance of particle effects by repeatedly drawing pixels when rendering particle effects. In order to obtain the performance indicators of particle effects, when rendering based on particle effect files, a rendering program is called to render the particle effects. Since the rendering program adds a fixed preset value to the color value of the pixel where the particle is located, the number of times the preset value is added to the pixel can be determined based on the final color value of the pixel in the rendered particle effect image frame. That is, the number of times the pixel is repeatedly drawn can be determined. Therefore, the performance indicators of particle effects related to repeated drawing can be accurately determined based on the color value of the pixel after rendering and the preset value, thus improving the accuracy of obtaining the performance indicators of particle effects.
[0172] Optionally, see Figure 21 The rendering program also includes a first adjustment factor and a second adjustment factor. The first adjustment factor is used to adjust the proportion of the color value of the pixel itself, and the second adjustment factor is used to adjust the proportion of the color value of the pixel in this superimposed color.
[0173] Rendering Module 2002, used for:
[0174] For any image frame rendered based on particle effect files, the rendering program is invoked, and based on the first adjustment factor and the second adjustment factor, the current color value of the pixel in the image frame is weighted and summed with the preset value. The weighted sum value is then determined as the color value of the pixel after this rendering.
[0175] The first adjustment factor and the second adjustment factor are both equal to 1.
[0176] Optionally, see Figure 21 The performance metrics include the number of times the particle effects are repeatedly rendered per image frame; the performance metric determination and acquisition module 2003 is used for:
[0177] The ratio between the color value of each pixel in the rendered image frame and the preset value is used to determine the number of times each pixel in the image frame is drawn repeatedly.
[0178] The average number of times multiple pixels in an image frame are drawn is determined as the number of times the image frame is drawn.
[0179] Optionally, see Figure 21 Rendering module 2002, used for:
[0180] Create an empty scene that contains no objects.
[0181] The rendering program is invoked to render the particle effect file in an empty scene, resulting in dynamic resources of the particle effect. The image frames in the dynamic resources are a single frame of the particle effect in the empty scene.
[0182] Optionally, see Figure 21 The performance metrics for particle effects also include the screen-to-body ratio of particle effects in each image frame; the performance metric determination and acquisition module 2003 is also used for:
[0183] For any image frame, determine a first quantity and a second quantity, where the first quantity is the number of rendered pixels in the image frame and the second quantity is the total number of pixels in the image frame.
[0184] The ratio between the second quantity and the first quantity is determined as the screen ratio of particle effects in the image frame. The screen ratio represents the proportion of particle effects in the image frame.
[0185] Optionally, see Figure 21 The performance metrics for particle effects also include the pixel fill rate per image frame; the performance metric determination and acquisition module 2003 is also used for:
[0186] For any image frame, determine a first quantity, which is the number of pixels that have been rendered in the image frame;
[0187] The first quantity is determined as the pixel fill rate of the image frame, which represents the number of pixels rendered per unit time.
[0188] Optionally, see Figure 21 File acquisition module 2001 is used for:
[0189] Search for files in the target format within the specified directory, where any particle effect file belongs to the target format;
[0190] Among the files found that belong to the target format, identify the file containing the particle component, which is used to generate particles;
[0191] The file containing the particle component is identified as the particle effects file.
[0192] Optionally, see Figure 21 Performance metrics also include at least one of the following: the number of vertices, the number of triangles, or the number of rendering passes for particle effects; the performance metric determination and acquisition module 2003 is also used for:
[0193] Obtain the data acquisition script, which includes object declaration code. The object declaration code is used to indicate at least one of the following: the number of vertices, the number of triangles, or the number of rendering passes.
[0194] During the rendering process based on particle effect files, a data acquisition script is executed to sequentially obtain at least one of the following in each image frame: the number of vertices, the number of triangles, or the number of rendering iterations for the particle effect.
[0195] Optionally, see Figure 21 The performance metrics also include the number of particles in particle effects; the performance metric determination and acquisition module 2003 is also used for:
[0196] Determine the particle processing function, which is used to calculate the number of particles generated based on the particle effect file;
[0197] Generate a data acquisition device and bind the data acquisition device to the particle processing function. The data acquisition device is used to acquire the data generated by the particle processing function.
[0198] During the rendering process based on particle effect files, the data acquisition device is called to obtain the number of particles calculated by the particle processing function.
[0199] Optionally, see Figure 21 The device also includes a data display module 2004, used for:
[0200] Obtain performance metrics for particle effects across multiple image frames. Performance metrics include at least one of the following: number of redraws, screen ratio, pixel fill rate, number of vertices, number of triangles, number of renders, number of particles, and number of particle components.
[0201] Based on the performance metrics of multiple image frames, out-of-standard image frames are identified. An out-of-standard image frame is an image frame that meets at least one out-of-standard condition. An out-of-standard condition is a condition in which the performance metrics of the image frame do not meet the standard performance metrics.
[0202] Displays performance metrics for multiple image frames and the conditions for exceeding the limits for image frames.
[0203] Optionally, see Figure 21 Data display module 2004 is used for:
[0204] Determine the priority of multiple exceeding conditions;
[0205] Display the performance metrics and satisfied exceedance conditions of multiple image frames that exceed the limits, according to the priority order of the exceedance conditions.
[0206] Displays the performance metrics of image frames other than the multiple over-standard image frames.
[0207] It should be noted that the particle effect performance index acquisition device provided in the above embodiments is only an example of the division of the above functional modules. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the computer device can be divided into different functional modules to complete all or part of the functions described above. In addition, the particle effect performance index acquisition device and the particle effect performance index acquisition method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.
[0208] This application also provides a computer device, which includes a processor and a memory. The memory stores at least one computer program, which is loaded and executed by the processor to perform the operations performed in the particle effect performance index acquisition method of the above embodiments.
[0209] Optionally, the computer device is provided as a terminal. Figure 22 A schematic diagram of the structure of a terminal 2200 provided in an exemplary embodiment of this application is shown.
[0210] Terminal 2200 includes a processor 2201 and a memory 2202.
[0211] Processor 2201 may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc. Processor 2201 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field Programmable Gate Array), and PLA (Programmable Logic Array). Processor 2201 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 2201 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, processor 2201 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.
[0212] The memory 2202 may include one or more computer-readable storage media, which may be non-transitory. The memory 2202 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments, the non-transitory computer-readable storage media in the memory 2202 are used to store at least one computer program, which is used by the processor 2201 to implement the particle effect performance index acquisition method provided in the method embodiments of this application.
[0213] In some embodiments, the terminal 2200 may also optionally include: a peripheral device interface 2203 and at least one peripheral device. The processor 2201, memory 2202, and peripheral device interface 2203 can be connected via a bus or signal line. Each peripheral device can be connected to the peripheral device interface 2203 via a bus, signal line, or circuit board. Optionally, the peripheral device includes at least one of: a radio frequency circuit 2204, a display screen 2205, a camera assembly 2206, an audio circuit 2207, and a power supply 2208.
[0214] Peripheral device interface 2203 can be used to connect at least one I / O (Input / Output) related peripheral device to processor 2201 and memory 2202. In some embodiments, processor 2201, memory 2202 and peripheral device interface 2203 are integrated on the same chip or circuit board; in some other embodiments, any one or two of processor 2201, memory 2202 and peripheral device interface 2203 can be implemented on separate chips or circuit boards, which is not limited in this embodiment.
[0215] The radio frequency (RF) circuit 2204 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The RF circuit 2204 communicates with communication networks and other communication devices via electromagnetic signals. The RF circuit 2204 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals back into electrical signals. Optionally, the RF circuit 2204 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, etc. The RF circuit 2204 can communicate with other devices through at least one wireless communication protocol. This wireless communication protocol includes, but is not limited to: metropolitan area networks (MANs), various generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks (WLANs), and / or WiFi (Wireless Fidelity) networks. In some embodiments, the RF circuit 2204 may also include circuitry related to NFC (Near Field Communication), which is not limited in this application.
[0216] Display screen 2205 is used to display a UI (User Interface). This UI may include graphics, text, icons, videos, and any combination thereof. When display screen 2205 is a touch display screen, it also has the ability to collect touch signals on or above its surface. These touch signals can be input as control signals to processor 2201 for processing. In this case, display screen 2205 can also be used to provide virtual buttons and / or a virtual keyboard, also known as soft buttons and / or a soft keyboard. In some embodiments, there may be one display screen 2205, disposed on the front panel of terminal 2200; in other embodiments, there may be at least two display screens, disposed on different surfaces of terminal 2200 or in a folded design; in still other embodiments, display screen 2205 may be a flexible display screen, disposed on a curved or folded surface of terminal 2200. Furthermore, display screen 2205 may be configured as a non-rectangular, irregular shape, i.e., a non-rectangular screen. The display screen 2205 can be made of materials such as LCD (Liquid Crystal Display) and OLED (Organic Light-Emitting Diode).
[0217] The camera assembly 2206 is used to acquire images or videos. Optionally, the camera assembly 2206 includes a front-facing camera and a rear-facing camera. The front-facing camera is disposed on the front panel of the terminal 2200, and the rear-facing camera is disposed on the back of the terminal 2200. In some embodiments, there are at least two rear-facing cameras, which are any one of a main camera, a depth-sensing camera, a wide-angle camera, and a telephoto camera, to achieve background blurring by fusion of the main camera and the depth-sensing camera, panoramic shooting by fusion of the main camera and the wide-angle camera, VR (Virtual Reality) shooting, or other fusion shooting functions. In some embodiments, the camera assembly 2206 may also include a flash. The flash may be a single-color temperature flash or a dual-color temperature flash. A dual-color temperature flash is a combination of a warm light flash and a cool light flash, which can be used for light compensation at different color temperatures.
[0218] The audio circuit 2207 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, converting them into electrical signals that are input to the processor 2201 for processing, or to the radio frequency circuit 2204 for voice communication. For stereo sound acquisition or noise reduction purposes, multiple microphones may be used, each positioned at a different location on the terminal 2200. The microphone may also be an array microphone or an omnidirectional microphone. The speaker is used to convert electrical signals from the processor 2201 or the radio frequency circuit 2204 into sound waves. The speaker may be a conventional diaphragm speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can convert electrical signals not only into audible sound waves but also into inaudible sound waves for purposes such as distance measurement. In some embodiments, the audio circuit 2207 may also include a headphone jack.
[0219] Power supply 2208 is used to power the various components in terminal 2200. Power supply 2208 can be AC power, DC power, a disposable battery, or a rechargeable battery. When power supply 2208 includes a rechargeable battery, the rechargeable battery can support wired or wireless charging. The rechargeable battery can also be used to support fast charging technology.
[0220] In some embodiments, the terminal 2200 further includes one or more sensors 2209. The one or more sensors 2209 include, but are not limited to: an acceleration sensor 2210, a gyroscope sensor 2211, a pressure sensor 2212, an optical sensor 2213, and a proximity sensor 2214.
[0221] Accelerometer 2210 can detect the magnitude of acceleration along the three axes of a coordinate system established by terminal 2200. For example, accelerometer 2210 can be used to detect the components of gravitational acceleration along the three axes. Processor 2201 can control display screen 2205 to display the user interface in either a landscape or portrait view based on the gravitational acceleration signal acquired by accelerometer 2210. Accelerometer 2210 can also be used for games or for acquiring user motion data.
[0222] The gyroscope sensor 2211 can detect the orientation and rotation angle of the terminal 2200. The gyroscope sensor 2211 can work in conjunction with the accelerometer sensor 2210 to collect the user's 3D movements on the terminal 2200. Based on the data collected by the gyroscope sensor 2211, the processor 2201 can perform the following functions: motion sensing (e.g., changing the UI based on the user's tilt), image stabilization during shooting, game control, and inertial navigation.
[0223] The pressure sensor 2212 can be installed on the side bezel of the terminal 2200 and / or on the lower layer of the display screen 2205. When the pressure sensor 2212 is installed on the side bezel of the terminal 2200, it can detect the user's grip signal on the terminal 2200, and the processor 2201 can perform left / right hand recognition or quick operation based on the grip signal collected by the pressure sensor 2212. When the pressure sensor 2212 is installed on the lower layer of the display screen 2205, the processor 2201 can control the operable controls on the UI interface based on the user's pressure operation on the display screen 2205. The operable controls include at least one of button controls, scroll bar controls, icon controls, and menu controls.
[0224] Optical sensor 2213 is used to collect ambient light intensity. In one embodiment, processor 2201 can control the display brightness of display screen 2205 based on the ambient light intensity collected by optical sensor 2213. Optionally, when the ambient light intensity is high, the display brightness of display screen 2205 is increased; when the ambient light intensity is low, the display brightness of display screen 2205 is decreased. In another embodiment, processor 2201 can also dynamically adjust the shooting parameters of camera assembly 2206 based on the ambient light intensity collected by optical sensor 2213.
[0225] The proximity sensor 2214, also known as a distance sensor, is installed on the front panel of the terminal 2200. The proximity sensor 2214 is used to detect the distance between the user and the front of the terminal 2200. In one embodiment, when the proximity sensor 2214 detects that the distance between the user and the front of the terminal 2200 is gradually decreasing, the processor 2201 controls the display screen 2205 to switch from a screen-on state to a screen-off state; when the proximity sensor 2214 detects that the distance between the user and the front of the terminal 2200 is gradually increasing, the processor 2201 controls the display screen 2205 to switch from a screen-off state to a screen-on state.
[0226] Those skilled in the art will understand that Figure 22 The structure shown does not constitute a limitation on terminal 2200 and may include more or fewer components than shown, or combine certain components, or use different component arrangements.
[0227] Optionally, the computer device is provided as a server. Figure 23This is a schematic diagram of a server structure provided in an embodiment of this application. The server 2300 can vary significantly due to different configurations or performance. It may include one or more Central Processing Units (CPUs) 2301 and one or more memories 2302. The memories 2302 store at least one computer program, which is loaded and executed by the processor 2301 to implement the methods provided in the above-described method embodiments. Of course, the server may also have wired or wireless network interfaces, a keyboard, and input / output interfaces for input and output. The server may also include other components for implementing device functions, which will not be elaborated upon here.
[0228] This application also provides a computer-readable storage medium storing at least one computer program, which is loaded and executed by a processor to perform the operations of the particle effect performance index acquisition method of the above embodiments.
[0229] This application also provides a computer program product, including a computer program loaded and executed by a processor to perform the operations performed by the particle effect performance index acquisition method of the above embodiments. In some embodiments, the computer program involved in this application can be deployed and executed on a single computer device, or on multiple computer devices located in one location, or on multiple computer devices distributed across multiple locations and interconnected via a communication network. These multiple computer devices distributed across multiple locations and interconnected via a communication network can form a blockchain system.
[0230] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0231] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present application should be included within the protection scope of the present application.
Claims
1. A method for obtaining a performance indicator of a particle effect, characterized by, The method includes: Obtain a particle effect file, which is used to generate particle effects, and the particle effects include multiple particles; The rendering program is invoked, and based on the first adjustment factor and the second adjustment factor in the rendering program, the current color value of a pixel in any image frame rendered based on the particle effect file is weighted and summed with a preset value. The weighted sum is determined as the color value of the pixel after this rendering, thus obtaining the dynamic resource of the particle effect. The dynamic resource includes multiple image frames for presenting the particle effect. When the rendering program draws color on the pixel where the particle is located in the image frame, it superimposes the preset value on the color value of the pixel. The first adjustment factor is used to adjust the proportion of the pixel's own color value, and the second adjustment factor is used to adjust the proportion of the superimposed color value of the pixel. Both the first adjustment factor and the second adjustment factor are equal to 1. Based on the color values of multiple pixels in the rendered image frame and the preset values, the performance index of the particle effect is determined, and the performance index is used to indicate the performance of the particle effect.
2. The method of claim 1, wherein, The performance metrics include the number of times the particle effect is repeatedly rendered for each image frame; The process of determining the performance metrics of the particle effect based on the color values of multiple pixels in the rendered image frame and the preset values includes: The ratio between the color value of each pixel in the rendered image frame and the preset value is determined as the number of times each pixel in the image frame is drawn repeatedly. The average number of times multiple pixels in the image frame are repeatedly drawn is determined as the number of times the image frame is repeatedly drawn.
3. The method of claim 1, wherein, The method further includes: Create an empty scene that contains no objects; The rendering program is invoked to render the particle effect file in the empty scene, thereby obtaining the dynamic resource of the particle effect. The image frame in the dynamic resource is a frame of the particle effect in the empty scene.
4. The method of claim 3, wherein, The performance metrics for the particle effects also include the screen-to-body ratio of the particle effects in each image frame; the method further includes: For any image frame, a first quantity and a second quantity are determined, where the first quantity is the number of rendered pixels in the image frame and the second quantity is the total number of pixels in the image frame. The ratio between the second quantity and the first quantity is determined as the screen ratio of the particle effect in the image frame, where the screen ratio represents the proportion of the particle effect in the image frame.
5. The method of claim 3, wherein, The performance metrics of the particle effects also include the pixel fill rate of each image frame of the particle effects; the method further includes: For any image frame, a first quantity is determined, which is the number of rendered pixels in the image frame; The first quantity is determined as the pixel fill rate of the image frame, whereby the pixel fill rate represents the number of pixels rendered per unit time.
6. The method of claim 1, wherein, The process of obtaining particle effect files includes: Search for files belonging to the target format in the specified directory, where any particle effect file belongs to the target format; Among the files found that belong to the target format, files containing particle components are identified, the particle components being used to generate particles; The file containing the particle component is identified as the particle effect file.
7. The method of claim 1, wherein, The performance metrics also include at least one of the following: the number of vertices, the number of triangles, or the number of rendering passes for the particle effect; the method also includes: Obtain a data acquisition script, the data acquisition script including object declaration code, the object declaration code being used to indicate the acquisition of at least one of the number of vertices, the number of triangles, or the number of rendering times; During the rendering process based on the particle effect file, the data acquisition script is executed to sequentially obtain at least one of the following in each image frame: the number of vertices, the number of triangles, or the number of rendering iterations.
8. The method of claim 1, wherein, The performance metrics also include the number of particles in the particle effects; the method further includes: Determine a particle processing function, which is used to calculate the number of particles generated based on the particle effects file; A data acquisition method is generated, and the data acquisition method is bound to the particle processing function. The data acquisition method is used to acquire the data generated by the particle processing function. During the rendering process based on the particle effect file, the data acquisition method is called to obtain the number of particles calculated by the particle processing function.
9. The method according to any one of claims 1 to 8, characterized in that, After determining the performance metrics of the particle effect based on the color values of multiple pixels in the rendered image frame and the preset values, the method further includes: The performance metrics of the particle effects in the multiple image frames are obtained. The performance metrics include at least one of the following: number of redraws, screen ratio, pixel fill rate, number of vertices, number of triangles, number of renderings, number of particles, and number of particle components. Based on the performance indicators of the multiple image frames, out-of-standard image frames are identified. An out-of-standard image frame is an image frame that meets at least one out-of-standard condition, which means that the performance indicators of the image frame do not meet the standard performance indicators. The display shows the performance metrics of the multiple image frames and the conditions for exceeding the limits met by the image frames that exceeded the limits.
10. The method according to claim 9, characterized in that, The display of performance metrics for the plurality of image frames and the exceeding conditions satisfied by the exceeding image frames include: Determine the priority of multiple exceeding conditions; According to the priority order of the multiple exceeding conditions, display the performance indicators and the exceeding conditions satisfied by multiple exceeding image frames; Displays the performance metrics of the image frames other than the multiple over-standard image frames.
11. A particle-specific performance indicator acquisition device, comprising: The device includes: The file acquisition module is used to acquire particle effect files, which are used to generate particle effects, and the particle effects include multiple particles. The rendering module is used to call the rendering program, and based on the first adjustment factor and the second adjustment factor in the rendering program, to perform a weighted summation of the current color value of a pixel in any image frame rendered based on the particle effect file and a preset value, and to determine the weighted summation value as the color value of the pixel after this rendering, thereby obtaining the dynamic resource of the particle effect. The dynamic resource includes multiple image frames for presenting the particle effect. The rendering program is used to superimpose the preset value on the color value of the pixel when rendering the color of the pixel where the particle is located in the image frame. The first adjustment factor is used to adjust the proportion of the pixel's own color value, and the second adjustment factor is used to adjust the proportion of the superimposed color value of the pixel. Both the first adjustment factor and the second adjustment factor are equal to 1. The performance index determination and acquisition module is used to determine the performance index of the particle effect based on the color values of multiple pixels in the image frame after rendering and the preset value. The performance index is used to indicate the performance of the particle effect.
12. The apparatus of claim 11, wherein, The performance metrics include the number of times the particle effect is repeatedly rendered for each image frame; The performance index determination and acquisition module is used for: The ratio between the color value of each pixel in the rendered image frame and the preset value is determined as the number of times each pixel in the image frame is drawn repeatedly. The average number of times multiple pixels in the image frame are repeatedly drawn is determined as the number of times the image frame is repeatedly drawn.
13. The apparatus of claim 11, wherein, The rendering module is also used for: Create an empty scene that contains no objects; The rendering program is invoked to render the particle effect file in the empty scene, thereby obtaining the dynamic resource of the particle effect. The image frame in the dynamic resource is a frame of the particle effect in the empty scene.
14. The apparatus of claim 13, wherein, The performance metrics of the particle effects also include the screen-to-body ratio of the particle effects in each image frame; the performance metric determination and acquisition module is further used for: For any image frame, a first quantity and a second quantity are determined, where the first quantity is the number of rendered pixels in the image frame and the second quantity is the total number of pixels in the image frame. The ratio between the second quantity and the first quantity is determined as the screen ratio of the particle effect in the image frame, where the screen ratio represents the proportion of the particle effect in the image frame.
15. The apparatus of claim 13, wherein, The performance metrics of the particle effects also include the pixel fill rate of each image frame of the particle effects; the performance metric determination and acquisition module is further used for: For any image frame, a first quantity is determined, which is the number of rendered pixels in the image frame; The first quantity is determined as the pixel fill rate of the image frame, whereby the pixel fill rate represents the number of pixels rendered per unit time.
16. The apparatus of claim 11, wherein, The file acquisition module is used for: Search for files belonging to the target format in the specified directory, where any particle effect file belongs to the target format; Among the files found that belong to the target format, files containing particle components are identified, the particle components being used to generate particles; The file containing the particle component is identified as the particle effect file.
17. The apparatus of claim 11, wherein, The performance metrics also include at least one of the following: the number of vertices, the number of triangles, or the number of rendering passes for the particle effect; the performance metric determination and acquisition module is further used for: Obtain a data acquisition script, the data acquisition script including object declaration code, the object declaration code being used to indicate the acquisition of at least one of the number of vertices, the number of triangles, or the number of rendering times; During the rendering process based on the particle effect file, the data acquisition script is executed to sequentially obtain at least one of the following in each image frame: the number of vertices, the number of triangles, or the number of rendering iterations.
18. The apparatus of claim 11, wherein, The performance metrics also include the number of particles in the particle effects; the performance metrics determination and acquisition module is further used for: Determine a particle processing function, which is used to calculate the number of particles generated based on the particle effects file; A data acquisition method is generated, and the data acquisition method is bound to the particle processing function. The data acquisition method is used to acquire the data generated by the particle processing function. During the rendering process based on the particle effect file, the data acquisition method is called to obtain the number of particles calculated by the particle processing function.
19. The apparatus of any of claims 11-18, wherein, The device also includes a data display module for: The performance metrics of the particle effects in the multiple image frames are obtained. The performance metrics include at least one of the following: number of redraws, screen ratio, pixel fill rate, number of vertices, number of triangles, number of renderings, number of particles, and number of particle components. Based on the performance indicators of the multiple image frames, out-of-standard image frames are identified. An out-of-standard image frame is an image frame that meets at least one out-of-standard condition, which means that the performance indicators of the image frame do not meet the standard performance indicators. The display shows the performance metrics of the multiple image frames and the conditions for exceeding the limits met by the image frames that exceeded the limits.
20. The apparatus of claim 19, wherein, The data display module is used for: Determine the priority of multiple exceeding conditions; According to the priority order of the multiple exceeding conditions, display the performance indicators and the exceeding conditions satisfied by multiple exceeding image frames; Displays the performance metrics of the image frames other than the multiple over-standard image frames.
21. A computer device, comprising: The computer device includes a processor and a memory, the memory storing at least one computer program, which is loaded and executed by the processor to perform the operations performed by the particle effect performance index acquisition method as described in any one of claims 1 to 10.
22. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores at least one computer program, which is loaded and executed by a processor to perform the operations performed by the particle effect performance index acquisition method as described in any one of claims 1 to 10.
23. A computer program product, comprising a computer program, characterized in that, The computer program is loaded and executed by a processor to perform the operations performed by the particle effect performance index acquisition method as described in any one of claims 1 to 10.