Particle flow effect generation method and device and electronic equipment
By generating multiple target curves and velocity fields, controlling the particle velocity attributes, the problem of difficult to control the movement of particles along the curve path is solved, and efficient generation of particle flow effects is achieved.
Patent Information
- Application Number
- CN202411153056.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-20
- Publication Date
- 2025-01-03
AI Technical Summary
The prior art is difficult to effectively control the movement of particles along the curved path, especially when the curve is bent and the speed is large, the particles are easily thrown out, causing the motion trajectory to be detached from control.
By obtaining preset curves and velocity field parameters, multiple target curves and velocity fields are generated. The velocity properties of particles are determined based on the velocity properties of the velocity field and the velocity properties of the target curve, thereby controlling the movement of particles along the curve, and limiting the particle velocity through the velocity field to avoid The particles were thrown out.
The precise control of particles moving along the curve path is achieved, the efficiency of particle flow effect is improved, and the problem of particles being separated from the curve due to excessive velocity is avoided.
Smart Images

Figure CN119251364A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of game interaction design, and in particular to a method, device and electronic device for generating particle flow effects. Background Art
[0002] The filamentary flow effect is a common special effect element in computer animation. In the related art, the method of making the filamentary flow effect usually requires placing a particle emission source at the end point of the curve, and then obtaining the velocity direction on the curve through point cloud or searching for nearby points to control the flow of particles along the curve. Although this method can produce the filamentary flow effect, it is difficult to achieve when the particles need to flow far and the shape and emission speed of the emission end need to be controlled. For example, Figure 1 The figure shows a schematic diagram of a particle flow effect in the prior art. When the curve is relatively large and the particle growth rate and disturbance are relatively large, the particles are more likely to be thrown out, that is, Figure 1 The particle in the direction indicated by the middle arrow is thrown out, causing the particle's motion trajectory to escape the control of the curve. Summary of the invention
[0003] The purpose of the present disclosure is to provide a method, device and electronic device for generating a particle flow effect, so as to generate a particle flow effect moving along a curved path and improve the generation efficiency of the particle flow effect.
[0004] In a first aspect, the present disclosure provides a method for generating a particle flow effect, the method comprising: obtaining a preset curve, and determining multiple target curves and growth animations corresponding to the target curves based on preset curve generation parameters and the preset curve; generating a velocity field disturbed along the multiple target curves based on preset velocity field parameters; wherein the velocity field comprises multiple voxels, and the multiple voxels are respectively configured with corresponding velocity attributes, and the velocity attributes include velocity direction and velocity magnitude; for the multiple target curves, generating the target curves based on the growth animations corresponding to the target curves, and emitting particles through the target curves in the process of generating the target curves; wherein the velocity attribute of the particle is determined based on the velocity attribute corresponding to the voxel where the particle is located in the velocity field and the velocity attribute corresponding to the target curve; generating an animation with a particle flow effect based on the velocity attribute corresponding to the particle emitted by the multiple target curves.
[0005] In a second aspect, the present disclosure provides a device for generating a particle flow effect, the device comprising: a curve generation module, for acquiring a preset curve, and determining a plurality of target curves and growth animations corresponding to the target curves based on preset curve generation parameters and the preset curve; a velocity field determination module, for generating a velocity field disturbed along a plurality of target curves based on preset velocity field parameters; wherein the velocity field comprises a plurality of voxels, and the plurality of voxels are respectively configured with corresponding velocity attributes, and the velocity attributes comprise velocity direction and velocity magnitude; a particle emission module, for generating target curves for a plurality of target curves based on growth animations corresponding to the target curves, and emitting particles through the target curves in the process of generating the target curves; wherein the velocity attribute of the particle is determined based on the velocity attribute corresponding to the voxel where the particle is located in the velocity field and the velocity attribute corresponding to the target curve; a particle motion module, for generating an animation with a particle flow effect based on the velocity attribute corresponding to the particle emitted by the plurality of target curves.
[0006] In a third aspect, the present disclosure provides an electronic device, which includes a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the above-mentioned method for generating particle flow effects.
[0007] In a fourth aspect, the present disclosure provides a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above-mentioned method for generating the particle flow effect.
[0008] The embodiments of the present disclosure bring the following beneficial effects:
[0009] The present disclosure provides a method, device and electronic device for generating a particle flow effect. First, a preset curve is obtained and based on the preset curve generation parameters and the preset curve, multiple target curves and the growth animation corresponding to the target curves are determined; then based on the preset velocity field parameters, a velocity field disturbed along the multiple target curves is generated; wherein the velocity field includes multiple voxels, and the multiple voxels are respectively configured with corresponding velocity attributes, and the velocity attributes include velocity direction and velocity magnitude; for multiple target curves, a target curve is generated based on the growth animation corresponding to the target curve, and particles are emitted through the target curve in the process of generating the target curve; wherein the velocity attribute of the particle is determined based on the velocity attribute corresponding to the voxel where the particle is located in the velocity field and the velocity attribute corresponding to the target curve; then, based on the velocity attribute corresponding to the particles emitted by the multiple target curves, an animation with a particle flow effect is generated. The velocity attribute corresponding to the target curve in this method controls the movement of the particle along the growth direction of the target curve, and the velocity field can limit the velocity of the particle within a certain range, thereby preventing the particle from being thrown out due to excessive velocity; at the same time, this method only needs to set fewer parameters to generate a particle flow effect along the curve path, thereby improving the generation efficiency of the particle flow effect.
[0010] Other features and advantages of the present disclosure will be set forth in the following description, or some features and advantages may be inferred or unambiguously determined from the description, or may be learned by implementing the above-mentioned technology of the present disclosure.
[0011] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, the following specifically cites preferred implementation modes and describes them in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the specific embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0013] Figure 1 A schematic diagram of a particle flow effect in the prior art provided by an embodiment of the present disclosure;
[0014] Figure 2 A flow chart of a method for generating a particle flow effect provided by an embodiment of the present disclosure;
[0015] Figure 3 A schematic diagram of a preset curve provided in an embodiment of the present disclosure;
[0016] Figure 4A schematic diagram of multiple target curves provided in an embodiment of the present disclosure;
[0017] Figure 5 A schematic diagram of a velocity field provided by an embodiment of the present disclosure;
[0018] Figure 6 A schematic diagram of particle generation provided by an embodiment of the present disclosure;
[0019] Figure 7 A schematic diagram of the structure of a device for generating a particle flow effect provided by an embodiment of the present disclosure;
[0020] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0021] In order to make the purpose, technical solutions and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all the embodiments. The components of the embodiments of the present disclosure described and shown in the drawings here can be arranged and designed in various different configurations.
[0022] Therefore, the following detailed description of the embodiments of the present disclosure provided in the accompanying drawings is not intended to limit the scope of the present disclosure claimed for protection, but merely represents selected embodiments of the present disclosure. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present disclosure.
[0023] In order to facilitate understanding of the embodiment of the present invention, a method for generating a particle flow effect provided by the embodiment of the present invention is first introduced in detail. Figure 2 As shown, the method comprises the following specific steps:
[0024] Step S202, obtaining a preset curve, and determining a plurality of target curves and growth animations corresponding to the target curves based on the preset curve generation parameters and the preset curve.
[0025] In specific implementation, the user can input a preset curve of any shape from the input end, that is, the shape of the preset curve can be determined according to the user's own needs. After the user inputs the preset curve, multiple target curves can be generated based on the preset curve according to the curve generation parameters pre-set by the user or the default curve generation parameters. The shape of the target curve is similar to the shape of the preset curve, but not exactly the same. For example, the target curve can be obtained by combining random noise with the preset curve; the preset curve can also be disturbed to obtain the target curve, etc. Among them, the growth animation corresponding to each target curve is determined by the curve generation parameters.
[0026] The above curve generation parameters can be parameters determined according to user setting operations, or they can be system default parameters. Optionally, the above curve generation parameters include but are not limited to the following parameters: the number of curves, curve growth animation, curve noise parameters, and the start frame and end frame of the target curve when the animation is generated; wherein the number of curves is used to determine the number of target curves to be generated, and the curve growth animation is used to control the growth process of the target curve from nothing to something when generating a particle flow effect, as well as the growth rhythm of the target curve; the curve noise parameters are used to control the amplitude and frequency of the generated curve; wherein the start frame is used to indicate the position where the target curve is started to be generated when generating a particle flow effect; and the end frame is used to indicate the position where the target curve is stopped when generating a particle flow effect.
[0027] Step S204, based on preset velocity field parameters, generating a velocity field disturbed along multiple target curves; wherein the velocity field includes multiple voxels, and the multiple voxels are respectively configured with corresponding velocity attributes; wherein the velocity attributes include velocity direction and velocity magnitude.
[0028] In a specific implementation, the above velocity field parameters can be determined according to user setting operations, or can be default parameters. The above velocity field parameters can include, but are not limited to: velocity field size, voxel accuracy, noise parameters added to the velocity field, etc. According to the velocity field parameters, a velocity field that is disturbed along a target curve and can surround multiple target curves can be generated, wherein the velocity field includes multiple voxels, and each voxel has a corresponding velocity attribute, which is usually determined according to the velocity attribute corresponding to the target curve, or can be set according to research and development needs.
[0029] Step S206, for multiple target curves, generate a target curve based on the growth animation corresponding to the target curve, and emit particles through the target curve in the process of generating the target curve; wherein the velocity attribute of the particle is determined based on the velocity attribute corresponding to the voxel where the particle is located in the velocity field and the velocity attribute corresponding to the target curve.
[0030] In the specific implementation, when generating the particle flow effect, it is necessary to gradually generate each target curve from scratch based on the growth animation corresponding to each target curve, and in the process of generating the target curve, emit particles through the generated target curve, and the velocity attribute of the emitted particles is associated with the velocity attribute corresponding to the voxel where the particle is located in the velocity field and the velocity attribute corresponding to the target curve, so as to ensure that the particles can run along the target curve, and ensure that the particles will not deviate from the target curve or be thrown out due to excessive speed through the velocity field.
[0031] Step S208, generating an animation with particle flow effect based on the velocity attributes corresponding to the particles emitted by the multiple target curves.
[0032] In specific implementation, based on the particles emitted by each target curve and the corresponding growth animation generated by the target curve, as well as the speed attribute corresponding to the particle, an animation with particle flow effect can be generated. Among them, the flow effect of the particles emitted by the target curve is determined by the growth animation corresponding to the target curve and the speed attribute corresponding to the particle.
[0033] In an optional embodiment, each emitted particle does not exist all the time, but has a certain life cycle, that is, each particle will only survive for a preset time, thereby avoiding the accumulation of particles to form a beautiful particle flow effect.
[0034] An embodiment of the present invention provides a method for generating a particle flow effect, in which a velocity attribute corresponding to a target curve controls the movement of particles along the growth direction of the target curve, and a velocity field can limit the velocity of particles within a certain range, thereby preventing particles from being thrown out due to excessive velocity; at the same time, the method only needs to set fewer parameters to generate a particle flow effect along a curved path, thereby improving the generation efficiency of the particle flow effect.
[0035] The following embodiments are used to describe the method of determining multiple target curves.
[0036] Specifically, the above-mentioned curve generation parameters include at least: the number of curves, the curve growth animation and the curve noise parameters; wherein, the curve noise parameters are used to control the amplitude and frequency of the generated curve; based on this, the above-mentioned specific process of determining multiple target curves and the growth animations corresponding to the target curves based on the preset curve generation parameters and the preset curves may include: based on the number of curves and the curve noise parameters indicated by the curve generation parameters, generating noise matching the number of curves; multiplying the preset curves by the number of curves and the noise respectively to obtain multiple target curves; wherein, the number of target curves matches the number of curves; based on the curve growth animation indicated by the curve generation parameters, determining the growth animation corresponding to the target curve.
[0037] In the specific implementation, the user can set the curve generation parameters in the parameter setting panel, which includes parameters for controlling the size, number, speed, growth animation and noise texture of the curve. These parameters include: curve length, number of curves, curve tangent speed, curve growth animation and curve noise parameters. Specifically, after accessing the preset curve, there will be a copy node in the tool designed by the present disclosure, allowing the user to select the number of curves to be copied, and then create a class attribute for each curve. The class attribute is used to control different target curves corresponding to different amplitudes and frequencies. The class attribute can be understood as the number of each curve (if there are 6 curves, the result of the class attribute is 0, 1, 2, 3, 4, 5), and then the noise is controlled according to the class attribute and the curve noise parameters to obtain different amplitudes and frequencies, thereby generating different target curves. Among them, the noise corresponding to different class attributes can be randomly generated or generated according to preset rules, and the preset rules can be determined according to research and development needs.
[0038] Specifically, the above curve noise parameters include main noise parameters controlling the curve and noise parameters controlling the curve details, wherein the main noise parameters include amplitude, random value and intensity; the noise parameters controlling the curve details also include amplitude, random value and intensity.
[0039] like Figure 3 FIG. 1 is a schematic diagram of a preset curve provided by an embodiment of the present invention. Figure 3 The curve in is a preset curve of any shape input by the user, such as Figure 4 FIG. 1 is a schematic diagram of multiple target curves provided by an embodiment of the present invention. Figure 4 The method includes multiple target curves generated based on a preset curve, and each target curve is obtained by multiplying the preset curve with random noise.
[0040] In an optional embodiment, the curve growth animation includes a start frame and an end frame corresponding to the target curve generation; wherein the start frame is used to indicate the position at which the target curve generation starts when the particle flow effect is generated; and the end frame is used to indicate the position at which the target curve generation ends when the particle flow effect is generated. The setting of the growth time corresponding to the growth animation (i.e., the start frame and the end frame) is mainly to obtain a more random particle growth animation, and will not change the shape of the target curve.
[0041] In the specific implementation, a loop program can be used to make a growth animation for each target curve, so that the growth rhythm of each target curve can be different. Among them, the loop program here is similar to foreach in computer language. The purpose is to let each target curve enter a calculation loop separately and in turn to achieve different control of each target curve. The purpose of making the target curve grow in the loop here is to make the growth rhythm of each target curve different. For example, there are 6 target curves in total. Some target curves are already growing at the beginning of the animation, while some curves will start to grow a few frames later. Specifically, the different growth rhythms of each target curve are achieved by setting the end frame and start frame corresponding to different target curves. The start frame here can be understood as the frame position of starting to generate the target curve when generating the particle flow effect, and the end frame can be understood as the frame position of ending the generation of the target curve.
[0042] In the above method, the purpose of making a growth animation for each target curve is to control the curve to have different animation performances when generating particle flow effects, so as to make the particle animation effect based on curve emission better. This method can produce the effect of particles flowing along the curve, and only needs to adjust the growth rhythm and noise size to quickly obtain the desired result, which greatly improves the production efficiency of such effects.
[0043] The following example is used to describe the method of generating a velocity field.
[0044] Specifically, the specific process of generating a velocity field disturbed along multiple target curves based on preset velocity field parameters may include: determining a three-dimensional bounding box that encloses the multiple target curves, and filling the three-dimensional bounding box with voxels of a specified size; determining target voxels in the three-dimensional bounding box through which the target curves pass, assigning the velocity attribute corresponding to the target curve in the target voxel to the target voxel, and obtaining the velocity attribute corresponding to the target voxel; and determining the area formed by combining the target voxels as the velocity field disturbed along the multiple target curves.
[0045] In specific implementation, a bound node can be used to generate a three-dimensional bounding box at the location of multiple target curves. The three-dimensional bounding box can enclose all target curves. The shape of the three-dimensional bounding box can be determined according to research and development requirements. For example, the three-dimensional orientation box can be a rectangular box, a cube box, or a box of other shapes. Then use the volume node to fill the volume in the three-dimensional bounding box, that is, to fill the voxels of a specified size into the three-dimensional bounding box. The specified size of the voxel here is related to the preset voxel accuracy. Generally, the larger the voxel accuracy, the larger the volume of the voxel; the smaller the voxel accuracy, the smaller the volume of the voxel; wherein, the larger the voxel accuracy, the more accurate the three-dimensional data, but the corresponding memory will also be larger. Then, the velocity attribute on the target curve is transferred to the voxel using the volumefrommattrib node, that is, when the target curve passes through a certain voxel, the velocity attribute corresponding to the part of the target curve in the voxel is assigned to the voxel, so that at least part of the voxels in the cubic bounding box have velocity attributes, and the area composed of voxels with velocity attributes is also the velocity field.
[0046] In practical applications, the velocity field is a velocity that exists in space, which can be understood as countless three-dimensional pixel blocks in a spatial volume, similar to the pixels of a two-dimensional picture. Figure 5 FIG. 1 is a schematic diagram of a velocity field provided by an embodiment of the present invention. Figure 5 The space area surrounded by multiple curves is the velocity field, which includes multiple voxels, each of which is Figure 5 There is a cubic grid in the space, and each voxel has a velocity vector with magnitude and direction. When the particle passes through this space, it will be affected by the velocity in this space and move accordingly.
[0047] In specific implementation, the curve generation parameters include the curve tangent speed, and the speed attributes corresponding to the target curve include speed magnitude and speed direction; wherein the speed direction is the tangent direction of the target curve, and the speed magnitude matches the tangent speed of the curve. Specifically, since the target curve is usually curved, the tangent directions corresponding to different regions in the target curve are different, and naturally the speed directions corresponding to different regions are different; usually, the speed magnitudes corresponding to different regions in the target curve are the same.
[0048] In the above method, since the velocity attribute corresponding to each voxel in the velocity field is determined according to the velocity attribute corresponding to the target curve, the velocity field can control the movement of the particles so as not to deviate from the position near the target curve, thereby avoiding the problem of particles leaving the curve path due to excessive speed.
[0049] The following embodiment is used to describe the method of determining the particle velocity when generating a particle flow effect.
[0050] Specifically, when generating particle flow effects, in the process of generating the target curve from scratch based on the growth animation, the particles will be emitted along the tangent direction of the target curve, and the particles have a certain speed. Specifically, the speed attribute of the particles is determined in the following way: determine the target point closest to the particle on multiple target curves; determine the speed attribute corresponding to the particle based on the speed attribute corresponding to the target point and the speed attribute corresponding to the voxel in the velocity field.
[0051] In specific implementation, the present disclosure needs to use a particle solver to solve the dynamics of particles. The particle solver solves frame by frame, that is, the particle speed of each frame can be controlled and changed. Only a particle emission source and a speed attribute are needed to obtain the corresponding moving particles. Among them, the particle emitter in the present disclosure is a target curve with a growth animation, and the speed attribute of the particle is determined by the speed field created outside the particle solver and the speed attribute constructed inside the particle solver. Specifically, after the particles are generated, their motion state needs to be controlled by speed. In the present disclosure, in addition to the speed field introduced in the particle solver, the speed of controlling the dynamics of particles also includes the speed attribute constructed inside the particle solver. The speed attribute uses the method of finding nearby points in the vex language to obtain the tangent direction and position of the target point on the target curve closest to the particle, and then converts these data into speed attributes through the corresponding vex language and adds them to the speed generated during the particle emission process to obtain a new speed, which is then reassigned to the particles so that the particles move according to the new speed direction in the next frame of solution.
[0052] like Figure 6 FIG. 1 is a schematic diagram of particle generation provided by an embodiment of the present invention. Figure 6 The gray areas around the curves in the figure show particles.
[0053] In a specific implementation, the specific process of determining the velocity attribute corresponding to the particle based on the velocity attribute corresponding to the target point and the velocity attribute corresponding to the voxel in the velocity field may include: adding the velocity attribute corresponding to the target point and the velocity attribute corresponding to the voxel in the velocity field to obtain the velocity attribute corresponding to the particle. Specifically, the velocity attribute corresponding to the particle in each frame is recalculated so that the calculated velocity attribute is used as the particle velocity of the current frame to control the particle movement, thereby controlling the particle to move along the path corresponding to the target curve.
[0054] In an optional embodiment, the parameter setting panel includes parameters for controlling the solution in the particle solver, which are mainly divided into four modules. The first module controls the particle emission part, which is mainly responsible for determining the number of particles and the initial velocity; the second module controls the external introduction of the velocity field; the third module controls the windForce to add basic noise to the particle movement; the fourth module controls the tangent velocity, rotation speed and inward contraction strength of the particle to find the nearest point on the target curve, which is used to calculate the velocity properties of the particle.
[0055] Among them, the particle emission part mainly introduces the external emission source (equivalent to the target curve) into the particle solver to solve the particle dynamics. What can be controlled here is how many frames the user needs to start solving particles, how many particles are emitted, how long the particle life cycle is, and the initial velocity of the particles. The initial velocity refers to the velocity of the particle itself when the particle emission source enters the first frame of the particle solver. The above-mentioned control of the external introduction of the velocity field is mainly to refer to the external velocity field to drive the particle velocity in the particle solver. The force field in the pop particle solver, its main logic is also to obtain the velocity of the particle in the current frame, add new velocity data to this velocity value, and then give this data to the particle to affect the particle movement in the next frame. The above-mentioned windForce is a force field in the particle solver, its main logic is also to obtain the velocity of the particle in the current frame, add new velocity data to this velocity value, and then give this data to the particle to affect the particle movement in the next frame. The above rotation speed is the speed direction of rotation around the curve obtained by cross-producting the tangent direction on the target curve and the direction of the particle toward the nearest point. It allows the particle to flow forward and rotate around the curve at the same time. The above inward contraction speed can be understood as the force that attracts the particle toward the curve, in order to prevent the particle from flying too far away from the curve so that it is not controlled by the curve.
[0056] The present invention encapsulates a set of curve production tools. You only need to connect a preset curve, simply adjust the curve generation parameters and growth animation, and then you can produce multiple target curves, and then directly enter the particle solution. In the particle solution, the particle velocity is controlled by searching for nearby points, and the particle flow velocity is jointly controlled by introducing the velocity field from the outside, ensuring that the particle trajectory can be accurately controlled. In addition, this tool presets the values under 3 scene size states, namely 10 meters, 50 meters, and 100 meters. You only need to switch to the corresponding data with one click according to your needs, and then make some corresponding adjustments to the speed, noise size, etc. according to your needs to solve directly.
[0057] Corresponding to the above method embodiment, the embodiment of the present invention also provides a device for generating particle flow effect, such as Figure 7 As shown, the device comprises:
[0058] The curve generation module 70 is used to obtain a preset curve, and determine a plurality of target curves and growth animations corresponding to the target curves based on the preset curve generation parameters and the preset curve.
[0059] The velocity field determination module 71 is used to generate a velocity field disturbed along multiple target curves based on preset velocity field parameters; wherein the velocity field includes multiple voxels, and the multiple voxels are respectively configured with corresponding velocity attributes; wherein the velocity attributes include velocity direction and velocity magnitude.
[0060] The particle emission module 72 is used to generate target curves for multiple target curves based on the growth animation corresponding to the target curves, and emit particles through the target curves during the process of generating the target curves; wherein the velocity attribute of the particle is determined based on the velocity attribute corresponding to the voxel where the particle is located in the velocity field and the velocity attribute corresponding to the target curve.
[0061] The particle motion module 73 is used to generate an animation with particle flow effect based on the velocity attributes corresponding to the particles emitted by multiple target curves.
[0062] In the above-mentioned device for generating the particle flow effect, the velocity attribute corresponding to the target curve in this method controls the movement of the particles along the growth direction of the target curve, and the velocity field can limit the velocity of the particles within a certain range, thereby preventing the particles from being thrown out due to excessive velocity; at the same time, this method only needs to set fewer parameters to generate the particle flow effect along the curved path, thereby improving the generation efficiency of the particle flow effect.
[0063] Specifically, the above-mentioned curve generation parameters include: the number of curves, the curve growth animation and the curve noise parameters; wherein, the curve noise parameters are used to control the amplitude and frequency of the generated curve; based on this, the above-mentioned curve generation module 70 is used to: generate noise matching the number of curves based on the number of curves and the curve noise parameters indicated by the curve generation parameters; multiply the preset curves by the number of curves and the noise respectively to obtain multiple target curves; wherein, the number of target curves matches the number of curves; based on the curve growth animation indicated by the curve generation parameters, determine the growth animation corresponding to the target curve.
[0064] In a specific implementation, the above-mentioned curve growth animation includes a start frame and an end frame corresponding to the generation of the target curve; wherein the start frame is used to indicate the position where the target curve is started to be generated when the particle flow effect is generated; and the end frame is used to indicate the position where the target curve is stopped to be generated when the particle flow effect is generated.
[0065] In a specific implementation, the velocity field determination module 71 is used to: determine a three-dimensional bounding box that encloses multiple target curves, and fill the three-dimensional bounding box with voxels of a specified size; determine the target voxels in the three-dimensional bounding box through which the target curves pass, assign the velocity attribute corresponding to the target curve in the target voxel to the target voxel, and obtain the velocity attribute corresponding to the target voxel; determine the area formed by combining the target voxels as the velocity field disturbed along the multiple target curves.
[0066] Furthermore, the curve generation parameters include the curve tangent speed, and the speed attributes corresponding to the target curve include speed magnitude and speed direction; wherein the speed direction is the tangent direction of the target curve, and the speed magnitude matches the curve tangent speed.
[0067] Furthermore, the above-mentioned device also includes a particle speed determination module, which is used to: determine the target point closest to the particle on multiple target curves; determine the speed attribute corresponding to the particle based on the speed attribute corresponding to the target point and the speed attribute corresponding to the voxel in the velocity field.
[0068] In a specific implementation, the particle velocity determination module is used to add the velocity attribute corresponding to the target point and the velocity attribute corresponding to the voxel in the velocity field to obtain the velocity attribute corresponding to the particle.
[0069] The device for generating particle flow effect provided in the embodiment of the present disclosure has the same implementation principle and technical effects as those of the aforementioned method embodiment. For the sake of brief description, for matters not mentioned in the device embodiment, reference may be made to the corresponding contents in the aforementioned method embodiment.
[0070] The present disclosure also provides an electronic device, such as Figure 8 As shown, the electronic device includes a processor and a memory, the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the above-mentioned method for generating particle flow effects.
[0071] Specifically, the above-mentioned method for generating the particle flow effect includes: obtaining a preset curve, and based on the preset curve generation parameters and the preset curve, determining multiple target curves and the growth animation corresponding to the target curves; based on the preset velocity field parameters, generating a velocity field disturbed along the multiple target curves; wherein the velocity field includes multiple voxels, and the multiple voxels are respectively configured with corresponding velocity attributes; wherein the velocity attributes include velocity direction and velocity magnitude; for multiple target curves, generating the target curves based on the growth animation corresponding to the target curves, and emitting particles through the target curves in the process of generating the target curves; wherein the velocity attribute of the particle is determined based on the velocity attribute corresponding to the voxel where the particle is located in the velocity field and the velocity attribute corresponding to the target curve; based on the velocity attributes corresponding to the particles emitted by the multiple target curves, generating an animation with a particle flow effect.
[0072] In the above-mentioned method for generating particle flow effects, the velocity attribute corresponding to the target curve in this method controls the movement of particles along the growth direction of the target curve, and the velocity field can limit the velocity of particles within a certain range, thereby preventing particles from being thrown out due to excessive velocity; at the same time, this method only needs to set fewer parameters to generate particle flow effects along the curved path, thereby improving the generation efficiency of particle flow effects.
[0073] In an optional embodiment, the above-mentioned curve generation parameters include: the number of curves, the curve growth animation and the curve noise parameters; wherein the curve noise parameters are used to control the amplitude and frequency of the generated curve; the above-mentioned step of determining multiple target curves and the growth animations corresponding to the target curves based on the preset curve generation parameters and the preset curves includes: based on the number of curves and the curve noise parameters indicated by the curve generation parameters, generating noise matching the number of curves; multiplying the preset curve by the number of curves and the noise respectively to obtain multiple target curves; wherein the number of target curves matches the number of curves; based on the curve growth animation indicated by the curve generation parameters, determining the growth animation corresponding to the target curve.
[0074] In an optional embodiment, the above-mentioned curve growth animation includes a start frame and an end frame corresponding to the generation of the target curve; wherein the start frame is used to indicate the position where the generation of the target curve starts when generating the particle flow effect; and the end frame is used to indicate the position where the generation of the target curve ends when generating the particle flow effect.
[0075] In an optional embodiment, the above-mentioned step of generating a velocity field disturbed along multiple target curves based on preset velocity field parameters includes: determining a three-dimensional bounding box that encloses the multiple target curves, and filling the three-dimensional bounding box with voxels of a specified size; determining the target voxels in the three-dimensional bounding box through which the target curves pass, assigning the velocity attribute corresponding to the target curve in the target voxel to the target voxel, and obtaining the velocity attribute corresponding to the target voxel; and determining the area formed by combining the target voxels as the velocity field disturbed along the multiple target curves.
[0076] In an optional embodiment, the above-mentioned curve generation parameters include the curve tangent speed, and the speed attributes corresponding to the target curve include speed magnitude and speed direction; wherein the speed direction is the tangent direction of the target curve, and the speed magnitude matches the curve tangent speed.
[0077] In an optional embodiment, the velocity attribute of the above-mentioned particle is determined in the following manner: determining the target point closest to the particle on multiple target curves; determining the velocity attribute corresponding to the particle based on the velocity attribute corresponding to the target point and the velocity attribute corresponding to the voxel in the velocity field.
[0078] In an optional embodiment, the step of determining the velocity attribute corresponding to the particle based on the velocity attribute corresponding to the target point and the velocity attribute corresponding to the voxel in the velocity field includes: adding the velocity attribute corresponding to the target point and the velocity attribute corresponding to the voxel in the velocity field to obtain the velocity attribute corresponding to the particle.
[0079] Further, Figure 8 The electronic device shown further includes a bus 102 and a communication interface 103 , and the processor 101 , the communication interface 103 and the memory 100 are connected via the bus 102 .
[0080] The memory 100 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 103 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 102 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0081] The processor 101 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 101. The above processor 101 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The disclosed methods, steps and logic block diagrams in the embodiments of the present disclosure can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present disclosure can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 100, and the processor 101 reads the information in the memory 100 and completes the steps of the method of the above embodiment in combination with its hardware.
[0082] The embodiments of the present disclosure also provide a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above-mentioned method for generating the particle flow effect. The specific implementation can be found in the method embodiment, which will not be repeated here.
[0083] Specifically, the above-mentioned method for generating the particle flow effect includes: obtaining a preset curve, and based on the preset curve generation parameters and the preset curve, determining multiple target curves and the growth animation corresponding to the target curves; based on the preset velocity field parameters, generating a velocity field disturbed along the multiple target curves; wherein the velocity field includes multiple voxels, and the multiple voxels are respectively configured with corresponding velocity attributes; wherein the velocity attributes include velocity direction and velocity magnitude; for multiple target curves, generating the target curves based on the growth animation corresponding to the target curves, and emitting particles through the target curves in the process of generating the target curves; wherein the velocity attribute of the particle is determined based on the velocity attribute corresponding to the voxel where the particle is located in the velocity field and the velocity attribute corresponding to the target curve; based on the velocity attributes corresponding to the particles emitted by the multiple target curves, generating an animation with a particle flow effect.
[0084] In the above-mentioned method for generating particle flow effects, the velocity attribute corresponding to the target curve in this method controls the movement of particles along the growth direction of the target curve, and the velocity field can limit the velocity of particles within a certain range, thereby preventing particles from being thrown out due to excessive velocity; at the same time, this method only needs to set fewer parameters to generate particle flow effects along the curved path, thereby improving the generation efficiency of particle flow effects.
[0085] In an optional embodiment, the above-mentioned curve generation parameters include: the number of curves, the curve growth animation and the curve noise parameters; wherein the curve noise parameters are used to control the amplitude and frequency of the generated curve; the above-mentioned step of determining multiple target curves and the growth animations corresponding to the target curves based on the preset curve generation parameters and the preset curves includes: based on the number of curves and the curve noise parameters indicated by the curve generation parameters, generating noise matching the number of curves; multiplying the preset curve by the number of curves and the noise respectively to obtain multiple target curves; wherein the number of target curves matches the number of curves; based on the curve growth animation indicated by the curve generation parameters, determining the growth animation corresponding to the target curve.
[0086] In an optional embodiment, the above-mentioned curve growth animation includes a start frame and an end frame corresponding to the generation of the target curve; wherein the start frame is used to indicate the position where the generation of the target curve starts when generating the particle flow effect; and the end frame is used to indicate the position where the generation of the target curve ends when generating the particle flow effect.
[0087] In an optional embodiment, the above-mentioned step of generating a velocity field disturbed along multiple target curves based on preset velocity field parameters includes: determining a three-dimensional bounding box that encloses the multiple target curves, and filling the three-dimensional bounding box with voxels of a specified size; determining the target voxels in the three-dimensional bounding box through which the target curves pass, assigning the velocity attribute corresponding to the target curve in the target voxel to the target voxel, and obtaining the velocity attribute corresponding to the target voxel; and determining the area formed by combining the target voxels as the velocity field disturbed along the multiple target curves.
[0088] In an optional embodiment, the above-mentioned curve generation parameters include the curve tangent speed, and the speed attributes corresponding to the target curve include speed magnitude and speed direction; wherein the speed direction is the tangent direction of the target curve, and the speed magnitude matches the curve tangent speed.
[0089] In an optional embodiment, the velocity attribute of the above-mentioned particle is determined in the following manner: determining the target point closest to the particle on multiple target curves; determining the velocity attribute corresponding to the particle based on the velocity attribute corresponding to the target point and the velocity attribute corresponding to the voxel in the velocity field.
[0090] In an optional embodiment, the step of determining the velocity attribute corresponding to the particle based on the velocity attribute corresponding to the target point and the velocity attribute corresponding to the voxel in the velocity field includes: adding the velocity attribute corresponding to the target point and the velocity attribute corresponding to the voxel in the velocity field to obtain the velocity attribute corresponding to the particle.
[0091] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a terminal device, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0092] In the description of the present disclosure, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present disclosure and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation of the present disclosure. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0093] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A method for generating a particle flow effect, characterized in that: The method comprises: Obtaining a preset curve, and determining a plurality of target curves and growth animations corresponding to the target curves based on preset curve generation parameters and the preset curve; Based on the preset velocity field parameters, a velocity field disturbed along the plurality of target curves is generated; wherein the velocity field includes a plurality of voxels, and the plurality of voxels are respectively configured with corresponding velocity attributes, and the velocity attributes include velocity direction and velocity magnitude; For the multiple target curves, the target curves are generated based on the growth animations corresponding to the target curves, and particles are emitted through the target curves during the process of generating the target curves; wherein the velocity attribute of the particles is determined based on the velocity attribute corresponding to the voxel where the particles are located in the velocity field and the velocity attribute corresponding to the target curves; Based on the velocity attributes corresponding to the particles emitted by the multiple target curves, an animation with a particle flow effect is generated.
2. The method according to claim 1, characterized in that The curve generation parameters include: the number of curves, curve growth animation and curve noise parameters; wherein the curve noise parameters are used to control the amplitude and frequency of the generated curve; The step of determining a plurality of target curves and growth animations corresponding to the target curves based on preset curve generation parameters and the preset curve comprises: Based on the curve quantity indicated by the curve generation parameter and the curve noise parameter, generating noise matching the curve quantity; Multiplying the preset curves by the noises of the number of curves respectively to obtain the multiple target curves; wherein the number of the target curves matches the number of the curves; Based on the curve growth animation indicated by the curve generation parameters, a growth animation corresponding to the target curve is determined.
3. The method according to claim 2, characterized in that The curve growth animation includes a start frame and an end frame corresponding to the generation of the target curve; wherein the start frame is used to indicate the position at which the generation of the target curve starts when the particle flow effect is generated; and the end frame is used to indicate the position at which the generation of the target curve ends when the particle flow effect is generated.
4. The method according to claim 1, characterized in that: The step of generating the velocity field disturbed along the plurality of target curves based on the preset velocity field parameters comprises: Determine a three-dimensional bounding box that encloses the plurality of target curves, and fill the three-dimensional bounding box with voxels of a specified size; Determine a target voxel in the three-dimensional bounding box where the target curve passes, assign a speed attribute corresponding to the target curve in the target voxel to the target voxel, and obtain a speed attribute corresponding to the target voxel; The region formed by combining the target voxels is determined as a velocity field disturbed along the plurality of target curves.
5. The method according to claim 4, characterized in that The curve generation parameters include the curve tangent speed, and the speed attributes corresponding to the target curve include speed magnitude and speed direction; wherein the speed direction is the tangent direction of the target curve, and the speed magnitude matches the curve tangent speed.
6. The method according to claim 1, characterized in that The velocity property of the particle is determined as follows: Determining a target point closest to the particle on the multiple target curves; The velocity attribute corresponding to the particle is determined based on the velocity attribute corresponding to the target point and the velocity attribute corresponding to the voxel in the velocity field.
7. The method according to claim 6, characterized in that The step of determining the velocity attribute corresponding to the particle based on the velocity attribute corresponding to the target point and the velocity attribute corresponding to the voxel in the velocity field comprises: The velocity attribute corresponding to the target point is added to the velocity attribute corresponding to the voxel in the velocity field to obtain the velocity attribute corresponding to the particle.
8. A device for generating particle flow effect, characterized in that: The device comprises: A curve generation module, used to obtain a preset curve, and determine a plurality of target curves and growth animations corresponding to the target curves based on preset curve generation parameters and the preset curve; A velocity field determination module, configured to generate a velocity field disturbed along the plurality of target curves based on preset velocity field parameters; wherein the velocity field includes a plurality of voxels, the plurality of voxels are respectively configured with corresponding velocity attributes, and the velocity attributes include velocity direction and velocity magnitude; A particle emission module, for generating the target curves based on the growth animations corresponding to the target curves for the multiple target curves, and emitting particles through the target curves in the process of generating the target curves; wherein the velocity attribute of the particles is determined based on the velocity attribute corresponding to the voxel where the particles are located in the velocity field and the velocity attribute corresponding to the target curves; The particle motion module is used to generate an animation with a particle flow effect based on the velocity attributes corresponding to the particles emitted by the multiple target curves.
9. An electronic device, characterized in that: The electronic device includes a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the method for generating a particle flow effect according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the method for generating a particle flow effect according to any one of claims 1 to 7.
