Particle special effects rendering method, device, equipment and storage medium
By using force fields and 3D texture maps in particle rendering, dynamically rendering the motion path of particles, solving the problems of low particle rendering efficiency and poor effect in the existing technology, achieving more efficient and spectacular rendering effects.
Patent Information
- Application Number
- CN202111582801.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-22
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2041-12-22
AI Technical Summary
In the prior art, when rendering particles on three-dimensional objects, complex collision detection is required, resulting in low rendering efficiency and poor effect.
By generating the force field of an object, using 3D texture maps to represent the force field, dynamically render the motion path of the particle according to its position and force value in the force field, thereby realizing dynamic rendering of the particle.
Reduces the complexity of particle rendering, improves rendering efficiency, and achieves a more spectacular rendering effect.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to the field of computer technology, and in particular to a particle special effect rendering method, device, equipment and storage medium. Background Art
[0002] Particle system is one of the commonly used technologies in computer graphics to simulate specific phenomena or visual effects. It has unique advantages in imitating natural phenomena and physical special effects, and can achieve some real, natural and random effects. It has a wide range of applications in image processing, video editing, game special effects and other fields.
[0003] In the related art, when performing particle rendering on a three-dimensional object, it is necessary to obtain the three-dimensional information of the object so that the particles can produce rendering effects according to the three-dimensional information of the object. However, this three-dimensional information is often obtained in the form of triangular vertex information of the object. When the particles produce rendering effects through triangular vertex information, they need to perform collision detection with all triangles. This process is relatively complicated, resulting in low efficiency of particle special effects rendering and poor rendering effects. Summary of the invention
[0004] The embodiments of the present disclosure provide a particle special effect rendering method, device, equipment and storage medium, which are used to reduce the complexity of particle special effect rendering and improve the efficiency of particle special effect rendering.
[0005] In a first aspect, an embodiment of the present disclosure provides a particle special effects rendering method, comprising:
[0006] Obtain an object to be rendered; based on the object to be rendered, generate a force field corresponding to the object to be rendered, the force field including one or more positions, and the vector value corresponding to the position is used to indicate the force exerted on the particle when it is at the position; based on the 3D texture map of the force field, obtain the second position of the particle in the force field in the image frame at the t+1th moment according to the vector value corresponding to the first position of the particle in the force field in the image frame at the tth moment, where t is a non-negative integer; render and generate the image frame at the t+1th moment according to the second position of the particle in the image frame at the t+1th moment, so as to obtain the particle special effect rendering result of the object to be rendered according to the image frames corresponding to each moment in the preset time period.
[0007] According to one or more embodiments of the present disclosure, obtaining a second position of a particle in a force field in an image frame at time t+1 according to a vector value corresponding to a first position of a particle in a force field in an image frame at time t includes:
[0008] According to the vector value corresponding to the particle at the first position, the force exerted on the particle at the first position is obtained; according to the force exerted on the particle at the first position, the second position of the particle in the force field in the image frame at the time t+1 is obtained.
[0009] According to one or more embodiments of the present disclosure, obtaining a second position of a particle in a force field in an image frame at time t+1 according to a force applied to the particle at a first position includes:
[0010] The mass of the particle and the initial velocity of the particle at the first position are obtained; the acceleration of the particle at the first position is obtained according to the force exerted on the particle at the first position and the mass of the particle; the second position of the particle in the force field in the image frame at the time t+1 is obtained according to the initial velocity and acceleration of the particle at the first position and the time difference between the image frame at the time t+1 and the image frame at the time t.
[0011] According to one or more embodiments of the present disclosure, the force field includes a vector field.
[0012] According to one or more embodiments of the present disclosure, the force field includes a signed distance field, and the signed distance field also includes the shortest distance between each position and the surface of the object to be rendered;
[0013] The particle special effect rendering method also includes: determining the shortest distance between the first position and the surface of the object to be rendered; and determining the force exerted on the particle at the first position according to the shortest distance and the vector value corresponding to the first position.
[0014] According to one or more embodiments of the present disclosure, generating a force field corresponding to the object to be rendered based on the object to be rendered includes: acquiring a three-dimensional mesh model corresponding to the object to be rendered; and generating a force field for the object to be rendered based on the three-dimensional mesh model.
[0015] In a second aspect, the disclosed embodiment provides a particle special effect rendering device, including:
[0016] A first acquisition module, used to acquire an object to be rendered;
[0017] A generation module, used for generating a force field corresponding to the object to be rendered based on the object to be rendered, wherein the force field includes one or more positions, and the vector value corresponding to the position is used to indicate the force exerted on the particle at the position;
[0018] A second acquisition module is used to obtain the second position of the particle in the force field in the image frame at time t+1 based on the 3D texture map of the force field according to the vector value corresponding to the first position of the particle in the force field in the image frame at time t, where t is a non-negative integer;
[0019] The rendering module is used to render and generate the image frame at time t+1 according to the second position of the particle in the image frame at time t+1, so as to obtain the particle special effect rendering result of the object to be rendered according to the image frames corresponding to each moment in the preset time period.
[0020] In a third aspect, an embodiment of the present disclosure provides an electronic device, comprising: at least one processor and a memory; the memory stores computer-executable instructions; at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes any particle special effects rendering method as described in the first aspect.
[0021] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, any particle special effects rendering method in the first aspect is implemented.
[0022] In a fifth aspect, an embodiment of the present disclosure provides a program product, including: a computer program, which, when executed by a processor, implements any particle special effects rendering method in the first aspect.
[0023] In the particle special effects rendering method, device, equipment and storage medium provided in the embodiments of the present disclosure, an object to be rendered is obtained; based on the object to be rendered, a force field corresponding to the object to be rendered is generated; based on the 3D texture map of the force field, the second position of the particle in the force field in the image frame at the t+1th moment is obtained according to the vector value corresponding to the first position of the particle in the force field in the image frame at the tth moment; based on the second position of the particle in the image frame at the t+1th moment, the image frame at the t+1th moment is rendered and generated, so as to obtain the particle special effects rendering result of the object to be rendered according to each image frame. In the embodiments of the present disclosure, dynamic rendering of particles is realized through force field implementation, which can achieve a spectacular rendering effect, and the force field of the object to be rendered is represented by a 3D texture map, so that the position of the particle in the force field relative to the object to be rendered can be quickly obtained, thereby greatly improving the particle rendering efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the 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 creative labor.
[0025] Figure 1 A schematic diagram of a scene of a particle special effects rendering method provided in an embodiment of the present disclosure;
[0026] Figure 2 Schematic diagram of the particle special effects rendering method provided in the embodiment of the present disclosure Figure 1 ;
[0027] Figure 3 A schematic diagram of a force field provided for an embodiment of the present disclosure;
[0028] Figure 4 Schematic diagram of the principle of the particle special effects rendering method provided in the embodiment of the present disclosure Figure 1 ;
[0029] Figure 5 Schematic diagram of the particle special effects rendering method provided in the embodiment of the present disclosure Figure 2 ;
[0030] Figure 6 Schematic diagram of the principle of the particle special effects rendering method provided in the embodiment of the present disclosure Figure 2 ;
[0031] Figure 7 A schematic diagram of the structure of a particle special effects rendering device provided in an embodiment of the present disclosure;
[0032] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0033] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution 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, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.
[0034] In the related art, when performing particle rendering on a three-dimensional object, it is necessary to obtain the three-dimensional information of the object so that the particles can produce rendering effects according to the three-dimensional information of the object. However, this three-dimensional information is often obtained in the form of triangular vertex information of the object. When the particles produce rendering effects through triangular vertex information, they need to perform collision detection with all triangles. This process is relatively complicated, which makes the efficiency of particle special effect rendering low and the rendering effect poor. In addition, during the rendering process, particles are usually generated directly at the object position according to the object's position information, and the rendering effect is poor.
[0035] In view of this, the embodiments of the present disclosure provide a particle special effects rendering method, device, equipment and storage medium, which realize the rendering of particle special effects through force field implementation and realize dynamic rendering of particles, thereby obtaining a more spectacular rendering effect, and using 3D texture mapping to represent the force field of the object to be rendered, so as to quickly obtain the position of the particles in the force field relative to the object to be rendered, thereby greatly improving the particle rendering efficiency.
[0036] It should be noted that the particle special effects rendering method in the embodiment of the present disclosure can be implemented by a terminal device or by a specific functional architecture in the terminal device. The following text introduces the implementation method of the present disclosure using the terminal device as the execution subject in the embodiment of the present disclosure. In other optional embodiments, other computer systems or functional structure modules of the computer system can also be used to implement the corresponding steps in the embodiment of the present disclosure, and the embodiment of the present disclosure is not limited.
[0037] Figure 1 A schematic diagram of a scene of a particle special effects rendering method provided by an embodiment of the present disclosure. Figure 1 As shown, the scenario includes a terminal device 101.
[0038] The terminal device 101 may be a personal digital assistant (PDA), a computing device (such as a personal computer (PC)), etc. It should be understood that Figure 1 A desktop computer is used as an example, but the invention is not limited thereto.
[0039] In the solution of the embodiment of the present disclosure, any three-dimensional object can be input into the terminal device 101, and the terminal device 101 obtains Figure 1 The particle special effect rendering result shown in FIG. It should be noted that the particle special effect rendering result is the process in which particles dynamically form the shape of the object to be rendered.
[0040] The following specific embodiments are used to describe in detail the technical solutions of the embodiments of the present disclosure and how the technical solutions of the present disclosure solve the above-mentioned technical problems. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the embodiments of the present disclosure will be described below in conjunction with the accompanying drawings.
[0041] Figure 2 Schematic diagram of the particle special effects rendering method provided in the embodiment of the present disclosure Figure 1 .like Figure 2 As shown, the particle special effects rendering method provided by the embodiment of the present disclosure includes the following steps:
[0042] S201: Obtain an object to be rendered.
[0043] It should be noted that the object to be rendered may be any type of 3D object, and the embodiments of the present disclosure do not specifically limit this.
[0044] S202: Based on the object to be rendered, generate a force field corresponding to the object to be rendered.
[0045] Among them, the force field is a unified grid composed of vectors that affect the movement of particles. When a particle enters the boundary of the force field, the movement of the particle will be affected by the force field. When the particle leaves the boundary, the influence of the force field on the particle disappears. The field includes one or more positions, and the vector value corresponding to each position is used to indicate the force exerted on the particle at that position.
[0046] It should be noted that the embodiment of the present disclosure does not specifically limit the way of dividing the positions in the force field. In a preferred implementation, the volume element (Volume Pixel, i.e., voxel) representation corresponding to the force field can be obtained, and a position in the force field corresponds to at least one volume element, that is, a position in the force field is represented by at least one volume element.
[0047] Taking the example of representing a position by a volume element, each volume element in the force field corresponds to a vector value, which is used to indicate the force acting on the particle at the volume element. When the particle moves to the volume element, it will be affected by the force corresponding to the volume element and move, thereby making the particle produce a dynamic effect.
[0048] In some embodiments, the size of the vector value corresponding to each position in the force field is related to the distance between the position and the surface of the object to be rendered. Specifically, the farther the position is from the surface of the object to be rendered (including positions inside and outside the object to be rendered), the larger the corresponding vector value is, and the greater the force is.
[0049] In addition, the direction of the vector value corresponding to each position in the force field is: perpendicular to the nearest surface of the object to be rendered.
[0050] It should be noted that the vector value corresponding to the surface position of the object to be rendered is preferably 0.
[0051] It should be understood that by setting the vector value corresponding to the position of the surface of the object to be rendered to 0, the magnitude of the force exerted on the particles when they are on the surface of the object to be rendered is 0, and when the particles reach the surface of the object to be rendered, they no longer move, and the shape of the object to be rendered can be rendered by the particles located on the surface of the object to be rendered.
[0052] Figure 3 Schematic diagram of the force field provided by the embodiment of the present disclosure. Figure 3 As shown, the force field is shown in the form of a 3D texture map. For example, in the 3D texture map, for position P1, it is not the surface position of the object to be rendered, and the force corresponding to position P1 is F1; for position P2, it is on the surface position of the object to be rendered, and its corresponding vector value is 0, and the corresponding force is also 0.
[0053] S203 . Based on the 3D texture map of the force field, the second position of the particle in the force field in the image frame at time t+1 is obtained according to the vector value corresponding to the first position of the particle in the force field in the image frame at time t.
[0054] S204, rendering and generating an image frame at time t+1 according to the second position of the particle in the image frame at time t+1, so as to obtain a particle special effect rendering result of the object to be rendered according to the image frames corresponding to each time in the preset time period.
[0055] In the disclosed embodiment, after obtaining the force field of the object to be rendered, the force field is imported into the GPU of the computing computer system in the form of a 3D texture map. The shader in the GPU can obtain the position information of each particle in the force field in real time according to the 3D texture map, and draw the particles in real time at the corresponding positions according to the position information to obtain an image composed of particles.
[0056] Specifically, before drawing particles, it is necessary to first set the relevant properties of the particles to generate a particle system for rendering the object to be rendered. The relevant properties of the particles include, for example, the life cycle range of the particles, the initial velocity range, and the particle mass range.
[0057] Further, the life cycle of each particle is randomly determined within the range of the particle life cycle, the initial velocity of each particle is randomly determined within the range of the initial velocity of the particle, and the mass of each particle is randomly determined within the range of the mass of the particle, so that each particle in the particle system for rendering the object to be rendered is generated according to the life cycle, initial velocity and mass of each particle. It should be understood that the life cycle, velocity and mass of each particle in the particle system are randomly distributed within the corresponding range.
[0058] According to one or more embodiments of the present disclosure, relevant properties of a particle also include: an initial position of the particle, a color of the particle, etc., which are not shown one by one here.
[0059] Furthermore, the particle emitter in the GPU emits each particle in the particle system into the force field according to the relevant properties of each particle. After each particle enters the force field, it is located at a different position and will be affected by the forces corresponding to different positions and move, thereby reaching different positions at different times. Therefore, the position information of the particle at the next moment can be calculated by the vector value of the particle's current position, and then the particle corresponding to the moment is drawn in the force field according to the position information and the relevant properties of the particle, so as to obtain the image frame corresponding to the moment, and the picture composed of the image frames corresponding to each moment in the preset time period is the particle special effect rendering result corresponding to the object to be rendered.
[0060] It should be noted that the embodiments of the present disclosure do not limit the preset time period. On the one hand, the preset time period can be a preset rendering time set by the user before rendering. For example, before the particles enter the force field, the user can set the preset rendering time according to needs. During the rendering process, the timing starts from the initial moment when the particles enter the force field. When the rendering time reaches the preset rendering time, the rendering is completed, and the picture composed of the image frames corresponding to each moment in this rendering time is determined as the particle special effect rendering result.
[0061] On the other hand, the preset time period can also be the rendering time randomly adjusted by the user during the rendering process. For example, during the rendering process, the user can control the end time of the rendering process according to the real-time rendering situation, and determine the period from the initial moment when the particle enters the force field to the end moment as the preset time period, and determine that the picture composed of the image frames corresponding to each moment in this time period is the particle special effects rendering result corresponding to the object to be rendered.
[0062] Figure 4 Schematic diagram of the principle of the particle special effects rendering method provided in the embodiment of the present disclosure Figure 1 .like Figure 4 As shown, taking a particle as an example, in the image frame corresponding to the tth moment, the particle is at position P1, and the magnitude of the force received by the particle at position P1 is F1, wherein the direction of F1 is perpendicular to the surface of the object to be rendered.
[0063] At the tth moment, the particle is affected by F1 and moves toward the surface of the object to be rendered. At the t+1th moment, the particle moves to the position P2. By drawing the particle at the position P2, the picture of the t+1th image frame can be obtained.
[0064] It should be noted that in the embodiment of the present disclosure, only one particle is shown as an example, and other particles are similar and will not be described in detail here.
[0065] Furthermore, each time an image frame is obtained, the image frame is displayed on the screen of the computer system, and the image frame composed of the image frames corresponding to each moment in the preset time period is the particle special effect rendering result corresponding to the object to be rendered.
[0066] It should be understood that as time goes by, since the vector value corresponding to the surface position of the object to be rendered in the force field is 0, all particles will get closer and closer to the position of the surface of the object to be rendered, and eventually the shape of the object to be rendered will be formed by each particle. That is, the particle special effect rendering result is the process of each particle dynamically forming the shape of the object to be rendered.
[0067] In the disclosed embodiment, the rendering of particle special effects is realized through force field implementation, and dynamic rendering of particles is realized, thereby obtaining a more spectacular rendering effect. The force field of the object to be rendered is represented by a 3D texture map, and the position of the particles in the force field relative to the object to be rendered can be quickly obtained, thereby greatly improving the particle rendering efficiency.
[0068] In addition, by using shader to perform calculations on the GPU to simulate particle motion, this process supports a large number of particles and can achieve a more spectacular force field effect, thereby further improving the particle rendering effect.
[0069] Figure 5 Schematic diagram of the particle special effects rendering method provided in the embodiment of the present disclosure Figure 2 . refer to Figure 5 The particle special effects rendering method provided by the embodiment of the present disclosure may include the following steps:
[0070] S501: Obtain an object to be rendered.
[0071] S502: Obtain a three-dimensional mesh model corresponding to the object to be rendered.
[0072] S503: Generate a force field of the object to be rendered based on the three-dimensional grid model.
[0073] S504 , obtaining the force exerted on the particle at the first position according to the vector value corresponding to the first position of the particle in the force field in the image frame at the tth moment.
[0074] When it is necessary to explain, the force field may be a vector field or a signed distance field.
[0075] Figure 6 Schematic diagram of the principle of the particle special effects rendering method provided in the embodiment of the present disclosure Figure 2 .in, Figure 6 The force field in can be any one of a vector field and a signed distance field, and the embodiment of the present disclosure does not make any specific limitation.
[0076] like Figure 6 As shown, Figure 6 Figure (a) in FIG. 1 is the rendering result of each particle in the image frame at the tth moment. For any particle a in the image frame, the first position of particle a in the force field can be obtained according to the 3D texture map of the force field.
[0077] Furthermore, the magnitude of the force exerted on particle a at the first position can be obtained according to the vector value corresponding to the first position.
[0078] In some embodiments, when the force field is a vector field, the force exerted on the particle at a first position in the vector field is the vector value corresponding to the first position.
[0079] In some other embodiments, when the force field is a directed distance field, the directed distance field also includes the shortest distance between the position and the surface of the object, and step S504 specifically includes:
[0080] (1) Determine the shortest distance between the first position and the surface of the object to be rendered.
[0081] Figure 6 Figure (b) in the figure is a schematic diagram of the force field cross section when the particle is in the first position. As shown in Figure (b), the force field cross section 1 contains multiple pixels (each grid in Figure (b) represents a pixel), and the closest distance corresponding to each pixel is different. Among them, the object surface 1 is the cross section of the object to be rendered in the force field cross section, and the closest distance corresponding to each pixel is the shortest distance from the pixel to the object surface 1.
[0082] (2) Determine the force exerted on the particle at the first position based on the vector value and the closest distance corresponding to the particle at the first position.
[0083] Specifically, the magnitude of the force F exerted on the particle a at the first position is the product of the vector value corresponding to the first position and the closest distance, and the direction of the force F exerted on the particle a at the first position is toward the surface 1 of the object.
[0084] S505 . Obtain a second position of the particle in the force field in the image frame at time t+1 according to the force exerted on the particle at the first position.
[0085] In the embodiment of the present disclosure, step S505 may include the following steps S5051 to S5053:
[0086] S5051. Obtain the mass of the particle and the initial velocity of the particle at the first position.
[0087] Among them, the mass of the particle is set when the particle system is generated, and the initial velocity at the first position is related to the time after the particle enters the force field. For example, if the tth moment is the first moment after the particle enters the force field, the initial velocity of the particle at the first position is the initial velocity set for the particle when the particle system is generated. If the tth moment is not the first moment, the initial velocity of the particle at the first position is calculated based on the velocity of the particle at the t-1th moment and the force at the t-1th moment.
[0088] Specifically, the initial velocity V of the particle at the first position can be obtained by the following formula: t :
[0089]
[0090] Among them, V t-1 is the velocity of the particle at time t-1, F t-1 is the force on the particle at time t-1, m is the mass of the particle, T t is the time difference between the tth moment and the t-1th moment.
[0091] Specifically, taking the particle rendering result as an example where 30 image frames are displayed per second, the time difference T between the tth moment and the t-1th moment is t for Second.
[0092] S5052. Obtain the acceleration of the particle at the first position according to the force exerted on the particle at the first position and the mass of the particle.
[0093] Specifically, the acceleration a of the particle at the first position can be obtained according to the following formula: t :
[0094]
[0095] Among them, F t is the force on the particle at the first position, m is the mass of the particle, and the direction of acceleration is the same as F t The direction is consistent.
[0096] In the embodiment of the present disclosure, when particle a is in the first position, it will be affected by F t The influence of the object surface 1 generates an acceleration a t , and moves toward the surface 1 of the object according to the acceleration.
[0097] S5053. Obtain a second position of the particle in the force field in the image frame at time t+1 according to the initial velocity and acceleration of the particle at the first position and the time difference between the image frame at time t+1 and the image frame at time t.
[0098] Specifically, the displacement S of the particle from time t to time t+1 can be obtained by the following formula: t+1 :
[0099]
[0100] Among them, T t+1 is the time difference between time t and time t+1.
[0101] Furthermore, according to the displacement S t+1 And the first position of particle a, the second position of particle a in the force field in the image frame at time t+1 is obtained, such as Figure 6 As shown in Figure (c).
[0102] It should be noted that the method for obtaining the second position of other particles in the particle system is similar to that of particle a, and will not be repeated here.
[0103] S506 , rendering and generating an image frame at time t+1 according to the second position of the particle in the image frame at time t+1, so as to obtain a particle special effect rendering result of the object to be rendered according to each image frame.
[0104] Furthermore, according to the second position of all particles in the particle system, each particle is drawn to obtain the following Figure 6 (d) shows the rendering results of each particle in the image frame at time t+1.
[0105] It should be understood that after obtaining the image frame at time t+1, the image frames at other times can be obtained in the same manner, and the video composed of these image frames in chronological order is the particle special effect rendering result of the object to be rendered.
[0106] It should be understood that as time goes by, all particles will get closer and closer to the surface of the object to be rendered, and eventually the shape of the object to be rendered will be formed by each particle. That is, the particle special effect rendering result is the process of each particle dynamically forming the shape of the object to be rendered.
[0107] In the embodiments of the present disclosure, by obtaining the force field of the object to be rendered and performing particle special effects rendering on the object to be rendered according to the force field, dynamic rendering of particles can be achieved, thereby achieving a more spectacular rendering effect. In addition, by providing two rendering methods, vector field and signed distance field, the solution of the present disclosure can be flexibly applied to various computing devices to improve development efficiency.
[0108] Corresponding to the particle special effects rendering method shown in the above embodiment, Figure 7 A schematic diagram of the structure of a particle special effect rendering device provided in an embodiment of the present disclosure. For ease of explanation, only the parts related to the embodiment of the present disclosure are shown, such as Figure 7 As shown, the particle special effect rendering device 700 includes:
[0109] A first acquisition module 701 is used to acquire an object to be rendered;
[0110] A generating module 702 is used to generate a force field corresponding to the object to be rendered based on the object to be rendered, wherein the force field includes one or more positions, and the vector value corresponding to the position is used to indicate the force exerted on the particle at the position;
[0111] The second acquisition module 703 is used for 3D texture mapping based on the force field, and obtains the second position of the particle in the force field in the image frame at the t+1th moment according to the vector value corresponding to the first position of the particle in the force field in the image frame at the tth moment, where t is a non-negative integer; the rendering module 704 is used to render and generate the image frame at the t+1th moment according to the second position of the particle in the image frame at the t+1th moment, so as to obtain the particle special effect rendering result of the object to be rendered according to the image frames corresponding to each moment in the preset time period.
[0112] According to one or more embodiments of the present disclosure, the second acquisition module 703 is specifically used to: obtain the force exerted on the particle at the first position according to the vector value corresponding to the particle at the first position; and obtain the second position of the particle in the force field in the image frame at the time t+1 according to the force exerted on the particle at the first position.
[0113] According to one or more embodiments of the present disclosure, the second acquisition module 703 is specifically used to: obtain the mass of the particle and the initial velocity of the particle at the first position; obtain the acceleration of the particle at the first position based on the force exerted on the particle at the first position and the mass of the particle; obtain the second position of the particle in the force field in the image frame at the t+1th time based on the initial velocity and acceleration of the particle at the first position and the time difference between the target image frame and the current image frame.
[0114] According to one or more embodiments of the present disclosure, the force field includes a vector field.
[0115] According to one or more embodiments of the present disclosure, the force field includes a signed distance field, which also includes the shortest distance between each position and the surface of the object to be rendered; the second acquisition module 703 is also used to: determine the shortest distance between the first position and the surface of the object to be rendered; and determine the force exerted on the particle at the first position based on the shortest distance and vector value corresponding to the first position.
[0116] The particle special effects rendering device provided in the embodiment of the present disclosure may be used to implement the technical solution of the particle special effects rendering method. The implementation principle and technical effects thereof are similar and will not be described in detail herein.
[0117] Figure 8A schematic diagram of the structure of an electronic device provided for an embodiment of the present disclosure. It shows a schematic diagram of the structure of an electronic device 800 suitable for implementing an embodiment of the present disclosure, and the electronic device 800 may be the above-mentioned terminal device or server. Among them, the terminal device may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, personal digital assistants (PDAs), tablet computers (Portable Android Devices, PADs), portable multimedia players (PMPs), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc.; the server may be an independent server, or it may be a service cluster, etc., which are not limited here.
[0118] It should be understood that Figure 8 The electronic device shown is only an example and should not bring any limitation to the functions and usage scope of the embodiments of the present disclosure.
[0119] like Figure 8 As shown, the electronic device 800 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage device 808 to a random access memory (RAM) 803. Various programs and data required for the operation of the electronic device 800 are also stored in the RAM 803. The processing device 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0120] Typically, the following devices may be connected to the I / O interface 805: input devices 806 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 807 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 808 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 809. The communication device 809 may allow the electronic device 800 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 8 The electronic device 800 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0121] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 809, or installed from a storage device 808, or installed from a ROM 802. When the computer program is executed by the processing device 801, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0122] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, device or device.
[0123] In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, device, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0124] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0125] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device executes the particle special effect rendering method shown in the above embodiment.
[0126] In some embodiments, computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0127] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0128] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware. The name of a unit does not limit the unit itself in some cases. For example, the first acquisition unit may also be described as a "unit for acquiring at least two Internet Protocol addresses".
[0129] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0130] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0131] In a first aspect, according to one or more embodiments of the present disclosure, a particle special effect rendering method is provided, comprising:
[0132] Acquire an object to be rendered; based on the object to be rendered, generate a force field corresponding to the object to be rendered, wherein the vector value corresponding to each position in the force field is used to indicate the force exerted on the particles at each position; based on a 3D texture map of the force field, obtain the second position of the particle in the force field in the image frame at the t+1th moment according to the vector value corresponding to the first position of the particle in the force field in the image frame at the tth moment, where t is a non-negative integer; render and generate the image frame at the t+1th moment according to the second position of the particle in the image frame at the t+1th moment, so as to obtain the particle special effect rendering result of the object to be rendered according to the image frames corresponding to each moment in a preset time period.
[0133] According to one or more embodiments of the present disclosure, obtaining the second position of the particle in the force field in the image frame at time t+1 according to the vector value corresponding to the first position of the particle in the force field in the image frame at time t includes: obtaining the force exerted on the particle at the first position according to the vector value corresponding to the particle at the first position; and obtaining the second position of the particle in the force field in the image frame at time t+1 according to the force exerted on the particle at the first position.
[0134] According to one or more embodiments of the present disclosure, obtaining a second position of the particle in the force field in an image frame at time t+1 according to the force exerted on the particle at the first position includes:
[0135] Obtain the mass of the particle and the initial velocity of the particle at the first position; obtain the acceleration of the particle at the first position according to the force exerted on the particle at the first position and the mass of the particle; obtain the second position of the particle in the force field in the image frame at the time t+1 according to the initial velocity of the particle at the first position, the acceleration, and the time difference between the image frame at the time t+1 and the image frame at the time t.
[0136] According to one or more embodiments of the present disclosure, the force field includes a vector field.
[0137] According to one or more embodiments of the present disclosure, the force field includes a signed distance field, and the signed distance field also includes the shortest distance between each of the positions and the surface of the object to be rendered;
[0138] The particle special effects rendering method also includes: determining the shortest distance between the first position and the surface of the object to be rendered; and determining the force exerted on the particle at the first position according to the shortest distance corresponding to the first position and the vector value.
[0139] According to one or more embodiments of the present disclosure, generating a force field corresponding to the object to be rendered based on the object to be rendered includes: acquiring a three-dimensional mesh model corresponding to the object to be rendered; and generating a force field of the object to be rendered based on the three-dimensional mesh model.
[0140] In a second aspect, according to one or more embodiments of the present disclosure, a particle special effect rendering device is provided, comprising: a first acquisition module, used to acquire an object to be rendered; a generation module, used to generate a force field corresponding to the object to be rendered based on the object to be rendered, wherein the force field includes one or more positions, and the vector value corresponding to the position is used to indicate the force exerted on the particle when the particle is at the position;
[0141] A second acquisition module is used to obtain, based on the 3D texture map of the force field, a second position of the particle in the force field in an image frame at time t+1 according to a vector value corresponding to the first position of the particle in the force field in an image frame at time t, where t is a non-negative integer;
[0142] The rendering module is used to render and generate the image frame at the time t+1 according to the second position of the particle in the image frame at the time t+1, so as to obtain the particle special effect rendering result of the object to be rendered according to the image frames corresponding to each time in the preset time period.
[0143] According to one or more embodiments of the present disclosure, the second acquisition module 703 is specifically used to: obtain the force exerted on the particle at the first position according to the vector value corresponding to the particle at the first position; and obtain the second position of the particle in the force field in the image frame at the time t+1 according to the force exerted on the particle at the first position.
[0144] According to one or more embodiments of the present disclosure, the second acquisition module 703 is specifically used to: obtain the mass of the particle and the initial velocity of the particle at the first position; obtain the acceleration of the particle at the first position based on the force acting on the particle at the first position and the mass of the particle; obtain the second position of the particle in the force field in the image frame at the time t+1 based on the initial velocity and acceleration of the particle at the first position and the time difference between the image frame at the time t+1 and the image frame at the time t.
[0145] According to one or more embodiments of the present disclosure, the force field includes a vector field.
[0146] According to one or more embodiments of the present disclosure, the force field includes a signed distance field, which also includes the shortest distance between each position and the surface of the object to be rendered; the second acquisition module 703 is also used to: determine the shortest distance between the first position and the surface of the object to be rendered; and determine the force exerted on the particle at the first position based on the shortest distance and vector value corresponding to the first position.
[0147] In a third aspect, according to one or more embodiments of the present disclosure, there is provided an electronic device comprising: at least one processor and a memory; the memory stores computer-executable instructions; the at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the particle special effects rendering method as described in the first aspect.
[0148] In a fourth aspect, according to one or more embodiments of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer execution instructions, and when a processor executes the computer execution instructions, the particle special effects rendering method as described in the first aspect is implemented.
[0149] In a fifth aspect, according to one or more embodiments of the present disclosure, a program product is provided, comprising: a computer program, characterized in that when the computer program is executed by a processor, it implements the particle special effects rendering method as described in the first aspect.
[0150] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0151] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0152] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A particle special effects rendering method, characterized in that: include: Get the object to be rendered; Based on the object to be rendered, generating a force field corresponding to the object to be rendered, wherein the force field includes one or more positions, and a vector value corresponding to the position is used to indicate a force exerted on a particle when the particle is at the position; Based on the 3D texture map of the force field, according to the vector value corresponding to the first position of the particle in the force field in the image frame at the tth time, obtaining the second position of the particle in the force field in the image frame at the t+1th time, where t is a non-negative integer, wherein the first position of the particle in the force field is determined according to the 3D texture map of the force field; The image frame at the time t+1 is rendered and generated according to the second position of the particle in the image frame at the time t+1, so as to obtain the particle special effect rendering result of the object to be rendered according to the image frames corresponding to each time in the preset time period.
2. The particle special effects rendering method according to claim 1, characterized in that: The step of obtaining the second position of the particle in the force field in the image frame at time t+1 according to the vector value corresponding to the first position of the particle in the force field in the image frame at time t comprises: Obtaining a force exerted on the particle at the first position according to a vector value corresponding to the particle at the first position; According to the force exerted on the particle at the first position, a second position of the particle in the force field in the image frame at time t+1 is obtained.
3. The particle special effects rendering method according to claim 2, characterized in that: The step of obtaining a second position of the particle in the force field in the image frame at time t+1 according to the force exerted on the particle at the first position comprises: Acquire the mass of the particle and the initial velocity of the particle at the first position; Obtaining the acceleration of the particle at the first position according to the force exerted on the particle at the first position and the mass of the particle; According to the initial velocity of the particle at the first position, the acceleration, and the time difference between the image frame at time t+1 and the image frame at time t, the second position of the particle in the force field in the image frame at time t+1 is obtained.
4. The particle special effects rendering method according to claim 3, characterized in that: The force field comprises a vector field.
5. The particle special effect rendering method according to claim 3, characterized in that: The force field includes a signed distance field, and the signed distance field also includes the shortest distance between each of the positions and the surface of the object to be rendered; the particle special effect rendering method also includes: Determining the shortest distance between the first position and the surface of the object to be rendered; The force exerted on the particle at the first position is determined according to the shortest distance corresponding to the first position and the vector value.
6. The particle special effect rendering method according to any one of claims 1 to 5, characterized in that: The generating a force field corresponding to the object to be rendered based on the object to be rendered includes: Obtaining a three-dimensional mesh model corresponding to the object to be rendered; Based on the three-dimensional grid model, a force field corresponding to the object to be rendered is generated.
7. A particle special effects rendering device, characterized in that: include: A first acquisition module, used to acquire an object to be rendered; A generating module, configured to generate a force field corresponding to the object to be rendered based on the object to be rendered, wherein the force field includes one or more positions, and a vector value corresponding to the position is used to indicate a force applied to a particle when the particle is at the position; a second acquisition module, configured to obtain, based on the 3D texture map of the force field and according to a vector value corresponding to the first position of the particle in the force field in the image frame at the time t+1, a second position of the particle in the force field in the image frame at the time t, where t is a non-negative integer, wherein the first position of the particle in the force field is determined according to the 3D texture map of the force field; The rendering module is used to render and generate the image frame at the time t+1 according to the second position of the particle in the image frame at the time t+1, so as to obtain the particle special effect rendering result of the object to be rendered according to the image frames corresponding to each moment in the preset time period.
8. An electronic device, characterized in that: include: at least one processor and memory; The memory stores computer-executable instructions; The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the particle special effect rendering method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions. When the processor executes the computer-executable instructions, the particle special effect rendering method according to any one of claims 1 to 6 is implemented.
10. A program product, characterized in that include: A computer program, which, when executed by a processor, implements the particle special effect rendering method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Rendering method and device of physical model, and electronic equipment
CN108846791A
Particle animation generation method and processing device, electronic equipment and storage medium
CN112270732A