A particle system rendering method, device, and electronic device
By classifying the particle system and using the GPU pipeline for rendering processing, the problem of low rendering efficiency of traditional CPU is solved, and efficient particle system rendering is achieved.
Patent Information
- Application Number
- CN202411619219.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-13
- Publication Date
- 2025-04-01
AI Technical Summary
Traditional particle system rendering technology is based on CPU, resulting in excessive performance consumption and low rendering efficiency when facing the update operations of large-scale particle systems and massive particle instances.
By classifying the particle system, generating rendering instructions, and using the GPU pipeline for rendering, parallel processing is realized from rendering of a single particle system to multi-category particle system.
It improves the efficiency of particle system processing and rendering, reduces the number of calls from CPU to GPU, reduces the switching of rendering state, and improves rendering performance.
Smart Images

Figure CN119741411A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and more specifically, to a method, device and electronic equipment for rendering a particle system. Background Art
[0002] Traditional rendering technology is difficult to achieve complex physical phenomena, such as flames, smoke or meteor trails, which can usually be simulated using particle systems. Particle systems are a technology used in 3D computer graphics to simulate fuzzy and dynamic phenomena, such as smoke, fire, nebulae, etc., by generating a large number of tiny, individually controlled particles to simulate various natural phenomena. In games and animation special effects, particle systems are widely used to create realistic visual effects. Current particle systems are usually processed based on the CPU (Central Processing Unit). Due to the limitations of the CPU itself, the performance consumption is too high and the rendering efficiency is low when facing large-scale particle systems and the update calculation of massive particle instances. Summary of the invention
[0003] The present invention aims to overcome at least one defect (shortcoming) of the above-mentioned prior art and provide a method, device and electronic device for rendering a particle system, so as to achieve the effect of improving the efficiency of processing and rendering a particle system.
[0004] According to a first aspect of the present application, a particle system rendering method is provided, comprising:
[0005] Classify the particle system to obtain classification results;
[0006] Setting corresponding rendering instructions for each category of particle system according to the classification result;
[0007] The rendering instructions are obtained through the GPU pipeline, and the corresponding particle system is rendered according to the rendering instructions.
[0008] The classification of the particle system to obtain the classification result and the rendering of the corresponding particle system through the GPU pipeline can improve the efficiency of particle system processing and rendering, and based on the classification result and the GPU pipeline, it is realized from the rendering of a single particle system to the parallel processing of multiple categories of particle systems.
[0009] Optionally, the particle system is classified according to the type and / or rendering material of the particle system to obtain a classification result.
[0010] The classification of the particle system is beneficial to the processing of the particle system, while improving the accuracy of processing and rendering. The same processing and rendering operations are performed on the particle systems of the same type, which reduces the number of rendering processes and reduces the performance loss of the device.
[0011] Optionally, determining a particle system category according to the classification result, and setting a corresponding rendering instruction for each particle system category;
[0012] The corresponding index tag is set for each particle system, and the corresponding category tag is set for each particle system category, so that the rendering instruction determines the associated particle system category and particle system based on the category tag and the index tag.
[0013] The rendering instructions are for particle systems of the same category, which can reduce the number of calls from the CPU to the GPU, thereby reducing latency. The rendering instructions allow developers to have fine-grained control over GPU resources, including textures, buffers, and shaders, etc., which can more effectively manage memory and improve resource utilization. Drawing multiple objects through the rendering instructions reduces the burden on the CPU and improves rendering performance.
[0014] The index tag and the category tag can enhance the possibility of being recognized by the rendering instruction and facilitate the management of particle instances of different categories.
[0015] Optionally, an emitter system buffer, a particle system instance buffer, a particle system emitter buffer, a particle system emitter indexer buffer, a particle instance index recycling pool buffer, a particle instance rendering batch index buffer, and a particle system module data buffer are set according to the number of the particle systems and the number of particle system instances;
[0016] When the pipeline of the GPU performs batch rendering processing on the corresponding particle system according to the rendering instruction, the data of the particle system is obtained from each of the buffers.
[0017] The buffer can be used to temporarily store data, and can reduce the number of direct data transmissions between the CPU and I / O devices or between different devices when performing rendering operations. The buffer can improve data transmission efficiency and overall system performance, and the buffer allows data generation and consumption processes to be performed asynchronously, that is, data can be written to the buffer and then processed or read asynchronously, thereby improving processing efficiency.
[0018] Optionally, initializing a particle instance of the particle system through a first pipeline of the GPU;
[0019] The particle system to be emitted in the current frame is processed in parallel by the second pipeline of the GPU, and the particle system emission logic control is executed on the particle system to be emitted, so as to emit and generate particle instances;
[0020] The particle instance rendering batch index buffer is input into the third pipeline of the GPU, parameters of the particle instance generated by emission are updated through the third pipeline of the GPU, and the particle system category corresponding to the particle instance generated by emission is determined, and the particle instance after parameter update is divided into blocks and stored in the particle instance rendering batch index buffer according to the corresponding particle system category;
[0021] The different pipelines of the GPU can process the particle instances of the particle system, and use the efficient floating-point computing power of the GPU pipeline to quickly perform complex mathematical calculations and perform initialization operations on the particle instance parameters of the particle system; and then use it to process a large amount of data at the same time to perform parallel computing tasks in graphics rendering, and the rendering task can be decomposed into multiple stages, each of which can be executed in parallel; the different pipelines of the GPU can provide high performance at lower power consumption, and each stage of the GPU pipeline can be customized as needed to achieve specific rendering effects.
[0022] Optionally, a GPU is used to determine a corresponding rendering instruction according to the particle system category corresponding to each block, and batch rasterization rendering processing is performed on the particle instances in the block according to the corresponding rendering instruction. Specifically, the GPU performs the following operations:
[0023] Set the primitives and corresponding primitive information of the rendered particle instance;
[0024] Create different rendering materials for each particle system category;
[0025] Based on the created rendering material, batch render the particle instances in each block respectively;
[0026] Calculate each vertex information of the particle instance in each block;
[0027] For the particle instances after batch rendering, perform rasterization operations, per-fragment operations, and color blending operations based on the primitive information and each vertex information to obtain the final rendered particle instances;
[0028] The final rendered particle instance is displayed.
[0029] The batch rendering of the particle instances in each block combines multiple rendering objects into one batch, which reduces the number of times the CPU sends rendering commands to the GPU and the number of times the GPU switches rendering states, allowing the GPU to complete more rendering work at one time as much as possible, thereby improving the overall efficiency of logic lines and rendering lines, and significantly improving the rendering performance of games and applications. Appropriate batching can increase the frame rate and make the scene smoother. The batch rendering technology can be used to adjust according to different rendering requirements and hardware performance to achieve the best rendering effect.
[0030] Optionally, batch rendering the particle instances in each block based on the created rendering material includes:
[0031] Find the position of the corresponding block in the particle instance rendering batch index buffer according to the block mark;
[0032] Creating a buffer of indirect parameters according to the primitive information and the total number of particle instances of the current frame;
[0033] Based on the created rendering material and the buffer of indirect parameters, batch rendering is performed on the particle instances in the corresponding blocks;
[0034] The step of calculating each vertex information of a particle instance in each block includes:
[0035] Taking the corresponding block as a starting point, finding all particle instances in the corresponding block;
[0036] Determine the parameters of the particle instances in the particle instance buffer and the particle system buffer and the particle system parameters according to all the particle instances in the corresponding block;
[0037] Calculate each vertex information of the particle instance in the corresponding block according to the parameters of the particle instance and the particle system parameters.
[0038] The batch rendering of the particle instances in each block can achieve special optimization, can provide extremely high rendering speed, achieve real-time rendering effect, is not only easy to understand and implement, but also can achieve complex visual effects. It can provide good performance and is suitable for various types of graphics applications, including games, simulations, animations, etc., and is easily extended to multi-core processors and multi-GPU configurations.
[0039] Optionally, the particle instances whose lifecycles have ended are recycled by the GPU.
[0040] The recycling of particle instances at the end of their life cycle by the GPU can reduce the frequency of memory allocation and release, thereby improving the performance of the application; the use of the recycling mechanism can effectively manage memory and reduce memory fragmentation; recycling particle instances at the end of their life cycle can also allow them to be reused, reducing the resource consumption required to create new instances; at the same time, it can also reduce the number of instruction issuances and improve rendering efficiency. The recycling operation can achieve life cycle management of particles, and the creation efficiency of particle effects is higher.
[0041] According to a second aspect of the present application, a particle system rendering device is provided, comprising:
[0042] A classification module is used to classify the particle system and obtain classification results;
[0043] A setting module, used for setting corresponding rendering instructions for each category of particle system according to the classification result;
[0044] The processing module obtains rendering instructions through the GPU pipeline and performs rendering processing on the corresponding particle system according to the rendering instructions.
[0045] The particle system rendering device, each module is an indispensable part of the whole process, and the modules cooperate with each other. The classification module classifies the particle system according to its properties to facilitate subsequent rendering processing. The setting module sets corresponding rendering instructions for each category of particle system according to the classification result. Finally, the GPU pipeline of the processing module is used to render the corresponding particle system according to the rendering instructions.
[0046] According to a third aspect of the present application, an electronic device is provided, including:
[0047] a memory for storing one or more computer programs;
[0048] The processor implements the particle system rendering method described in the first aspect when the one or more computer programs are executed by the processor.
[0049] The electronic device provides a complete set of equipment, which is convenient for rendering the particle system and improves the efficiency of processing and rendering the particle system. The equipment has certain advantages.
[0050] According to a fourth aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement a particle system rendering method described in the first aspect when executed.
[0051] Based on any of the above aspects, the particle system rendering method, device, and electronic device provided in the embodiments of the present application transfer the particle update and rendering process to the GPU, and use the parallel processing capabilities of the GPU to process a large number of particles at the same time. Using GPU instantiation rendering technology, a single drawing call is allowed to render multiple particles, reducing the number of calls from the CPU to the GPU. The particle system is classified, and particles with the same properties are merged into the same rendering batch, reducing the switching of rendering states. A multi-function buffer is opened up to implement an intelligent caching mechanism. For particle states that do not change frequently, unnecessary recalculation and rendering are avoided. This application reduces costs, improves performance and benefits, and brings significant progress to the field of computer graphics rendering. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0053] Figure 1 This is a flow chart of a particle system rendering method provided in this embodiment.
[0054] Figure 2 A schematic diagram of sub-steps of rendering processing of a particle system rendering method provided in this embodiment.
[0055] Figure 3 A schematic diagram of functional modules of a particle system rendering device of a particle system rendering method provided in this embodiment.
[0056] Figure 4 This is a schematic diagram of the structure of an electronic device provided in this embodiment. DETAILED DESCRIPTION
[0057] The drawings of this application are only used for illustrative purposes and should not be construed as limiting the present application. In order to better illustrate the following embodiments, some parts of the drawings may be omitted, enlarged or reduced, and do not represent the size of the actual product; it is understandable to those skilled in the art that some well-known structures and their descriptions in the drawings may be omitted.
[0058] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0059] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0060] The current particle system rendering is mainly based on the CPU. Due to the large number of particles generated by the characteristics of the particle system itself, the high computing requirements make the CPU the bottleneck of the overall performance. At the same time, the particle system needs to frequently update the status of a large number of particles, which is also a computationally intensive task. In addition, dynamic allocation and recycling of memory to manage the particle life cycle may lead to memory fragmentation and inefficiency. Computationally intensive tasks will increase device power consumption, especially on mobile devices, which will shorten battery life. When faced with massive amounts of particle system data, traditional processors have low processing and rendering efficiency.
[0061] This embodiment provides a technical solution that can solve the above-mentioned problem. The specific implementation methods of this application are described in detail below in conjunction with the accompanying drawings.
[0062] like Figure 1 As shown, this embodiment provides a particle system rendering method, which may include the following steps:
[0063] S110, classifying the particle system to obtain a classification result;
[0064] In this embodiment, the particle system can be single or multiple. The particle system can be classified through a tree diagram model or an integrated learning method, using multiple decision trees to classify the data and taking the majority voting result as the final classification. It can also be classified by finding the optimal boundary (hyperplane) between different categories or using a model inspired by the structure of the human brain to learn classification tasks by adjusting weights and biases.
[0065] In an optional implementation, multiple particle systems are selected for classification processing, and a particle system manager is established through a CPU processor. The multiple particle systems are registered in the particle system manager, and an index ID is assigned to the settled particle system. The particle system manager will classify the settled particle systems according to their types and / or rendering materials. The same category will be divided into a set called Batch, and a Batch ID will be assigned to each set obtained after classification. The particle system will record the Batch ID. The classification method includes but is not limited to this.
[0066] S120, setting corresponding rendering instructions for each category of particle system according to the classification result;
[0067] In this embodiment, the rendering instructions for each category of particle system may be setting rendering instructions for one category of particle system separately, or may be setting corresponding rendering instructions for multiple categories of particle systems at the same time to achieve parallel processing; the rendering instructions may be issued by a CPU processor or other processors, etc.
[0068] In an optional implementation, the CPU processor sets corresponding rendering instructions for multiple categories of particle systems, and the rendering instructions are not limited.
[0069] In this embodiment, before rendering the particle system, it is necessary to open up memory space to reduce memory consumption. The memory space can be opened up by setting a buffer, using an array, creating a fixed-size memory area, or dynamic arrays, strings, queues and stacks, hash tables, memory-mapped files, etc.
[0070] In an optional implementation, memory space is opened up by a CPU processor, and an emitter system buffer, a particle system instance buffer, a particle system emitter buffer, a particle system emitter indexer buffer, a particle instance index recovery pool buffer, a particle instance rendering batch index buffer, and a particle system module data buffer can be set according to the number of particle systems and the number of particle system instances in the particle manager. At the same time, when the GPU pipeline renders the corresponding particle system according to the rendering instruction, the particle system data is obtained from each of the buffers. The method of opening up memory space is not limited to this.
[0071] S130, obtaining a rendering instruction through the GPU pipeline, and performing rendering processing on the corresponding particle system according to the rendering instruction.
[0072] In the specific implementation process, steps S110 and S120 are executed by the CPU, and S130 is executed by the GPU. The method of this embodiment is completed through the interaction between the CPU and the GPU.
[0073] In the specific implementation process, the specific steps of S130 may include:
[0074] Initialize the particle instance of the particle system through the first pipeline of the GPU;
[0075] The particle system to be emitted in the current frame is processed in parallel by the second pipeline of the GPU, and the particle system emission logic control is executed on the particle system to be emitted, so as to emit and generate particle instances;
[0076] The particle instance rendering batch index buffer is input into the third pipeline of the GPU, parameters of the particle instance generated by emission are updated through the third pipeline of the GPU, and the particle system category corresponding to the particle instance generated by emission is determined, and the particle instance after parameter update is divided into blocks and stored in the particle instance rendering batch index buffer according to the corresponding particle system category;
[0077] The GPU determines a corresponding rendering instruction according to the particle system category corresponding to each block, and performs batch rasterization rendering processing on the particle instances in the block according to the corresponding rendering instruction.
[0078] In this embodiment, the pipeline of the GPU includes a first pipeline, a second pipeline, and a third pipeline. The first pipeline can be the Init computer pipeline in the GPU; the second pipeline can be the Emit computer pipeline in the GPU; the third pipeline can be the Update computer shader in the GPU, and the corresponding particle system is rendered on the pipeline.
[0079] In this embodiment, the particle instance of the particle system is initialized through the first pipeline of the GPU.
[0080] In an optional implementation, the particle instance of the particle system is initialized through the first pipeline of the GPU, and the first pipeline of the GPU is the Init computer pipeline. The particle system instance buffer and the particle instance index recycling pool buffer are input into the Init compute pipeline to perform an initialization operation. The initialized parameters include life cycle, motion matrix, color, UV change, etc. A large number of particle instance parameters are initialized through parallel processing of the Init computer pipeline. The method of implementing parameter initialization on the particles is not limited to this.
[0081] In this embodiment, the second pipeline of the GPU processes the particle system that needs to be emitted in the current frame in parallel, executes the particle system emission logic control on the particle system that needs to be emitted, and emits the generated particle instance.
[0082] In an optional implementation, the particle system that needs to be emitted in the current frame is processed in parallel by the second pipeline of the GPU, and the second pipeline of the GPU is the Emit computer pipeline. The particle instance buffer, the particle instance index recovery pool buffer, the particle system buffer, the particle system emitter index buffer, and the particle system emitter buffer are input into the Emit computer pipeline, and then the corresponding particle system buffer and the particle system emitter index buffer are determined according to the index ID assigned to the particle system that needs to be emitted in the current frame, and the particle system that needs to be emitted is processed in parallel by the corresponding particle system emitter index buffer and the particle system buffer. According to the emitter parameters corresponding to the particle system that needs to be emitted in the current frame, the particle instance is allocated from the particle instance pool to generate the emission of the particle instance. Then, the corresponding particle system is found according to the emitter parameters of the emitted particle instance, and the particle system to which it belongs is marked by the parameters. The emission generation particle instance includes but is not limited to this.
[0083] In this embodiment, the particle instance rendering batch index buffer is input into the third pipeline of the GPU, the parameters of the particle instances generated by the emission are updated through the third pipeline of the GPU, and the corresponding particle system category is determined according to the particle instances generated by the emission, and the particle instance blocks after the parameter update are stored in the particle instance rendering batch index buffer according to the corresponding particle system category.
[0084] In an optional implementation, the particle instance rendering batch index buffer is input into the third pipeline of the GPU, and the parameters of the particle instances generated by the emission are updated through the third pipeline of the GPU. The third pipeline of the GPU is the Update computer pipeline. The particle instance buffer, the particle instance index recovery pool buffer, the particle system buffer, the particle instance rendering batch index buffer, and the particle system module data buffer are input into the Update computer pipeline. Each particle instance finds the particle system and particle system parameter module data to which it belongs through parameter tags. After determining the particle system and particle system parameter module data to which it belongs, a series of module parameter update operations such as life cycle, motion matrix, color, and UV changes are performed to synchronously update the motion rendering information parameters of the particle instance.
[0085] It can be understood that in the Update compute pipeline, the corresponding particle system category is determined according to the particle instance emitted by the current frame, and all active particle instances of the current frame are stored in parallel in a particle instance rendering batch index buffer by dividing the area into blocks for batch rendering processing.
[0086] In this embodiment, the GPU determines a corresponding rendering instruction according to the particle system category corresponding to each block, and performs batch rasterization rendering processing on the particle instances in the block according to the corresponding rendering instruction.
[0087] In an optional embodiment, illustratively, Figure 2 A rendering processing schematic diagram of a particle system rendering method provided in an embodiment of the present application, the specific steps may include:
[0088] S131, setting the primitives and corresponding primitive information of the rendering particle instance;
[0089] In this embodiment, the primitive information includes position, color, particle instance size, speed, life cycle, texture coordinates, transparency, normal information, material and shader attributes, etc.
[0090] S132. Creating different rendering materials for each particle system category;
[0091] In this embodiment, different rendering materials are created for each particle system category, and the rendering materials include basic color, transparency, texture, etc.
[0092] S133, creating a buffer of indirect parameters according to the primitive information and the total number of particle instances in the current frame;
[0093] In this embodiment, the primitive information includes position, color, particle instance size, speed, life cycle, texture coordinate transparency normal information material and shader attributes, etc.; the total number of particle instances in the current frame can be obtained by the created particle instance counter buffer. Before classifying the particle instances, the particle instances are stored in the particle instance counter buffer. The particle instance counter buffer automatically counts the number of particle instances and plays a role in recording the particle instance data.
[0094] S134, batch rendering the particle instances in each block based on the created rendering material;
[0095] S135, calculating each vertex information of the particle instance in each block;
[0096] In this embodiment, each vertex information includes coordinate position, color, UV coordinates, etc.
[0097] S136, performing rasterization operation, per-fragment operation, and color blending operation on the particle instance after batch rendering in combination with the primitive information and each vertex information to obtain the final rendered particle instance;
[0098] S137: Display the finally rendered particle instance.
[0099] The technical solution provided by this application is described below in conjunction with a specific embodiment.
[0100] like Figure 3 As shown, the embodiment of the present application also provides a particle system rendering device 210 of a particle system rendering method.
[0101] Optionally, the particle system rendering device 210 may include:
[0102] A classification module 211 is used to classify the particle system to obtain a classification result;
[0103] In this embodiment, the classification module 211 can be used to perform Figure 1 As shown in step S110 , for a detailed description of the classification module 211 , reference may be made to the description of step S110 .
[0104] A setting module 212, used for setting corresponding rendering instructions for each category of particle system according to the classification result;
[0105] In this embodiment, the setting module 212 can be used to perform Figure 1 As shown in step S120, for a detailed description of the setting module 212, reference may be made to the description of step S120.
[0106] The processing module 213 is used to obtain a rendering instruction through the GPU pipeline, and perform rendering processing on the corresponding particle system according to the rendering instruction;
[0107] In this embodiment, the processing module 213 may be used to execute Figure 1 As shown in step S130, for the specific description of the processing module 213, reference may be made to the description of the step S130.
[0108] It can be understood that the above-mentioned device embodiment and the above-mentioned method embodiment can correspond to each other, and similar descriptions of the device embodiment can refer to the method embodiment. To avoid repetition, it will not be repeated here. A particle system rendering device provided in an embodiment of the present application can execute a particle system rendering method provided in any embodiment of the present application, and has functional modules and beneficial effects corresponding to the execution method. The functional modules of the particle system rendering device can be implemented in the form of hardware, can be implemented by instructions in the form of software, and can also be implemented by a combination of hardware and software modules.
[0109] Specifically, each step of the method embodiment of the present application can be completed by the hardware integrated logic circuit and / or software instructions in the processor. The steps of the particle system rendering method in combination with the embodiment of the present application can be directly embodied as a hardware encoding processor, or a combination of hardware and software modules in the encoding processor. Optionally, the software module can be located in a random access memory, a read-only memory, a programmable read-only memory, a flash memory, an electrically erasable programmable memory, a register, and other storage media. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps in the above method embodiment in combination with its hardware.
[0110] The present application embodiment provides an electronic device 710, whose structure is as follows: Figure 4 The electronic device 710 may be Figure 1 The server 100 or the terminal 200 is shown.
[0111] like Figure 4 As shown, the electronic device 710 includes a memory 711, a processor 712, a communication module 713 and an input / output interface 714, etc. Optionally, the memory 711, the processor 712, the communication module 713 and the input / output interface 714 can be connected and communicated through a bus 715.
[0112] The memory 711 is used to store one or more computer programs and transmit the code of the computer program to the processor 712; when the one or more computer programs are executed by the processor 712, the particle system rendering method in the embodiment of the present application is implemented.
[0113] Optionally, the electronic device 710 can be connected to a network via a communication module 713 to communicate with other devices, such as a terminal or a server, through the network to achieve data interaction. The electronic device 710 can be various forms of digital computers, such as desktop computers, servers, workstations, mainframe computers or other types of computers. The electronic device 710 can also be various forms of mobile terminals, such as smart phones, tablet computers, wearable devices (such as helmets, glasses, watches, etc.) and other similar mobile terminals.
[0114] Optionally, the electronic device 710 can be connected to the required input / output devices, such as a keyboard, a display device, etc., through the input / output interface 714. The electronic device 710 itself can have a display device, and can also be connected to other display devices through the input / output interface 714. Optionally, a storage device, such as a hard disk, can also be connected through the input / output interface 714, so that data in the electronic device 710 can be stored in the storage device, or data in the storage device can be read, and data in the storage device can also be stored in the memory 711. It can be understood that the input / output interface 714 can be a wired interface or a wireless interface. Depending on the actual application scenario, the device connected to the input / output interface 714 can be a component of the electronic device 710, or it can be an external device connected to the electronic device 710 when needed.
[0115] Optionally, the memory 711 may be a volatile memory and / or a non-volatile memory, the volatile memory may be a random access memory, etc., and the non-volatile memory may be a read-only memory, a programmable read-only memory, an erasable programmable read-only memory, an electrically erasable programmable read-only memory or a flash memory, etc.
[0116] Optionally, the computer program stored in the processor 712 may be divided into one or more modules, which are stored in the memory 711 and executed by the processor 712 to complete the method provided in the embodiment. The one or more modules may be a series of computer program instruction segments capable of completing specific functions, and the computer program instruction segments are used to describe the execution process of the computer program in the electronic device 710.
[0117] Optionally, the processor 712 may be various general and / or special processing components with processing and computing capabilities. Some examples of the processor 712 include, but are not limited to, a central processing unit, a graphics processing unit, a digital signal processor, various special artificial intelligence computing chips, various processors running machine learning model algorithms, and may also be any appropriate controller, microcontroller, processor, etc. The processor 712 executes various methods and processes of this embodiment, illustratively, such as a particle system rendering method of an embodiment of the present application.
[0118] Optionally, the bus 715 may include a path for transmitting information. The bus 715 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. According to different functions, the bus 715 may be divided into an address bus, a data bus, a control bus, etc.
[0119] In an optional implementation, the embodiment of the present application further provides a computer storage medium on which a computer program is stored, and when the computer program is executed by a computer, the computer can perform the method of the above method embodiment. Part or all of the computer program can be loaded and / or installed on the memory 711 of the electronic device 710. When the computer program is executed by the processor 712, one or more steps of a particle system rendering method of the embodiment of the present application can be performed.
[0120] Optionally, the computer-readable storage medium may be a random access memory, a read-only memory, a programmable read-only memory, an erasable programmable read-only memory, an electrically erasable programmable read-only memory, or the like.
[0121] Obviously, the above embodiments of the present application are merely examples for clearly illustrating the technical solution of the present application, and are not intended to limit the specific implementation methods of the present application. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the claims of the present application shall be included in the protection scope of the claims of the present application.
Claims
1. A method for rendering a particle system, characterized in that: include: Classify the particle system to obtain classification results; Setting corresponding rendering instructions for each category of particle system according to the classification result; The rendering instructions are obtained through the GPU pipeline, and the particle systems of the corresponding categories are batch rendered according to the rendering instructions.
2. A particle system rendering method according to claim 1, characterized in that: The particle system is classified to obtain a classification result, including: The particle system is classified according to the type and / or rendering material of the particle system to obtain a classification result.
3. The method for rendering a particle system according to claim 1, characterized in that: According to the classification result, corresponding rendering instructions are set for each category of particle system, including: Determine the particle system category according to the classification result, and set corresponding rendering instructions for each particle system category; The corresponding index tag is set for each particle system, and the corresponding category tag is set for each particle system category, so that the rendering instruction determines the associated particle system category and particle system based on the category tag and the index tag.
4. A particle system rendering method according to any one of claims 1 to 3, characterized in that: The method further comprises: According to the number of the particle systems and the number of particle system instances, an emitter system buffer, a particle system instance buffer, a particle system emitter buffer, a particle system emitter indexer buffer, a particle instance index recycling pool buffer, a particle instance rendering batch index buffer, and a particle system module data buffer are set; When the pipeline of the GPU performs rendering processing on the corresponding particle system according to the rendering instruction, the data of the particle system is obtained from each of the buffers.
5. The particle system rendering method according to claim 1, characterized in that: The process of obtaining rendering instructions through the GPU pipeline and performing batch rendering processing on the corresponding particle system according to the rendering instructions includes: Initialize the particle instance of the particle system through the first pipeline of the GPU; The particle system to be emitted in the current frame is processed in parallel by the second pipeline of the GPU, and the particle system emission logic control is executed on the particle system to be emitted, so as to emit and generate particle instances; The particle instance rendering batch index buffer is input into the third pipeline of the GPU, parameters of the particle instance generated by emission are updated through the third pipeline of the GPU, and the particle system category corresponding to the particle instance generated by emission is determined, and the particle instance after parameter update is divided into blocks and stored in the particle instance rendering batch index buffer according to the corresponding particle system category; The GPU determines a corresponding rendering instruction according to the particle system category corresponding to each block, and performs batch rasterization rendering processing on the particle instances in the block according to the corresponding rendering instruction.
6. A particle system rendering method according to claim 5, characterized in that: The GPU determines a corresponding rendering instruction according to the particle system category corresponding to each block, and performs batch rasterization rendering processing on the particle instances in the block according to the corresponding rendering instruction, specifically performing the following operations by the GPU: Set the primitives and corresponding primitive information of the rendered particle instance; Create different rendering materials for each particle system category; Based on the created rendering material, batch render the particle instances in each block respectively; Calculate each vertex information of the particle instance in each block; For the particle instances after batch rendering, perform rasterization operations, per-fragment operations, and color blending operations based on the primitive information and each vertex information to obtain the final rendered particle instances; The final rendered particle instance is displayed.
7. A particle system rendering method according to claim 6, characterized in that: The method further comprises setting a block mark for each of the blocks: The batch rendering of the particle instances in each block based on the created rendering material includes: Find the position of the corresponding block in the particle instance rendering batch index buffer according to the block mark; Creating a buffer of indirect parameters according to the primitive information and the total number of particle instances of the current frame; Based on the created rendering material and the buffer of indirect parameters, batch rendering is performed on the particle instances in the corresponding blocks; The step of calculating each vertex information of a particle instance in each block includes: Taking the corresponding block as a starting point, finding all particle instances in the corresponding block; Determine the parameters of the particle instances in the particle instance buffer and the particle system buffer and the particle system parameters according to all the particle instances in the corresponding block; Calculate each vertex information of the particle instance in the corresponding block according to the parameters of the particle instance and the particle system parameters.
8. A particle system rendering method according to any one of claims 1 to 3, characterized in that: The method further comprises: The GPU is used to recycle particle instances whose life cycle has ended.
9. A particle system rendering device, characterized in that: The device comprises: A classification module is used to classify the particle system and obtain classification results; A setting module, used for setting corresponding rendering instructions for each category of particle system according to the classification result; The processing module obtains rendering instructions through the GPU pipeline and performs batch rendering processing on the corresponding particle system according to the rendering instructions.
10. An electronic device, characterized in that: include: a memory for storing one or more computer programs; A processor, when the one or more computer programs are executed by the processor, implements a particle system rendering method as described in any one of claims 1-8.
Citation Information
Cited By
WebGL-based particle effect implementation method, system and device and storage medium
CN120182445A
Particle management method and system in PIC / MCC simulation based on GPU architecture
CN121302838A
A particle management method and system in PIC / MCC simulation based on GPU architecture
CN121302838B