Particle animation generation method, device and equipment and readable storage medium
By creating an initial model within the central processor and leveraging the rendering capabilities of the graphics processor, the problem of difficulty in displaying a large number of particle special effects animations on mobile devices is solved, and efficient particle animation display and hardware adaptation are achieved.
Patent Information
- Application Number
- CN202411977807.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-05-09
- Estimated Expiration
- 2044-12-30
AI Technical Summary
The prior art is difficult to display a large number of particle effects animations on mobile devices, especially due to high performance consumption and hardware support issues.
By creating an initial model corresponding to the particle animation to be displayed in the central processor, and assigning attribute parameters to the initial model based on the particle animation, the rendering ability of the graphics processor is used to solve and restore particle animation in real time.
It realizes the ability to efficiently display a large number of particle special effects animations on mobile devices, adapts to the hardware of different mobile devices, and improves operating performance.
Smart Images

Figure CN119963695A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a particle animation generation method, device, equipment and readable storage medium. Background Art
[0002] In many scenarios, such as virtual game scenes, a large number of particle special effects animations are often needed to display the effects. At present, there are two main forms of particle special effects animations, one is CPU (Central Processing Unit) particles, and the other is GPU (graphics processing unit) particles.
[0003] However, although CPU particles theoretically support an unlimited number of particles, they have high requirements for performance consumption. For example, on mobile devices, displaying 2,000 to 3,000 particles on the same screen will cause a significant drop in frame rate and operation delays. Although GPU particles can support the display of a large number of particle effects through optimization technologies such as particle batching, they require engine and hardware support, and are prone to hardware support problems on mobile devices. In other words, in order to achieve better performance effects in particle animation in the prior art, there are often certain requirements for the hardware of mobile devices. Summary of the invention
[0004] Based on this, it is necessary to provide a particle animation generation method, device, equipment and readable storage medium to address the above technical problems, so as to solve the technical problem in the related art that it is difficult to display a large number of particle special effects animations on mobile devices.
[0005] In a first aspect, the present application provides a particle animation generation method, comprising:
[0006] Determine a particle animation to be displayed, and determine displacement information corresponding to each particle in the particle animation at each moment based on texture information of the particle animation;
[0007] Creating an initial model according to initial position information of each particle in the particle animation, and generating a color value for each vertex in the initial model; the vertices in the initial model correspond to the particles in the particle animation;
[0008] An objective function is generated according to the displacement information corresponding to the particle at each moment and the color value, so as to solve each vertex in the initial model through the objective function to generate the particle animation.
[0009] In a second aspect, the present application provides a particle animation generating device, comprising:
[0010] A processing module, used to determine a particle animation to be displayed, and determine displacement information corresponding to each particle in the particle animation at each moment based on texture information of the particle animation;
[0011] A creation module, used to create an initial model according to the initial position information of each particle in the particle animation, and 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] A generation module is used to generate an objective function according to the displacement information corresponding to the particle at each moment and the color value, so as to solve each vertex in the initial model through the objective function to generate the particle animation.
[0013] In a third aspect, the present application further provides a computer device, the computer device comprising:
[0014] one or more processors;
[0015] Memory; and
[0016] One or more application programs, wherein the one or more application programs are stored in the memory and are configured to be executed by the processor to implement the particle animation generation method provided above.
[0017] In a fourth aspect, the present application also provides a computer-readable storage medium on which a computer program is stored, and the computer program is loaded by a processor to execute the particle animation generation method provided above.
[0018] In a fifth aspect, an embodiment of the present application provides a computer program product or a computer program, the computer program product or the computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the particle animation generation method provided above.
[0019] The particle animation generation method provided in the embodiment of the present application determines the displacement information corresponding to each particle in the particle animation at each moment through the texture information in the particle animation, and then 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, thereby constructing an objective function between the displacement information corresponding to the particle at each moment and the color value. Since the graphics processor can render the attribute parameters in the model, the objective function can be run in real time in the graphics processor to render and solve each particle in the initial model, and obtain the displacement information corresponding to each vertex at each moment, thereby restoring the original particle animation and displaying it. In the above manner, art production personnel can create models corresponding to different particle performance effects under a fixed particle framework, so as to solve and restore the corresponding particle performance effects in real time in the graphics processor of different terminal devices. Compared with CPU particles, it can meet the needs of displaying a large number of particle special effects animations on mobile devices, and compared with GPU particles, it can also be well adapted to the hardware of different mobile devices. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] 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 those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0021] Figure 1 A schematic diagram of the steps of a particle animation generation method provided in an embodiment of the present application;
[0022] Figure 2 A schematic diagram of a process flow for generating a color value for each vertex provided in an embodiment of the present application;
[0023] Figure 3a A schematic diagram of another step flow of creating an initial model to record particle information provided in an embodiment of the present application;
[0024] Figure 3b A schematic diagram of the effect of generating facets from vertices to obtain an initial model provided in an embodiment of the present application;
[0025] Figure 4 A schematic diagram of the structure of a particle animation generating device provided in an embodiment of the present application;
[0026] Figure 5 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0027] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions 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 those skilled in the art without creative work 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 understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this application, "plurality" means two or more, unless otherwise clearly and specifically defined.
[0029] In the description of the present application, the word "for example" is used to mean "used as an example, illustration or explanation". Any embodiment described as "for example" in the present application is not necessarily to be construed as being more preferred or advantageous than other embodiments. The following description is given to enable any technician in the field to implement and use the present invention. In the following description, details are listed for the purpose of explanation. It should be understood that a person of ordinary skill in the art can recognize that the present invention can be implemented without using these specific details. In other examples, well-known structures and processes will not be elaborated in detail to avoid obscuring the description of the present invention with unnecessary details. Therefore, the present invention is not intended to be limited to the embodiments shown, but is consistent with the widest scope consistent with the principles and features disclosed in the present application.
[0030] To facilitate understanding of the particle animation generation method provided in the embodiment of the present application, the relevant application scenarios of the particle animation generation method are first described. The particle animation generation method provided in the present 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 off in games, etc. At present, particles in particle special effects animations usually have two forms, one is a particle system that is calculated and simulated in a central processing unit, each particle is regarded as an independent calculation unit, and its position, speed, acceleration and other properties are calculated and updated by the central processing unit, but this method has high requirements for performance consumption, especially on mobile devices, displaying two thousand to three thousand particles on the same screen will cause a significant drop in frame rate, operation delays and other problems. The other is a particle system that is calculated and simulated on a graphics processor, because the particle system usually uses the computing power of the graphics rendering pipeline to accelerate the simulation and rendering process of particles, that is, by utilizing the parallel computing power of the graphics processor to process a large number of particles at the same time, so as to achieve more efficient particle simulation and rendering effects. However, this method depends on the engine and hardware support, and is prone to hardware unsupported problems on mobile devices, that is, it is prone to particle incompatibility anomalies.
[0031] Precisely to solve the above-mentioned problems, the present application provides a particle animation generation method, apparatus, device and readable storage medium, which creates an initial model corresponding to the particle animation to be displayed in a central processing unit, and assigns corresponding attribute parameters to the initial model based on the particle animation. When it is subsequently configured on a mobile device, the rendering capability of the graphics processor can be utilized to render and solve the initial model in real time, and restore the parameters corresponding to the particle animation, thereby generating and displaying the corresponding particle animation, which meets the demand for displaying a large number of particle special effects animations on mobile devices. At the same time, based on the graphics processor's ability to render and process the model in real time to restore and display the particle special effects animation, it can also be better compatible with the hardware of different mobile devices.
[0032] For details, please refer to Figure 1 , Figure 1 A schematic flow chart of a particle animation generation method provided in an embodiment of the present application, specifically, comprising steps S110 to S130:
[0033] S110, determining a particle animation to be displayed, and determining displacement information corresponding to each particle in the particle animation at each time based on texture information of the particle animation.
[0034] In the embodiment of the present application, particle animation can be understood as a collection of movement trajectories of each particle, wherein different animation frames in the particle animation respectively describe the position information of the particle at different moments. Therefore, by parsing the texture information of the particle animation, the displacement information of each particle in the particle animation at each moment can be obtained.
[0035] Specifically, there are many implementation schemes for determining the displacement information corresponding to the particles at each moment by processing the texture information of the particle animation. For example, as a common feasible implementation scheme, the displacement information of each particle relative to the initial position at each moment can be obtained by performing texture sampling on the particle animation. Alternatively, as another feasible implementation scheme, in addition to texture sampling, the programmed vertex effect of the image can be achieved by performing Fast Fourier Transform (FFT) processing on each frame image of the particle animation, thereby obtaining the displacement information corresponding to each particle in the particle animation at each moment. That is to say, in one embodiment provided in the present application, the displacement information corresponding to each particle in the particle animation at each moment is determined based on the texture information of the particle animation, including:
[0036] Performing texture sampling and / or fast Fourier transform on the particle animation to determine a plurality of particles in the particle animation;
[0037] According to the texture coordinates corresponding to the image frames of the particles at different moments in the particle animation, the displacement information corresponding to the particles at each moment in the particle animation is determined.
[0038] Of course, in addition to the methods provided above, it is also feasible to determine the displacement information corresponding to each particle in the particle animation at each moment by other methods. The present application here obtains the implementation scheme of the displacement information corresponding to each particle at each moment by processing the particle animation, without limitation.
[0039] Furthermore, the displacement information corresponding to each particle at each moment in the particle animation may generally be composed of a plurality of different displacements of the particle in a plurality of orthogonal directions, depending on the type of particle animation. For example, taking a two-dimensional particle animation as an example, the displacement information corresponding to the particle at each moment may include the displacement in the two orthogonal directions of the horizontal and vertical directions, that is, the displacement information may exist in the form of a two-dimensional vector, while for a three-dimensional particle animation, the displacement information corresponding to the particle at each moment may include the displacement in the three orthogonal directions of the horizontal, vertical and vertical directions, that is, the displacement information may 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 scheme of the present application, when different particles in the particle animation have corresponding attribute information at different times, such as different effect intensities, the displacement information may also contain a parameter for describing the effect intensity, such as Visual_Effect_Intensity, to control the actual performance of the particles.
[0041] In addition, it should be noted that since the graphics processor can only be used to process data of specific attributes and cannot complete the processing of the displacement information corresponding to the particles at each moment, in the embodiment of the present application, in order to enable the graphics processor on the mobile device to further parse and recover the displacement information corresponding to the particles at each moment, it will be considered to associate the displacement information corresponding to the particles at each moment with the data of the specific attributes of the model, so that the corresponding particle animation can be rendered and displayed through the graphics processor of the mobile terminal. The specific association strategy can be further referred to the relevant instructions of the subsequent steps.
[0042] S120: creating an initial model according to the initial position information of each particle in the particle animation, and generating a color value for each vertex in the initial model.
[0043] In an embodiment of the present application, the particles in the particle animation are first taken as particles of preset size and fixed orientation, or the size and orientation of the particles are not considered in the process of generating the particle animation. At this time, it can be considered to create an initial model with the initial position information of each particle in the particle animation. It can be understood that at this time, each vertex in the initial model can correspond one-to-one to 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. At this time, in order to facilitate the subsequent further recording of the displacement information corresponding to each particle at different times, a certain color value can be assigned to each vertex in the initial model to associate it with the displacement information corresponding to different times. Among them, the color value here can be used in the graphics processor to complete the rendering of the vertex as one of the vertex attribute information of the model. Therefore, by associating the color value and the position information, the subsequent graphics processor can restore the displacement information of each particle by processing the color value of the vertex. Moreover, taking the commonly used RGB (red-green-blue) three-channel color value as an example, since the color value on each channel has 256 values, namely 0 to 255, therefore, the color value of each vertex has more than 16 million values. Since each color value can correspond to a displacement information, the particle animation generation effect of more than 16 million particles can be achieved subsequently, which has far exceeded the effect display needs of most particle animations.
[0044] Of course, it should be noted that, since the displacement information of different particles at different moments in particle animation is usually different, that is, it usually needs to be associated with different color values, so as to avoid the graphics processor from restoring the same displacement information for the same color value during the rendering process, the technical solution provided in the embodiment of the present application also provides a method based on the hash algorithm to determine the color value of each vertex, so as to avoid different vertices being assigned the same color value, resulting in the inability to restore the corresponding displacement information of each particle at each moment during the graphics processor rendering process. For details, please refer to Figure 2 , Figure 2 A schematic flow chart of a step of generating a color value for each vertex provided in an embodiment of the present application, specifically, comprising steps S210 to S220:
[0045] S210, performing a hash operation on identification information of particles corresponding to each vertex in the initial model to obtain a hash value of each vertex.
[0046] To avoid different vertices being assigned the same color value, in an embodiment of the present application, it is considered to process the identification information of the particle corresponding to each vertex in the initial model through a hash operation to obtain the hash value of each vertex. Specifically, the identification information of the particle here can be simply understood as the particle number. For example, in the particle animation, it starts from 1 and increases sequentially to set a corresponding number for each particle, such as particle No. 1, particle No. 2, and so on. In this process, the number of each particle is processed by a preset hash algorithm, also known as a hash algorithm, to generate a hash value with a length of 256 bits. The hash value with a length of 256 bits is the hash value of each vertex.
[0047] S220: Determine a color value of each vertex according to the hash value.
[0048] After randomly generating a 256-bit hash value through the identification information of each particle, the color value of each vertex can be further determined based on the processing of the hash value. Since there are approximately 256×256×256 ways to determine the color value of each vertex, as a convenient and feasible implementation scheme, the color value of each vertex can be determined by taking the remainder function of the hash value, including the color values in the red color channel, the green color channel, and the blue color channel.
[0049] Of course, in addition to the aforementioned method of determining the color value of each vertex through the hash value, in fact, the color value of the vertex can also be directly corresponded to the number of each particle. For example, as a feasible implementation scheme, the color value of the vertex corresponding to particle No. 1 can be set to (0, 0, 0), and the color value of the vertex corresponding to particle No. 2 can be set to (0, 0, 1), the color value of the vertex corresponding to particle No. 256 can be set to (0, 0, 255), and the color value of the vertex corresponding to particle No. 257 can be set to (0, 1, 0). After completing the color value setting of the vertex corresponding to each particle in the above manner, it can also be used to subsequently restore the displacement information corresponding to each particle at each moment through the color value.
[0050] Of course, it should be noted that in the above-mentioned embodiments, the particles in the particle animation are particles of preset size and fixed orientation, or the size and orientation of the particles are not considered in the process of generating the particle animation. In fact, in some scenarios, the particles in the particle animation may exist in the form of particles of different sizes and orientations. Therefore, if the vertices in the model are used to describe the particles, and the color values of the vertices are used to restore the displacement information of each particle, the size and orientation information unique to each particle will often be lost in the process of displaying the particle animation. Therefore, in order to synchronously restore the particle size or orientation information in the particle animation during the process of rendering and restoring the display of the particle animation by the graphics processor, as another feasible embodiment of the present application, it is considered to create an initial model that describes each particle in the particle animation with a patch. That is, in the model created in the embodiment of the present application, it will include multiple patches, each of which is composed of multiple vertices in the initial model, which are used to jointly record the corresponding particle information in the particle animation. For details, please refer to Figure 3a , Figure 3a Another schematic flow chart of steps for creating an initial model to record particle information provided in an embodiment of the present application, specifically, includes steps S310 to S320:
[0051] S310, generating a patch corresponding to the particle according to the initial position information of each particle in the particle animation to create an initial model.
[0052] Different from the aforementioned method of recording the information of each particle in the particle animation through the model vertices, in the scheme provided in the embodiment of the present application, the information of each particle in the particle animation is recorded through the patches in the model, that is, the patches corresponding to the particles are first generated according to the initial position information of each particle in the particle animation to create an initial model. For example, as a common feasible implementation scheme, the initial position information of the particles can be used as the center point of the patches, and patches with a fixed orientation can be generated. For example, it is common to generate patches with a fixed upward orientation first. Among them, the specific shape of the patches here can adopt the patch shapes commonly used in the model, such as triangular patches, square patches, or hexagonal patches, etc. The embodiment of the present application does not limit this. For the convenience of description, the square patches will be used as an example for explanation in the following. For details, please refer to Figure 3b , Figure 3b This is a schematic diagram of the effect of obtaining an initial model based on vertices provided in an embodiment of the present application.
[0053] It can be seen that in Figure 3b In the embodiment, each particle is compressed into a fixed upward square patch, wherein the center of the patch is the center of the particle. In addition, the patch can be resized based on actual needs. For example, in order to reduce the amount of data processing, the patch can be reduced as much as possible. Ideally, the patch should collapse into a vertex. Of course, the actual effect can be set based on the effect supported by the engine or hardware. The embodiment of the present application does not limit the form of the patch.
[0054] Of course, it should be noted that when a patch is composed of multiple vertices of a model, the multiple vertices corresponding to the same patch correspond to the same particle. At this time, combined with the aforementioned related description, it can be seen that in order to restore the displacement information of the particles at each moment, the colors of the multiple vertices on the same patch should be configured with the same color value. For example, the four vertices of a square patch are configured with the same color value.
[0055] S320: Using the transformation parameters of the particles relative to the patch as the camera parameters of the patch, and setting the material parameters of the patch according to the camera parameters.
[0056] In order to record the size or orientation information of each particle in the particle animation in the attribute parameters of the patch, so as to restore the size or orientation of each particle through the attribute parameters of the patch during the rendering process of the graphics processor, in an embodiment of the present application, the transformation parameters of the particle relative to the patch will be considered as the camera parameters of the patch, so as to set the material parameters of the patch based on the camera parameters. Specifically, the change parameters of the particle relative to the patch usually include displacement parameters, rotation parameters and scaling parameters. Of course, in the case where the center of the particle is usually the center of the patch, the change parameters of the particle relative to the patch usually include rotation parameters and scaling parameters. Specifically, the rotation parameter can be understood as the rotation matrix between the normal vector of the particle and the normal vector of the patch, and the scaling parameter can be understood as the scaling ratio of the particle to the patch, which is used to further restore the size of the particle.
[0057] Considering that the patches in the model are usually configured with corresponding camera parameters, the visual information of observing the patches is described by the camera parameters. Among them, corresponding to the transformation parameters of the particles relative to the patches, the camera parameters of the patches usually also include displacement parameters, rotation parameters and scaling parameters, which are used to determine the visual information observed on the patches under different orientations and distances. Therefore, the transformation parameters of the particles relative to the patches can be considered as the camera parameters of the patches, and the material parameters of the patches can be set based on the camera parameters. In the process of rendering the model by the graphics processor, the material parameters of the patches can be solved by the graphics processor, so as to restore the transformation parameters of the particles relative to the patches, so as to use the change parameters to redetermine the performance of the particles in the particle animation, such as the particle size, or the orientation of the particles, etc.
[0058] Of course, in order to further optimize the rendering effect of the particle animation, other attribute information of the particles in the particle animation, such as color, transparency, etc., can be further considered in the embodiment of the present application. After the transformation parameters of the particles are used as the camera parameters of the patch, the color information and transparency information of the particles can also be used as the material parameters of the patch. In this way, during the rendering process of the graphics processor, in addition to being able to restore the size and orientation information of the particles, the color and transparency information of the particles can also be restored according to the material parameters of the patch, thereby making the rendered particle animation richer and more realistic.
[0059] Specifically, the color information of the particles can be converted into the diffuse color parameters of the patch material, and the transparency information of the particles can be converted into the transparency parameters of the material. In this way, when the graphics processor renders according to the material parameters of the patch, it can not only restore the geometric information of the particles, but also restore the visual effects of the particles, making the final rendered particle animation visually closer to the particle effects in the real world.
[0060] In addition, the embodiments of the present application also take into account the dynamic change characteristics of particles in particle animation. For example, dynamic properties such as the life cycle, speed, and acceleration of particles can also be recorded and converted into material parameters of the patch. By solving these dynamic properties in the graphics processor, the dynamic change effects of particles in the particle animation can be achieved, such as fading in and out of particles, accelerated motion, etc., making the particle animation more vivid and expressive.
[0061] In addition, it should be noted that the process of creating the initial model provided in the embodiment of the present application is usually performed on the first terminal, wherein the first terminal usually runs software that supports digital content creation (DCC), such as 3DS, MAYA, etc., wherein the first terminal can be a computer or a mobile device, such as a mobile phone, tablet computer, etc. The embodiment of the present application does not limit the device type of the first terminal for creating the initial model. All terminal devices that support model making are required to be within the scope of protection required by this application.
[0062] S130, generating an objective function according to the displacement information corresponding to the particle at each moment and the color value, solving each vertex in the initial model through the objective function, obtaining the displacement information corresponding to each vertex at each moment, and generating the particle animation.
[0063] In the embodiment of the present application, in order to recover the displacement information corresponding to the particle at each moment from the color value of the vertex or the vertex of the face, as a further feasible implementation scheme of the present application, the target function is generated according to the displacement information and color value corresponding to the particle at each moment, wherein the target function is used to describe the mapping relationship between the displacement information corresponding to the particle at each moment and the color value, so that in the subsequent process of processing the model, the color of the vertex in the model can be processed according to the target function, so as to obtain the displacement information corresponding to the corresponding vertex at each moment, so as to further render and generate the corresponding particle animation based on the displacement information. Wherein, the processing of the model can usually be completed by a graphics processor, wherein the graphics processor here can be a graphics processor of the first terminal, which is used to restore the particle animation based on the model created in the DCC software, and of course, it can also be a graphics processor of a second terminal different from the first terminal on the second terminal, such as other mobile terminals, to restore the particle animation, compared with making GPU particles of a specific data format to generate particle animation, it can be well adapted to the hardware of different mobile devices, without requiring these hardware to have the ability to process data in a specific format, but only relying on the graphics processing function of the graphics processor, so that the restoration of particle animation can be conveniently realized across platforms.
[0064] Specifically, it can be understood that the aforementioned method of generating the objective function can be to use the color value and time as independent variables, and the displacement information of the particle at the corresponding time as the dependent variable, to fit the preset polynomial function, such as difference fitting, so as to determine the coefficients of each term in the polynomial function, and obtain the objective function, that is, 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 displacement information of the particle at the corresponding time. It should be noted that, in the case where the displacement information of the particle includes the displacement in multiple directions or the performance parameters such as the effect intensity of the particle, the corresponding objective function can be generated according to each displacement information, or the functional relationship between the displacement information of the particle 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 above process of fitting the objective function by utilizing the displacement information corresponding to each particle, in order to further reduce the amount of calculation, as a further feasible implementation scheme of the present application, after obtaining the displacement information corresponding to the particle at each moment, the displacement information corresponding to the particle at each moment can be further normalized based on the maximum displacement value corresponding to the particle at each moment, so as to use the normalized displacement information corresponding to the particle at each moment, that is, the offset coefficient between [-1,1] to describe the relative offset of the particle at each moment, so as to fit the polynomial function and obtain the objective function, so that in the subsequent graphics processor, in the process of solving the model, after obtaining the offset coefficient of the particle in each direction, the displacement in each direction can be further determined in combination with the maximum displacement value, so as to increase the displacement on the basis of the initial position of the particle, so as to obtain the position information of the particle at the corresponding moment, so as to generate the corresponding particle animation.
[0066] Specifically, in order to further improve the speed of solving the particle animation effect, in the technical solution provided in the embodiment of the present application, the initial model created can also be baked to save the attribute parameter information of each vertex or patch in the model in the texture map, so that in the subsequent process of rendering the texture map through the graphics processor, the target function can be used to complete the solution of the initial model, so as to restore the parameters such as the displacement information corresponding to the particles at each moment, the particle size or orientation, etc., to generate the corresponding particle animation. Specifically, the particle animation generation method provided by the present application specifically includes:
[0067] Baking the initial model to obtain a texture map of the initial model;
[0068] The texture map is rendered by a graphics processor, so that the initial model is solved by an objective function to generate a particle animation.
[0069] Through the method provided above, art producers can produce particle animations of the same order of magnitude as GPU particles under a fixed particle framework. Compared with using GPU particles, the method provided by this application is to restore the original particle animation information during the process of rendering and solving the model by the graphics processor, thereby generating corresponding particle display effects, that is, it can adapt to any image processor architecture and can effectively be compatible with different terminal devices.
[0070] In order to clearly understand the particle animation generation method provided in the embodiment of the present application, the following will provide a realization process of creating an initial model so that a graphics processor can generate a specified particle animation effect in combination with the relevant contents provided in the above figures, specifically, including the following steps:
[0071] (1) Based on the particle animation to be generated, in DCC (Digital Content Creation) software, such as 3DS MAX, Maya, Houdini, etc., an initial model of the particle animation is created, which can be understood as recording the zero-frame position of the particle as the initial position of the particle to create an initial model;
[0072] (2) By transforming the particles in the model, the particles are converted into square or other arbitrary shapes of patches. Taking square patches as an example, the effect after the change can be seen in Figure 3b , and at the same time reduce the area of the patch as much as possible, such as reducing the patch to 0.00001 times, and ideally to 0 times, that is, collapse the patch into four overlapping vertices, and adjust the Euler rotation angle of the patch to 0, that is, the default patch faces upward;
[0073] (3) Set the corresponding color value for each vertex of each patch, including the RGB three-color channel value. Different patches are required to have different vertex colors. Therefore, based on the idea of hash algorithm, the color value of each vertex of each patch can be determined. The color value can be regarded as a unique seed for the subsequent restoration of particle animation effects.
[0074] (4) If the particle has attribute information such as size and orientation, the change parameters of the particle relative to the patch, such as displacement parameters, rotation parameters and scaling parameters, usually including rotation parameters and scaling parameters, can be configured as camera parameters of the patch to determine the material parameters of the patch. In this way, when the image processor uses the camera parameters to complete the rendering of the patch, the patch is 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 particles at each moment can be obtained by performing texture sampling or fast Fourier transform on each frame image in the particle animation, and then the displacement information of the particles at each moment and the color value of the vertex of the surface corresponding to the particles are used to construct a polynomial function describing the displacement information, color value and time through the idea of function fitting. The polynomial can be stored and recorded so that the displacement information of the particles at the moment can be solved in real time by rendering the model in the graphics processor, thereby generating the corresponding particle animation;
[0076] (6) After completing the above processing, the created model can be ported to any mobile device with a graphics processor. The mobile device can then use the recorded polynomial function and other camera parameter information to render and solve the model, and obtain the properties of each particle, such as size, orientation, and the position offset of the particle relative to the initial position at each moment, thereby adjusting the particle's presentation accordingly to generate a corresponding particle animation effect.
[0077] The particle animation generation method provided in the embodiment of the present application processes the particle animation to be displayed to obtain the displacement information corresponding to each particle in the particle animation at each moment, then 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, thereby constructing an objective function between the displacement information corresponding to the particle at each moment and the color value. Since the graphics processor can render the attribute parameters in the model, the objective function can be run in real time in the graphics processor to render and solve each particle in the initial model, and obtain the displacement information corresponding to each vertex at each moment, thereby restoring the original particle animation and displaying it. In the above manner, art production personnel can create models corresponding to different particle performance effects under a fixed particle framework, so as to solve and restore the corresponding particle performance effects in real time in the graphics processor of different terminal devices. Compared with CPU particles, it can meet the needs of displaying a large number of particle special effects animations on mobile devices, and compared with GPU particles, it can also be well adapted to the hardware of different mobile devices.
[0078] In order to better implement the particle animation generation method provided in the embodiment of the present application, on the basis of the particle animation generation method provided in the embodiment of the present application, the embodiment of the present application also provides a particle animation generation device, such as Figure 4 As shown, the particle animation generating device 400 includes:
[0079] The processing module 410 is used to determine the particle animation to be displayed, and determine the displacement information corresponding to each particle in the particle animation at each time based on the texture information of the particle animation;
[0080] A creation module 420, which creates an initial model according to 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 an objective function according to the displacement information corresponding to the particle at each time and the color value, so as to solve each vertex in the initial model through the objective function to generate the particle animation.
[0082] In some embodiments of the present application, the processing module 410 is further used to perform texture sampling and / or fast Fourier transform on the particle animation to determine a plurality of particles in the particle animation;
[0083] According to the texture coordinates corresponding to the image frames of the particles at different moments in the particle animation, the displacement information corresponding to the particles at each moment in the particle animation is determined.
[0084] In some embodiments of the present application, the creation module 420 is further used to perform a hash operation on the identification information of the particle corresponding to each vertex in the initial model to obtain a hash value of each vertex;
[0085] The color value of each of the vertices is determined according to the hash value.
[0086] In some embodiments of the present application, the generation module 430 is further used to process the color value of each vertex in the initial model according to the objective function to obtain the offset corresponding to the vertex at different times; and generate the particle animation based on the offset.
[0087] In some embodiments of the present application, the generation module 430 is also used to fit a preset polynomial function using the color value and time as independent variables, and the displacement information corresponding to the particle at the time as a dependent variable, 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 the present application, the generation module 430 is also used to normalize the displacement information corresponding to the particle at each moment according to the maximum displacement value corresponding to the particle at each moment, so as to obtain the normalized displacement information corresponding to the particle at each moment; based on the normalized displacement information, a preset polynomial function is fitted to obtain a target function.
[0089] In some embodiments of the present application, the creation module 420 is further used to generate a patch corresponding to the particle according to the initial position information of each particle in the particle animation to create an initial model, wherein each patch corresponding to the particle includes a plurality of vertices in the initial model;
[0090] Using the transformation parameters of the particles relative to the patch as the camera parameters of the patch, and setting the material parameters of the patch according to the camera parameters;
[0091] According to the material parameters of the patches in the initial model, the position information of each patch in the initial model is transformed to obtain the initial position information of each particle in the particle animation.
[0092] In some embodiments of the present application, the generation module 430 is further used to solve the initial model through a graphics processor to render and generate particle animation.
[0093] The specific definition of the particle animation generation device can be found in the definition of the particle animation generation method above, which will not be repeated here. Each module in the above-mentioned particle animation generation device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0094] The embodiment of the present application processes the particle animation to be displayed to obtain the displacement information corresponding to each particle in the particle animation at each moment, then 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, thereby constructing an objective function between the displacement information corresponding to the particle at each moment and the color value. Since the graphics processor can render the attribute parameters in the model, the objective function can be run in real time in the graphics processor to render and solve each particle in the initial model, and obtain the displacement information corresponding to each vertex at each moment, thereby restoring the original particle animation and displaying it. In the above manner, art production personnel can create models corresponding to different particle performance effects under a fixed particle framework, so as to solve and restore the corresponding particle performance effects in real time in the graphics processor of different terminal devices. Compared with CPU particles, it can meet the needs of displaying a large number of particle special effects animations on mobile devices, and compared with GPU particles, it can also be well adapted to the hardware of different mobile devices.
[0095] In some embodiments of the present application, the particle animation generating device 400 can be implemented in the form of a computer program. The computer program can be used in Figure 5The computer device shown in the figure is run. The memory of the computer device can store various program modules constituting the particle animation generating device 400, for example, Figure 4 The processing module 410, the creation module 420 and the generation module 430 are shown. The computer program composed of various program modules enables the processor to execute the steps of the particle animation generation method of each embodiment of the present application described in this specification.
[0096] For example, Figure 5 The computer device shown can be Figure 4 The processing module 410 in the particle animation generating device 400 shown executes step S110. The computer device can execute step S120 through the creation module 420. The computer device can execute step S130 through the generation module 430. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external computer device through a network connection. When the computer program is executed by the processor, a particle animation generating method is implemented.
[0097] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0098] In some embodiments of the present application, a computer device is provided, comprising one or more processors; a 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 following steps:
[0099] Determine a particle animation to be displayed, and determine displacement information corresponding to each particle in the particle animation at each moment based on texture information of the particle animation;
[0100] Creating an initial model according to initial position information of each particle in the particle animation, and generating a color value for each vertex in the initial model; the vertices in the initial model correspond to the particles in the particle animation;
[0101] An objective function is generated according to the displacement information corresponding to the particle at each moment and the color value, so as to solve each vertex in the initial model through the objective function to generate the particle animation.
[0102] In some embodiments of the present application, when the processor executes the computer program, the processor further implements the following steps:
[0103] Performing texture sampling and / or fast Fourier transform on the particle animation to determine a plurality of particles in the particle animation;
[0104] According to the texture coordinates corresponding to the image frames of the particles at different moments in the particle animation, the displacement information corresponding to the particles at each moment in the particle animation is determined.
[0105] In some embodiments of the present application, when the processor executes the computer program, the following steps are further implemented: performing a hash operation on the identification information of the particle corresponding to each vertex in the initial model to obtain a hash value of each vertex;
[0106] The color value of each of the vertices is determined according to the hash value.
[0107] In some embodiments of the present application, the processor further implements the following steps when executing the computer program: processing the color value of each vertex in the initial model according to the objective function to obtain the offset corresponding to the vertex at different times; and generating the particle animation based on the offset.
[0108] In some embodiments of the present application, when the processor executes the computer program, the following steps are also implemented: taking the color value and the moment as independent variables, and taking the displacement information corresponding to the particle at the moment as the dependent variable, a preset polynomial function is fitted to obtain a target function, wherein the target function is used to indicate the functional relationship between the displacement information and the moment and the color value.
[0109] In some embodiments of the present application, the processor further implements the following steps when executing the computer program: normalizing the displacement information corresponding to the particle at each moment according to the maximum displacement value corresponding to the particle at each moment to obtain the normalized displacement information corresponding to the particle at each moment; fitting a preset polynomial function based on the normalized displacement information to obtain the target function.
[0110] In some embodiments of the present application, when the processor executes the computer program, the following steps are further implemented: generating a patch corresponding to the particle according to the initial position information of each particle in the particle animation to create an initial model, wherein each patch corresponding to the particle includes a plurality of vertices in the initial model;
[0111] Using the transformation parameters of the particles relative to the patch as the camera parameters of the patch, and setting the material parameters of the patch according to the camera parameters;
[0112] According to the material parameters of the patches in the initial model, the position information of each patch in the initial model is transformed to obtain the initial position information of each particle in the particle animation.
[0113] In some embodiments of the present application, when the processor executes the computer program, the following steps are further implemented: solving the initial model by means of a graphics processor to render and generate particle animation.
[0114] In some embodiments of the present application, a computer-readable storage medium is provided, which stores a computer program. The computer program is loaded by a processor, so that the processor performs the following steps:
[0115] Determine a particle animation to be displayed, and determine displacement information corresponding to each particle in the particle animation at each moment based on texture information of the particle animation;
[0116] Creating an initial model according to initial position information of each particle in the particle animation, and generating a color value for each vertex in the initial model; the vertices in the initial model correspond to the particles in the particle animation;
[0117] An objective function is generated according to the displacement information corresponding to the particle at each moment and the color value, so as to solve each vertex in the initial model through the objective function to generate the particle animation.
[0118] In some embodiments of the present application, when the processor executes the computer program, it also implements 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 corresponding to the particles in the particle animation at each moment based on the texture coordinates corresponding to the image frames of the particles at different moments in the particle animation.
[0119] In some embodiments of the present application, when the processor executes the computer program, the following steps are further implemented: performing a hash operation on the identification information of the particle corresponding to each vertex in the initial model to obtain a hash value of each vertex;
[0120] The color value of each of the vertices is determined according to the hash value.
[0121] In some embodiments of the present application, when the processor executes the computer program, the following steps are further implemented: processing the color value of each vertex in the initial model according to the objective function to obtain the offset corresponding to the vertex at different times;
[0122] Based on the offset, the particle animation is generated.
[0123] In some embodiments of the present application, when the processor executes the computer program, the following steps are also implemented: taking the color value and the moment as independent variables, and taking the displacement information corresponding to the particle at the moment as the dependent variable, a preset polynomial function is fitted to obtain a target function, wherein the target function is used to indicate the functional relationship between the displacement information and the moment and the color value.
[0124] In some embodiments of the present application, the processor further implements the following steps when executing the computer program: normalizing the displacement information corresponding to the particle at each moment according to the maximum displacement value corresponding to the particle at each moment to obtain the normalized position information corresponding to the particle at each moment; fitting a preset polynomial function based on the normalized displacement information to obtain the target function.
[0125] In some embodiments of the present application, when the processor executes the computer program, the following steps are further implemented: generating a patch corresponding to the particle according to the initial position information of each particle in the particle animation to create an initial model, wherein each patch corresponding to the particle includes a plurality of vertices in the initial model;
[0126] Using the transformation parameters of the particles relative to the patch as the camera parameters of the patch, and setting the material parameters of the patch according to the camera parameters;
[0127] According to the material parameters of the patches in the initial model, the position information of each patch in the initial model is transformed to obtain the initial position information of each particle in the particle animation.
[0128] In some embodiments of the present application, when the processor executes the computer program, the following steps are further implemented: solving the initial model by means of a graphics processor to render and generate particle animation.
[0129] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Any reference to memory, storage, information library or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0130] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, 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 is a detailed introduction to a particle animation generation method, device, computer equipment and storage medium provided in the embodiments of the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A particle animation generation method, characterized in that: include: Determine a particle animation to be displayed, and determine displacement information corresponding to each particle in the particle animation at each moment based on texture information of the particle animation; Creating an initial model according to initial position information of each particle in the particle animation, and generating a color value for each vertex in the initial model; the vertices in the initial model correspond to the particles in the particle animation; An objective function is generated according to the displacement information corresponding to the particle at each moment and the color value, so as to solve each vertex in the initial model through the objective function to generate the particle animation.
2. The method according to claim 1, characterized in that: The determining, based on the texture information of the particle animation, the displacement information corresponding to each particle in the particle animation at each moment comprises: Performing texture sampling and / or fast Fourier transform on the particle animation to determine a plurality of particles in the particle animation; According to the texture coordinates corresponding to the image frames of the particles at different moments in the particle animation, the displacement information corresponding to the particles at each moment in the particle animation is determined.
3. The method according to claim 2, characterized in that The displacement information corresponding to 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 each vertex in the initial model by using an objective function to generate the particle animation comprises: Processing the color value of each vertex in the initial model according to the objective function to obtain the offset corresponding to the vertex at different times; Based on the offset, the particle animation is generated.
5. The method according to claim 1, characterized in that: The generating the target function according to the displacement information corresponding to the particle at each time and the color value comprises: With the color value and time as independent variables, and with the displacement information of the particle at the time as dependent variable, a preset polynomial function is fitted to obtain an objective function, wherein the objective function is used to indicate the functional relationship between the displacement information and the time and the color value.
6. The method according to claim 5, characterized in that The method further comprises: Normalizing the displacement information of the particle at each moment according to the maximum displacement value of the particle at each moment to obtain the normalized displacement information of the particle at each moment; and The preset polynomial function is fitted based on the normalized displacement information to obtain the target function.
7. The method according to claim 1, characterized in that The step of creating an initial model according to the initial position information of each particle in the particle animation comprises: Generating a patch corresponding to each particle according to initial position information of each particle in the particle animation to create an initial model, wherein each patch corresponding to the particle includes a plurality of vertices in the initial model; Using the transformation parameters of the particles relative to the patch as the camera parameters of the patch, and setting the material parameters of the patch according to the camera parameters; The solving the initial model by using the objective function includes: According to the material parameters of the patches in the initial model, the position information of each patch in the initial model is transformed to obtain the initial position information of each particle in the particle animation.
8. The method according to claim 7, characterized in that The transformation parameters of the particles relative to the patch include a displacement parameter, a rotation parameter, and a scaling parameter.
9. The method according to any one of claims 1 to 8, characterized in that: The solving the initial model by using the objective function includes: The initial model is solved by a graphics processor to render and generate particle animation.
10. A particle animation generating device, characterized in that: include: A processing module, used to determine a particle animation to be displayed, and determine displacement information corresponding to each particle in the particle animation at each moment based on texture information of the particle animation; A creation module, used to create an initial model according to the initial position information of each particle in the particle animation, and 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; A generation module is used to generate an objective function according to the displacement information corresponding to the particle at each moment and the color value, so as to solve each vertex in the initial model through the objective function to generate the particle animation.
11. A computer device, characterized in that: The computer device comprises: one or more processors; Memory; and One or more application programs, wherein the one or more application programs are stored in the memory and are configured to be executed by the processor to implement the particle animation generation method according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and the computer program is loaded by a processor to execute the particle animation generation method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Particle animation processing method and device, storage medium and computer equipment
CN112215932A
Particle effect rendering method and device, equipment and medium
CN114332323A
Animation implementation method and device of target model, storage medium and electronic equipment
CN114663560A
Animation generation method and device, nonvolatile storage medium and computer equipment
CN118071895A
Particle animation generation method and device
CN119068088A