A rendering method, device, system and storage medium for fluid particles
By interpolating and selecting non-adjacent frames for fluid particle rendering, the method addresses the performance limitations of mobile devices in rendering fluid particle trails, ensuring clear and efficient trail rendering in two-dimensional scenes.
Patent Information
- Application Number
- CN202111521903.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-13
- Publication Date
- 2025-07-15
- Estimated Expiration
- 2041-12-13
AI Technical Summary
The existing fluid particle tailing rendering schemes are limited in performance on mobile devices, and cannot effectively render the tailing effect of a large number of fluid particles. Especially when the speed of fluid particles is slow, the tailing effect is not obvious.
By obtaining the positions of the same fluid particles in continuous N frames in timing, inserting the positions of at least one frame, and selecting non-adjacent N frame positions for rendering, setting the particle size and attenuation curve, and performing melting processing, which is suitable for mobile devices.
It realizes effective tailing rendering of a large number of fluid particles on mobile devices, avoids the problem of insufficient tailing effect caused by slow fluid particles, and is suitable for rendering of fluid particles in two-dimensional scenes.
Smart Images

Figure CN114202598B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present disclosure relate to the field of computer technologies, and particularly to a method, apparatus, system, and storage medium for rendering fluid particles. Background Art
[0002] Currently, the trailing effect of fluid particles can be rendered in various ways.
[0003] For example, by using a Trail Renderer component to render a single particle to achieve the trailing effect of the particle. However, the Trail Renderer component generates multiple meshes behind the mesh corresponding to a single particle by using a mesh to complete the trailing rendering. For the trailing rendering of a large number of fluid particles in a two-dimensional scene, the Trail Renderer component will generate a large number of meshes, so it cannot be applied to mobile devices with limited performance.
[0004] Therefore, there is an urgent need to provide a trailing rendering solution for fluid particles to solve at least one of the foregoing technical problems. Summary of the Invention
[0005] To solve at least one problem existing in the prior art, at least one embodiment of the present disclosure provides a method, apparatus, system, and storage medium for rendering fluid particles.
[0006] In a first aspect, an embodiment of the present disclosure provides a method for rendering fluid particles, including:
[0007] Obtaining the positions of the same fluid particle in N consecutive frames in time series, where N is a positive integer greater than or equal to 2;
[0008] Interpolating at least one frame of position of the same fluid particle based on the positions of the N consecutive frames;
[0009] Selecting N non-adjacent frame positions from the positions of the N consecutive frames and the at least one frame of position;
[0010] Performing trailing rendering of the fluid particle based on the N non-adjacent frame positions.
[0011] In some embodiments, performing trailing rendering of the fluid particle based on the N non-adjacent frame positions includes:
[0012] Setting corresponding particle sizes and attenuation curves for the N non-adjacent frame positions respectively;
[0013] Performing metaball processing on the N non-adjacent frame positions based on the particle sizes and attenuation curves.
[0014] In some embodiments, setting corresponding particle sizes for the N non-adjacent frame positions respectively includes:
[0015] The particle sizes corresponding to non - adjacent N - frame positions increase with the increase of the time sequence.
[0016] In some embodiments, before performing the ball - melting process on non - adjacent N - frame positions based on the particle size and the decay curve, the rendering method of fluid particles further includes:
[0017] Converting the non - adjacent N - frame positions to N - frame screen positions in the screen coordinate system;
[0018] Based on the N - frame screen positions, determining the distance between two adjacent frame screen positions;
[0019] Based on the particle sizes corresponding to two adjacent frame screen positions respectively, determining a distance threshold corresponding to two adjacent frame screen positions;
[0020] If the distance between two adjacent frame screen positions is greater than or equal to the distance threshold, reducing the distance between two adjacent frame screen positions.
[0021] In some embodiments, the distance threshold corresponding to two adjacent frame screen positions is determined by the following formula:
[0022] Distance threshold = a×particle size 1 + b×particle size 2;
[0023] Wherein, a and b are preset constants, and particle size 1 and particle size 2 are the particle sizes corresponding to two adjacent frame screen positions respectively.
[0024] In some embodiments, the N - frame screen positions include: the first - frame screen position, the third - frame screen position, and the fifth - frame screen position;
[0025] Reducing the distance between two adjacent frame screen positions includes:
[0026] Fixing the first - frame screen position, adjusting the third - frame screen position until the distance between the first - frame screen position and the adjusted third - frame screen position is less than the first distance threshold; the first distance threshold is a threshold determined based on the particle sizes corresponding to the first - frame screen position and the third - frame screen position respectively;
[0027] Fixing the adjusted third - frame screen position, adjusting the fifth - frame screen position until the distance between the adjusted third - frame screen position and the adjusted fifth - frame screen position is less than the second distance threshold; the second distance threshold is a threshold determined based on the particle sizes corresponding to the third - frame screen position and the fifth - frame screen position respectively.
[0028] In some embodiments, reducing the distance between two adjacent frame screen positions includes:
[0029] Fixing any one of the two adjacent frame screen positions;
[0030] Determine a distance vector corresponding to the screen positions of two adjacent frames based on a fixed position;
[0031] Based on the fixed position, the distance vector, the distance between the screen positions of two adjacent frames, and a distance threshold, determine the screen position after distance reduction.
[0032] In some embodiments, the screen position after distance reduction is determined by the following formula:
[0033] Screen position after distance reduction = fixed position + distance vector × (distance threshold ÷ distance between the screen positions of two adjacent frames).
[0034] In some embodiments, the interpolating at least one frame position of the same fluid particle based on the positions of consecutive N frames includes:
[0035] If N is less than or equal to a preset frame number threshold, then centered on the position of the Nth frame, at least one of the positions from the 1st frame to the (N - 1)th frame is symmetrically transformed to obtain at least one frame position of the same fluid particle.
[0036] In some embodiments, the selecting N non - adjacent frame positions from the positions of consecutive N frames and the at least one frame position includes:
[0037] Select X frames from the positions of consecutive N frames and Y frames from the at least one frame position; wherein, X is a positive integer less than N, Y is a positive integer greater than or equal to 1, and X + Y = N.
[0038] In some embodiments, the consecutive N frames are consecutive 3 frames, and the preset frame number threshold is 3 frames.
[0039] In some embodiments, the interpolating at least one frame position of the same fluid particle based on the positions of consecutive N frames includes:
[0040] Centered on the position of the 3rd frame, the position of the 1st frame is symmetrically transformed to obtain the position of the 5th frame of the same fluid particle.
[0041] In some embodiments, the selecting N non - adjacent frame positions from the positions of consecutive N frames and the at least one frame position includes:
[0042] Select the position of the 1st frame, the position of the 3rd frame, and the position of the 5th frame.
[0043] In a second aspect, an embodiment of the present disclosure provides a rendering device for fluid particles, including:
[0044] An acquisition unit, configured to acquire the positions of the same fluid particle in N consecutive frames in time series, where N is a positive integer greater than or equal to 2;
[0045] An interpolation unit for interpolating at least one frame of positions of the same fluid particle based on the positions of consecutive N frames;
[0046] A selection unit for selecting N non - adjacent frames of positions from the positions of consecutive N frames and at least one frame of positions;
[0047] A rendering unit for performing trailing rendering of fluid particles based on the N non - adjacent frames of positions.
[0048] In a third aspect, an embodiment of the present disclosure also provides a system including at least one computing device and at least one storage device storing instructions, wherein when the instructions are run by the at least one computing device, the at least one computing device is caused to execute the steps of the fluid particle rendering method according to any embodiment of the first aspect.
[0049] In a fourth aspect, an embodiment of the present disclosure also provides a computer - readable storage medium storing a program or instructions, which when run by at least one computing device, cause the at least one computing device to execute the steps of the fluid particle rendering method according to any embodiment of the first aspect.
[0050] It can be seen that in at least one embodiment of the present disclosure, after obtaining the positions of consecutive N frames of the same fluid particle in time sequence, instead of directly performing metaball processing on these N frames of positions, at least one frame of positions of the fluid particle is interpolated based on these N frames of positions, and then N non - adjacent frames of positions are selected from the positions of consecutive N frames and the at least one frame of positions interpolated, so as to perform trailing rendering of the fluid particle based on the N non - adjacent frames of positions, avoiding the problem of unclear trailing effect caused by the close distance of the positions of consecutive N frames due to the slow speed of the fluid particle, and being applicable to the trailing rendering of a large number of fluid particles in a two - dimensional scene. Description of the Drawings
[0051] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following will briefly introduce the drawings required for use in the embodiments or the description of the prior art. Obviously, the following drawings are only some embodiments of the present disclosure, and those of ordinary skill in the art can also obtain other drawings based on these drawings.
[0052] Figure 1 An exemplary flowchart of a fluid particle rendering method provided by an embodiment of the present disclosure;
[0053] Figure 2 A schematic diagram of a fluid particle rendering process provided by an embodiment of the present disclosure;
[0054] Figure 3It is a schematic diagram of a process for adjusting the distance between adjacent particles provided by an embodiment of the present disclosure;
[0055] Figure 4 It is an exemplary flowchart of another method for rendering fluid particles provided by an embodiment of the present disclosure;
[0056] Figure 5 It is an exemplary flowchart of yet another method for rendering fluid particles provided by an embodiment of the present disclosure;
[0057] Figure 6 It is a schematic diagram of a process for rendering fluid particles provided by an embodiment of the present disclosure;
[0058] Figure 7 It is another schematic diagram of a process for adjusting the distance between adjacent particles provided by an embodiment of the present disclosure;
[0059] Figure 8 It is an exemplary block diagram of a device for rendering fluid particles provided by an embodiment of the present disclosure;
[0060] Figure 9 It is an exemplary block diagram of a system including at least one computing device and at least one storage device storing instructions provided by an embodiment of the present disclosure;
[0061] Figure 10 It is a schematic diagram of a disconnection phenomenon provided by an embodiment of the present disclosure;
[0062] Figure 11 It is a schematic diagram of a trailing effect in the shape of a water droplet provided by an embodiment of the present disclosure. Detailed implementation manners
[0063] In order to more clearly understand the above objects, features, and advantages of the present disclosure, the present disclosure will be further described in detail below with reference to the accompanying drawings and embodiments. It can be understood that the described embodiments are part of the embodiments of the present disclosure, rather than all of the embodiments. The specific embodiments described herein are only used to explain the present disclosure, rather than limiting the present disclosure. All other embodiments obtained by those of ordinary skill in the art based on the described embodiments of the present disclosure fall within the scope of protection of the present disclosure.
[0064] It should be noted that in this text, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations.
[0065] Figure 1 It is an exemplary flowchart of a method for rendering fluid particles provided by an embodiment of the present disclosure. The execution subject of this rendering method can be a server or a mobile terminal.
[0066] The rendering method may include, but is not limited to, the following steps 101 to 104:
[0067] In step 101, the positions of the same fluid particle in N consecutive frames in time sequence are obtained, where N is a positive integer greater than or equal to 2.
[0068] The fluid particle is a particle generated in the simulation space by a vertex shader. In some embodiments, the simulation space is a square planar region, and the aspect ratio of the planar region can be set to 16:9 to meet the aspect ratio of the screen of the server or the mobile device. For example, the Y-axis coordinate range of the simulation space is from -27.2 to +27.2, the X-axis coordinate range of the simulation space is from -15.3 to +15.3, and the origin of the simulation space is at the center position of the simulation space.
[0069] The above-mentioned simulation space can be understood as a particle space. Therefore, the positions of the same fluid particle in N consecutive frames in time sequence can be understood as the particle space positions of the fluid particle in N consecutive frames in time sequence.
[0070] The positions of the same fluid particle in N consecutive frames in time sequence are denoted as: the position of the first frame, the position of the second frame, the position of the third frame,..., the position of the Nth frame, where the position of the first frame can be understood as the position of the current frame of the fluid particle, and the positions of the second frame to the Nth frame can be understood as the positions of the historical frames of the fluid particle.
[0071] In step 102, based on the positions of the N consecutive frames, at least one frame of position of the same fluid particle is interpolated.
[0072] Based on the positions of the N consecutive frames, the position of the (N + 1)th frame, the position of the (N + 2)th frame, and even more frame positions of the same fluid particle can be interpolated. The trajectory formed by these N consecutive frame positions and the multiple frame positions interpolated constitutes a straight line or a curve (such as a Bezier curve).
[0073] In step 103, N non-adjacent frame positions are selected from the N consecutive frame positions and at least one frame of position.
[0074] X frames are selected from the N consecutive frame positions, and Y frames are selected from at least one frame of position; where X is a positive integer less than N, Y is a positive integer greater than or equal to 1, and X + Y = N.
[0075] In step 104, a trailing rendering of the fluid particle is performed based on the N non-adjacent frame positions.
[0076] In this embodiment, metaball processing can be performed based on N non-adjacent frame positions to achieve the trailing effect of the fluid particles. The specific process of metaball processing is a mature technology in the art and will not be elaborated here.
[0077] It can be seen that after obtaining the positions of the same fluid particle in N consecutive frames in time sequence in this embodiment, instead of directly performing metaball processing on the positions of these N frames, at least one frame of position of the fluid particle is interpolated based on the positions of these N frames, and then N non-adjacent frame positions are selected from the positions of the consecutive N frames and the at least one frame of position obtained by interpolation, so as to perform trailing rendering of the fluid particle based on the N non-adjacent frame positions, avoiding the problem that the trailing effect is not obvious due to the close distance of the positions of the consecutive N frames caused by the slow speed of the fluid particle, and being applicable to the trailing rendering of fluid particles in a two-dimensional scene.
[0078] Figure 2 It is a schematic diagram of a trailing rendering process of a fluid particle provided by an embodiment of the present disclosure, applicable to Figure 1 step 104 in Figure 2 As shown, performing trailing rendering of fluid particles based on N non-adjacent frame positions may include, but is not limited to, the following steps 201 and 202:
[0079] In step 201, corresponding particle sizes and attenuation curves are set for the N non-adjacent frame positions respectively.
[0080] The particle size can be understood as the diameter of the particle. By setting the particle size, different trailing effects can be achieved. For example, increasing the particle size corresponding to the N non-adjacent frame positions with the increase of time sequence, the final metaball processing can achieve a trailing effect in the shape of a water droplet.
[0081] The attenuation curve is the attenuation curve of the alpha channel of the particle from the center to the outside. The alpha channel represents transparency. Therefore, the center of the particle is opaque and gradually becomes transparent from the center to the outside according to the attenuation curve. In some embodiments, the attenuation curve is a cubic attenuation curve or a quintic attenuation curve.
[0082] In step 202, metaball processing is performed on the N non-adjacent frame positions based on the particle size and the attenuation curve.
[0083] After setting the particle size and the attenuation curve, the particle at a certain frame position gradually becomes transparent from the center to the outside, and the particle at another frame position also gradually becomes transparent from the center to the outside. Therefore, the particles at these two frame positions will produce a superimposed effect at the edge, resulting in a change in the alpha channel, that is, a change in transparency.
[0084] Therefore, a transparency threshold can be set to determine whether the transparency after the particles at these two frame positions are superimposed at the edge is greater than or equal to the transparency threshold. If it is greater than or equal to the threshold, the particles at these two frame positions are subjected to sphere fusion processing.
[0085] In some embodiments, considering the scenario where the fluid particles have a relatively high speed, if the distance between two frame positions is relatively far, it may not be possible to complete the particle fusion between these two frame positions, resulting in a disconnection phenomenon. The disconnection phenomenon is as Figure 10 shown. Whether it is a cubic attenuation curve or a fifth-power attenuation curve, there is a disconnection phenomenon. Therefore, to solve the disconnection problem, before performing sphere fusion processing on N non-adjacent frame positions, it is necessary to first reduce the distance between adjacent particles.
[0086] Figure 3 FIG. is a schematic diagram of a process for adjusting the distance between adjacent particles provided by an embodiment of the present disclosure. This process is applied before Figure 2 the step 202 shown in, as Figure 3 shown, and may include, but is not limited to, the following steps 301 to 304:
[0087] In step 301, N non-adjacent frame positions are converted to N screen positions in the screen coordinate system.
[0088] Since the positions of the same fluid particle obtained for N consecutive frames in time sequence are the particle space positions of the fluid particle for N consecutive frames in time sequence, rather than the screen space positions of the mobile device, therefore, based on the particle space positions of N consecutive frames, at least one frame position of the same fluid particle interpolated is also a position in the particle space, rather than the screen space position of the mobile device. So, among the N consecutive frame positions and at least one frame position, N non-adjacent frame positions selected are also positions in the particle space, rather than the screen space positions of the mobile device.
[0089] In this embodiment, converting N non-adjacent frame positions from the particle space to N screen positions in the screen coordinate system specifically includes, first, normalizing the N non-adjacent frame positions, and then converting them to N screen positions in the screen coordinate system. The formula is as follows:
[0090] Screen position = Particle space position ÷ Particle space size × (Screen size ÷ 2).
[0091] Among them, Particle space position ÷ Particle space size is the normalization process.
[0092] In step 302, based on the N screen positions, the distance between adjacent two screen positions is determined.
[0093] The distance between adjacent two screen positions can be solved using an existing distance calculation formula.
[0094] In step 303, based on the particle sizes corresponding to the screen positions of two adjacent frames, a distance threshold corresponding to the screen positions of the two adjacent frames is determined.
[0095] In this embodiment, the distance threshold corresponding to the screen positions of two adjacent frames is determined by the following formula:
[0096] Distance threshold = a × Particle size 1 + b × Particle size 2;
[0097] Where a and b are preset constants, and Particle size 1 and Particle size 2 are the particle sizes corresponding to the screen positions of two adjacent frames respectively.
[0098] In step 304, if the distance between the screen positions of two adjacent frames is greater than or equal to the distance threshold, the distance between the screen positions of the two adjacent frames is reduced.
[0099] In some embodiments, reducing the distance between the screen positions of two adjacent frames includes the following three steps S1 to S3:
[0100] S1. Fix any one of the screen positions of the two adjacent frames.
[0101] S2. Determine the distance vector corresponding to the screen positions of the two adjacent frames based on the fixed position.
[0102] S3. Determine the screen position after distance reduction based on the fixed position, the distance vector, the distance between the screen positions of the two adjacent frames, and the distance threshold.
[0103] In this embodiment, the screen position after distance reduction is determined by the following formula:
[0104] Screen position after distance reduction = Fixed position + Distance vector × (Distance threshold ÷ Distance between the screen positions of the two adjacent frames).
[0105] After reducing the distance between the screen positions of two adjacent frames, the screen positions of N frames are converted into normalized coordinates, and then step 202 shown below is executed: Based on the particle size and the attenuation curve, sphere melting processing is performed on the non-adjacent N frame positions. It should be noted that the non-adjacent N frame positions are the N frame positions of the normalized coordinates. Figure 2 Shown in
[0106] It can be seen that in the above embodiments, by setting a distance threshold, when the distance between adjacent particles is greater than or equal to the distance threshold, the position of the particle that appears earlier is changed to make it closer to the position of the particle in the current frame, avoiding the phenomenon of disconnection when the particle movement speed is fast. In addition, by setting the particle size and the attenuation curve, different trailing effects can be achieved. For example, the particle sizes corresponding to the positions of N non-adjacent frames are increased as the time sequence increases, and finally, the metaball processing can achieve a trailing effect in the shape of a water droplet. The trailing effect in the shape of a water droplet is as Figure 11 shown.
[0107] Figure 4 FIG. is an exemplary flowchart of a method for rendering fluid particles provided by an embodiment of the present disclosure. As Figure 4 shown, it includes the following steps 401 to 404:
[0108] In step 401, the positions of the same fluid particle in N consecutive frames in time sequence are obtained, where N is a positive integer greater than or equal to 2.
[0109] In step 402, if N is less than or equal to a preset frame number threshold, at least one of the positions from the 1st frame to the (N - 1)th frame is symmetrically arranged with the position of the Nth frame as the center, obtaining at least one frame of position of the same fluid particle.
[0110] In step 403, N non-adjacent frames of positions are selected from the consecutive N frames of positions and the at least one frame of position.
[0111] X frames are selected from the consecutive N frames of positions, and Y frames are selected from the at least one frame of position; where X is a positive integer less than N, Y is a positive integer greater than or equal to 1, and X + Y = N.
[0112] In step 404, trailing rendering of the fluid particle is performed based on the N non-adjacent frames of positions.
[0113] Among them, steps 401, 403, and 404 are the same as Figure 1 steps 101, 103, and 104 in, and will not be described in detail.
[0114] It can be seen that in this embodiment, after obtaining the positions of the same fluid particle in N consecutive frames in time sequence, instead of directly performing metaball processing on these N frames of positions, at least one frame of position of the fluid particle is interpolated based on these N frames of positions. Then, N non-adjacent frames of positions are selected from the consecutive N frames of positions and the at least one frame of position obtained by interpolation, so as to perform trailing rendering of the fluid particle based on the N non-adjacent frames of positions, avoiding the problem of unclear trailing effect caused by the close distance between the positions of the consecutive N frames due to the slow speed of the fluid particle, and being applicable to the trailing rendering of fluid particles in a two-dimensional scene.
[0115] Currently, due to the performance limitations of mobile devices such as smartphones and tablets, usually only the positions of the same fluid particle in 3 consecutive frames in time series are recorded, that is, the movement path of the same fluid particle. For example, the position of the fluid particle in the current frame is recorded as the position of the 1st frame, the position of the fluid particle in the previous frame of the current frame is recorded as the position of the 2nd frame, and so on. The earlier the time, the larger the corresponding frame number. Therefore, the mobile device does not record the positions of the fluid particle in the 4th frame and the 5th frame.
[0116] However, when the movement speed of the fluid particle is small, for example, when gently shaking a water cup and the water droplets splash out with a small speed, the positions of the water droplets in 3 consecutive frames in time series may be relatively close, so that they cannot be distinguished. If the positions of 3 consecutive frames are directly used for metaball processing, the trailing effect is not obvious.
[0117] Therefore, in at least one embodiment of the present disclosure, after obtaining the positions of the same fluid particle in 3 consecutive frames in time series, instead of directly performing metaball processing on the positions of these 3 frames, at least one frame of position of the fluid particle is interpolated based on the positions of these 3 frames. Then, 3 non-adjacent frames of positions are selected from the positions of 3 consecutive frames and the at least one frame of position interpolated, so as to perform trailing rendering of the fluid particle based on the 3 non-adjacent frames of positions, avoiding the problem of unobvious trailing effect caused by the relatively close positions of 3 consecutive frames due to the slow speed of the fluid particle, and being applicable to trailing rendering of a large number of fluid particles in a two-dimensional scene and applicable to mobile devices.
[0118] Figure 5 It is an exemplary flowchart of a rendering method for a fluid particle provided by an embodiment of the present disclosure. The execution subject of the rendering method is a mobile device, such as a smartphone, a tablet computer, or other mobile devices. The rendering method may include but is not limited to the following steps 501 to step 504:
[0119] In step 501, obtain the positions of the same fluid particle in 3 consecutive frames in time series.
[0120] Among them, the fluid particle is a particle generated in a simulation space by a vertex shader. In some embodiments, the simulation space is a square planar region, and the aspect ratio of the planar region can be set to 16:9 to meet the aspect ratio of the screen of the mobile device. For example, the Y-axis coordinate range of the simulation space is from -27.2 to +27.2, the X-axis coordinate range of the simulation space is from -15.3 to +15.3, and the origin of the simulation space is at the center position of the simulation space.
[0121] The aforementioned simulation space can be understood as a particle space. Therefore, the positions of the same fluid particle in three consecutive frames in time sequence can be understood as the positions of the fluid particle in the particle space in three consecutive frames in time sequence.
[0122] The positions of the same fluid particle in three consecutive frames in time sequence are denoted as: the position of the first frame, the position of the second frame, and the position of the third frame. Among them, the position of the first frame can be understood as the position of the current frame of the fluid particle, and the positions of the second frame and the third frame can be understood as the positions of the historical frames of the fluid particle.
[0123] In step 502, based on the positions of three consecutive frames, at least one frame of position of the same fluid particle is interpolated.
[0124] Based on the positions of three consecutive frames, the position of the fourth frame, the position of the fifth frame, and even more frames of the same fluid particle can be interpolated. The trajectory formed by these three consecutive frames of positions and the three frames of positions interpolated constitutes a straight line or a curve (such as a Bezier curve).
[0125] In step 503, three non-adjacent frames of positions are selected from the positions of three consecutive frames and at least one frame of position.
[0126] For example, if the positions of the fourth frame and the fifth frame are interpolated, then, the positions of frames 1, 2, 4 can be selected, the positions of frames 1, 2, 5 can be selected, the positions of frames 1, 3, 4 can be selected, and the positions of frames 1, 3, 5 can be selected.
[0127] In step 504, the trailing rendering of the fluid particle is performed based on the three non-adjacent frames of positions.
[0128] In this embodiment, metaball processing can be performed based on the three non-adjacent frames of positions to achieve the trailing effect of the fluid particle. Among them, the specific process of metaball processing is a mature technology in the art and will not be elaborated.
[0129] It can be seen that in this embodiment, after obtaining the positions of the same fluid particle in three consecutive frames in time sequence, metaball processing is not directly performed on these three frames of positions. Instead, based on these three frames of positions, at least one frame of position of the fluid particle is interpolated. Then, three non-adjacent frames of positions are selected from the positions of three consecutive frames and the at least one frame of position interpolated. Thus, the trailing rendering of the fluid particle is performed based on the three non-adjacent frames of positions, avoiding the problem of unclear trailing effect caused by the close distance of the positions of three consecutive frames due to the slow speed of the fluid particle, and being applicable to the trailing rendering of fluid particles in a two-dimensional scene and applicable to mobile devices.
[0130] In some embodiments, due to the performance limitations of the mobile device, only 3 frames of images can be processed for metaball, and in order to avoid the problem that the trailing effect is not obvious due to the relatively close positions of three consecutive frames, in this embodiment, after obtaining the positions of the same fluid particle in three consecutive frames in time sequence, only the position of the first frame and the position of the third frame are retained, and the position of the second frame is discarded. In addition, in order to make up 3 frames, in this embodiment, the position of the fifth frame of the same fluid particle is obtained by interpolation. For example, with the position of the third frame as the center, the position of the first frame is centrosymmetric to obtain the position of the fifth frame of the same fluid particle. In this way, this embodiment performs trailing rendering of the fluid particle based on the positions of the first, third, and fifth frames.
[0131] Figure 6 Another schematic diagram of the rendering process of fluid particles provided by an embodiment of the present disclosure is applicable to Figure 5 step 504 in. As Figure 6 shown, the trailing rendering of fluid particles based on three non-adjacent frame positions may include, but is not limited to, the following steps 601 and 602:
[0132] In step 601, corresponding particle sizes and attenuation curves are set for three non-adjacent frame positions respectively.
[0133] The particle size can be understood as the diameter of the particle. By setting the particle size, different trailing effects can be achieved. For example, the particle sizes corresponding to three non-adjacent frame positions increase with the increase of time sequence, and finally, the metaball processing can achieve a trailing effect in the shape of a water droplet. Taking the positions of the first, third, and fifth frames as an example, the positions of the first, third, and fifth frames arranged in increasing order of time sequence are recorded as the positions of the fifth, third, and first frames. Among them, the position of the first frame can be understood as the current frame position, and the third and fifth frames are historical frame positions. Then, the particle size corresponding to the first frame position is set to be the largest, and the particle sizes corresponding to the third frame position and the fifth frame position decrease.
[0134] The attenuation curve is the attenuation curve of the alpha channel of the particle from the center of the circle outwards. The alpha channel represents transparency. Therefore, the center of the particle is opaque and gradually becomes transparent from the center outwards according to the attenuation curve. In some embodiments, the attenuation curve is a cubic attenuation curve or a fifth-power attenuation curve.
[0135] In step 602, based on the particle size and the attenuation curve, metaball processing is performed on three non-adjacent frame positions.
[0136] Taking the 1st, 3rd, and 5th frame positions as examples, after setting the particle size and decay curve, the particles at the 1st frame position gradually become transparent from the center outwards, and the particles at the 3rd frame position also gradually become transparent from the center outwards. Therefore, the particles at the 1st frame position and the 3rd frame position will produce a superimposed effect at the edge, resulting in a change in the alpha channel, that is, a change in transparency.
[0137] Therefore, a transparency threshold can be set to determine whether the transparency after the particles at the 1st frame position and the 3rd frame position are superimposed at the edge is greater than or equal to the transparency threshold. If it is greater than or equal to, the particles at the 1st frame position and the 3rd frame position are subjected to sphere melting processing. In addition, for the particles at the 3rd frame position and the 5th frame position, it can be determined whether the transparency after the particles at the 3rd frame position and the 5th frame position are superimposed at the edge is greater than or equal to the transparency threshold. If it is greater than or equal to, the particles at the 3rd frame position and the 5th frame position are subjected to sphere melting processing. In this way, after completing the sphere melting processing of the particles at the 1st, 3rd, and 5th frame positions, a trailing effect in the shape of a water droplet can be achieved.
[0138] In some embodiments, considering the scenario where the fluid particles move relatively fast, the distance between the 1st, 3rd, and 5th frame positions is relatively far, then it may not be possible to complete the particle fusion, resulting in a disconnection phenomenon, as shown in Figure 10 Whether it is a cubic decay curve or a fifth-power decay curve, there is a disconnection phenomenon. Therefore, to solve the disconnection problem, before performing sphere melting processing on three non-adjacent frame positions, it is necessary to first reduce the distance between adjacent particles.
[0139] Figure 7 FIG. is a schematic diagram of a process for adjusting the distance between adjacent particles provided by an embodiment of the present disclosure. This process is applied before step 602 shown in Figure 6 As shown in Figure 7 it may include but is not limited to the following steps 701 to 704:
[0140] In step 701, three non-adjacent frame positions are converted into three screen positions in the screen coordinate system.
[0141] Since the positions of three consecutive frames of the same fluid particle obtained are the particle space positions of the same fluid particle in three consecutive frames in time sequence, rather than the screen space positions of the mobile terminal, therefore, based on the particle space positions of three consecutive frames, interpolating to obtain at least one frame position of the same fluid particle is also a position in the particle space, rather than the screen space position of the mobile terminal. So, from the three consecutive frame positions and at least one frame position, selecting three non-adjacent frame positions is also a position in the particle space, rather than the screen space position of the mobile terminal.
[0142] In this embodiment, three non - adjacent frame positions are converted from the particle space to three screen positions in the screen coordinate system. Specifically, first, the three non - adjacent frame positions are normalized, and then they are converted to three screen positions in the screen coordinate system. The formula is as follows:
[0143] Screen position = Particle space position ÷ Particle space size × (Screen size ÷ 2).
[0144] Among them, Particle space position ÷ Particle space size is the normalization process.
[0145] For example, the particle space position of the first frame is denoted as (firstPos.x, firstPos.y). The particle space size is 15.3×27.2, that is, the Y - axis coordinate range of the particle space is from - 27.2 to + 27.2, and the X - axis coordinate range of the particle space is from - 15.3 to + 15.3. The screen size is 720×1280. Then, the screen position of the first frame is denoted as (firstPos.x÷15.3×360, firstPos.y÷27.2×640).
[0146] Another example, the particle space position of the third frame is denoted as (thirdPos.x, thirdPos.y). Then, the screen position of the third frame is denoted as (thirdPos.x÷15.3×360, thirdPos.y÷27.2×640).
[0147] Another example, the particle space position of the fifth frame is denoted as (fifthPos.x, fifthPos.y). Then, the screen position of the fifth frame is denoted as (fifthPos.x÷15.3×360, fifthPos.y÷27.2×640).
[0148] In step 702, based on the three screen positions, the distance between two adjacent screen positions is determined.
[0149] Taking the screen positions of the first, third, and fifth frames as an example, the screen positions of the first frame and the third frame are two adjacent screen positions, and the screen positions of the third frame and the fifth frame are also two adjacent screen positions. The distance between two adjacent screen positions can be solved using the existing distance calculation formula.
[0150] In step 703, based on the particle sizes corresponding to two adjacent screen positions respectively, the distance threshold corresponding to two adjacent screen positions is determined.
[0151] In this embodiment, the distance threshold corresponding to two adjacent screen positions is determined by the following formula:
[0152] Distance threshold = a×Particle size 1 + b×Particle size 2;
[0153] Wherein, a and b are preset constants, and particle size 1 and particle size 2 are the particle sizes corresponding to the respective adjacent two-frame screen positions.
[0154] Taking the screen positions of frames 1, 3, and 5 as an example, the screen positions of the first frame and the third frame are adjacent two-frame screen positions, and the corresponding distance threshold is denoted as the first distance threshold. Then, the first distance threshold = a × the particle size corresponding to the screen position of the first frame + b × the particle size corresponding to the screen position of the third frame. Additionally, the screen positions of the third frame and the fifth frame are adjacent two-frame screen positions, and the corresponding distance threshold is denoted as the second distance threshold. Then, the second distance threshold = a × the particle size corresponding to the screen position of the third frame + b × the particle size corresponding to the screen position of the fifth frame.
[0155] In step 704, if the distance between adjacent two-frame screen positions is greater than or equal to the distance threshold, the distance between the adjacent two-frame screen positions is reduced.
[0156] Taking the screen positions of frames 1, 3, and 5 as an example, if the distance between the screen positions of the first frame and the third frame is greater than or equal to the first distance threshold, the screen position of the first frame is fixed, and the screen position of the third frame is adjusted until the distance between the screen position of the first frame and the adjusted screen position of the third frame is less than the first distance threshold.
[0157] Additionally, if the distance between the adjusted screen position of the third frame and the screen position of the fifth frame is greater than or equal to the second distance threshold, the adjusted screen position of the third frame is fixed, and the screen position of the fifth frame is adjusted until the distance between the adjusted screen position of the third frame and the adjusted screen position of the fifth frame is less than the second distance threshold.
[0158] It should be noted that if the distance between the screen positions of the first frame and the third frame is less than the first distance threshold, there is no need to adjust this distance. At the same time, if the distance between the screen positions of the third frame and the fifth frame is greater than or equal to the second distance threshold, the screen position of the third frame is fixed, and the screen position of the fifth frame is adjusted until the distance between the screen position of the third frame and the adjusted screen position of the fifth frame is less than the second distance threshold.
[0159] In some embodiments, reducing the distance between adjacent two-frame screen positions includes the following three steps S1 to S3:
[0160] S1. Fix any one of the adjacent two-frame screen positions.
[0161] Taking the screen positions of frames 1, 3, and 5 as an example, if the distance between the screen positions of the first frame and the third frame is greater than or equal to the first distance threshold, the screen position of the first frame is fixed.
[0162] If the distance between the adjusted screen position of the third frame and the screen position of the fifth frame is greater than or equal to the second distance threshold, fix the adjusted screen position of the third frame.
[0163] If the distance between the screen position of the third frame and the screen position of the fifth frame is greater than or equal to the second distance threshold, fix the screen position of the third frame.
[0164] S2. Determine the distance vector corresponding to the adjacent two-frame screen positions based on the fixed position.
[0165] After fixing the screen position of the first frame, the distance vector between the screen position of the first frame and the screen position of the third frame is the vector obtained by (the screen position of the first frame - the screen position of the third frame).
[0166] After fixing the adjusted screen position of the third frame, the distance vector between the adjusted screen position of the third frame and the screen position of the fifth frame is the vector obtained by (the adjusted screen position of the third frame - the screen position of the fifth frame).
[0167] After fixing the screen position of the third frame, the distance vector between the screen position of the third frame and the screen position of the fifth frame is the vector obtained by (the screen position of the third frame - the screen position of the fifth frame).
[0168] S3. Determine the screen position with reduced distance based on the fixed position, the distance vector, the distance between the adjacent two-frame screen positions, and the distance threshold.
[0169] In this embodiment, the screen position with reduced distance is determined by the following formula:
[0170] The screen position with reduced distance = the fixed position + the distance vector × (the distance threshold ÷ the distance between the adjacent two-frame screen positions).
[0171] Taking the screen positions of frames 1, 3, and 5 as an example, if the screen position of the first frame is fixed and the screen position of the third frame is adjusted, then the adjusted screen position of the third frame = the screen position of the first frame + the distance vector between the screen position of the first frame and the screen position of the third frame × (the first distance threshold ÷ the distance between the screen position of the first frame and the screen position of the third frame).
[0172] If the adjusted screen position of the third frame is fixed and the screen position of the fifth frame is adjusted, then the adjusted screen position of the fifth frame = the adjusted screen position of the third frame + the distance vector between the adjusted screen position of the third frame and the screen position of the fifth frame × (the second distance threshold ÷ the distance between the adjusted screen position of the third frame and the screen position of the fifth frame).
[0173] If the screen position of the third frame is fixed and the screen position of the fifth frame is adjusted, then the adjusted screen position of the fifth frame = the screen position of the third frame + the distance vector between the screen positions of the third frame and the fifth frame × (the second distance threshold ÷ the distance between the screen positions of the third frame and the fifth frame).
[0174] After reducing the distance between the screen positions of two adjacent frames, convert the screen positions of three frames into normalized coordinates, and then execute Figure 2 Step 202 shown: Based on the particle size and the decay curve, perform sphere melting processing on the positions of three non-adjacent frames. It should be noted that the three non-adjacent frames are the positions of three frames in normalized coordinates.
[0175] It can be seen that in the above embodiments, by setting the distance threshold, when the distance between adjacent particles is greater than or equal to the distance threshold, change the position of the particle that appears earlier so that it is closer to the position of the particle in the current frame, avoiding the phenomenon of disconnection when the particle movement speed is fast. In addition, by setting the particle size and the decay curve, different trailing effects can be achieved. For example, the particle size corresponding to the positions of three non-adjacent frames increases with the increase of time sequence, and finally the sphere melting processing can achieve a trailing effect in the shape of a water droplet, and the trailing effect in the shape of a water droplet is as Figure 11 shown.
[0176] It should be noted that for the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art can understand that the embodiments of the present disclosure are not limited by the described action sequence, because according to the embodiments of the present disclosure, certain steps can be performed in other sequences or simultaneously. In addition, those skilled in the art can understand that the embodiments described in the specification are all optional embodiments.
[0177] Figure 8 A rendering device for fluid particles provided by an embodiment of the present disclosure. This rendering device for fluid particles can be applied to a mobile terminal, such as a mobile terminal device such as a smart phone or a tablet computer. The rendering device for fluid particles includes, but is not limited to: an acquisition unit 81, an interpolation unit 82, a selection unit 83, and a rendering unit 84.
[0178] The acquisition unit 81 is configured to acquire the positions of the same fluid particle in N consecutive frames in time sequence, where N is a positive integer greater than or equal to 2;
[0179] The interpolation unit 82 is configured to interpolate at least one frame of position of the same fluid particle based on the positions of N consecutive frames;
[0180] The selection unit 83 is configured to select N non-adjacent frames of positions from the positions of N consecutive frames and at least one frame of position;
[0181] A rendering unit 84 for performing trailing rendering of fluid particles based on non-adjacent N-frame positions.
[0182] In some embodiments, the rendering unit 84 is configured to: set corresponding particle sizes and attenuation curves for non-adjacent N-frame positions respectively; perform metaball processing on the non-adjacent N-frame positions based on the particle sizes and attenuation curves.
[0183] In some embodiments, the particle sizes corresponding to the non-adjacent N-frame positions increase as the time sequence increases.
[0184] In some embodiments, the rendering device for fluid particles may further include Figure 8 A distance adjustment unit 85 (not shown in the figure) for: converting the non-adjacent N-frame positions to N-frame screen positions in the screen coordinate system; determining the distance between adjacent two-frame screen positions based on the N-frame screen positions; determining a distance threshold corresponding to the adjacent two-frame screen positions based on the particle sizes respectively corresponding to the adjacent two-frame screen positions; if the distance between the adjacent two-frame screen positions is greater than or equal to the distance threshold, reducing the distance between the adjacent two-frame screen positions.
[0185] Correspondingly, after the distance adjustment unit 85 reduces the distance between the adjacent two-frame screen positions, the rendering unit 84 performs metaball processing on the non-adjacent N-frame positions based on the particle sizes and attenuation curves.
[0186] In some embodiments, the distance threshold corresponding to the adjacent two-frame screen positions is determined by the following formula:
[0187] Distance threshold = a × particle size 1 + b × particle size 2;
[0188] where a and b are preset constants, and particle size 1 and particle size 2 are the particle sizes respectively corresponding to the adjacent two-frame screen positions.
[0189] In some embodiments, the N-frame screen positions include: the first-frame screen position, the third-frame screen position, and the fifth-frame screen position.
[0190] The distance adjustment unit 85 is configured to:
[0191] Fix the first-frame screen position, adjust the third-frame screen position until the distance between the first-frame screen position and the adjusted third-frame screen position is less than a first distance threshold; the first distance threshold is a threshold determined based on the particle sizes respectively corresponding to the first-frame screen position and the third-frame screen position;
[0192] Fix the adjusted screen position of the 3rd frame, and adjust the screen position of the 5th frame until the distance between the adjusted screen position of the 3rd frame and the adjusted screen position of the 5th frame is less than the second distance threshold; the second distance threshold is a threshold determined based on the particle sizes corresponding to the screen positions of the 3rd frame and the 5th frame respectively.
[0193] In some embodiments, the distance adjustment unit 85 is configured to: fix any one of the screen positions of two adjacent frames; determine the distance vector corresponding to the screen positions of two adjacent frames based on the fixed position; determine the screen position after distance reduction based on the fixed position, the distance vector, the distance between the screen positions of two adjacent frames, and the distance threshold.
[0194] In some embodiments, the screen position after distance reduction is determined by the following formula:
[0195] Screen position after distance reduction = fixed position + distance vector × (distance threshold ÷ distance between the screen positions of two adjacent frames).
[0196] In some embodiments, the interpolation unit 82 is configured to: if N is less than or equal to the preset frame number threshold, symmetric at least one of the positions from the 1st frame to the (N - 1)th frame with the position of the Nth frame as the center, to obtain at least one frame position of the same fluid particle.
[0197] In some embodiments, the selection unit 83 is configured to: select X frames from the positions of the continuous N frames, and select Y frames from the at least one frame position; where X is a positive integer less than N, Y is a positive integer greater than or equal to 1, and X + Y = N.
[0198] In some embodiments, the continuous N frames are continuous 3 frames, and the preset frame number threshold is 3 frames.
[0199] In some embodiments, the interpolation unit 82 is configured to: symmetric the position of the 1st frame with the position of the 3rd frame as the center, to obtain the position of the 5th frame of the same fluid particle.
[0200] In some embodiments, the selection unit 83 is configured to: select the position of the 1st frame, the position of the 3rd frame, and the position of the 5th frame.
[0201] The technical details of the rendering device of the fluid particle disclosed in each of the above embodiments can be referred to the descriptions of the embodiments of the rendering method of the fluid particle. To avoid repetition, they will not be elaborated here.
[0202] In some embodiments, the division of each unit in the rendering device of fluid particles is only a logical function division. In actual implementation, there may be other division methods. For example, at least two units in the rendering device of fluid particles can be implemented as one unit; each unit in the rendering device of fluid particles can also be divided into multiple sub-units. It can be understood that each unit or sub-unit can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods for each specific application to implement the described functions.
[0203] Figure 9 FIG. is an exemplary block diagram of a system provided by an embodiment of the present disclosure, including at least one computing device and at least one storage device storing instructions. In some embodiments, the system can be used for big data processing, and at least one computing device and at least one storage device can be distributedly deployed, making the system a distributed data processing cluster.
[0204] As Figure 9 shown in the figure, the system includes: at least one computing device 91 and at least one storage device 92 storing instructions. It can be understood that the storage device 92 in this embodiment can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories.
[0205] In some embodiments, the storage device 92 stores the following elements, executable units or data structures, or subsets thereof, or extended sets thereof: an operating system and application programs.
[0206] Among them, the operating system includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic tasks and processing hardware-based tasks. The application programs include various application programs, such as a Media Player, a Browser, etc., for implementing various application tasks. The program for implementing the fluid particle rendering method provided by the embodiment of the present disclosure can be included in the application programs.
[0207] In the embodiment of the present disclosure, at least one computing device 91 calls the programs or instructions stored in at least one storage device 92. Specifically, it can be the programs or instructions stored in the application programs. At least one computing device 91 is used to execute the steps of the embodiments of the fluid particle rendering method provided by the embodiment of the present disclosure.
[0208] The rendering method of fluid particles provided by the embodiments of the present disclosure can be applied to or implemented by a computing device 91. The computing device 91 can be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the integrated logic circuit of the hardware in the computing device 91 or the instructions in the form of software. The above computing device 91 can be a general-purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.
[0209] The steps of the rendering method of fluid particles provided by the embodiments of the present disclosure can be directly embodied as being executed and completed by a hardware decoding processor, or executed and completed by a combination of the hardware and software units in the decoding processor. The software unit can be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. This storage medium is located in a storage device 92, and the computing device 91 reads the information in the storage device 92 and combines its hardware to complete the steps of the method.
[0210] The embodiments of the present disclosure also propose a computer-readable storage medium. The computer-readable storage medium stores programs or instructions. When the programs or instructions are run by at least one computing device, the at least one computing device is caused to execute the steps of the embodiments of the rendering method of fluid particles. To avoid repeated description, it will not be elaborated here. Among them, the computing device can be Figure 9 the computing device 91 as shown. In some embodiments, the computer-readable storage medium is a non-transitory computer-readable storage medium.
[0211] The embodiments of the present disclosure also propose a computer program product. Among them, the computer program product includes a computer program. The computer program is stored in a non-transitory computer-readable storage medium. At least one processor of the computer reads and executes the computer program, so that the computer executes the steps of the embodiments of the rendering method of fluid particles. To avoid repeated description, it will not be elaborated here.
[0212] Among them, the computer program product can be written in any combination of one or more programming languages for executing the program code of the operations of the embodiments of the present disclosure. The programming languages include object-oriented programming languages such as Java, C++, etc., and also include conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computing device, partially on the user's device, executed as an independent software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0213] It should be noted that in this article, the term "including", "comprising" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without more limitations, the elements defined by the statement "including..." do not exclude the existence of additional identical elements in the process, method, article or device including such element.
[0214] Those skilled in the art can understand that although some of the embodiments described herein include certain features included in other embodiments but not other features, the combination of the features of different embodiments means that it is within the scope of the present disclosure and forms different embodiments.
[0215] Those skilled in the art can understand that the descriptions of the various embodiments have their respective emphases. For the parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0216] Although the embodiments of the present disclosure have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations fall within the scope defined by the appended claims.
Claims
1. A rendering method for fluid particles, the method comprising: Obtaining the positions of the same fluid particle in N consecutive frames in time series, where N is a positive integer greater than or equal to 2; Interpolating at least one frame of positions of the same fluid particle based on the positions of the N consecutive frames; Selecting N non-adjacent frame positions from the positions of the N consecutive frames and the at least one frame of positions; Performing trailing rendering of the fluid particle based on the N non-adjacent frame positions; Wherein, the performing trailing rendering of the fluid particle based on the N non-adjacent frame positions includes: reducing the distance between adjacent particles based on the N non-adjacent frame positions.
2. The method according to claim 1, wherein The performing trailing rendering of the fluid particle based on the N non-adjacent frame positions includes: Respectively setting corresponding particle sizes and attenuation curves for the N non-adjacent frame positions; Performing sphere merging processing on the N non-adjacent frame positions based on the particle sizes and the attenuation curves.
3. The method according to claim 2, wherein The respectively setting corresponding particle sizes for the N non-adjacent frame positions includes: The particle sizes corresponding to the N non-adjacent frame positions increase as the time series increases.
4. The method according to claim 2, wherein, Before performing sphere merging processing on the N non-adjacent frame positions based on the particle sizes and the attenuation curves, the method further includes: Converting the N non-adjacent frame positions to N screen positions in the screen coordinate system; Determining the distance between two adjacent screen positions based on the N screen positions; Determining a distance threshold corresponding to two adjacent screen positions based on the particle sizes respectively corresponding to the two adjacent screen positions; If the distance between two adjacent screen positions is greater than or equal to the distance threshold, reducing the distance between the two adjacent screen positions.
5. The method according to claim 4, wherein, The distance threshold corresponding to two adjacent screen positions is determined by the following formula: Distance threshold = a × particle size 1 + b × particle size 2; Wherein, a and b are preset constants, and particle size 1 and particle size 2 are the particle sizes respectively corresponding to two adjacent screen positions.
6. The method according to claim 4, wherein The N screen positions include: the first frame screen position, the third frame screen position, and the fifth frame screen position; The reducing the distance between two adjacent screen positions includes: Fixing the first frame screen position, adjusting the third frame screen position until the distance between the first frame screen position and the adjusted third frame screen position is less than a first distance threshold; the first distance threshold is a threshold determined based on the particle sizes respectively corresponding to the first frame screen position and the third frame screen position; Fixing the adjusted third frame screen position, adjusting the fifth frame screen position until the distance between the adjusted third frame screen position and the adjusted fifth frame screen position is less than a second distance threshold; the second distance threshold is a threshold determined based on the particle sizes respectively corresponding to the third frame screen position and the fifth frame screen position.
7. The method according to any one of claims 4 to 6, wherein, The reducing the distance between two adjacent screen positions includes: Fixing any one of the two adjacent screen positions; Determining a distance vector corresponding to the two adjacent screen positions based on the fixed position; Determine the screen position after distance reduction based on the fixed position, the distance vector, the distance between adjacent two-frame screen positions, and the distance threshold.
8. The method according to claim 7, wherein, The screen position after distance reduction is determined by the following formula: Screen position after distance reduction = fixed position + distance vector × (distance threshold ÷ distance between adjacent two-frame screen positions).
9. The method according to claim 1, wherein, The interpolating to obtain at least one frame position of the same fluid particle based on the positions of the continuous N frames includes: If N is less than or equal to the preset frame number threshold, center on the position of the Nth frame and symmetrically transform at least one of the positions from the 1st frame to the (N - 1)th frame to obtain at least one frame position of the same fluid particle.
10. The method according to claim 1, wherein, The selecting non-adjacent N frame positions from the positions of the continuous N frames and the at least one frame position includes: Select X frames from the positions of the continuous N frames and Y frames from the at least one frame position; where X is a positive integer less than N, Y is a positive integer greater than or equal to 1, and X + Y = N.
11. The method according to claim 9, wherein, The continuous N frames are continuous 3 frames, and the preset frame number threshold is 3 frames.
12. The method according to claim 11, wherein, The interpolating to obtain at least one frame position of the same fluid particle based on the positions of the continuous N frames includes: Center on the position of the 3rd frame and symmetrically transform the position of the 1st frame to obtain the position of the 5th frame of the same fluid particle.
13. The method according to claim 12, wherein, The selecting non-adjacent N frame positions from the positions of the continuous N frames and the at least one frame position includes: Select the position of the 1st frame, the position of the 3rd frame, and the position of the 5th frame.
14. A rendering device for fluid particles, the device includes: An acquisition unit, configured to acquire the positions of the same fluid particle in N consecutive frames in time sequence, where N is a positive integer greater than or equal to 2; An interpolation unit, configured to interpolate to obtain at least one frame position of the same fluid particle based on the positions of the continuous N frames; A selection unit, configured to select non-adjacent N frame positions from the positions of the continuous N frames and the at least one frame position; A rendering unit, configured to perform trailing rendering of the fluid particle based on the non-adjacent N frame positions; Wherein, the performing trailing rendering of the fluid particle based on the non-adjacent N frame positions includes: reducing the distance between adjacent particles based on the non-adjacent N frame positions.
15. A system comprising at least one computing device and at least one storage device storing instructions, wherein, When the instruction is run by the at least one computing device, it causes the at least one computing device to execute the steps of the rendering method for fluid particles according to any one of claims 1 to 13.
16. A computer-readable storage medium, wherein, The computer-readable storage medium stores a program or instruction, and when the program or instruction is run by at least one computing device, it causes at least one computing device to execute the steps of the rendering method for fluid particles according to any one of claims 1 to 13.
Citation Information
Patent Citations
Smearing effect rendering method, device and equipment, and computer readable storage medium
CN109688346A
Trailing visual effect generation method, video generation method and electronic equipment
CN112700518A