CN113824990A - Video generation method, device and storage medium - Google Patents

Video generation method, device and storage medium Download PDF

Info

Publication number
CN113824990A
CN113824990A CN202110947248.9A CN202110947248A CN113824990A CN 113824990 A CN113824990 A CN 113824990A CN 202110947248 A CN202110947248 A CN 202110947248A CN 113824990 A CN113824990 A CN 113824990A
Authority
CN
China
Prior art keywords
particle
frame
fluid
constraint equation
updated
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110947248.9A
Other languages
Chinese (zh)
Inventor
戴强
刘斌
马重阳
李雅子
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Dajia Internet Information Technology Co Ltd filed Critical Beijing Dajia Internet Information Technology Co Ltd
Priority to CN202110947248.9A priority Critical patent/CN113824990A/en
Publication of CN113824990A publication Critical patent/CN113824990A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/234Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs
    • H04N21/23424Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs involving splicing one content stream with another content stream, e.g. for inserting or substituting an advertisement
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/431Generation of visual interfaces for content selection or interaction; Content or additional data rendering
    • H04N21/4312Generation of visual interfaces for content selection or interaction; Content or additional data rendering involving specific graphical features, e.g. screen layout, special fonts or colors, blinking icons, highlights or animations

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Business, Economics & Management (AREA)
  • Marketing (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The present disclosure relates to a video generation method, apparatus, and storage medium, the method comprising: determining the initial velocity and the initial position of the fluid in a weightless state; determining the external force to which each particle in the fluid is subjected when the fluid is subjected to the external force; then determining the predicted position of each frame of each particle in a preset time period; constructing a density constraint equation of each particle frame based on the predicted position of each particle frame; obtaining a plurality of video frames of the fluid based on a density constraint equation of each frame of each particle; thereby obtaining a video within a preset time period. The present disclosure improves the realism of the flutter, merge and split states of the fluid under simulated weightlessness conditions.

Description

Video generation method, device and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a video generation method, an apparatus, and a storage medium.
Background
In the related art, a series of advances are made in real-time animation simulation algorithms and techniques with high realism for various substances, but the main focus is on PC and server platforms, such as off-line simulation and emulation of a large number of particles using classical algorithms like Smooth Particle Hydrodynamics (SPH) and Material Point Method (MPM). The method has certain challenges in performing real-time physical animation simulation operation with high realism on mobile terminal equipment or edge computing nodes with less computing resources.
Therefore, the present disclosure provides a video generation method, device and storage medium, which simulate the operation state of a fluid under a weight loss condition after being stressed, and can ensure that the local density of the fluid is not changed in the operation process; the reality of the states of fluid vibration, combination and splitting under the condition of simulated weightlessness is improved.
Disclosure of Invention
The present disclosure provides a video generation method, apparatus, and storage medium to at least solve the problem in the related art that the operation state of a fluid under stress under a weightless condition cannot be simulated really. The technical scheme of the disclosure is as follows:
according to a first aspect of the embodiments of the present disclosure, there is provided a video generation method, including:
determining an initial velocity and an initial position of the fluid in a weightless state, so that the fluid moves from the initial position to the initial velocity in the page;
determining the external force to which each particle in the fluid is subjected when the fluid is subjected to the external force;
determining the predicted position of each frame of each particle in a preset time period based on the initial speed of each particle, the received external force and a preset time step; the initial velocity of each particle is the same as the initial velocity of the fluid;
constructing a density constraint equation of each frame of each particle based on the predicted position of each frame of each particle;
obtaining a plurality of video frames of the fluid based on the density constraint equation of each frame of each particle;
and splicing the plurality of video frames to obtain the video in the preset time period.
In an exemplary embodiment, said deriving a plurality of video frames of said fluid based on said density constraint equation per frame for each particle comprises:
determining an updated position increment of each frame of each particle based on a density constraint equation of each frame of each particle;
obtaining the updated position of each frame of each particle according to the predicted position and the updated position increment of each frame of each particle;
and obtaining a plurality of video frames of the fluid according to the updated position of each frame of each particle.
In an exemplary embodiment, before the constructing the density constraint equation for each frame of each particle based on the predicted position of each frame of each particle, the method further comprises:
acquiring the quality of a plurality of neighbor particles corresponding to each particle and the predicted positions of each frame of the plurality of neighbor particles; the plurality of neighboring particles corresponding to each particle are particles in the fluid, and the distance between the neighboring particles and each particle is within the smooth radius range of the core;
constructing a density constraint equation of each frame of each particle based on the predicted position of each frame of each particle, wherein the density constraint equation comprises:
constructing a density estimation function of each frame of each particle according to the predicted position of each frame of each particle, the quality of a plurality of neighbor particles corresponding to each particle and the predicted position of each frame;
and constructing a density constraint equation of each frame of each particle according to the predicted position of each frame of each particle and the density estimation function.
In an exemplary embodiment, the determining the updated position increment of each frame of each particle based on the density constraint equation of each frame of each particle comprises:
determining a gradient function of each frame of each particle based on a density constraint equation of each frame of each particle;
solving the density constraint equation of each frame of each particle according to a Newton method to obtain the density constraint equation expansion of each frame of each particle;
obtaining a gradient coefficient function of each frame of each particle according to the gradient function of each frame of each particle and the density constraint equation expansion;
and determining the updated position increment of each frame of each particle according to the gradient coefficient function of each frame of each particle.
In an exemplary embodiment, before the obtaining the gradient coefficient function per frame of each particle according to the gradient function per frame of each particle and the density constraint equation expansion, the method further includes:
updating the density constraint equation expansion of each frame of each particle according to the relaxation factor to obtain an updated density constraint equation of each frame of each particle;
the obtaining a gradient coefficient function of each frame of each particle according to the gradient function of each frame of each particle and the density constraint equation expansion includes:
and obtaining a gradient coefficient function of each frame of each particle according to the gradient function of each frame of each particle and the update density constraint equation.
In an exemplary embodiment, before determining the updated position increment of each frame of each particle according to the gradient coefficient function of each frame of each particle, the method further includes:
applying a virtual pressure to each particle to obtain a surface tension compensation coefficient of each particle;
determining an updated position increment of each frame of each particle according to the gradient coefficient function of each frame of each particle, wherein the determining comprises the following steps:
and determining the updated position increment of each frame of each particle according to the gradient coefficient function of each frame of each particle and the surface tension compensation coefficient.
In an exemplary embodiment, before obtaining the updated position of each frame of each particle according to the predicted position and the updated position increment of each frame of each particle, the method further includes:
when the external force applied to the fluid is the acting force of a collision body, acquiring the area occupied by each frame of the collision body;
the obtaining the updated position of each frame of each particle according to the predicted position and the updated position increment of each frame of each particle comprises:
obtaining the current position of each frame of each particle according to the predicted position of each frame of each particle and the updated position increment;
when the current position of any frame of any particle is outside the boundary of the page or the current position of any frame of any particle is in the area occupied by the collision body of the corresponding frame, taking the any particle as a particle to be updated, and taking the any frame as a frame to be updated;
updating the update position increment of the particle to be updated in the frame to be updated to obtain a secondary update position increment of the particle to be updated in the frame to be updated;
and obtaining the updating position of the particle to be updated in the frame to be updated according to the predicted position of the particle to be updated in the frame to be updated and the increment of the secondary updating position.
In an exemplary embodiment, the updating the update position increment of the particle to be updated in the frame to be updated to obtain the secondary update position increment of the particle to be updated in the frame to be updated includes:
acquiring a collision point position of the fluid;
according to the position of the collision point of the fluid, obtaining the normal distance between the current position of the particle to be updated corresponding to the frame to be updated and the position of the collision point of the fluid;
and obtaining a secondary updating position increment of the particle to be updated in the frame to be updated according to the current position of the particle to be updated in the frame to be updated, the corresponding normal distance and the collision point position of the fluid.
In an exemplary embodiment, before determining the predicted position of each frame of each particle within a preset time period based on the initial velocity of each particle, the applied external force and a preset time step, the method further includes:
obtaining the mass of each particle;
acquiring the updating time of each frame of each particle;
determining a predicted position of each frame of each particle within a preset time period based on the initial speed, the external force and a preset time step of each particle, including:
determining the updating speed of each frame of each particle based on the initial speed, the mass, the external force and the preset time step of each particle;
and determining the predicted position of each frame of each particle in the preset time period based on the updating speed and the updating time of each frame of each particle.
According to a second aspect of the embodiments of the present disclosure, there is provided a video generating apparatus including:
an initial information determination module configured to perform determining an initial velocity and an initial position of a fluid in a weightless state to cause the fluid to move from the initial position in a page at the initial velocity;
an external force determination module configured to perform determining an external force to which each particle in the fluid is subjected when the fluid is subjected to the external force;
a predicted position determination module configured to determine a predicted position of each frame of each particle within a preset time period based on the initial velocity of each particle, the applied external force and a preset time step; the initial velocity of each particle is the same as the initial velocity of the fluid;
a density constraint equation building module configured to perform a density constraint equation building for each frame of each particle based on the predicted position of each frame of each particle;
a video frame determination module configured to perform a density constraint equation per frame based on the each particle, resulting in a plurality of video frames of the fluid;
and the video generation module is configured to perform splicing on the plurality of video frames to obtain a video within the preset time period.
In an exemplary embodiment, the video frame determination module includes:
an update position increment determination unit configured to perform determination of an update position increment of each frame of each particle based on a density constraint equation of each frame of each particle;
an update position determination unit configured to perform obtaining an update position of each frame of each particle according to the predicted position of each frame of each particle and an update position increment;
a video frame determination unit configured to perform obtaining a plurality of video frames of the fluid according to the updated position of each frame of each particle.
In an exemplary embodiment, the video generating apparatus further includes:
a neighbor particle acquisition module configured to perform acquisition of the quality of a plurality of neighbor particles corresponding to each particle and the predicted position of each frame of the plurality of neighbor particles; the plurality of neighboring particles corresponding to each particle are particles in the fluid, and the distance between the neighboring particles and each particle is within the smooth radius range of the core;
the density constraint equation building module comprises:
a density estimation function construction unit configured to perform construction of a density estimation function per frame for each particle according to the predicted position per frame for each particle, the quality of a plurality of neighbor particles corresponding to each particle, and the predicted position per frame;
a density constraint equation building unit configured to perform a density constraint equation building for each frame of each particle according to the predicted position of each frame of each particle and a density estimation function.
In an exemplary embodiment, the update location increment determination module includes:
a gradient function determination unit configured to perform a density constraint equation based on each frame of each particle to determine a gradient function of each frame of each particle;
a density constraint equation expansion determining unit configured to perform solving a density constraint equation of each frame of each particle according to a newton method to obtain a density constraint equation expansion of each frame of each particle;
a gradient coefficient function determining unit configured to perform a gradient coefficient function per frame of each particle according to the gradient function per frame of each particle and the density constraint equation expansion;
an update position increment determining unit configured to perform determining an update position increment of each frame of each particle according to the gradient coefficient function of each frame of each particle.
In an exemplary embodiment, the video generating apparatus further includes:
the density constraint equation expansion updating module is configured to update the density constraint equation expansion of each frame of each particle according to a relaxation factor to obtain an updated density constraint equation of each frame of each particle;
the gradient coefficient function determination unit includes:
a gradient coefficient function determining subunit configured to perform a gradient coefficient function per frame of each particle according to the gradient function per frame of each particle and the update density constraint equation.
In an exemplary embodiment, the video generating apparatus further includes:
a surface tension compensation coefficient determination module configured to perform applying a virtual pressure to the each particle to obtain a surface tension compensation coefficient of the each particle;
the update position increment determination unit includes:
an update position increment determination subunit configured to perform determining an update position increment per frame of the each particle according to the gradient coefficient function per frame of the each particle and the surface tension compensation coefficient.
In an exemplary embodiment, the video generating apparatus further includes:
the position acquisition module is configured to acquire the area occupied by each frame of the collider when the external force applied to the fluid is the acting force of the collider;
the update location determination module comprises:
the current position determining unit is configured to execute the step of obtaining the current position of each frame of each particle according to the predicted position of each frame of each particle and the updated position increment;
a to-be-updated particle determination unit configured to perform, when a current position of any one of the frames of any one of the particles is outside a boundary of the page or the current position of any one of the frames of any one of the particles is within an area occupied by the collision volume of the corresponding frame, regarding the any one of the particles as a to-be-updated particle and regarding the any one of the frames as a to-be-updated frame;
the secondary updating position increment determining unit is configured to update the updating position increment of the particle to be updated in the frame to be updated, so as to obtain the secondary updating position increment of the particle to be updated in the frame to be updated;
and the secondary updating position determining unit is configured to execute the operation of obtaining the updating position of the particle to be updated in the frame to be updated according to the predicted position of the particle to be updated in the frame to be updated and the secondary updating position increment.
In an exemplary embodiment, the secondary update position determination unit includes:
a collision point position acquisition subunit configured to perform acquisition of a collision point position of the fluid;
a normal distance determining subunit configured to perform obtaining, according to the collision point position of the fluid, a normal distance between a current position of the particle to be updated corresponding to a frame to be updated and the collision point position of the fluid;
and the secondary updating position increment determining subunit is configured to execute obtaining the secondary updating position increment of the particle to be updated in the frame to be updated according to the current position of the particle to be updated in the frame to be updated, the corresponding normal distance and the collision point position of the fluid.
In an exemplary embodiment, the video generating apparatus further includes:
a mass acquisition module configured to perform acquiring a mass of the each particle;
an update time acquisition module configured to perform acquisition of an update time per frame of the each particle;
the predicted position determination module includes:
an update speed determination unit configured to perform determination of an update speed per frame of each particle based on an initial speed, a mass, an external force received, and a preset time step of each particle;
a predicted position determination unit configured to perform determination of a predicted position of each of the particles per frame within the preset time period based on an update speed and an update time of each of the particles per frame.
According to a third aspect of the embodiments of the present disclosure, there is provided an electronic apparatus including:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the video generation method as described above.
According to a fourth aspect of embodiments of the present disclosure, there is provided a computer-readable storage medium, in which instructions, when executed by a processor of an electronic device, enable the electronic device to perform the video generation method as described above.
According to a fifth aspect of embodiments of the present disclosure, there is provided a computer program product comprising a computer program which, when executed by a processor, implements the video generation method as described above.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects:
the present disclosure determines an initial velocity and an initial position of a fluid in a weightless condition; when the fluid is subjected to an external force, determining the external force applied to each particle in the fluid; thereby determining a predicted position of each frame of each particle within a preset time period; constructing a density constraint equation of each frame of each particle based on the density constraint equation; therefore, under the condition that the local density of the fluid is not changed, a plurality of video frames of the fluid are determined, and the video of the fluid in the preset time period is obtained. The video height simulates the operation state of the fluid after stress under the weightlessness condition, and can ensure that the local density is unchanged in the fluid operation process; the reality of the states of fluid vibration, combination and splitting under the condition of simulated weightlessness is improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure and are not to be construed as limiting the disclosure.
Fig. 1 is a diagram illustrating an application environment for a video generation method according to an exemplary embodiment.
Fig. 2 is a flow diagram illustrating a video generation method according to an example embodiment.
FIG. 3 is a flow chart illustrating a method of determining a predicted position per frame for each particle within a preset time period according to an exemplary embodiment.
FIG. 4 is a flowchart illustrating a method of constructing a density constraint equation for each frame of particles in accordance with an exemplary embodiment.
Fig. 5 is a flow chart illustrating a method of obtaining a plurality of video frames of a fluid according to an example embodiment.
FIG. 6 is a flowchart illustrating a method of determining an update location delta per frame for each particle in accordance with an exemplary embodiment.
FIG. 7 is a flowchart illustrating a method of deriving an updated position per frame for each particle in accordance with an exemplary embodiment.
FIG. 8 is a flowchart illustrating a method for obtaining a secondary update position increment of a particle to be updated in a corresponding frame to be updated according to an example embodiment.
Fig. 9-17 are graphs illustrating motion simulations of two masses of liquid meeting and merging in a 2D space under a weight loss condition and fluttering based on surface tension, according to an exemplary embodiment.
Fig. 18-26 are graphs illustrating a motion simulation of a liquid in a 2D space breaking up against an obstacle in a weightless condition according to an exemplary embodiment.
Fig. 27 is a block diagram illustrating a video generation apparatus according to an example embodiment.
Fig. 28 is a block diagram illustrating a hardware configuration of a server of a video generation method according to an exemplary embodiment.
Detailed Description
In order to make the technical solutions of the present disclosure better understood by those of ordinary skill in the art, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are capable of operation in sequences other than those illustrated or otherwise described herein. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
Referring to fig. 1, a diagram of an application environment of a video generation method according to an exemplary embodiment is shown, and the application environment may include a server 01 and a client 02.
Specifically, in this embodiment of the present disclosure, the server 01 may include an independently operating server, or a distributed server, or a server cluster composed of a plurality of servers, and may also be a cloud server that provides basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a Network service, cloud communication, a middleware service, a domain name service, a security service, a CDN (Content Delivery Network), and a big data and artificial intelligence platform. The server 01 may comprise a network communication unit, a processor, a memory, etc. Specifically, the server 01 may be configured to simulate an operation state of the fluid after being stressed, so as to obtain a video of fluid operation, and send the video to the client 02.
Specifically, in the embodiment of the present disclosure, the client 02 may include a type of physical device such as a smart phone, a desktop computer, a tablet computer, a notebook computer, a digital assistant, a smart wearable device, and a vehicle-mounted terminal, and may also include software running in the physical device, such as a web page provided by some service providers to a user, and an application provided by the service providers to the user. In particular, the client 02 may be used to play a video of a fluid.
Fig. 2 is a flowchart illustrating a video generation method according to an exemplary embodiment, and the method is applied to the server 01 shown in fig. 1, as shown in fig. 2, and includes the following steps.
In step S21, an initial velocity and an initial position of the fluid in a weight loss state are determined such that the fluid moves from the initial position in the page at the initial velocity.
In the embodiment of the disclosure, under the condition of weight loss, when the fluid is simulated, the density of the fluid needs to be increased, so that the particles are more tightly gathered and are not easy to break and distort. The density of the fluid under weight loss is 0.8-4 times of the real density. Under the condition of weightlessness, the fluid can form a spherical shape due to the surface tension; in the process of simulating the fluid motion state, the fluid in the weightless state may be spherical. Under the condition of weightlessness, in order to avoid the condition that the fluid integrally hovers in a space, the initial velocity of the fluid is greater than zero, but if the initial velocity is too large, the fluid cannot keep the shape during collision, and the fluid is broken or distorted; therefore, the initial velocity of the fluid is less than the preset velocity threshold, and in practical applications, the preset velocity threshold may be set according to practical requirements, for example, may be set to 0.03 m/s; that is, the initial velocity V0 of the fluid in the weightless state may be set as: v0 is more than 0 and less than 0.03 m/s; the initial position of the fluid can be set according to actual conditions, for example, the initial position can be set in the middle of the page. The fluid is composed of a plurality of particles, the initial velocity and the initial position of each particle can be determined according to the initial velocity and the initial position of the fluid in a weightless state, and the initial velocity of each particle is equal to the initial velocity of the fluid under the condition of no external force.
In step S22, when the fluid is subjected to an external force, the external force to which each particle in the fluid is subjected is determined.
In the embodiment of the present disclosure, the fluid is subjected to an external force, which includes the following three conditions:
first, the force that a fluid is subjected to when a user interacts with the fluid; for example, a user may touch a fluid with an extremity, applying an external force thereto;
second, the forces encountered when in contact with other fluids; the fluid can be fused after colliding with other fluids in the moving process;
thirdly, the force which is applied when the collision body such as a sharp object or a wall is met; the fluid can be split when encountering sharp objects and can rebound when encountering collision bodies such as walls and the like;
in the three cases, the colliders of the fluid are different, the external force applied to the fluid and the contact area between the virtual object and the collider are different, and the external force applied to each particle is different; in practical application, the external force applied to each particle in the fluid can be determined according to different conditions.
In step S23, a predicted position of each of the particles per frame within a preset time period is determined based on the initial velocity of each of the particles, the applied external force, and a preset time step. The initial velocity of each particle is the same as the initial velocity of the fluid.
In the embodiment of the present disclosure, the time step of the particle is a preset parameter, and the specific value may be set according to an actual situation.
In some embodiments, before determining the predicted position of each frame of each particle within a preset time period based on the initial velocity of each particle, the applied external force, and a preset time step, the method further includes:
obtaining the mass of each particle;
and acquiring the update time of each frame of each particle.
In the embodiment of the present disclosure, the mass of each particle may be set according to actual conditions, for example, for convenience of calculation, the mass of each particle may be set to be 1 g; in addition, the time step of each particle per frame, i.e., the update time of each particle per frame, may be set in advance.
In the embodiment of the disclosure, the mass of the fluid can be determined according to the volume and the density of the fluid, and the mass of each particle can be further determined. The update time of each frame of each particle is the time difference between two adjacent video frames.
In some embodiments, as shown in fig. 3, the determining the predicted position of each of the particles per frame in a preset time period based on the initial velocity of each of the particles, the applied external force, and a preset time step includes:
in step S231, determining an update speed of each frame of each particle based on the initial speed, the mass, the external force applied, and a preset time step of each particle;
in the embodiment of the present disclosure, a calculation formula of the update speed of each frame of each particle i is as follows:
Vi*:=Vi+Δtfi/mi
wherein Vi is the initial velocity of the particle, Vi is the update velocity of each frame of the particle, mi is the mass of the particle, fi is the external force applied to the particle, the external force does not contain gravity, and Δ t is the update time of each frame of the particle, namely the time step of simulation.
In step S232, a predicted position of each of the particles per frame in the preset time period is determined based on the update speed and the update time of each of the particles per frame.
In the embodiment of the present disclosure, the calculation formula of the predicted position of each frame of each particle is as follows:
Pi*:=Pi+ΔtVi*
pi is the predicted position of each frame of the particle, Pi is the initial position of the particle, Vi is the update speed of the particle, and Δ t is the update time of each frame of the particle.
In the embodiment of the disclosure, after the fluid is subjected to the external force, the position of each particle in the video frame changes, and the update speed of each particle in each video frame can be determined according to the initial speed, the quality, the external force and the preset time step of each particle, so as to determine the predicted position of each particle; accurate positioning of the predicted position of each particle is achieved.
In step S24, a density constraint equation for each of the particles is constructed based on the predicted position of each of the particles per frame.
In the embodiment of the disclosure, after the predicted position of each frame of each particle is determined, in order to meet the characteristic that the local density of the fluid is kept unchanged in the motion process, a density constraint equation of each frame of each particle needs to be constructed.
In some embodiments, the fluid comprises n particles, and the density constraint equation for particle i per frame is as follows:
Figure BDA0003217170220000111
wherein p is1,……,pnρ i is the density of the ith particle, and ρ 0 is the density of the ith particle in steady state, which is the predicted position of the n particles in the fluid. The solving process of the equation needs to iterate for M times, M is less than or equal to 10, and the value can be determined according to actual requirements in practical application.
In some embodiments, before the constructing the density constraint equation for each frame of each particle based on the predicted position of each frame of each particle, the method further includes:
acquiring the quality of a plurality of neighbor particles corresponding to each particle and the predicted positions of each frame of the plurality of neighbor particles; the plurality of neighboring particles corresponding to each particle are particles in the fluid, the distance between the neighboring particles and each particle is within the smooth radius range of the core.
In some embodiments, as shown in fig. 4, the constructing a density constraint equation for each frame of each particle based on the predicted position of each frame of each particle includes:
in step S241, a density estimation function of each frame of each particle is constructed according to the predicted position of each frame of each particle, the quality of a plurality of neighboring particles corresponding to each particle, and the predicted position of each frame;
in some embodiments, the density of the ith Particle can be calculated using a standard SPH density estimation function, SPH (smoothed Particle hydrodynamics) is an abbreviation for smooth Particle hydrodynamics method, a meshless method that has evolved gradually over the last 20 years. The basic idea of the method is to describe continuous fluid (or solid) by an interactive particle group, each particle carries various physical quantities including mass, speed and the like, and the mechanical behavior of the whole system is obtained by solving the dynamic equation of the particle group and tracking the motion orbit of each particle; the specific calculation formula is as follows:
Figure BDA0003217170220000112
where the equation represents the sum of the mass contributions at pi for each neighbor particle j of the computed particle i. h is the smooth nucleus radius. The W function was calculated using a Poly6 kernel, and the gradient was calculated using a Spiky kernel.
In step S242, a density constraint equation for each frame of each particle is constructed according to the predicted position of each frame of each particle and the density estimation function.
In the embodiment of the disclosure, the density constraint equation is the formula (1), and the position variation of each frame of particle particles is solved through the PBF algorithm, so that the particles meet the property of constant local density of the fluid, and the fluid is truly simulated, thereby improving the truth of simulating the flutter, combination and split of the fluid.
In step S25, a plurality of video frames of the fluid are obtained based on the density constraint equation for each particle per frame.
In some embodiments, as shown in fig. 5, the obtaining a plurality of video frames of the fluid based on the density constraint equation for each particle per frame includes:
in step S251, the update position increment per frame of each particle is determined based on the density constraint equation per frame of each particle.
In some embodiments, the updated position delta for the particle at each frame may be calculated such that the constraint of equation is satisfied:
C(p+Δp)=0 (3)
in some embodiments, as shown in fig. 6, the determining the updated position increment of each particle per frame based on the density constraint equation of each particle per frame includes:
in step S2511, a gradient function of each of the particles is determined based on the density constraint equation of each of the particles;
in the embodiment of the present disclosure, the ith equation in formula (1) constrains the gradient function for any particle k to be:
Figure BDA0003217170220000121
Figure BDA0003217170220000122
in step S2512, solving the density constraint equation of each frame of each particle according to a newton method to obtain an expanded density constraint equation of each frame of each particle;
in the disclosed embodiment, the following can be obtained according to newton's method:
Figure BDA0003217170220000123
Figure BDA0003217170220000124
Figure BDA0003217170220000131
wherein the content of the first and second substances,
Figure BDA0003217170220000132
is the gradient of C; equation (6) is the density constraint equation expansion for each frame of each particle.
In step S2513, a gradient coefficient function of each frame of each particle is obtained according to the gradient function of each frame of each particle and the density constraint equation expansion;
in some embodiments, the obtaining the gradient coefficient function of each particle per frame according to the gradient function of each particle per frame and the density constraint equation expansion includes:
and obtaining a gradient coefficient function of each frame of each particle according to the gradient function of each frame of each particle and the update density constraint equation.
In the embodiment of the present disclosure, in combination with formulas (6) and (8), the following calculation results:
Figure BDA0003217170220000133
in some embodiments, before obtaining the gradient coefficient function of each particle per frame according to the gradient function of each particle per frame and the density constraint equation expansion, the method further includes:
and updating the density constraint equation expansion of each frame of each particle according to the relaxation factor to obtain an updated density constraint equation of each frame of each particle.
In the embodiment of the disclosure, in order to solve the stability, a relaxation factor epsilon is added; the update density constraint equation is as follows:
Figure BDA0003217170220000134
thus updated lambdai
Figure BDA0003217170220000135
In the embodiment of the present disclosure, λ j may be obtained by calculation according to formula (10); the relaxation factor epsilon in the formula is a constant, the specific numerical value can be adjusted according to the convergence of the solution of the density constraint equation, and when the iterative solution of the equation is difficult to converge, the numerical value can be properly increased, so that the convergence speed can be increased, the rapid update of the gradient coefficient function is realized, and the update position increment of each frame of each particle can be rapidly obtained.
In step S2514, the updated position increment of each particle per frame is determined according to the gradient coefficient function of each particle per frame.
In the embodiment of the present disclosure, the calculation formula of the update position increment of each particle per frame is as follows:
Figure BDA0003217170220000141
in the embodiment of the disclosure, the corresponding gradient function and the density constraint equation expansion are determined through the density constraint equation of each frame of each particle, and then the gradient coefficient function is calculated according to the corresponding gradient function and the density constraint equation expansion, so that the updated position increment of each frame of each particle can be quickly obtained in a way of solving the equation.
In some embodiments, before determining the updated position increment of each frame of each particle according to the gradient coefficient function of each frame of each particle, the method further includes:
and applying virtual pressure to each particle to obtain the surface tension compensation coefficient of each particle.
In the embodiment of the present disclosure, in order to overcome the problem of unstable particle surface, surface tension compensation may be performed by applying virtual pressure to obtain a surface tension compensation coefficient, and a specific calculation formula thereof is as follows:
Figure BDA0003217170220000142
wherein, Δ q is a particle within a smooth core radius, | Δ q | ═ 0.1h … …, 0.3 h; n is a constant and can take a value of 4; k is a constant and is usually set according to the virtual pressure, and the larger the k value is, the larger the virtual pressure is, so that the method is suitable for the condition of poor surface stability; the smaller the k value is, the smaller the virtual pressure intensity is, and the method is suitable for the condition of better surface stability; usually, k is 0.1, 0.2, ….
In some embodiments, the determining the updated position increment of each particle per frame according to the gradient coefficient function of each particle per frame includes:
and determining the updated position increment of each frame of each particle according to the gradient coefficient function of each frame of each particle and the surface tension compensation coefficient.
In the embodiment of the present disclosure, equation (11) is updated based on the surface tension compensation coefficient, and the following is obtained:
Figure BDA0003217170220000143
in the embodiment of the disclosure, by increasing the surface tension of the particle, the problem of instability of the particle surface is overcome, so that the stability of the update position increment of each frame of the particle is improved.
In step S252, an updated position of each particle per frame is obtained according to the predicted position and the updated position increment of each particle per frame.
In the embodiment of the present disclosure, the calculation formula of the updated position pi of each frame of each particle is as follows:
pi*=pi+Δpi
in some embodiments, the real-time update speed of each frame of each particle can be obtained according to the update position increment and the update time of each frame; the specific calculation formula is as follows:
vi=Δpi/Δt
in some embodiments, before obtaining the updated position of each frame of each particle according to the predicted position and the updated position increment of each frame of each particle, the method further includes:
when the external force applied to the fluid is the acting force of a collider, the position of each frame of each collision particle in the collider is obtained.
In some embodiments, as shown in fig. 7, the obtaining the updated position of each frame of each particle according to the predicted position and the updated position increment of each frame of each particle includes:
in step S2521, obtaining a current position of each frame of each particle according to the predicted position and the updated position increment of each frame of each particle;
in the embodiment of the disclosure, the sum of the predicted position and the updated position increment of each frame of each particle is used as the current position of each frame of each particle.
In step S2522, when the current position of any one of the frames of any one of the particles is outside the boundary of the page, or the current position of any one of the frames of any one of the particles is within the region occupied by the collision volume of the corresponding frame, the any one of the particles is regarded as a particle to be updated, and the any one of the frames is regarded as a frame to be updated.
In the embodiment of the present disclosure, after obtaining the current position of each frame of each particle, it may be detected whether the current position is outside the boundary of the page or intersects with the shape of the collision geometry (that is, after collision occurs, there are particles located inside the geometry of the collision geometry in the fluid); when the current position of the particle is outside the boundary of the page or is intersected with the collision geometrical shape, the particle is determined as a particle to be updated, and the video frame corresponding to the particle to be updated is determined as a frame to be updated, so that the current position of the particle to be updated in the corresponding frame to be updated is updated conveniently.
In step S2523, the update position increment of the particle to be updated in the frame to be updated is updated to obtain a secondary update position increment of the particle to be updated in the frame to be updated.
In the embodiment of the disclosure, when the current position of the particle is outside the boundary of the page, the particle cannot be displayed in the page in real time, and the display effect of the particle is influenced; at this moment, the positions of the particles are updated for the second time, so that the situation that the particles cannot be displayed in the page can be avoided, and the visual experience effect of the user is improved. When a particle falls within the geometry of the collider, it can be determined that the particle has collided and its position needs to be updated.
In some embodiments, if the current position of the particle is outside the boundary of the page, updating the update position increment of the particle to be updated in the corresponding frame to be updated into a vector with a preset length inwards along the normal of the boundary; the preset length can be adjusted according to actual requirements.
In some embodiments, as shown in fig. 8, the updating the update position increment of the particle to be updated in the frame to be updated to obtain the secondary update position increment of the particle to be updated in the frame to be updated includes:
in step S25231, a collision point position of the fluid is acquired;
in step S25232, a normal distance between a current position of the particle to be updated corresponding to the frame to be updated and a collision point position of the fluid is obtained according to the collision point position of the fluid;
in step S25233, a secondary update position increment of the particle to be updated in the frame to be updated is obtained according to the current position of the particle to be updated in the frame to be updated, the corresponding normal distance, and the collision point position of the fluid.
In the embodiment of the present disclosure, when the current position of any one particle in any frame is located in the region occupied by the collision volume of the corresponding frame, the normal distance between the current position of the particle to be updated corresponding to the frame to be updated and the collision point position of the fluid may be determined according to the collision point position of the fluid; the particles to be updated can be moved for a certain distance according to the normal direction of the collision position; when implemented, small random perturbations can be applied generally normal; the normal distance is calculated as follows:
Figure BDA0003217170220000161
wherein pc is the position of the collision point, dc is the distance between the particle and the collision point during collision,
Figure BDA0003217170220000162
as a function of the normal distance,
Figure BDA0003217170220000163
applying a normal of random disturbance to the collision, nc is a normal vector of the collision, r is a unit random vector, and epsilonr is a positive constant, and is used for controlling the magnitude of the random disturbance, and the value is usually 10-4Or 10-5And the smaller value, pi is the current position.
In the embodiment of the disclosure, according to the position of the collision point of the fluid, the normal distance between the current position of the particle to be updated corresponding to the frame to be updated and the position of the collision point of the fluid is determined, and the secondary update position increment of the particle to be updated corresponding to the frame to be updated is obtained, so that the particle to be updated moves according to the normal distance at the current position corresponding to the frame to be updated, and the problem that the particle to be updated cannot be displayed in a page is effectively avoided.
In step S2524, the update position of the particle to be updated in the frame to be updated is obtained according to the predicted position of the particle to be updated in the frame to be updated and the increment of the secondary update position.
In step S253, a plurality of video frames of the fluid are obtained according to the updated position of each particle per frame.
In the embodiment of the disclosure, the update position increment of each frame of each particle is determined according to the density constraint equation of each frame of each particle; therefore, the updated position increment of each frame of each particle is obtained under the condition that the local density of the fluid is not changed; obtaining the updated position of each particle frame according to the predicted position and the updated position increment of each particle frame; therefore, the accuracy of the updated position of each frame of each particle can be improved, and the reality of a plurality of video frames of the simulated fluid is further improved.
In step S26, the video frames are spliced to obtain a video within the preset time period.
The method of the present disclosure may be used to simulate the flutter, merge and break-up states of a fluid.
(1) In the running process of the water polo, the water polo can vibrate under the action of surface tension;
the PBF algorithm solves for the position increment of the particle every frame to satisfy the fluid local density constraint. Increasing the surface tension by increasing the virtual pressure causes the particles located close to each other to converge into a spherical shape. However, the magnitude and direction of the binding force applied to the particles at different positions are different, so that the particles move in different directions, and the overall movement of the particles is represented by slight vibration on the surface of the water polo, and the center of mass of the water polo moves along the direction of the initial speed.
(2) Two independently operating fluids will fuse when meeting
For a certain particle, calculating the density of the particle position according to the neighboring particles around the particle in the PBF algorithm, and when the density value is smaller than the initially set density value rho 0, the particles around the position are subjected to a force approaching each other; when the density value is larger than rho 0, surrounding particles can be subjected to mutual repulsive force;
when the particles are converged to form the water polo, the density of the surface of the water polo is often less than rho 0, so that when the surfaces of the two water polo are contacted, the surface particles receive the mutual approaching force, and then the inner particles are driven to move towards the approaching direction, thereby realizing the effect of fusing the two water polo.
(3) The water ball is split when meeting a sharp obstacle
When calculating the position increment of the fluid particles, judging whether the fluid particles collide with the barrier or not; when a collision occurs, it is necessary to apply a collision response speed in the direction of the obstacle surface at the collision point to the fluid particles. The particles at different positions are subjected to different collision response speeds, so that the particles can move in different directions, and the effect of splitting when the water ball meets a sharp obstacle is achieved.
As shown in fig. 9-17, motion simulation diagrams simulating that two masses of liquid meet and merge in a 2D space under a weightless state and vibrate based on surface tension in real time are provided in a display interface of a mobile terminal. FIGS. 9-17 include two dummy liquids 11 and 22, which come closer together; FIG. 12 is a fusion of virtual liquids 11 and 22, virtual liquid 33; fig. 13-17 are schematic diagrams of the surface tension-based dithering of dummy liquid 33, with different states of dithering resulting in different forms of dummy liquid.
As shown in fig. 18-26, the motion simulation diagram of the liquid in the 2D space encountering the obstacle splitting in the moving end real-time simulation weightlessness status. FIGS. 18-19 are schematic views of the progressive approach between the meeting of two sets of liquids 44 and 55; FIGS. 20-21 are schematic diagrams of the deformation of two sets of liquids 44 and 55 after they meet; FIG. 22 shows the recombination of two sets of liquids 44 and 55 after they have met, with liquids 66, 771, 772; the liquids 771, 772 then further fuse into liquid 77, resulting in recombinant liquids 66 and 77 of fig. 23; fig. 24-26 are schematic illustrations of the surface tension-based dithering of reconstituted liquids 66 and 77.
The method can perform real-time and vivid high-quality simulation on the liquid motion in the weightless state according to the GPU computing capacity on the mobile terminal of the mobile phone; for example, a high speed computing performance of 30FPS can be achieved on a millet 8 handset.
The video generation method disclosed by the invention can also be used for simulating the movement of water under the weightless condition, and provides a video special effect scene interacted with the weightless water ball in the astronaut space station for a user by combining the technologies of space station background replacement, astronaut clothing changing and the like. The method disclosed by the invention can be used for simulating the animation process which has higher sense of reality and accords with the physical law on the substances such as liquid and the like on mobile or edge computing equipment (such as a mobile phone, a tablet personal computer and the like) so as to achieve the purposes of entertainment, games, scientific simulation and the like.
The present disclosure determines an initial velocity and an initial position of a fluid in a weightless condition; when the fluid is subjected to an external force, determining the external force applied to each particle in the fluid; thereby determining a predicted position of each frame of each particle within a preset time period; constructing a density constraint equation of each frame of each particle based on the density constraint equation; therefore, under the condition that the local density of the fluid is not changed, a plurality of video frames of the fluid are determined, and the video of the fluid in the preset time period is obtained. The video height simulates the operation state of the fluid after stress under the weightlessness condition, and can ensure that the local density is unchanged in the fluid operation process; the reality of the states of fluid vibration, combination and splitting under the condition of simulated weightlessness is improved.
Fig. 27 is a block diagram illustrating a video generation apparatus according to an example embodiment. Referring to fig. 27, the apparatus includes an initial information determining module 2710, an external force determining module 2720, a predicted position determining module 2730, a density constraint equation constructing module 2740, a video frame determining module 2750, and a video generating module 2760.
An initial information determination module 2710 configured to perform determining an initial velocity and an initial position of the fluid in a weightless state, so that the fluid moves from the initial position in the page at the initial velocity;
an external force determining module 2720 configured to perform determining, when the fluid is subjected to an external force, the external force to which each particle in the fluid is subjected;
a predicted position determining module 2730, configured to determine a predicted position of each frame of each particle within a preset time period based on the initial velocity of each particle, the external force applied, and a preset time step; the initial velocity of each particle is the same as the initial velocity of the fluid;
a density constraint equation construction module 2740 configured to execute a density constraint equation construction for each frame of each particle based on the predicted position of each frame of each particle;
a video frame determination module 2750 configured to execute a density constraint equation based on each frame of each particle to obtain a plurality of video frames of the fluid;
the video generating module 2760 is configured to perform stitching on the plurality of video frames to obtain a video within the preset time period.
In some embodiments, the video frame determination module comprises:
an update position increment determination unit configured to execute a density constraint equation based on each frame of each particle to determine an update position increment of each frame of each particle;
an update position determination unit configured to perform obtaining an update position of each frame of each particle according to the predicted position of each frame of each particle and an update position increment;
and a video frame determining unit configured to obtain a plurality of video frames of the fluid according to the updated position of each frame of each particle.
In some embodiments, the video generating apparatus further includes:
a neighbor particle obtaining module configured to obtain the quality of a plurality of neighbor particles corresponding to each of the particles and the predicted position of each frame of the plurality of neighbor particles; the plurality of neighboring particles corresponding to each particle are particles in the fluid, the distance between the neighboring particles and each particle is within the smooth radius range of the core;
the density constraint equation building module comprises:
a density estimation function construction unit configured to perform a density estimation function per frame of each of the particles according to the predicted position per frame of each of the particles, the masses of a plurality of neighbor particles corresponding to each of the particles, and the predicted position per frame;
and a density constraint equation constructing unit configured to execute a density constraint equation for each frame of each particle according to the predicted position of each frame of each particle and the density estimation function.
In some embodiments, the update position increment determination module includes:
a gradient function determination unit configured to execute a density constraint equation based on each frame of each particle to determine a gradient function of each frame of each particle;
a density constraint equation expansion determining unit configured to perform a density constraint equation for solving each frame of the particles according to a newton method to obtain a density constraint equation expansion for each frame of the particles;
a gradient coefficient function determining unit configured to perform a gradient coefficient function per frame of each particle according to the gradient function per frame of each particle and the density constraint equation expansion;
and an update position increment determining unit configured to perform determining an update position increment of each frame of each particle according to the gradient coefficient function of each frame of each particle.
In some embodiments, the video generating apparatus further includes:
a density constraint equation expansion updating module configured to update the density constraint equation expansion of each frame of the each particle according to a relaxation factor to obtain an updated density constraint equation of each frame of the each particle;
the gradient coefficient function determining unit includes:
a gradient coefficient function determining subunit configured to execute a gradient coefficient function per frame of each particle according to the gradient function per frame of each particle and the update density constraint equation.
In some embodiments, the video generating apparatus further includes:
a surface tension compensation coefficient determining module configured to apply a virtual pressure to each of the particles to obtain a surface tension compensation coefficient of each of the particles;
the update position increment determining unit includes:
an update position increment determining subunit configured to perform determining an update position increment per frame for each of the particles according to the gradient coefficient function per frame for each of the particles and the surface tension compensation coefficient.
In some embodiments, the video generating apparatus further includes:
the position acquisition module is configured to acquire the area occupied by each frame of the collider when the external force applied to the fluid is the acting force of the collider;
the update position determination module includes:
a current position determining unit configured to perform obtaining a current position of each frame of each particle according to the predicted position of each frame of each particle and the updated position increment;
a to-be-updated particle determination unit configured to perform, when a current position of any one of the frames of any one of the particles is outside a boundary of the page or the current position of any one of the frames of any one of the particles is within an area occupied by the collision volume of the corresponding frame, regarding the any one of the particles as a to-be-updated particle and regarding the any one of the frames as a to-be-updated frame;
the secondary updating position increment determining unit is configured to update the updating position increment of the particle to be updated in the frame to be updated, so as to obtain the secondary updating position increment of the particle to be updated in the frame to be updated;
and the secondary updating position determining unit is configured to execute the operation of obtaining the updating position of the particle to be updated in the frame to be updated according to the predicted position of the particle to be updated in the frame to be updated and the secondary updating position increment.
In some embodiments, the second update position determination unit includes:
a collision point position acquisition subunit configured to perform acquisition of a collision point position of the fluid;
a normal distance determining subunit, configured to perform obtaining, according to the position of the collision point of the fluid, a normal distance between a current position of the particle to be updated corresponding to the frame to be updated and the position of the collision point of the fluid;
and the secondary updating position increment determining subunit is configured to perform obtaining of the secondary updating position increment of the particle to be updated in the frame to be updated according to the current position of the particle to be updated in the frame to be updated, the corresponding normal distance and the collision point position of the fluid.
In some embodiments, the video generating apparatus further includes:
a mass acquisition module configured to perform acquiring a mass of each of the particles;
an update time acquisition module configured to perform acquisition of an update time per frame of each particle;
the predicted position determining module includes:
an update speed determination unit configured to determine an update speed of each frame of each particle based on the initial speed, the mass, the external force applied, and a preset time step of each particle;
and a predicted position determination unit configured to perform determination of a predicted position of each of the particles per frame within the preset time period based on the update speed and the update time of each of the particles per frame.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
In an exemplary embodiment, there is also provided an electronic device including: a processor; a memory for storing the processor-executable instructions; wherein the processor is configured to execute the instructions to implement the video generation method as described above.
In an exemplary embodiment, a computer-readable storage medium comprising instructions, such as a memory comprising instructions, executable by a processor of the electronic device to perform the method described above is also provided. Alternatively, the computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
In an exemplary embodiment, a computer program product is also provided, comprising a computer program which, when executed by a processor, implements the video generation method described above.
The video generation method provided by the embodiment of the disclosure can be executed in a mobile terminal, a computer terminal, a server or a similar operation device. Taking the example of the video stream running on a server, fig. 28 is a block diagram of a hardware structure of the server of the video generation method according to the embodiment of the present application. As shown in fig. 28, the server 2800 may vary greatly according to configuration or performance, and may include one or more Central Processing Units (CPUs) 2810 (the processor 2810 may include but is not limited to a Processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 2830 for storing data, and one or more storage media 2820 (such as one or more mass storage devices) for storing application programs 2823 or data 2822. Memory 2830 and storage medium 2820 may be transitory or persistent storage, among other things. The program stored in the storage medium 2820 may include one or more modules, each of which may include a series of instruction operations for a server. Further, a central processor 2810 may be provided in communication with the storage medium 2820 to execute a series of instruction operations in the storage medium 2820 on the server 2800. The server 2800 may also include one or more power supplies 2860, one or more wired or wireless network interfaces 2850, one or more input-output interfaces 2840, and/or one or more operating systems 2821, such as Windows Server, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
The input/output interface 2840 may be used to receive or transmit data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the server 2800. In one example, the input/output Interface 2840 includes a Network adapter (NIC) that can be connected to other Network devices through a base station to communicate with the internet. In one example, the input/output interface 2840 may be a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
It will be understood by those skilled in the art that the structure shown in fig. 28 is merely an illustration and is not intended to limit the structure of the electronic device. For example, the server 2800 could also include more or fewer components than shown in FIG. 28, or have a different configuration than shown in FIG. 28.
The present disclosure determines an initial velocity and an initial position of a fluid in a weightless condition; when the fluid is subjected to an external force, determining the external force applied to each particle in the fluid; thereby determining a predicted position of each frame of each particle within a preset time period; constructing a density constraint equation of each frame of each particle based on the density constraint equation; therefore, under the condition that the local density of the fluid is not changed, a plurality of video frames of the fluid are determined, and the video of the fluid in the preset time period is obtained. The video height simulates the operation state of the fluid after stress under the weightlessness condition, and can ensure that the local density is unchanged in the fluid operation process; the reality of the states of fluid vibration, combination and splitting under the condition of simulated weightlessness is improved.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (10)

1. A method of video generation, comprising:
determining an initial velocity and an initial position of the fluid in a weightless state, so that the fluid moves from the initial position to the initial velocity in the page;
determining the external force to which each particle in the fluid is subjected when the fluid is subjected to the external force;
determining the predicted position of each frame of each particle in a preset time period based on the initial speed of each particle, the received external force and a preset time step; the initial velocity of each particle is the same as the initial velocity of the fluid;
constructing a density constraint equation of each frame of each particle based on the predicted position of each frame of each particle;
obtaining a plurality of video frames of the fluid based on the density constraint equation of each frame of each particle;
and splicing the plurality of video frames to obtain the video in the preset time period.
2. The video generation method of claim 1, wherein obtaining the plurality of video frames of the fluid based on the density constraint equation for each frame of each particle comprises:
determining an updated position increment of each frame of each particle based on a density constraint equation of each frame of each particle;
obtaining the updated position of each frame of each particle according to the predicted position and the updated position increment of each frame of each particle;
and obtaining a plurality of video frames of the fluid according to the updated position of each frame of each particle.
3. The method of claim 1, wherein prior to constructing the density constraint equation for each frame of each particle based on the predicted position of each frame of each particle, the method further comprises:
acquiring the quality of a plurality of neighbor particles corresponding to each particle and the predicted positions of each frame of the plurality of neighbor particles; the plurality of neighboring particles corresponding to each particle are particles in the fluid, and the distance between the neighboring particles and each particle is within the smooth radius range of the core;
constructing a density constraint equation of each frame of each particle based on the predicted position of each frame of each particle, wherein the density constraint equation comprises:
constructing a density estimation function of each frame of each particle according to the predicted position of each frame of each particle, the quality of a plurality of neighbor particles corresponding to each particle and the predicted position of each frame;
and constructing a density constraint equation of each frame of each particle according to the predicted position of each frame of each particle and the density estimation function.
4. The method of claim 2, wherein determining the updated position delta for each frame of each particle based on the density constraint equation for each frame of each particle comprises:
determining a gradient function of each frame of each particle based on a density constraint equation of each frame of each particle;
solving the density constraint equation of each frame of each particle according to a Newton method to obtain the density constraint equation expansion of each frame of each particle;
obtaining a gradient coefficient function of each frame of each particle according to the gradient function of each frame of each particle and the density constraint equation expansion;
and determining the updated position increment of each frame of each particle according to the gradient coefficient function of each frame of each particle.
5. The video generation method of claim 4, wherein before the obtaining the gradient coefficient function of each particle per frame according to the gradient function of each particle per frame and the density constraint equation expansion, the method further comprises:
updating the density constraint equation expansion of each frame of each particle according to the relaxation factor to obtain an updated density constraint equation of each frame of each particle;
the obtaining a gradient coefficient function of each frame of each particle according to the gradient function of each frame of each particle and the density constraint equation expansion includes:
and obtaining a gradient coefficient function of each frame of each particle according to the gradient function of each frame of each particle and the update density constraint equation.
6. The method of claim 4, wherein before determining the updated position increment for each frame of each particle according to the gradient coefficient function for each frame of each particle, the method further comprises:
applying a virtual pressure to each particle to obtain a surface tension compensation coefficient of each particle;
determining an updated position increment of each frame of each particle according to the gradient coefficient function of each frame of each particle, wherein the determining comprises the following steps:
and determining the updated position increment of each frame of each particle according to the gradient coefficient function of each frame of each particle and the surface tension compensation coefficient.
7. A video generation apparatus, comprising:
an initial information determination module configured to perform determining an initial velocity and an initial position of a fluid in a weightless state to cause the fluid to move from the initial position in a page at the initial velocity;
an external force determination module configured to perform determining an external force to which each particle in the fluid is subjected when the fluid is subjected to the external force;
a predicted position determination module configured to determine a predicted position of each frame of each particle within a preset time period based on the initial velocity of each particle, the applied external force and a preset time step; the initial velocity of each particle is the same as the initial velocity of the fluid;
a density constraint equation building module configured to perform a density constraint equation building for each frame of each particle based on the predicted position of each frame of each particle;
a video frame determination module configured to perform a density constraint equation per frame based on the each particle, resulting in a plurality of video frames of the fluid;
and the video generation module is configured to perform splicing on the plurality of video frames to obtain a video within the preset time period.
8. An electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the video generation method of any of claims 1-6.
9. A computer-readable storage medium, wherein instructions in the computer-readable storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the video generation method of any of claims 1-6.
10. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the video generation method of any of claims 1-6.
CN202110947248.9A 2021-08-18 2021-08-18 Video generation method, device and storage medium Pending CN113824990A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110947248.9A CN113824990A (en) 2021-08-18 2021-08-18 Video generation method, device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110947248.9A CN113824990A (en) 2021-08-18 2021-08-18 Video generation method, device and storage medium

Publications (1)

Publication Number Publication Date
CN113824990A true CN113824990A (en) 2021-12-21

Family

ID=78913324

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110947248.9A Pending CN113824990A (en) 2021-08-18 2021-08-18 Video generation method, device and storage medium

Country Status (1)

Country Link
CN (1) CN113824990A (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2010140957A1 (en) * 2009-06-03 2010-12-09 Algoryx Simulation Ab A method, an apparatus and computer program product for simulating dynamic fluids
CN105006015A (en) * 2015-02-12 2015-10-28 上海交通大学 Control method and system for position-based fluid simulation
WO2018072652A1 (en) * 2016-10-17 2018-04-26 腾讯科技(深圳)有限公司 Video processing method, video processing device, and storage medium
CN109344450A (en) * 2018-09-07 2019-02-15 中山大学 Fluid sets analogy method and system based on PBF
CN110992456A (en) * 2019-11-19 2020-04-10 浙江大学 Avalanche simulation method based on position dynamics
US20210158603A1 (en) * 2019-11-21 2021-05-27 Nvidia Corporation Fluid simulations using one or more neural networks
CN113033068A (en) * 2021-04-23 2021-06-25 上海交通大学 Visual simulation method for fluid particles in container during boiling and electronic equipment

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2010140957A1 (en) * 2009-06-03 2010-12-09 Algoryx Simulation Ab A method, an apparatus and computer program product for simulating dynamic fluids
CN105006015A (en) * 2015-02-12 2015-10-28 上海交通大学 Control method and system for position-based fluid simulation
WO2018072652A1 (en) * 2016-10-17 2018-04-26 腾讯科技(深圳)有限公司 Video processing method, video processing device, and storage medium
CN109344450A (en) * 2018-09-07 2019-02-15 中山大学 Fluid sets analogy method and system based on PBF
CN110992456A (en) * 2019-11-19 2020-04-10 浙江大学 Avalanche simulation method based on position dynamics
US20210158603A1 (en) * 2019-11-21 2021-05-27 Nvidia Corporation Fluid simulations using one or more neural networks
CN113033068A (en) * 2021-04-23 2021-06-25 上海交通大学 Visual simulation method for fluid particles in container during boiling and electronic equipment

Similar Documents

Publication Publication Date Title
CN110838162A (en) Vegetation rendering method and device, storage medium and electronic equipment
CN111260764B (en) Method, device and storage medium for making animation
CN105916060A (en) Method, apparatus and system for transmitting data
CN107704667B (en) Crowd movement simulation method, device and system for simulating clustering
CN113658309A (en) Three-dimensional reconstruction method, device, equipment and storage medium
US20130132051A1 (en) System and Method for Physically Based Curve Editing
O'Brien et al. Automatic simplification of particle system dynamics
CN115587523B (en) High dynamic space self-adaptive fluid simulation method, equipment and storage medium
US20110161060A1 (en) Optimization-Based exact formulation and solution of crowd simulation in virtual worlds
Su et al. Energy Conservation for the Simulation of Deformable Bodies.
WO2021224936A1 (en) Method and system for real-time simulation of elastic body
US20170076488A1 (en) Precomputing data for an interactive system having discrete control inputs
CN113824990A (en) Video generation method, device and storage medium
CN114565705A (en) Virtual character simulation and live broadcast method, device, equipment and storage medium
US20110202327A1 (en) Finite Difference Particulate Fluid Flow Algorithm Based on the Level Set Projection Framework
Dervaux et al. Haptic rendering of interacting dynamic deformable objects simulated in real-time at different frequencies
Im et al. Visual simulation of rapidly freezing water based on crystallization
Rivalcoba et al. Towards urban crowd visualization
Hoxie et al. Developments in standards for networked virtual reality
Shiau et al. Real-time network virtual military simulation system
Toledo et al. Fuzzy and data-driven urban crowds
JP6457603B1 (en) Image processing program, image processing apparatus, and image processing method
Yang et al. Interactive coupling between a tree and raindrops
Jang et al. A geometric approach to animating thin surface features in smoothed particle hydrodynamics water
US11373353B1 (en) Heuristic scheme in material point method for simulating material

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20211221

RJ01 Rejection of invention patent application after publication