A particle special effects processing method, device, equipment, medium and product
By reducing the dimensionality of the three-dimensional noise field information, storing it as a two-dimensional noise field information table, and processing it with the CPU, the problem of difficulty in rendering particle special effects on low-configuration mobile terminals is solved, achieving better user experience and wide compatibility.
Patent Information
- Application Number
- CN202210136804.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-15
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2042-02-15
AI Technical Summary
The prior art is difficult to effectively realize particle special effect rendering on low-configured mobile terminals, mainly due to the lack of GPU processing capabilities.
By dimensionality reduction processing of three-dimensional noise field information, the noise field information is stored and processed in the form of a two-dimensional noise field information table, and particle special effect rendering is performed using a central processor (CPU).
It realizes better rendering of particle effects on low-configuration mobile terminals, improves user experience, and ensures that most models can realize particle effects functions.
Smart Images

Figure CN114445535B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer graphics technology, and in particular to a particle special effect processing method, device, equipment, medium and product. Background Art
[0002] Particle effects are a common special effects technology in 3D computer graphics. They are widely used in the game and animation industries. They can be used to simulate natural phenomena such as fire, snow, and smoke, and can also be used to create more abstract visual effects. In recent years, with the rise of the live broadcast and short video industries, particle effects have also been gradually applied to special effects materials such as stickers and gifts.
[0003] The key to particle special effects rendering is to control the motion state of particles, and the control of the motion state of particles is mainly achieved through 3D noise rendering. Existing 3D particle noise rendering is mainly achieved through a graphics processing unit (GPU) to complete the logic implementation.
[0004] Currently, live broadcast or short video applications are mainly implemented on smart mobile terminals, but many low-configuration terminals do not support GPU processing, which greatly affects the implementation of particle effects functions in live broadcast or short video application clients. Summary of the invention
[0005] The embodiments of the present invention provide a particle special effect processing method, device, equipment, medium and product to solve the problem that low-configuration mobile terminals cannot achieve better rendering.
[0006] According to one aspect of the present invention, a particle special effect rendering method is provided, comprising:
[0007] Get the particle data stream of the selected particle effect and obtain the pre-created two-dimensional noise field information table;
[0008] Determine the particle motion state of each particle in the current particle data frame according to the two-dimensional noise field information and the particle data information of the current particle data frame in the particle data stream;
[0009] The particle special effects are presented in real time according to the motion status of each particle.
[0010] According to another aspect of the present invention, there is provided a particle special effect rendering device, comprising:
[0011] A data stream acquisition module is used to acquire the particle data stream of the selected particle special effect and obtain a pre-created two-dimensional noise field information table;
[0012] A motion state determination module, used to determine the particle motion state of each particle in the current particle data frame according to the two-dimensional noise field information and the particle data information of the current particle data frame in the particle data stream;
[0013] The particle special effect presentation module is used to present the particle special effect in real time according to the motion state of each particle.
[0014] According to another aspect of the present invention, a particle special effect rendering device is provided, the particle special effect rendering device comprising:
[0015] at least one processor; and
[0016] a memory communicatively connected to the at least one processor; wherein,
[0017] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the particle special effect rendering method described in any embodiment of the present invention.
[0018] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the particle special effect rendering method described in any embodiment of the present invention when executed.
[0019] According to another aspect of the present invention, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, the particle special effect rendering method described in any embodiment of the present invention is implemented.
[0020] The embodiments of the present invention disclose a particle special effect processing method, device, equipment, medium and product. The method includes obtaining a particle data stream of a selected particle special effect, and obtaining a pre-created two-dimensional noise field information table; determining the particle motion state of each particle in the current particle data frame according to the two-dimensional noise field information and the particle data information of the current particle data frame in the particle data stream; and presenting the particle special effect in real time according to each of the particle motion states. Considering that particle special effect rendering in the prior art is mainly realized by three-dimensional texture map rendering, and the central processing unit is not good at calculation and processing based on three-dimensional images; in order to solve this problem, the noise field information is stored in the form of a two-dimensional noise field information table by performing dimensionality reduction processing on the three-dimensional texture map, and when the particle special effect presentation is realized, the corresponding logic processing is performed based on the two-dimensional noise field information table. For low-configuration mobile terminals, the particle special effect rendering function can be better realized, and a better user experience can be provided.
[0021] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0023] Figure 1 A flowchart of a particle special effects rendering method is provided for the first embodiment of the present invention;
[0024] Figure 2 This is an example flow chart of particle special effects rendering provided in the second embodiment of the present invention;
[0025] Figure 3 A structural block diagram of a particle special effects rendering device provided in Embodiment 3 of the present invention;
[0026] Figure 4 A schematic diagram of the hardware structure of a computer device provided in Embodiment 4 of the present invention. DETAILED DESCRIPTION
[0027] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0029] Embodiment 1
[0030] Figure 1 A flowchart of a particle special effects rendering method is provided for the first embodiment of the present invention. This embodiment is applicable to the case where particle special effects rendering is performed based on a central processing unit. The method can be executed by a particle special effects rendering device. The particle special effects rendering device can be implemented in the form of hardware and / or software. The particle special effects rendering device can be configured in a particle special effects rendering device.
[0031] It should be noted that when controlling particle special effects through 3D rendering based on GPU, it is first necessary to load or generate a three-dimensional texture map of noise. The GPU matches the position of the particle with the coordinates of the three-dimensional texture map, determines the corresponding noise value, and adjusts the position of the particle based on the noise value to control the trajectory of the particle motion, thereby realizing particle special effects rendering. At present, for applications such as live broadcast or short video, it is mainly implemented on smart mobile terminals, and many existing low-configuration terminals do not support GPU processing. Considering the wide application of particle special effects functions, it is necessary to find a method that is more suitable for particle special effects rendering. This embodiment provides a particle special effects processing method.
[0032] like Figure 1 As shown, the method includes:
[0033] S110, obtaining a particle data stream of the selected particle special effect, and obtaining a pre-created two-dimensional noise field information table.
[0034] Among them, the special effects simulated by the particle system can realize abstract visual effects such as fire, smoke, water flow or luminous tracks. The particle data stream can be specifically understood as a data set containing several data frames, and the data frames are output in a flowing manner. In this step, the particle stream corresponding to the particle special effect can be selected according to the required particle special effect. It should be noted that when the GPU processes particle special effects, a three-dimensional texture map related to noise information is used, and the three-dimensional texture map is not suitable for the CPU to process it. In order to enable the CPU operation to support particle special effects, this embodiment performs dimensionality reduction processing on the three-dimensional noise field information, projects the relevant three-dimensional texture map of the particle noise field on two dimensions, and represents the three-dimensional texture map of the noise information in a two-dimensional manner.
[0035] In this embodiment, before performing particle special effects rendering, a static memory can be pre-allocated in the CPU to store the particle noise field in the form of a two-dimensional noise field information table. Considering that a three-dimensional texture map is represented in two dimensions, where the two dimensions can be the xy axis, the xz axis or the yz axis, no specific restrictions are made here. Among them, each cell in the two-dimensional noise field information table corresponds to an index coordinate, and a noise value is stored inside the cell. Preferably, the size of the two-dimensional noise field information table is 256*256. Considering that the particle special effects rendering is presented in units of particles, the pixels of the particles themselves are relatively small, generally not exceeding 256*256. When the size of the two-dimensional noise field information table is set to 256*256, it is sufficient to match the particles, so it is also sufficient to obtain the noise value for controlling the movement of the particles.
[0036] In addition, it should be noted that when there are multiple particle systems in the scene using the method provided by this embodiment, multiple independent particle systems can share the same particle noise field, thereby reducing memory usage and initialization time.
[0037] Specifically, when a particle special effect instruction is received, before the particle special effect rendering is performed, the particle flow of the selected particle special effect is obtained in advance, and the pre-created noise field information table about the noise field information is obtained.
[0038] S120. Determine the particle motion state of each particle in the current particle data frame according to the two-dimensional noise field information and the particle data information of the current particle data frame in the particle data stream.
[0039] Among them, the particle data frame can be specifically understood as the basic data for particle special effects rendering, and the particle data frame contains multiple particles. The particle data stream can be specifically understood as a data set containing several data frames, and the data frames are output in a flowing manner. The particle data information can be specifically understood as the attribute information of the particle. Each particle has a set of attribute information, such as position, size and texture, and also attribute information such as color, transparency, movement speed, acceleration, spin period, life cycle, etc. What kind of attributes a particle needs to have depends on its specific application. It should be noted that in this embodiment, it is necessary to determine the particle motion state of each particle in the particle data frame, and the particle motion state can be characterized by the change in the position of the particle, so it is necessary to obtain the corresponding position information of the particle in the current particle data frame.
[0040] In this step, the particle motion state can be understood as the particle motion trajectory in the particle data frame, and the particle motion trajectory can be controlled by noise interference. It is clear that the noise value is stored in the above-mentioned pre-created two-dimensional noise field information table. For the current particle data frame, the noise value corresponding to each particle can be obtained from the two-dimensional noise field information table. Considering that the position of the particle in the current particle data frame matches the index position of the two-dimensional noise field information table, after obtaining the position of the particle in the current particle data frame, the noise value matching the coordinates can be found in the noise field. It should be noted that the particle unit size is limited to a certain extent, usually an image block smaller than 256*256, and the size of the two-dimensional noise field information table can usually be 256*256, and the corresponding noise value can be found by coordinate matching. Exemplarily, the particle coordinates can be rounded as coordinate values, and the matching index coordinates in the two-dimensional noise field information table are found. The corresponding noise value is stored in the cell corresponding to the matching index coordinates, and the particle motion state can be interfered with according to the noise value. The noise value can be understood as the increment of the particle position change. The target motion position of the particle is determined based on this noise value. When the initial position and the target motion position of the particle are known, the motion state of the particle can be obtained.
[0041] S130, presenting particle special effects in real time according to the motion states of the particles.
[0042] Specifically, this step is performed after the motion state of each particle in the current particle data frame is determined. The motion state of each particle is a representation of the particle motion trajectory and has a directional effect on the motion trajectory. The above steps have obtained the particle initial position information of the current particle data frame. According to the particle motion state, the direction and distance of the particle movement can be controlled, and the position to which the particle moves can be controlled. The operation of each particle is controlled according to the particle motion state, and each particle runs according to the motion state, thereby presenting particle special effects.
[0043] The first embodiment of the present invention discloses a particle special effect processing method, which first obtains the particle data stream of the selected particle special effect and obtains a pre-created two-dimensional noise field information table; then, according to the two-dimensional noise field information and the particle data information of the current particle data frame in the particle data stream, determines the particle motion state of each particle in the current particle data frame; finally, presents the particle special effect in real time according to each particle motion state. Considering that particle special effect rendering in the prior art is mainly realized by three-dimensional texture map rendering, and the central processing unit is not good at calculation and processing based on three-dimensional images; in order to solve this problem, by performing dimensionality reduction processing on the three-dimensional texture map, the noise field information is stored in the form of a two-dimensional noise field information table, and when realizing the particle special effect presentation, the corresponding logic processing is performed based on the two-dimensional noise field information table. For low-configuration mobile terminals, the particle special effect rendering function can be better realized, and a better user experience can be provided.
[0044] As a first optional embodiment of the first embodiment, the first optional embodiment further provides a step of creating the two-dimensional noise field information table. It can be known that the steps provided in the first optional embodiment are specifically performed before determining the particle motion state of each particle in the current particle data frame. Specifically, the creation step may include:
[0045] S111. Create a two-dimensional data table with set row and column values.
[0046] Specifically, in the existing GPU processing, a three-dimensional texture map related to noise information is used, and the three-dimensional texture map is not suitable for CPU processing. In order to enable CPU operation to also support particle special effects, this embodiment performs dimensionality reduction processing on the three-dimensional noise field information, projects the three-dimensional texture map related to the particle noise field on two dimensions, and represents the three-dimensional texture map of the noise information in a two-dimensional manner.
[0047] In this embodiment, before performing particle special effects rendering, a static memory can be pre-allocated in the CPU to store the particle noise field in the form of a two-dimensional noise field information table. Considering the characterization of a three-dimensional texture map in two dimensions, where two dimensions can be the xy axis, the xz axis or the yz axis, no specific restrictions are made here. Exemplarily, when a three-dimensional space vector is represented by a two-dimensional array, it can be stipulated that the coordinate value corresponding to one of the omitted coordinate axes is equal to one of the coordinate values corresponding to the other two axes. Exemplarily, assuming that the three axes are x, y, and z axes, the corresponding two dimensions are x and y axes, and the z-axis value is the same as the y-axis. If a coordinate value in the two-dimensional data table is (1,2), then its corresponding three-dimensional coordinate value is (1,2,2). Create a two-dimensional data table with set row and column values. Preferably, the size of the two-dimensional noise field information table is 256*256. Considering that particle special effects rendering is presented in units of particles, the pixels of the particles themselves are relatively small, generally not exceeding 256*256. When the size of the two-dimensional noise field information table is set to 256*256, it is sufficient to match the particles, so it is sufficient to obtain the noise value for controlling the particle movement.
[0048] S112. Determine the noise value in each cell according to the index coordinates corresponding to each cell in the two-dimensional data table and in combination with a given noise generation algorithm.
[0049] Wherein, each cell in the two-dimensional data table corresponds to an index coordinate, and the index coordinate is calculated according to a given noise generation algorithm to obtain the noise value corresponding to each cell. There are multiple options for setting the noise generation algorithm, such as Perlin noise algorithm, fractal noise algorithm and curl noise algorithm. Preferably, the noise generation algorithm set in this step can be Perlin noise algorithm.
[0050] S113, adding each of the noise values to a corresponding cell to obtain a two-dimensional noise field information table.
[0051] In this step, the noise value calculated according to the index coordinate is added to the cell corresponding to the index coordinate. Each cell corresponds to an index position and a noise value, and a two-dimensional noise field information table can be formed. It can be seen that by converting the three-dimensional space vector into a two-dimensional representation, the calculation rate can be increased and the memory occupied can be saved.
[0052] As a second optional embodiment of the first embodiment, based on the above embodiment, the second optional embodiment determines the particle motion state of each particle in the current particle data frame according to the two-dimensional noise field information table and the particle data information of the current particle data frame in the particle data stream, and concretizes it into the following steps:
[0053] S121. Extract particle data information of a current particle data frame in the particle data stream to obtain an initial position corresponding to each particle in the current particle data frame.
[0054] In this second optional embodiment, the particle data information can be specifically understood as the attribute information of the particle. Each particle has a set of attribute information, such as position, size and texture, and attribute information such as color, transparency, movement speed, acceleration, spin period, life cycle, etc. What kind of attribute a particle needs to have depends on its specific application. It should be noted that in this second optional embodiment, it is necessary to determine the particle motion state of each particle in the particle data frame, and the particle motion state can be characterized by the position change of the particle, so it is necessary to obtain the initial position corresponding to the particle in the current particle data frame.
[0055] A particle data frame is composed of multiple particles. Specifically, each surviving particle is traversed to extract the particle data information of the current particle data frame in the particle data stream. The particle data information may include multiple attributes of the particle, and the initial position corresponding to each particle in the current particle data frame is obtained from the multiple attributes.
[0056] S122. For each particle, determine the target movement position of the particle according to the initial position and in combination with the two-dimensional noise field information table.
[0057] In this step, the target motion position can be understood as the motion position that should be reached through noise interference. For each particle, according to the initial position of the particle, it can be matched with the index position of each cell in the two-dimensional noise field information table. If they match, the noise value of the cell corresponding to the index position can be determined, and the position of the particle can be adjusted according to the noise value.
[0058] S123. Determine the particle motion state of each particle in the current particle data frame based on each target motion position.
[0059] Specifically, according to the initial position corresponding to each particle in the current particle data frame obtained in S121 and the target motion position obtained in S122, the displacement corresponding to each particle can be determined, thereby determining the particle motion state of each particle.
[0060] As a third optional embodiment of the first embodiment, this third optional embodiment, based on the above embodiment, concretizes the step of determining the target motion position of the particle based on the initial position in combination with the two-dimensional noise field information into the following steps: if the precision mode of the configured noise rendering is the first precision rendering, the target motion position of the particle is determined by combining the initial position and the two-dimensional noise field information through a first processing strategy; if the precision mode of the configured noise rendering is the second precision rendering, the target motion position of the particle is determined by combining the initial position and the two-dimensional noise field information through a second processing strategy.
[0061] In this third optional embodiment, the precision mode of the configured noise rendering includes two modes, which can be divided into a first precision rendering mode and a second precision rendering mode. Different precision modes correspond to different strategies for determining the target motion position of particles, which can be divided into a first processing strategy and a second processing strategy. Among them, the first precision is lower than the second precision, and the first processing strategy is different from the second processing strategy. It can be known that when the precision requirement of noise rendering is low, the simpler the corresponding processing strategy, the lower the noise calculation cost; the corresponding high-quality noise calculation cost is slightly higher than ordinary noise, but its effect on particles is also smoother.
[0062] As a fourth optional embodiment of the first embodiment, based on the above embodiment, the fourth optional embodiment determines the target motion position of the particle by combining the initial position and the two-dimensional noise field information through the first processing strategy, and concretizes it into the following steps. The fourth optional embodiment is equivalent to the process of determining the target motion position of the particle in the third optional embodiment if the configured noise rendering precision mode is the first precision rendering. The specific steps may include:
[0063] a1) performing a rounding operation on each coordinate value in the first coordinate representing the initial position, and matching the rounded coordinates with the index coordinates corresponding to each cell in the two-dimensional noise field information table to obtain the target index coordinates.
[0064] It should be noted that, since the size of the two-dimensional noise field information table is usually set to 256*256, the coordinate value corresponding to the particle position may not be an integer, because a rounding operation is required. The way to round each coordinate value in this step can be rounding up, rounding down, adding 1 as long as there is a decimal behind the integer in front, or rounding to the nearest integer, etc. Any rounding method can be set as the rounding operation of this step. It can be known that in this step, only one set of data is obtained after the coordinate values in the first coordinate are rounded. This fourth optional embodiment is suitable for using ordinary mass noise and does not require interpolation operations. Exemplarily, if the set rounding method is rounding, assuming that the coordinate values of the first coordinate corresponding to the X-axis and Y-axis are (5.2, 3.9), after rounding, a set of coordinate values (5, 4) can be obtained.
[0065] Specifically, by rounding the coordinate values in the first coordinate representing the initial position, a set of rounded coordinates can be obtained, and the rounded coordinates are matched with the index coordinates corresponding to each cell in the two-dimensional noise field information table. When the match is successful, it can also be understood that the coordinate values are equal, and the successfully matched index coordinates can be used as the target index coordinates.
[0066] b1) adjusting the first coordinate based on the noise value in the cell corresponding to the target index coordinate, and characterizing the target movement position of the particle based on the adjusted coordinate.
[0067] Among them, the noise value can be specifically understood as the coordinate increment of each dimension of the particle, the numerical value of the noise value represents the coordinate increment size, and the positive and negative noise values represent the direction. The target motion position can be understood as the final position to which each particle should move from the initial position in order to achieve the desired particle special effects. Specifically, according to the target index coordinates, determine the cell corresponding to the target table index coordinates, obtain the noise value in the cell, adjust the first coordinate corresponding to the particle according to the noise value, and use the position corresponding to the adjusted coordinates as the target motion position of the particle.
[0068] As the fifth optional embodiment of the first embodiment, based on the above embodiment, the fifth optional embodiment determines the target motion position of the particle by combining the initial position and the two-dimensional noise field information through the second processing strategy, and concretizes it into the following steps. The fifth optional embodiment is equivalent to the process of determining the target motion position of the particle in the third optional embodiment if the configured noise rendering precision mode is the second precision rendering. The specific steps may include:
[0069] a2) performing rounding operations downward and upward on each coordinate value in the first coordinate representing the initial position.
[0070] It is clear that in this step, each coordinate value in the first coordinate is rounded down and up respectively, and four sets of data can be obtained after the rounding operation. This fifth optional embodiment is suitable for using high-quality noise and requires interpolation operation. Exemplarily, assuming that the coordinate values of the first coordinate corresponding to the X-axis and the Y-axis are (1.1, 2.8), after rounding up and down, four sets of coordinate values (1, 2), (1, 3), (2, 2) and (2, 3) can be obtained. In this step, each coordinate value in the first coordinate is rounded up and down respectively, and multiple sets of noise values can be matched to facilitate interpolation calculation.
[0071] b2) constructing a set number of associated coordinates based on the rounded coordinate values, and matching each of the associated coordinates with an index coordinate corresponding to each cell in the two-dimensional noise field information table.
[0072] In this fifth optional embodiment, after the coordinate values in the first coordinate are rounded, the coordinate values obtained can form associated coordinates. Exemplarily, the description continues with the example in step a2), and the set number of associated coordinates can be four groups. The four groups of coordinates are matched with the index coordinates corresponding to each cell in the two-dimensional noise field information table to obtain matching index coordinates.
[0073] c2) Record the noise values in the cells corresponding to the matching index coordinates as candidate noise values.
[0074] In this step, matching can be specifically understood as the coordinates corresponding to the particle position being equal to the index coordinates. Exemplarily, the noise values in the cells corresponding to the two matching index coordinates can be taken as candidate noise values.
[0075] d2) performing linear interpolation based on each of the candidate noise values in combination with the corresponding determined linear coefficients to obtain a target noise value.
[0076] Preferably, the linear coefficient of each candidate noise value is the distance value from the corresponding associated coordinate to the first coordinate. Specifically, the candidate noise value is linearly interpolated according to the linear coefficient to obtain the target noise value. The target noise value is multiplied by the noise coefficient and added to the particle to modify the spatial position of the current particle. It is clear that the noise value can be made smoother by the linear interpolation operation to obtain a high-quality noise value. Among them, the noise coefficient is an adjustable parameter. The exemplary noise coefficient has a value range of 0-1.
[0077] e2) adjusting the first coordinate based on the target noise value, and characterizing the target motion position of the particle based on the adjusted coordinate.
[0078] Among them, the noise value can be specifically understood as the coordinate increment of each dimension of the particle, the numerical value of the noise value represents the coordinate increment size, and the positive and negative noise values represent the direction. The target motion position can be understood as the final position to which each particle should move from the initial position in order to achieve the desired particle special effects. Specifically, according to the target index coordinates, determine the cell corresponding to the target table index coordinates, obtain the noise value in the cell, adjust the first coordinate corresponding to the particle according to the noise value, and use the position corresponding to the adjusted coordinates as the target motion position of the particle.
[0079] As the sixth optional embodiment of the first embodiment, this sixth optional embodiment, based on the above embodiments, will determine the particle motion state of each particle in the current particle data frame based on each target motion position and concretize it into the following steps: the movement of each particle from the initial position to the corresponding target motion position is determined as the particle motion state of each particle in the current particle data frame.
[0080] Among them, each particle corresponds to a different initial position and a different target motion position. Each particle in the current particle data frame moves from its own initial position to its own target motion position, which can be determined as the particle motion state of each particle, and is used to continue to control the particle movement through the particle motion state.
[0081] As the seventh optional embodiment of the first embodiment, based on the above embodiments, the seventh optional embodiment will concretize the real-time presentation of particle special effects according to the motion state of each particle into the following steps: controlling each particle to move according to the particle motion state, so as to present the particle special effects through the movement of each particle.
[0082] The seventh optional embodiment is a specific step for presenting particle special effects. The particle motion state is characterized by the position state of the particle at different times. By controlling each particle to move according to the particle motion state, different particles have different motion states, and the different particle motion states of multiple particles are combined to present particle special effects.
[0083] As the eighth optional embodiment of the first embodiment, based on the first to eighth embodiments, the method of the eighth optional embodiment also includes: taking the next particle data frame in the particle data stream as the new current particle data frame, returning to continue determining the particle motion state of each particle in the current particle data frame until a particle special effect end instruction is received.
[0084] It should be noted that, as can be seen from the eighth optional embodiment, the step of determining the particle motion state will be executed for each particle data frame in the particle data stream. The order is to call the particle data frame in the particle data stream as the current particle data frame in turn, and determine the particle motion state of each particle in the current particle data frame. After the particle motion state of each particle in the current particle data frame is determined, the next particle data frame in the particle data stream will be obtained as the new current particle data frame to continue to perform the particle motion state determination operation. The condition for the end of the method is to receive a particle special effect end instruction. When the particle special effect end instruction is received, the method stops running.
[0085] In addition, it should be pointed out that before the motion state of the next particle data frame is updated, it is necessary to determine whether the motion trajectory of the next particle data frame is the original trajectory. If the initial information is directly obtained, the motion state control of the particle data frame can continue; if it is information after noise interference, it is necessary to first subtract the interference value of the previous particle data frame, that is, the noise value, so as to restore the original trajectory, so as to avoid the superposition of noise states.
[0086] When the noise field storage method changes, the corresponding processing steps and processing logic also change. The noise field information is stored based on the two-dimensional noise field information table. Through such logic implementation, memory usage is reduced, resources can be saved, and better particle special effects rendering can be achieved in the CPU.
[0087] Embodiment 2
[0088] Figure 2 This is an example flow chart of particle special effects rendering provided by an embodiment of the present invention, such as Figure 2 As shown, the second embodiment adopts the following steps to achieve particle special effects rendering.
[0089] Specifically, an exemplary implementation of the particle special effects rendering method provided in this embodiment may include:
[0090] S201, creating a two-dimensional data table with set row and column values.
[0091] S202: Determine the noise value in each cell according to the index coordinates corresponding to each cell in the two-dimensional data table and in combination with a given noise generation algorithm.
[0092] S203, adding each noise value to a corresponding cell to obtain a two-dimensional noise field information table.
[0093] S204, obtaining the particle data stream of the selected particle special effect, and obtaining a two-dimensional noise field information table.
[0094] S205 , extracting particle data information of the current particle data frame in the particle data stream, and obtaining the initial position corresponding to each particle in the current particle data frame.
[0095] S206 , determining the precision mode of the configured noise rendering, if it is the first precision rendering, executing S207 - S208 in sequence; if it is the second precision rendering, executing S209 - S213 in sequence.
[0096] S207 , performing a rounding operation on each coordinate value in the first coordinate representing the initial position, and matching the rounded coordinates with the index coordinates corresponding to each cell in the two-dimensional noise field information table to obtain the target index coordinates.
[0097] S208 , adjusting the first coordinate based on the noise value in the cell corresponding to the target index coordinate, characterizing the target motion position of the particle based on the adjusted coordinate, and jumping to S214 .
[0098] S209, performing rounding operations downward and upward on each coordinate value in the first coordinate representing the initial position.
[0099] S210 , constructing a set number of associated coordinates based on the rounded coordinate values, and matching each associated coordinate with an index coordinate corresponding to each cell in the two-dimensional noise field information table.
[0100] S211 , recording the noise values in the cells corresponding to the matching index coordinates as candidate noise values.
[0101] S212: Perform linear interpolation based on each candidate noise value and a corresponding determined linear coefficient to obtain a target noise value.
[0102] S213, adjusting the first coordinate based on the target noise value, characterizing the target motion position of the particle based on the adjusted coordinate, and jumping to S214.
[0103] S214: Determine the movement of each particle from the initial position to the corresponding target movement position as the particle movement state of each particle in the current particle data frame.
[0104] S215. Control each particle to move according to the particle motion state, so as to present particle special effects through the movement of each particle.
[0105] S216: Use the next particle data frame in the particle data stream as a new current particle data frame, and return to continue executing S205.
[0106] Embodiment 3
[0107] Figure 3This is a block diagram of a particle special effect rendering device provided in the second embodiment of the present invention. The device is suitable for performing particle special effect rendering based on a central processing unit. The device can be implemented by software and / or hardware and can generally be integrated on a computer device. Figure 3 As shown, the device includes: an information pulling module 31 and a mode determining module 32.
[0108] The data stream acquisition module 31 is used to acquire the particle data stream of the selected particle special effect and obtain the pre-created two-dimensional noise field information table;
[0109] A motion state determination module 32, for determining the particle motion state of each particle in the current particle data frame according to the two-dimensional noise field information and the particle data information of the current particle data frame in the particle data stream;
[0110] The particle special effect presentation module 33 is used to present the particle special effect in real time according to the motion state of each particle.
[0111] A particle special effect rendering device provided in the third embodiment of the present invention first obtains the particle data stream of the selected particle special effect and obtains a pre-created two-dimensional noise field information table; then determines the particle motion state of each particle in the current particle data frame according to the two-dimensional noise field information and the particle data information of the current particle data frame in the particle data stream; finally, presents the particle special effect in real time according to the particle motion state. Considering the influence of the hardware configuration of the terminal itself on the particle special effect function in the application client, the noise generation and calculation method is transplanted into the central processing unit by using this method, realizing the particle special effect rendering function, ensuring that the particle special effect function can be realized for most models, and having good user data.
[0112] Furthermore, the device also includes an information table creation module, which is specifically used to: create a two-dimensional data table with set row and column values; determine the noise value in each cell according to the index coordinates corresponding to each cell in the two-dimensional data table, combined with a given noise generation algorithm; add each noise value to the corresponding cell to obtain a two-dimensional noise field information table.
[0113] Furthermore, the motion state determination module 32 may be specifically used for:
[0114] Extracting particle data information of a current particle data frame in the particle data stream to obtain an initial position corresponding to each particle in the current particle data frame;
[0115] For each particle, according to the initial position and in combination with the two-dimensional noise field information table, determine the target movement position of the particle;
[0116] Based on each of the target motion positions, the particle motion state of each particle in the current particle data frame is determined.
[0117] Further, the motion state determination module 32 may include a first processing unit and a second processing unit:
[0118] A first processing unit, configured to determine a target motion position of the particle by combining the initial position and the two-dimensional noise field information through a first processing strategy if the configured noise rendering precision mode is the first precision rendering;
[0119] A second processing unit, configured to determine a target movement position of the particle by combining the initial position and the two-dimensional noise field information through a second processing strategy if the configured noise rendering precision mode is second precision rendering;
[0120] The first precision is lower than the second precision, and the first processing strategy is different from the second processing strategy.
[0121] Furthermore, the first processing unit is specifically configured to:
[0122] Performing a rounding operation on each coordinate value in the first coordinate representing the initial position, and matching the rounded coordinates with the index coordinates corresponding to each cell in the two-dimensional noise field information table to obtain the target index coordinates;
[0123] The first coordinate is adjusted based on the noise value in the cell corresponding to the target index coordinate, and the target movement position of the particle is characterized based on the adjusted coordinate.
[0124] Furthermore, the second processing unit is specifically configured to:
[0125] Rounding down and rounding up each coordinate value in the first coordinate representing the initial position;
[0126] Constructing a set number of associated coordinates based on the rounded coordinate values, and matching each of the associated coordinates with an index coordinate corresponding to each cell in the two-dimensional noise field information table;
[0127] The noise values in the cells corresponding to the matched index coordinates are recorded as candidate noise values respectively;
[0128] Performing linear interpolation based on each of the candidate noise values in combination with a corresponding determined linear coefficient to obtain a target noise value;
[0129] The first coordinate is adjusted based on the target noise value, and the target motion position of the particle is characterized based on the adjusted coordinate.
[0130] Furthermore, the step in which the motion state determination module 32 determines the particle motion state of each particle in the current particle data frame based on each target motion position may include: determining the movement of each particle from the initial position to the corresponding target motion position as the particle motion state of each particle in the current particle data frame.
[0131] Furthermore, the particle special effect presentation module 33 is specifically used to: control each of the particles to move according to the particle motion state, so as to present the particle special effect through the movement of each of the particles.
[0132] Furthermore, the device also includes a continuing execution module:
[0133] The continuing execution module can be used to take the next particle data frame in the particle data stream as a new current particle data frame, and return to continue to determine the particle motion state of each particle in the current particle data frame until a particle special effect end instruction is received.
[0134] The particle special effect rendering device provided in the embodiment of the present invention can execute the particle special effect rendering method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0135] Embodiment 4
[0136] Figure 4 A schematic diagram of the structure of a particle special effect rendering device 40 provided for an embodiment of the present invention. The particle special effect rendering device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The particle special effect rendering device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0137] like Figure 4As shown, the particle special effect rendering device 40 includes at least one processor 41, and a memory connected to the at least one processor 41, such as a read-only memory (ROM) 42, a random access memory (RAM) 43, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 41 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 42 or the computer program loaded from the storage unit 48 to the random access memory (RAM) 43. In RAM 43, various programs and data required for the operation of the particle special effect rendering device 40 can also be stored. The processor 41, ROM 42 and RAM 43 are connected to each other through a bus 44. An input / output (I / O) interface 45 is also connected to the bus 44.
[0138] Multiple components in the particle special effect rendering device 40 are connected to the I / O interface 45, including: an input unit 46, such as a keyboard, a mouse, etc.; an output unit 47, such as various types of displays, speakers, etc.; a storage unit 48, such as a disk, an optical disk, etc.; and a communication unit 49, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 49 allows the particle special effect rendering device 40 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0139] The processor 41 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 41 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 41 executes the various methods and processes described above, such as a particle special effects rendering method.
[0140] In some embodiments, the particle special effects rendering method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 48. In some embodiments, part or all of the computer program may be loaded and / or installed on the particle special effects rendering device 40 via the ROM 42 and / or the communication unit 49. When the computer program is loaded into the RAM 43 and executed by the processor 41, one or more steps of the particle special effects rendering method described above may be performed. Alternatively, in other embodiments, the processor 41 may be configured to execute the particle special effects rendering method in any other appropriate manner (e.g., by means of firmware).
[0141] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0142] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0143] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. 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.
[0144] To provide interaction with a user, the systems and techniques described herein may be implemented on a particle special effects rendering device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball), through which a user may provide input to the particle special effects rendering device. Other types of devices may also be used to provide interaction with a user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0145] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0146] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0147] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0148] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A particle special effects rendering method, characterized in that: include: Get the particle data stream of the selected particle effect and obtain the pre-created two-dimensional noise field information table; Determine the particle motion state of each particle in the current particle data frame according to the two-dimensional noise field information table and the particle data information of the current particle data frame in the particle data stream; Present particle effects in real time according to the motion state of each particle; Wherein, determining the particle motion state of each particle in the current particle data frame according to the two-dimensional noise field information table and the particle data information of the current particle data frame in the particle data stream includes: A pre-created two-dimensional noise field information table stores noise values. For a current particle data frame, the noise value corresponding to each particle is obtained from the two-dimensional noise field information table. The position of the particle in the current particle data frame matches the index position of the two-dimensional noise field information table. After obtaining the position of the particle in the current particle data frame, a noise value matching the coordinates is found from the two-dimensional noise field information table. The motion state of the particle is interfered with according to the noise value. The noise value is an increment of the particle position change. The target motion position of the particle is determined according to the noise value. The motion state of the particle is obtained according to the known initial position of the particle and the target motion position of the particle.
2. The method according to claim 1, characterized in that The steps of creating the two-dimensional noise field information table include: Create a two-dimensional data table with set row and column values; According to the index coordinates corresponding to each cell in the two-dimensional data table, in combination with a given noise generation algorithm, determine the noise value in each cell; Each of the noise values is added to a corresponding cell to obtain a two-dimensional noise field information table.
3. The method according to claim 1, characterized in that Determining the particle motion state of each particle in the current particle data frame according to the two-dimensional noise field information table and the particle data information of the current particle data frame in the particle data stream includes: Extracting particle data information of a current particle data frame in the particle data stream to obtain an initial position corresponding to each particle in the current particle data frame; For each particle, according to the initial position and in combination with the two-dimensional noise field information table, determine the target movement position of the particle; Based on each of the target motion positions, the particle motion state of each particle in the current particle data frame is determined.
4. The method according to claim 3, characterized in that: Determining the target movement position of the particle according to the initial position and in combination with the two-dimensional noise field information table includes: If the configured noise rendering precision mode is the first precision rendering, determining the target movement position of the particle by combining the initial position and the two-dimensional noise field information table through a first processing strategy; If the configured noise rendering precision mode is second precision rendering, determining the target movement position of the particle by combining the initial position and the two-dimensional noise field information table through a second processing strategy; The first precision is lower than the second precision, and the first processing strategy is different from the second processing strategy.
5. The method according to claim 4, characterized in that The step of determining the target movement position of the particle by combining the initial position and the two-dimensional noise field information table with the first processing strategy includes: Performing a rounding operation on each coordinate value in the first coordinate representing the initial position, and matching the rounded coordinates with the index coordinates corresponding to each cell in the two-dimensional noise field information table to obtain the target index coordinates; The first coordinate is adjusted based on the noise value in the cell corresponding to the target index coordinate, and the target movement position of the particle is characterized based on the adjusted coordinate.
6. The method according to claim 4, characterized in that The step of determining the target movement position of the particle by combining the initial position and the two-dimensional noise field information table with the second processing strategy includes: Rounding down and rounding up each coordinate value in the first coordinate representing the initial position; Constructing a set number of associated coordinates based on the rounded coordinate values, and matching each of the associated coordinates with an index coordinate corresponding to each cell in the two-dimensional noise field information table; The noise values in the cells corresponding to the matched index coordinates are recorded as candidate noise values respectively; Performing linear interpolation based on each of the candidate noise values in combination with a corresponding determined linear coefficient to obtain a target noise value; The first coordinate is adjusted based on the target noise value, and the target motion position of the particle is characterized based on the adjusted coordinate.
7. The method according to claim 3, characterized in that The step of determining the particle motion state of each particle in the current particle data frame based on each target motion position includes: The movement of each particle from the initial position to the corresponding target movement position is determined as the particle movement state of each particle in the current particle data frame.
8. The method according to claim 7, characterized in that The real-time presentation of particle special effects according to the motion state of each particle includes: Each of the particles is controlled to move according to the particle motion state, so as to present a particle special effect through the movement of each of the particles.
9. The method according to any one of claims 1 to 8, characterized in that: Also includes: The next particle data frame in the particle data stream is used as a new current particle data frame, and the determination of the particle motion state of each particle in the current particle data frame is continued until a particle special effect end instruction is received.
10. A particle special effects rendering device, characterized in that: include: A data stream acquisition module is used to acquire the particle data stream of the selected particle special effect and obtain a pre-created two-dimensional noise field information table; A motion state determination module, used to determine the particle motion state of each particle in the current particle data frame according to the two-dimensional noise field information table and the particle data information of the current particle data frame in the particle data stream; A particle special effect presentation module, used for presenting particle special effects in real time according to the motion state of each particle; The motion state determination module is specifically used for: A pre-created two-dimensional noise field information table stores noise values. For a current particle data frame, the noise value corresponding to each particle is obtained from the two-dimensional noise field information table. The position of the particle in the current particle data frame matches the index position of the two-dimensional noise field information table. After obtaining the position of the particle in the current particle data frame, a noise value matching the coordinates is found from the two-dimensional noise field information table. The motion state of the particle is interfered with according to the noise value. The noise value is an increment of the particle position change. The target motion position of the particle is determined according to the noise value. The motion state of the particle is obtained according to the known initial position of the particle and the target motion position of the particle.
11. A particle special effects rendering device, characterized in that: The particle special effects rendering device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the particle special effect rendering method according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the particle special effect rendering method according to any one of claims 1 to 9 when executed.
13. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the computer program implements the particle special effect rendering method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Particle animation processing method and device, storage medium and computer equipment
CN112215932A