Particle animation generation method, apparatus, device and readable storage medium
By creating an initial model within the central processing unit and rendering and solving it using the graphics processor, the challenge of displaying a large number of particle effects animations on mobile devices is solved, achieving efficient rendering and hardware compatibility.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NETEASE (HANGZHOU) NETWORK CO LTD
- Filing Date
- 2024-12-30
- Publication Date
- 2026-06-02
AI Technical Summary
It is difficult to display a large number of particle effects animations on mobile devices. CPU particles consume a lot of performance, and GPU particles have strong hardware dependencies, which leads to frame rate drops and hardware incompatibility issues.
An initial model is created within the central processing unit. Based on the texture information and initial position information of the particle animation, an objective function is generated, and the particle animation is restored by rendering and solving using the graphics processor.
Display a large number of particle effects animations on mobile devices, be compatible with different hardware, reduce performance consumption, and achieve efficient rendering effects.
Smart Images

Figure CN119963695B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and specifically to a particle animation generation method, apparatus, device, and readable storage medium. Background Technology
[0002] In many scenarios, such as virtual game environments, a large number of particle effects animations are often needed to showcase the visuals. Currently, there are two main types of particle effects animations: CPU (Central Processing Unit) particles and GPU (Graphics Processing Unit) particles.
[0003] However, while CPU particles theoretically support an unlimited number of particles, they are highly performance-intensive. For example, on mobile devices, displaying two to three thousand particles simultaneously can cause a significant drop in frame rate and operational lag. GPU particles, on the other hand, can support displaying a large number of particle effects through optimization techniques such as particle batching, but they require engine and hardware support, and are prone to hardware incompatibility issues on mobile devices. In other words, achieving good performance in particle animation using current technologies often places certain demands on the hardware of mobile devices. Summary of the Invention
[0004] Therefore, it is necessary to provide a particle animation generation method, apparatus, device, and readable storage medium to address the aforementioned technical problems, thereby resolving the technical issue of difficulty in displaying a large number of particle special effects animations on mobile devices.
[0005] In a first aspect, this application provides a method for generating particle animation, including:
[0006] The particle animation to be displayed is determined, and the displacement information of each particle in the particle animation at each time moment is determined based on the texture information of the particle animation.
[0007] An initial model is created based on the initial position information of each particle in the particle animation, and a color value is generated for each vertex in the initial model; the vertices in the initial model correspond to the particles in the particle animation.
[0008] Based on the displacement information of the particles at each time point and the color value, a target function is generated to solve for each vertex in the initial model and generate the particle animation.
[0009] Secondly, this application provides a particle animation generation apparatus, comprising:
[0010] The processing module is used to determine the particle animation to be displayed, and to determine the displacement information of each particle in the particle animation at each time step based on the texture information of the particle animation.
[0011] A creation module is used to create an initial model based on the initial position information of each particle in the particle animation, and to generate a color value for each vertex in the initial model; the vertices in the initial model correspond to the particles in the particle animation.
[0012] The generation module is used to generate a target function based on the displacement information of the particles at each time point and the color value, so as to solve the particle animation by using the target function to solve each vertex in the initial model.
[0013] Thirdly, this application also provides a computer device, the computer device comprising:
[0014] One or more processors;
[0015] Memory; and
[0016] One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the particle animation generation method provided above.
[0017] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, the computer program being loaded by a processor to execute the particle animation generation method provided above.
[0018] Fifthly, embodiments of this application provide a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the particle animation generation method described above.
[0019] The particle animation generation method provided in this application determines the displacement information of each particle at each moment in the particle animation by using the texture information in the particle animation. Then, an initial model is created based on the initial position information of each particle in the particle animation, and a color value is generated for each vertex in the initial model. This constructs an objective function between the displacement information and color value of the particles at each moment. Since the graphics processor can render the attribute parameters in the model, the objective function can run in real time on the graphics processor to render and calculate each particle in the initial model, obtain the displacement information of each vertex at each moment, and thus restore the original particle animation for display. In this way, artists can create models with different particle effects within a fixed particle framework, and calculate and restore the corresponding particle effects in real time on the graphics processors of different terminal devices. Compared with CPU particles, it can meet the needs of displaying a large number of particle effects animations on mobile devices. Compared with GPU particles, it can also adapt well to the hardware of different mobile devices. Attached Figure Description
[0020] 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 this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 This is a flowchart illustrating the steps of a particle animation generation method provided in an embodiment of this application.
[0022] Figure 2 This is a schematic diagram of a step for generating a color value for each vertex, provided in an embodiment of this application.
[0023] Figure 3a A schematic flowchart illustrating another step in creating an initial model to record particle information, provided in an embodiment of this application;
[0024] Figure 3b This is a schematic diagram illustrating the effect of generating an initial model from vertices using facets, as provided in an embodiment of this application.
[0025] Figure 4 This is a schematic diagram of the structure of a particle animation generation device provided in an embodiment of this application;
[0026] Figure 5 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0027] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0028] In the description of this application, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the stated features. In the description of this application, "multiple" means two or more, unless otherwise explicitly specified.
[0029] In the description of this application, the word "for example" is used to mean "used as an example, illustration, or description." Any embodiment described as "for example" in this application is not necessarily to be construed as being more preferred or advantageous than other embodiments. The following description is provided to enable any person skilled in the art to make and use the invention. Details are set forth in the following description for purposes of explanation. It should be understood that those skilled in the art will recognize that the invention can be made without using these specific details. In other instances, well-known structures and processes will not be described in detail to avoid obscuring the description of the invention with unnecessary detail. Therefore, the invention is not intended to be limited to the embodiments shown, but is consistent with the broadest scope of the principles and features disclosed in this application.
[0030] To facilitate understanding of the particle animation generation method provided in this application, the relevant application scenarios of the particle animation generation method are first described. The particle animation generation method provided in this application is generally used to generate and display special effects animations composed of particles, such as particle special effects animations simulating drone flight performances, or special effects animations simulating dragon-shaped particles taking flight in games, etc. Currently, particles in particle special effects animations generally come in two forms. One is a particle system that is calculated and simulated within the central processing unit (CPU), where each particle is regarded as an independent computing unit, and its position, velocity, acceleration, and other attributes are calculated and updated by the CPU. However, this method has high performance requirements, especially on mobile devices, where displaying two to three thousand particles on the same screen can cause a significant drop in frame rate and operation delays. The other is a particle system that is calculated and simulated on the graphics processing unit (GPU). Since this particle system usually uses the computing power of the graphics rendering pipeline to accelerate the particle simulation and rendering process, that is, by utilizing the parallel computing power of the GPU to process a large number of particles simultaneously, more efficient particle simulation and rendering effects can be achieved. However, this method depends on engine and hardware support, and on mobile devices, hardware incompatibility issues are prone to occur, that is, particle incompatibility anomalies are likely to occur.
[0031] To address the aforementioned issues, this application provides a particle animation generation method, apparatus, device, and readable storage medium. By creating an initial model corresponding to the particle animation to be displayed within a central processing unit (CPU), and assigning corresponding attribute parameters to the initial model based on the particle animation, the initial model can be rendered and calculated in real time using the graphics processor (GPU) when subsequently configured on a mobile device. This allows the GPU to restore the parameters corresponding to the particle animation, thereby generating and displaying the corresponding particle animation. This satisfies the need to display a large number of particle effect animations on mobile devices. Furthermore, the ability of the GPU to render and process the model in real time to restore and display the particle effect animations also ensures good compatibility with the hardware of different mobile devices.
[0032] For details, please refer to Figure 1 , Figure 1 This application provides a schematic flowchart of a particle animation generation method, specifically including steps S110 to S130:
[0033] S110, determine the particle animation to be displayed, and determine the displacement information of each particle in the particle animation at each time based on the texture information of the particle animation.
[0034] In this embodiment of the application, particle animation can be understood as a collection of the movement trajectories of each particle. Different animation frames in the particle animation describe the position information of the particles at different times. Therefore, by parsing the texture information of the particle animation, the displacement information of each particle at each time can be obtained.
[0035] Specifically, there are many ways to determine the displacement information of particles at each moment by processing the texture information of particle animation. For example, as a common and feasible approach, texture sampling can be performed on the particle animation to obtain the displacement information of each particle relative to its initial position at each moment. Alternatively, as another feasible approach, in addition to texture sampling, Fast Fourier Transform (FFT) processing can be performed on each frame of the particle animation to achieve a procedural vertex effect on the image, thereby obtaining the displacement information of each particle at each moment in the particle animation. That is, in one embodiment provided in this application, determining the displacement information of each particle at each moment in the particle animation based on the texture information of the particle animation includes:
[0036] Texture sampling and / or fast Fourier transform are performed on the particle animation to determine multiple particles in the particle animation;
[0037] Based on the texture coordinates corresponding to the image frames of the particle at different times in the particle animation, the displacement information of the particle at each time moment is determined.
[0038] Of course, in addition to the methods provided above, it is also feasible to determine the displacement information of each particle at each moment in the particle animation through other methods. This application here obtains the displacement information of each particle at each moment by processing the particle animation, without any limitation.
[0039] Furthermore, the displacement information of each particle at each moment in particle animation can typically be composed of multiple different displacements of the particle in multiple orthogonal directions, depending on the type of particle animation. For example, in two-dimensional particle animation, the displacement information of the particle at each moment can include displacements in two orthogonal directions, namely, the displacement information can exist in the form of a two-dimensional vector. In contrast, in three-dimensional particle animation, the displacement information of the particle at each moment can be composed of displacements in three orthogonal directions, namely, the displacement information can exist in the form of a three-dimensional vector.
[0040] Of course, in addition to the displacement amounts in different directions provided above, as a further feasible implementation of this application, when different particles in the particle animation have corresponding attribute information at different times, such as different effect intensities, the displacement information can also contain a parameter for describing the effect intensity, such as Visual_Effect_Intensity, to control the actual performance of the particles.
[0041] Furthermore, it should be noted that since graphics processors can only process data of specific attributes and cannot process the displacement information of particles at each moment, in this embodiment of the application, in order for the graphics processor on the mobile device to further parse and recover the displacement information of particles at each moment, it is considered to associate the displacement information of particles at each moment with the data of specific attributes of the model, so that the corresponding particle animation can be generated and displayed by the graphics processor of the mobile terminal. The specific association strategy can be further referred to in the relevant description of the subsequent steps.
[0042] S120, create an initial model based on the initial position information of each particle in the particle animation, and generate a color value for each vertex in the initial model.
[0043] In this embodiment, we will first take the particles in the particle animation as particles with a preset size and fixed orientation, or consider not considering the size and orientation of the particles during the generation of the particle animation as an example. In this case, we can consider creating an initial model based on the initial position information of each particle in the particle animation. It can be understood that each vertex in the initial model can correspond one-to-one with each particle in the particle animation, that is, one vertex corresponds to one particle in the particle animation, and the relative position information of each vertex in the model corresponds to the initial position information of each particle in the particle animation. In this case, in order to facilitate the subsequent recording of the displacement information of each particle at different times, we can assign a certain color value to each vertex in the initial model to associate it with the displacement information at different times. Here, the color value, as one of the vertex attribute information of the model, can be used in the graphics processor to complete the rendering of the vertex. Therefore, by associating the color value with the position information, the graphics processor can then process the color value of the vertex to recover the displacement information of each particle. Taking the commonly used RGB (red-green-blue) three-channel color value as an example, since each channel has 256 possible values (0 to 255), each vertex has more than 16 million possible color values. Since each color value can correspond to a displacement information, it is possible to generate particle animation effects for more than 16 million particles, which far exceeds the needs of most particle animation effects.
[0044] Of course, it should be noted that since the displacement information of different particles in particle animation is usually different at different times, that is, they usually need to be associated with different color values, in order to avoid the graphics processor from recovering the same displacement information for the same color value during the rendering process, the technical solution provided in this application embodiment also provides a method based on the idea of hash algorithm to determine the color value of each vertex, thereby avoiding the abnormal situation where different vertices are assigned the same color value, which would prevent the graphics processor from recovering the corresponding displacement information of each particle at each time during the rendering process. For details, please refer to Figure 2 , Figure 2 This application provides a flowchart illustrating the steps for generating color values for each vertex, specifically including steps S210 to S220:
[0045] S210, perform a hash operation on the identification information of the particle corresponding to each vertex in the initial model to obtain the hash value of each vertex.
[0046] To avoid assigning the same color value to different vertices, this embodiment considers processing the particle identification information corresponding to each vertex in the initial model through hash operation to obtain the hash value of each vertex. Specifically, the particle identification information can be simply understood as the particle number. For example, in particle animation, it starts from 1 and increments sequentially to assign a corresponding number to each particle, such as particle number 1, particle number 2, etc. In this process, the number of each particle is processed by a preset hash algorithm, also known as a hashing algorithm, to generate a hash value with a length of 256 bits. This 256-bit hash value is the hash value of each vertex.
[0047] S220, determine the color value of each vertex based on the hash value.
[0048] After generating a 256-bit hash value randomly using the identification information of each particle, the color value of each vertex can be further determined based on the processing of this hash value. Since there are approximately 256×256×256 possible color values for each vertex, as a convenient and feasible implementation, the color value of each vertex can be determined by taking the remainder of the hash value, including the color values in the red, green, and blue color channels.
[0049] Of course, in addition to determining the color value of each vertex using hash values as mentioned above, it is also possible to directly correspond the color value of each vertex to the particle's number. For example, as a feasible implementation, the color value of the vertex corresponding to particle number 1 can be set to (0, 0, 0), the color value of the vertex corresponding to particle number 2 can be set to (0, 0, 1), the color value of the vertex corresponding to particle number 256 can be set to (0, 0, 255), and the color value of the vertex corresponding to particle number 257 can be set to (0, 1, 0). After setting the color value of the vertex corresponding to each particle in the above way, it can also be used to recover the displacement information of each particle at each time step using the color value.
[0050] Of course, it should be noted that the aforementioned embodiments are based on the assumption that the particles in the particle animation are of a preset size and have a fixed orientation, or that the size and orientation of the particles are not considered during the generation of the particle animation. In reality, in some scenarios, the particles in the particle animation can exist in the form of particles of different sizes and orientations. Therefore, if vertices in the model are used to describe the particles and the color values of the vertices are used to recover the displacement information of each particle, the unique size and orientation information of each particle will often be lost during the display of the particle animation. Therefore, in order to synchronously recover the particle size or orientation information in the particle animation during the rendering and recovery of the particle animation by the graphics processor, as another feasible embodiment of this application, it is considered to create an initial model that describes each particle in the particle animation using patches. That is, the model created in the embodiments of this application will include multiple patches, each of which is composed of multiple vertices in the initial model, used to jointly record the corresponding particle information in the particle animation. For details, please refer to Figure 3a , Figure 3a This application provides another flowchart illustrating the steps for creating an initial model to record particle information, specifically including steps S310 to S320:
[0051] S310, Generate a facet corresponding to each particle based on the initial position information of each particle in the particle animation to create an initial model.
[0052] Unlike the aforementioned method of recording particle information in particle animation through model vertices, the solution provided in this application uses facets within the model to record particle information. Specifically, facets corresponding to the particles are first generated based on their initial positions in the particle animation to create an initial model. For example, as a common and feasible implementation, the initial position information of the particles can be used as the center point of the facets, generating facets with fixed orientations. For instance, facets facing a fixed upward direction can be generated first. The specific shape of these facets can adopt commonly used facet shapes in models, such as triangular, square, or hexagonal facets. This application does not limit this; for ease of description, a square facet will be used as an example. For details, please refer to [link to relevant documentation]. Figure 3b , Figure 3b This is a schematic diagram illustrating the effect of generating an initial model from vertices using face patches, as provided in an embodiment of this application.
[0053] It can be seen that, Figure 3b In this process, each particle is compressed into a square facet that is fixed upwards, with the center of the facet being the center of the particle. Furthermore, the size of the facet can be adjusted according to actual needs. For example, to reduce the amount of data processing, the facet can be shrunk as much as possible. Ideally, the facet should collapse into a vertex. Of course, the actual effect can be set based on the effects supported by the engine or hardware. This application does not limit the form of the facet in this embodiment.
[0054] Of course, it should be noted that when a facet is composed of multiple vertices of the model, and multiple vertices of the same facet correspond to the same particles, in order to recover the displacement information of the particles at various times, the colors of multiple vertices on the same facet should be configured with the same color value. For example, the four vertices of a square facet should be configured with the same color value.
[0055] S320, the transformation parameters of the particles relative to the surface are used as the camera parameters of the surface, and the material parameters of the surface are set according to the camera parameters.
[0056] To record the size or orientation information of each particle in the particle animation in the attribute parameters of a surface, so that the size or orientation of each particle can be recovered from the surface's attribute parameters during the graphics processor's rendering process, this embodiment considers using the transformation parameters of the particles relative to the surface as the camera parameters of the surface, and sets the material parameters of the surface based on the camera parameters. Specifically, the transformation parameters of the particles relative to the surface typically include displacement parameters, rotation parameters, and scaling parameters. Of course, when the center of the particle is usually the center of the surface, the transformation parameters of the particles relative to the surface typically include rotation parameters and scaling parameters. Specifically, the rotation parameter can be understood as the rotation matrix between the particle's normal vector and the surface's normal vector, while the scaling parameter can be understood as the scaling ratio between the particle and the surface, used to further recover and restore the size of the particles.
[0057] Considering that the facets in a model are usually configured with corresponding camera parameters to describe the visual information observed on the facet, the camera parameters of the facet, corresponding to the transformation parameters of the particles relative to the facet, typically include displacement, rotation, and scaling parameters to determine the visual information observed on the facet from different orientations and distances. Therefore, it is possible to consider using the transformation parameters of the particles relative to the facet as the camera parameters of the facet, and simultaneously setting the material parameters of the facet based on the camera parameters. This allows the graphics processor to calculate the material parameters of the facet during the rendering process of the model, thereby recovering the transformation parameters of the particles relative to the facet. These transformation parameters can then be used to redefine the particle's performance in the particle animation, such as particle size or particle orientation.
[0058] Of course, to further optimize the rendering effect of particle animation, other attribute information of particles in the particle animation, such as color and transparency, can also be considered in this embodiment. After using the transformation parameters of the particles as the camera parameters of the surface, the color information and transparency information of the particles can also be used as the material parameters of the surface. In this way, during the graphics processor rendering process, in addition to recovering the size and orientation information of the particles, the color and transparency information of the particles can also be recovered according to the material parameters of the surface, thereby making the rendered particle animation richer and more realistic.
[0059] Specifically, the color information of particles can be converted into the diffuse color parameters of the surface material, while the transparency information of particles can be converted into the transparency parameters of the material. In this way, when the graphics processor renders based on the surface material parameters, it can not only restore the geometric information of the particles, but also restore the visual effect of the particles, making the final rendered particle animation visually closer to the particle effects in the real world.
[0060] Furthermore, the embodiments of this application also consider the dynamic change characteristics of particles in particle animation. For example, dynamic attributes such as particle lifecycle, velocity, and acceleration can also be recorded and converted into material parameters of the surface. By solving these dynamic attributes in the graphics processor, dynamic change effects of particles in particle animation can be realized, such as particle fade-in and fade-out, accelerated motion, etc., thereby making particle animation more vivid and expressive.
[0061] Furthermore, it should be noted that the process of creating the initial model provided in this application embodiment is usually executed on a first terminal, which typically runs software that supports Digital Content Creation (DCC), such as 3DS, MAYA, etc. The first terminal can be a computer or a mobile device, such as a mobile phone, tablet, etc. This application embodiment does not limit the type of device of the first terminal for creating the initial model. All terminal devices that support model creation are required to be within the scope of protection claimed in this application.
[0062] S130, a target function is generated based on the displacement information of the particle at each time step and the color value, and the target function is used to solve for each vertex in the initial model to obtain the displacement information of each vertex at each time step, thereby generating the particle animation.
[0063] In this embodiment, to recover the displacement information of particles at each time step from the color values of vertices or faces, as a further feasible implementation, a target function is generated based on the displacement information and color values of the particles at each time step. The target function describes the mapping relationship between the displacement information and color values of the particles at each time step. Subsequently, during model processing, the colors of vertices in the model can be processed according to this target function to obtain the displacement information of the corresponding vertices at each time step. Based on this displacement information, the corresponding particle animation is further rendered. Model processing is typically performed by a graphics processing unit (GPU). This GPU can be the GPU of a first terminal, used to recreate particle animations based on models created in DCC software. Alternatively, it can be the GPU of a second terminal (different from the first terminal), such as other mobile terminals, to recreate particle animations. Compared to creating GPU particles with specific data formats to generate particle animations, this method is well-suited to the hardware of different mobile devices, without requiring these devices to have the ability to process specific data formats. It only relies on the graphics processing capabilities of the GPU, thus facilitating cross-platform particle animation restoration.
[0064] Specifically, the aforementioned method of generating the objective function can be understood as follows: using color value and time as independent variables, and particle displacement information at the corresponding time as the dependent variable, a pre-defined polynomial function is fitted, such as through difference fitting, to determine the coefficients of each term in the polynomial function, thus obtaining the objective function. The objective function can be understood as Z = f(x, y), where x is the color value, y is the time, and Z represents the particle displacement information at the corresponding time. It should be noted that when the particle displacement information includes displacement in multiple directions or parameters such as particle effect intensity, the corresponding objective function can be generated based on each displacement value, or the functional relationship between the particle displacement information at the corresponding time and the color value and time can be described in the form of a matrix polynomial.
[0065] It should be noted that, in the process of fitting the objective function using the displacement information of each particle as described above, in order to further reduce the amount of computation, as a further feasible implementation scheme of this application, after obtaining the displacement information of the particle at each time moment, the displacement information of the particle at each time moment can be further normalized based on the maximum displacement value of the particle at each time moment. Thus, the normalized displacement information of the particle at each time moment, that is, the offset coefficient between [-1,1], is used to describe the relative offset of the particle at each time moment, so as to fit the polynomial function and obtain the objective function. Thus, when the graphics processor solves the model, after obtaining the offset coefficient of the particle in each direction, it can further determine the displacement in each direction by combining the maximum displacement value, thereby adding the displacement to the initial position of the particle to obtain the position information of the particle at the corresponding time moment, so as to generate the corresponding particle animation.
[0066] Specifically, to further improve the speed of calculating particle animation effects, the technical solution provided in this application embodiment can also bake the created initial model to save the attribute parameter information of each vertex or face in the texture map. Then, during the subsequent rendering of the texture map by the graphics processor, the objective function can be used to calculate the initial model, thereby recovering parameters such as the displacement information of particles at various times, particle size, or facing direction, to generate the corresponding particle animation. Specifically, the particle animation generation method provided in this application includes:
[0067] The initial model is baked to obtain a texture map of the initial model;
[0068] The texture map is rendered using a graphics processor, and the initial model is solved using an objective function to generate particle animation.
[0069] The aforementioned method allows artists to create particle animations of the same magnitude as GPU particles within a fixed particle framework. Compared to using GPU particles, the method provided in this application recovers the original particle animation information during the rendering and calculation of the model by the graphics processor, thereby generating corresponding particle display effects. This method can adapt to any graphics processor architecture and is effectively compatible with different terminal devices.
[0070] To clearly understand the particle animation generation method provided in the embodiments of this application, the following will, in conjunction with the relevant content provided in the foregoing drawings, provide an implementation process for creating an initial model to generate specified particle animation effects on a graphics processor, specifically including the following steps:
[0071] (1) Based on the particle animation to be generated, create the initial model of the particle animation in DCC (Digital Content Creation) software, such as 3DS MAX, Maya, Houdini, etc., which can be understood as recording the zero frame position of the particle as the initial position of the particle and creating the initial model.
[0072] (2) By transforming the particles in the model, the particles can be converted into squares or other arbitrary shapes. Taking a square shape as an example, the effect after transformation can be seen in [reference needed]. Figure 3b At the same time, the area of the face should be reduced as much as possible, such as reducing the face to 0.00001 times, and ideally to 0 times, that is, the face should be collapsed into four overlapping vertices, and the Euler rotation angle of the face should be adjusted to 0, that is, the face should face upward by default.
[0073] (3) Set the corresponding color value for each vertex of each face, including the RGB three color channel values. It is required that the vertex color schemes of different faces are different. Therefore, the color value of each face vertex can be determined based on the idea of hash algorithm. This color value can be regarded as a unique seed for subsequent restoration of particle animation effects.
[0074] (4) If the particles have attributes such as size and orientation, the change parameters of the particles relative to the surface, such as displacement parameters, rotation parameters and scaling parameters, usually including rotation parameters and scaling parameters, can be configured as the camera parameters of the surface to determine the material parameters of the surface. Thus, during the rendering process of the surface using the camera parameters by the image processor, the surface can be changed through the camera parameters to restore the corresponding particle performance effect, such as particle size or particle orientation, etc.
[0075] (5) If the particle animation is a dynamic animation effect, the displacement information of the particle at each time moment can be obtained by performing texture sampling or fast Fourier transform on each frame image in the particle animation. Then, using the displacement information of the particle at each time moment and the color value of the vertex of the corresponding face of the particle, a polynomial function describing the displacement information and color value and time moment can be constructed through the idea of function fitting. This polynomial can be stored and recorded so that the displacement information of the particle at each time moment can be calculated in real time by rendering the model in the graphics processor, thereby generating the corresponding particle animation.
[0076] (6) After the aforementioned processing is completed, the created model can be ported to any mobile device with a graphics processor. The mobile device can use the recorded polynomial function and other camera parameter information to render and solve the model, obtain the attributes of each particle, such as size, orientation, and the position offset of the particle relative to the initial position at each moment, and thus adjust the appearance of the particles accordingly to generate the corresponding particle animation effect.
[0077] The particle animation generation method provided in this application process the particle animation to be displayed to obtain the displacement information of each particle at each moment. Then, an initial model is created based on the initial position information of each particle in the animation, and a color value is generated for each vertex in the initial model. This constructs an objective function relating the displacement information and color value of the particles at each moment. Since the graphics processing unit (GPU) can render the attribute parameters in the model, this objective function can run in real-time on the GPU to render and calculate each particle in the initial model, obtaining the displacement information of each vertex at each moment, thereby restoring the original particle animation for display. Through this method, artists can create models with different particle effects within a fixed particle framework, and then calculate and restore the corresponding particle effects in real-time on the GPUs of different terminal devices. Compared to CPU particles, this method can meet the need to display a large number of particle effects animations on mobile devices; compared to GPU particles, it can also adapt well to the hardware of different mobile devices.
[0078] To better implement the particle animation generation method provided in the embodiments of this application, based on the particle animation generation method provided in the embodiments of this application, this application also provides a particle animation generation device, such as... Figure 4 As shown, the particle animation generation device 400 includes:
[0079] The processing module 410 is used to determine the particle animation to be displayed, and to determine the displacement information of each particle in the particle animation at each time based on the texture information of the particle animation.
[0080] The creation module 420 creates an initial model based on the initial position information of each particle in the particle animation, and generates a color value for each vertex in the initial model; the vertices in the initial model correspond to the particles in the particle animation.
[0081] The generation module 430 generates a target function based on the displacement information of the particles at each time point and the color value, and then uses the target function to solve for each vertex in the initial model to generate the particle animation.
[0082] In some embodiments of this application, the processing module 410 is further configured to perform texture sampling and / or fast Fourier transform on the particle animation to determine multiple particles in the particle animation;
[0083] Based on the texture coordinates corresponding to the image frames of the particle at different times in the particle animation, the displacement information of the particle at each time moment is determined.
[0084] In some embodiments of this application, the creation module 420 is further configured to perform a hash operation on the identification information of the particle corresponding to each vertex in the initial model to obtain the hash value of each vertex;
[0085] The color value of each vertex is determined based on the hash value.
[0086] In some embodiments of this application, the generation module 430 is further configured to process the color values of each vertex in the initial model according to the objective function to obtain the offset of the vertex at different times; and generate the particle animation based on the offset.
[0087] In some embodiments of this application, the generation module 430 is further configured to fit a preset polynomial function with the color value and time as independent variables and the displacement information of the particle at the time as dependent variables to obtain a target function, wherein the target function is used to indicate the functional relationship between the displacement information and the time and the color value.
[0088] In some embodiments of this application, the generation module 430 is further configured to normalize the displacement information of the particle at each time step according to the maximum displacement value of the particle at each time step, so as to obtain the normalized displacement information of the particle at each time step; and to fit a preset polynomial function based on the normalized displacement information to obtain the target function.
[0089] In some embodiments of this application, the creation module 420 is further configured to generate a facet corresponding to each particle based on the initial position information of each particle in the particle animation, so as to create an initial model, wherein each facet corresponding to each particle includes multiple vertices in the initial model;
[0090] The transformation parameters of the particles relative to the surface are used as the camera parameters of the surface, and the material parameters of the surface are set according to the camera parameters;
[0091] Based on the material parameters of the facets in the initial model, the position information of each facet in the initial model is transformed to obtain the initial position information of each particle in the particle animation.
[0092] In some embodiments of this application, the generation module 430 is further configured to solve the initial model by a graphics processor to render and generate particle animation.
[0093] Specific limitations regarding the particle animation generation device can be found in the limitations of the particle animation generation method described above, and will not be repeated here. Each module in the aforementioned particle animation generation device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0094] This application embodiment processes the particle animation to be displayed to obtain the displacement information of each particle at each moment in the particle animation. Then, based on the initial position information of each particle in the particle animation, an initial model is created, and a color value is generated for each vertex in the initial model. This constructs an objective function relating the displacement information and color value of the particles at each moment. Since the graphics processor can render the attribute parameters in the model, this objective function can run in real time on the graphics processor to render and calculate each particle in the initial model, obtaining the displacement information of each vertex at each moment, thereby restoring the original particle animation for display. In this way, artists can create models corresponding to different particle effects within a fixed particle framework, and calculate and restore the corresponding particle effects in real time on the graphics processors of different terminal devices. Compared to CPU particles, this can meet the needs of displaying a large number of particle effect animations on mobile devices. Compared to GPU particles, it can also adapt well to the hardware of different mobile devices.
[0095] In some embodiments of this application, the particle animation generation device 400 can be implemented as a computer program, which can be implemented in, for example... Figure 5The computer device shown operates on this device. The computer device's memory can store the various program modules that make up the particle animation generation apparatus 400, for example, Figure 4 The processing module 410, creation module 420, and generation module 430 are shown. The computer program, consisting of these modules, causes the processor to execute the steps in the particle animation generation methods of the various embodiments of this application described in this specification.
[0096] For example, Figure 5 The computer device shown can be used as follows Figure 4 The processing module 410 in the particle animation generation apparatus 400 shown executes step S110. The computer device can execute step S120 via the creation module 420. The computer device can execute step S130 via the generation module 430. The computer device includes a processor, memory, and a network interface connected via a system bus. The processor of the computer device provides computational and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used for communication with external computer devices via a network connection. When the computer program is executed by the processor, it implements a particle animation generation method.
[0097] Those skilled in the art will understand that Figure 5 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0098] In some embodiments of this application, a computer device is provided, including one or more processors; memory; and one or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the processor to perform the following steps:
[0099] The particle animation to be displayed is determined, and the displacement information of each particle in the particle animation at each time moment is determined based on the texture information of the particle animation.
[0100] An initial model is created based on the initial position information of each particle in the particle animation, and a color value is generated for each vertex in the initial model; the vertices in the initial model correspond to the particles in the particle animation.
[0101] Based on the displacement information of the particles at each time point and the color value, a target function is generated to solve for each vertex in the initial model and generate the particle animation.
[0102] In some embodiments of this application, the processor further performs the following steps when executing the computer program:
[0103] Texture sampling and / or fast Fourier transform are performed on the particle animation to determine multiple particles in the particle animation;
[0104] Based on the texture coordinates corresponding to the image frames of the particle at different times in the particle animation, the displacement information of the particle at each time moment is determined.
[0105] In some embodiments of this application, when the processor executes the computer program, it further implements the following steps: performing a hash operation on the identification information of the particle corresponding to each vertex in the initial model to obtain the hash value of each vertex;
[0106] The color value of each vertex is determined based on the hash value.
[0107] In some embodiments of this application, when the processor executes the computer program, it further performs the following steps: processing the color values of each vertex in the initial model according to the objective function to obtain the offset of the vertex at different times; and generating the particle animation based on the offset.
[0108] In some embodiments of this application, when the processor executes the computer program, it further implements the following steps: using the color value and time as independent variables, and using the displacement information of the particle at the time as the dependent variable, fitting a preset polynomial function to obtain a target function, wherein the target function is used to indicate the functional relationship between the displacement information and the time and the color value.
[0109] In some embodiments of this application, when the processor executes the computer program, it further performs the following steps: normalizing the displacement information of the particle at each time step according to the maximum displacement value of the particle at each time step to obtain the normalized displacement information of the particle at each time step; and fitting a preset polynomial function based on the normalized displacement information to obtain the target function.
[0110] In some embodiments of this application, when the processor executes the computer program, it further implements the following steps: generating a facet corresponding to each particle based on the initial position information of each particle in the particle animation to create an initial model, wherein each facet corresponding to each particle includes multiple vertices in the initial model;
[0111] The transformation parameters of the particles relative to the surface are used as the camera parameters of the surface, and the material parameters of the surface are set according to the camera parameters;
[0112] Based on the material parameters of the facets in the initial model, the position information of each facet in the initial model is transformed to obtain the initial position information of each particle in the particle animation.
[0113] In some embodiments of this application, when the processor executes the computer program, it also performs the following steps: solving the initial model using a graphics processor to render and generate particle animation.
[0114] In some embodiments of this application, a computer-readable storage medium is provided, storing a computer program that is loaded by a processor, causing the processor to perform the following steps:
[0115] The particle animation to be displayed is determined, and the displacement information of each particle in the particle animation at each time moment is determined based on the texture information of the particle animation.
[0116] An initial model is created based on the initial position information of each particle in the particle animation, and a color value is generated for each vertex in the initial model; the vertices in the initial model correspond to the particles in the particle animation.
[0117] Based on the displacement information of the particles at each time point and the color value, a target function is generated to solve for each vertex in the initial model and generate the particle animation.
[0118] In some embodiments of this application, when the processor executes the computer program, it further performs the following steps: performing texture sampling and / or fast Fourier transform on the particle animation to determine multiple particles in the particle animation; and determining the displacement information of the particles at each moment in the particle animation based on the texture coordinates corresponding to the image frames of the particles at different times in the particle animation.
[0119] In some embodiments of this application, when the processor executes the computer program, it further implements the following steps: performing a hash operation on the identification information of the particle corresponding to each vertex in the initial model to obtain the hash value of each vertex;
[0120] The color value of each vertex is determined based on the hash value.
[0121] In some embodiments of this application, when the processor executes the computer program, it further implements the following steps: processing the color values of each vertex in the initial model according to the objective function to obtain the offset of the vertex at different times;
[0122] The particle animation is generated based on the offset.
[0123] In some embodiments of this application, when the processor executes the computer program, it further implements the following steps: using the color value and time as independent variables, and using the displacement information of the particle at the time as the dependent variable, fitting a preset polynomial function to obtain a target function, wherein the target function is used to indicate the functional relationship between the displacement information and the time and the color value.
[0124] In some embodiments of this application, when the processor executes the computer program, it further performs the following steps: normalizing the displacement information of the particle at each time step according to the maximum displacement value of the particle at each time step to obtain the normalized position information of the particle at each time step; and fitting a preset polynomial function based on the normalized displacement information to obtain the target function.
[0125] In some embodiments of this application, when the processor executes the computer program, it further implements the following steps: generating a facet corresponding to each particle based on the initial position information of each particle in the particle animation to create an initial model, wherein each facet corresponding to each particle includes multiple vertices in the initial model;
[0126] The transformation parameters of the particles relative to the surface are used as the camera parameters of the surface, and the material parameters of the surface are set according to the camera parameters;
[0127] Based on the material parameters of the facets in the initial model, the position information of each facet in the initial model is transformed to obtain the initial position information of each particle in the particle animation.
[0128] In some embodiments of this application, when the processor executes the computer program, it also performs the following steps: solving the initial model using a graphics processor to render and generate particle animation.
[0129] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical storage, etc. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.
[0130] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0131] The above provides a detailed description of a particle animation generation method, apparatus, computer device, and storage medium provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for generating particle animation, characterized in that, include: The particle animation to be displayed is determined, and the displacement information of each particle in the particle animation at each time moment is determined based on the texture information of the particle animation. An initial model is created based on the initial position information of each particle in the particle animation, and a color value is generated for each vertex in the initial model; the vertices in the initial model correspond to the particles in the particle animation. A target function is generated based on the displacement information of the particles at each time point and the color value, and the particle animation is generated by solving each vertex in the initial model through the target function. The step of creating an initial model based on the initial position information of each particle in the particle animation includes: Based on the initial position information of each particle in the particle animation, generate a facet corresponding to the particle to create an initial model, wherein each facet corresponding to the particle includes multiple vertices in the initial model; The transformation parameters of the particles relative to the surface are used as the camera parameters of the surface, and the material parameters of the surface are set according to the camera parameters; The step of solving the initial model using the objective function includes: Based on the material parameters of the facets in the initial model, the position information of each facet in the initial model is transformed to obtain the initial position information of each particle in the particle animation.
2. The method according to claim 1, characterized in that, The determination of the displacement information of each particle in the particle animation at each time step based on the texture information of the particle animation includes: Texture sampling and / or fast Fourier transform are performed on the particle animation to determine multiple particles in the particle animation; Based on the texture coordinates corresponding to the image frames of the particle at different times in the particle animation, the displacement information of the particle at each time moment is determined.
3. The method according to claim 2, characterized in that, The displacement information of the particle at each moment includes the displacement of the particle in multiple orthogonal directions.
4. The method according to claim 1, characterized in that, The step of solving the objective function for each vertex in the initial model to generate the particle animation includes: The color values of each vertex in the initial model are processed according to the objective function to obtain the offset of the vertex at different times; The particle animation is generated based on the offset.
5. The method according to claim 1, characterized in that, The step of generating the objective function based on the displacement information of the particle at each time moment and the color value includes: Using the color value and time as independent variables, and the displacement information of the particle at the time as the dependent variable, a preset polynomial function is fitted to obtain a target function. The target function is used to indicate the functional relationship between the displacement information, the time, and the color value.
6. The method according to claim 5, characterized in that, The method further includes: Based on the maximum displacement value of the particle at each time moment, the displacement information of the particle at each time moment is normalized to obtain the normalized displacement information of the particle at each time moment; and The target function is obtained by fitting a preset polynomial function based on the normalized displacement information.
7. The method according to claim 6, characterized in that, The transformation parameters of the particle relative to the surface include displacement parameters, rotation parameters, and scaling parameters.
8. The method according to any one of claims 1 to 7, characterized in that, The step of solving the initial model using the objective function includes: The initial model is solved using a graphics processor to render and generate particle animation.
9. A particle animation generation device, characterized in that, include: The processing module is used to determine the particle animation to be displayed, and to determine the displacement information of each particle in the particle animation at each time step based on the texture information of the particle animation. A creation module is used to create an initial model based on the initial position information of each particle in the particle animation, and to generate a color value for each vertex in the initial model; the vertices in the initial model correspond to the particles in the particle animation. The generation module is used to generate a target function based on the displacement information of the particles at each time and the color value, so as to solve each vertex in the initial model through the target function and generate the particle animation; The step of creating an initial model based on the initial position information of each particle in the particle animation includes: Based on the initial position information of each particle in the particle animation, generate a facet corresponding to the particle to create an initial model, wherein each facet corresponding to the particle includes multiple vertices in the initial model; The transformation parameters of the particles relative to the surface are used as the camera parameters of the surface, and the material parameters of the surface are set according to the camera parameters; The step of solving the initial model using the objective function includes: Based on the material parameters of the facets in the initial model, the position information of each facet in the initial model is transformed to obtain the initial position information of each particle in the particle animation.
10. A computer device, characterized in that, The computer device includes: One or more processors; Memory; and One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the particle animation generation method of any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that, It stores a computer program, which is loaded by a processor to execute the particle animation generation method according to any one of claims 1 to 8.