Methods, apparatus, storage media and devices for generating animation effects of mosaic particles
By expanding the model vertex information and generating a mosaic noise map, the problems of mosaic particle color correspondence and excessive CPU pressure were solved, achieving efficient animation effect generation.
Patent Information
- Application Number
- CN202211457782.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-21
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2042-11-21
AI Technical Summary
In existing technologies, the methods for generating mosaic particle scattering effects have the problem that the particle colors do not completely correspond to the image colors, and a large number of 3D surface models are required when subdividing particles, resulting in excessive CPU pressure.
By acquiring the vertex information and textures of the original model, the vertex information of the model is expanded to match the number of mosaic particles, a mosaic noise map is generated, the movement position and speed of each particle are determined, and pixel motion is controlled to generate animation effects, avoiding the addition of unnecessary 3D patch models.
It achieves a perfect correspondence between the mosaic particle colors and the image colors, reducing the burden on computer equipment and improving performance.
Smart Images

Figure CN115761066B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and more particularly to the field of game animation technology, specifically to a method, apparatus, storage medium, and device for generating animation effects of mosaic particles. Background Technology
[0002] Currently, achieving a mosaic particle scattering effect typically involves using a particle emitter to emit particles of similar color to the image. These particles then converge / scatter towards the image's location, and mosaic particles are then cut out on top of the image. The more particles converge, the fewer cut-out mosaic particles remain, ultimately revealing a complete image. This approach has the following two drawbacks: First, the particles and the image are rendered separately, each corresponding to two different rendering methods. In the end, it only visually simulates many tiny particles assembling into a complete image, but the particle colors and image colors do not completely correspond, and the cutout positions of the image and the particle aggregation positions do not completely correspond. Secondly, when mosaic particles need to be subdivided into very small particles, the number of particles is huge. The larger the particles are, the more each individual particle needs a 3D surface model. Therefore, the required 3D surface model is larger, which will put a huge pressure on the CPU.
[0003] Among them, such as Figure 1a As shown, each square particle is a 3D surface model. The more particles there are, the more 3D surface models there are, such as... Figure 1b As shown. Summary of the Invention
[0004] This application provides a method, apparatus, storage medium, and computer device for generating animation effects of mosaic particles, which can make the colors of the scattered mosaic particles completely correspond to the colors of the image while improving the performance of the computer device.
[0005] This application provides a method for generating animation effects for mosaic particles, including: Obtain the vertex information and original textures of the original model; Expand the vertex information of the original model according to the range of motion of the mosaic particles, while keeping the size and position of the original texture relative to the screen unchanged; The texture coordinates corresponding to the original texture are processed according to the number of mosaic particles to obtain a mosaic noise map, which includes mosaic particles matching the number. Determine the target moving position and moving speed of each mosaic particle within the said range of motion; Based on the moving speed and the mosaic noise map, determine the coordinate offset value of each mosaic particle in each frame; The corresponding pixel in the original texture is obtained based on the coordinate offset value in each frame, and the pixel is controlled to move towards the target position according to the moving speed of the mosaic particles in each frame, so as to generate the animation effect of the mosaic particles.
[0006] This application embodiment also provides a mosaic particle animation effect generation device, including: The acquisition module is used to acquire vertex information and original textures of the original model; The zoom-out module is used to zoom out the vertex information of the original model according to the movement range of the mosaic particles, while keeping the original texture unchanged; The particle determination module is used to process the texture coordinates corresponding to the original texture according to the number of mosaic particles to obtain a mosaic noise map, wherein the mosaic noise map includes mosaic particles that match the number. The position and velocity determination module is used to determine the target moving position and moving velocity of each mosaic particle within the range of motion; The offset determination module is used to determine the coordinate offset value of each mosaic particle in each frame based on the moving speed and the mosaic noise map. The acquisition control module is used to acquire the corresponding pixel in the original texture based on the coordinate offset value in each frame, and control the pixel to move towards the target position according to the moving speed of the mosaic particles in each frame, so as to generate the animation effect of the mosaic particles.
[0007] This application also provides a computer-readable storage medium storing a computer program adapted for loading by a processor to execute the steps in the mosaic particle animation effect generation method as described in any of the above embodiments.
[0008] This application also provides a computer device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the steps in the mosaic particle animation effect generation method described in any of the above embodiments by calling the computer program stored in the memory.
[0009] The method, apparatus, storage medium, and computer equipment for generating mosaic particle animation effects provided in this application embodiment obtain vertex information and original textures of the original model. They expand the vertex information of the original model according to the motion range of the mosaic particles while keeping the original textures unchanged. The texture coordinates corresponding to the original textures are processed according to the number of mosaic particles to obtain a mosaic noise map. This mosaic noise map includes mosaic particles matching the number of particles. The target movement position and movement speed of each mosaic particle within its motion range are determined. Based on the movement speed and the mosaic noise map, the coordinate offset value of each mosaic particle in each frame is determined. The coordinate offset value in a frame is obtained to obtain the corresponding pixel in the original texture. The pixels in each frame are controlled to move towards the target position according to the moving speed of the corresponding mosaic particle to generate the animation effect of the mosaic particle. In this embodiment, the pixels in the original texture are manipulated to generate the animation effect of the mosaic particle, so that the color of the mosaic particle corresponds completely with the color of the hollow in the original texture. Moreover, no matter how many mosaic particles are generated, only one original model is used. The animation effect of each mosaic particle is based on the movement of pixels on the original texture, without adding extra 3D surface models, thus improving the performance of computer equipment. Attached Figure Description
[0010] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0011] Figure 1a and Figure 1b This is a schematic diagram of a 3D patch model corresponding to a particle in the prior art.
[0012] Figure 2 This is a flowchart illustrating the method for generating animation effects of mosaic particles provided in an embodiment of this application.
[0013] Figure 3 This is a schematic diagram showing the effect of the original model provided in the embodiments of this application displayed on the screen.
[0014] Figure 4 This is a schematic diagram showing the effect of enlarging the vertex coordinates of the original model and shrinking the texture, as provided in the embodiments of this application.
[0015] Figure 5 A schematic diagram of the initial mosaic noise map provided for an embodiment of this application.
[0016] Figure 6Example diagrams illustrating the key steps for obtaining an initial mosaic noise map provided in embodiments of this application.
[0017] Figure 7 This is a schematic diagram of the intermediate mosaic noise map provided in the embodiments of this application.
[0018] Figure 8 Example diagrams illustrating the key steps for obtaining an intermediate mosaic noise map provided in embodiments of this application.
[0019] Figure 9 A schematic diagram of the final mosaic noise map provided for an embodiment of this application.
[0020] Figure 10 Example diagrams illustrating key steps in the final mosaic noise map provided in the embodiments of this application.
[0021] Figure 11 This is a schematic diagram of mosaic particles of varying sizes provided in an embodiment of this application.
[0022] Figure 12a and Figure 12b This is a schematic diagram of a frame of animation effect provided in an embodiment of this application.
[0023] Figure 13 This is a schematic diagram of the structure of the mosaic particle animation effect generation device provided in the embodiments of this application.
[0024] Figure 14 A schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0025] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0026] This application provides a method, apparatus, storage medium, and computer device for generating mosaic particle animation effects. Specifically, the method for generating mosaic particle animation effects can be executed by a computer device, which can be a terminal or a server. The terminal can be a smartphone, tablet, laptop, touchscreen, game console, personal computer (PC), personal digital assistant (PDA), or other terminal device. The server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.
[0027] For example, when the mosaic particle animation effect generation method runs on a terminal device, the terminal device stores a mosaic particle animation effect generation application and uses it to render the mosaic particle animation effect, or the terminal device stores a game application that generates the mosaic particle animation effect within that game application. The terminal device is used to interact with the user through a graphical user interface, for example, by downloading and running the animation effect generation application / game application. The terminal device can provide the graphical user interface to the user in various ways, such as rendering it on the terminal device's display screen or presenting the graphical user interface through holographic projection.
[0028] For example, when the mosaic particle animation generation method runs on a server, it can be used for cloud animation or cloud gaming, such as animations in cloud games. Cloud gaming refers to a gaming method based on cloud computing. In the cloud gaming operating mode, the main body running the game application and the main body presenting the game screen / animation effects are separated. The storage and execution of the mosaic particle animation generation method are completed on the cloud gaming server. The presentation of the animation effects is completed on the cloud gaming client, which is mainly used for receiving and sending game data and presenting game screens (including animation effects). When playing the game, the user operates the cloud gaming client to send operation commands to the cloud gaming server. The cloud gaming server runs the game application according to the operation commands, encodes and compresses the game screen and other data, returns it to the cloud gaming client through the network, and finally decodes and outputs the game screen through the cloud gaming client. This reduces the terminal's computing resource consumption and improves the image quality of the screen displayed on the terminal.
[0029] It should be noted that the animation in the embodiments of this application can be a three-dimensional animation or a two-dimensional animation. The following description uses a two-dimensional animation as an example.
[0030] The following will provide a detailed description of a direction control method, apparatus, computer-readable storage medium, and computer device provided in the embodiments of this application. It should be noted that the sequence numbers of the following embodiments are not intended to limit the preferred order of the embodiments.
[0031] Figure 2 This application provides a method for generating animation effects of mosaic particles, which includes the following steps.
[0032] 101. Obtain the vertex information and original textures of the original model.
[0033] If the generated animation is 2D, the original model is a 2D model, such as a 2D patch model. If the animation is 3D, the original model can be a 3D model, such as a 3D patch model.
[0034] The original model includes vertex information and texture map, which is the original texture map. The original texture map is an image, and its corresponding coordinates are texture map coordinates, also known as UV coordinates or texture coordinates, etc., represented by u and v. u and v define the position information of each point on the texture map coordinates.
[0035] This embodiment uses a two-dimensional animation as an example for illustration. Correspondingly, the original model can be a two-dimensional patch model, the vertex information can include the four vertex information of the two-dimensional patch model, and the original texture is the texture corresponding to the original model, with the two-dimensional patch model as the carrier. For one original texture, there is also one corresponding original model.
[0036] Obtain the vertex information and original textures of the original model, and load the original model onto the screen for display. For example... Figure 3 The image shown is a schematic diagram illustrating the effect of the original model displayed on the screen. The larger white box represents the screen size of the computer device, and the smaller black box represents the size of the original 2D patch model; the displayed image is the original texture.
[0037] 102. Expand the vertex information of the original model according to the movement range of the mosaic particles, while keeping the size and position of the original texture relative to the screen unchanged.
[0038] To create a mosaic particle scattering / aggregating animation effect on an image, mosaic particles need to either scatter from the image or aggregate from outside the image into it. Therefore, the movement range of the mosaic particles needs to be greater than the display area of the image (such as the original texture) and also greater than the area of the original model. Thus, the vertex information of the original model can be expanded according to the movement range of the mosaic particles, while keeping the size and position of the original texture relative to the screen unchanged.
[0039] For example, the original model is expanded according to the movement range of the mosaic particles to obtain expanded vertex information and expanded textures. When expanding the original model, the vertex information and the original textures will inevitably be expanded at the same time. Expanding the vertex information can expand the display range of the mosaic particles, but it is not necessary to obtain the expanded textures. Therefore, the expanded textures are restored to the original textures, that is, the expanded textures are reduced to the original textures, while keeping the size and position of the original textures relative to the screen unchanged.
[0040] The movement range of the mosaic particles can be determined by a motion range parameter, such as _MosaicRange. This motion range parameter is a custom parameter that can be set in advance by the user according to the specific scenario, or a default motion range parameter can be used. This motion range parameter is a floating-point value and can be set to values such as 3 and 5, that is, multiplied by 3 or 5.
[0041] In the vertex shader, the vertex information of the original model is expanded according to the movement range of the mosaic particles. The expanded model range containing the four vertices is the movement range of the mosaic particles. In one embodiment, the model range can be made to extend beyond the screen of the computer device to create an animation effect of mosaic particles flying in from outside the screen.
[0042] The key step in the vertex shader to amplify the vertex information of the original model is as follows: OUT.worldPosition.xyz += ((_ MosaicRange - 1.0) IN.vertex.xyz); where _ MosaicRange is the motion range parameter of the mosaic particles, IN.vertex.xyz is the vertex coordinates of the original input model, and OUT.worldPosition.xyz is the output enlarged vertex coordinates. The -1 is used to allow the motion range parameter to be used for both enlarging the model vertices and shrinking the texture. It can be understood that multiplying the vertex coordinates by 1 is equivalent to not moving the vertex coordinates, so the UV coordinates cannot move either. Multiplying the vertex coordinates by 2 is equivalent to enlarging the vertices by 1, while the UV coordinates are halved.
[0043] In the pixel shader, the enlarged texture is reduced in size. The texture reduction factor is consistent with the model magnification factor. For example, if the original model is magnified by 1 time, the texture is reduced by 1 time; if the original model is magnified by 5 times, the texture is reduced by 5 times.
[0044] The key step in scaling down texture pixels in the pixel shader is as follows: float2 finalvu651 = saturate(((mosaicuv650) _MosaicRange)+((_MosaicRange-1.0) (-0.5)))); where, the saturate function constrains the result value to between 0 and 1, taking 1 for values greater than 1 and 0 for values less than 0, while keeping others unchanged, and mosaicuv650 is the passed-in uv coordinate value, (_ MosaicRange-1.0). The function of (-0.5) is to transform the texture coordinates so that the texture is scaled from the center point of the screen. The bottom left corner of the original texture is the origin. If there is no (_MosaicRange-1.0), then (_MosaicRange-1.0) will be used. If the value is -0.5, then the texture is scaled from the bottom left corner. When scaling down the texture pixels, both the u and v coordinates need to be processed accordingly; therefore, the output is in float2 format, which can also be understood as a two-dimensional result.
[0045] It should be noted that the two-dimensionality in this embodiment is different from the usual understanding of two-dimensionality. Usually, (x, y) is used to represent a two-dimensional point, while in this embodiment, the u-coordinate corresponds to a dimension, which can be called the u-coordinate dimension, and the v-coordinate corresponds to a dimension, which can be called the v-coordinate dimension. The dimension corresponding to the u-coordinate includes the u-coordinates of multiple points, and the dimension corresponding to the v-coordinate includes the v-coordinates of multiple points. The u-coordinate dimension and the v-coordinate dimension together constitute two dimensions.
[0046] The vertex information of the original model is amplified according to the movement range of the mosaic particles, which expands the movement range of the mosaic particles, while the relative size and position of the texture relative to the screen remain unchanged, so that the scattered mosaic particles have more display space.
[0047] Figure 4 This is a diagram illustrating the effect of scaling down the texture mapping after enlarging the vertex coordinates of the original model. Figure 4 In the image, the white box represents the screen size, and the black box that extends beyond the screen represents the enlarged model area. It can be seen that the size and position of the texture relative to the screen remain unchanged after the texture is reduced, that is, the size and position of the original texture relative to the screen remain unchanged.
[0048] from Figure 3 and Figure 4 As can be seen from this, there is only one two-dimensional patch model in this embodiment of the application, and the number of mosaic particles will not affect the number of models.
[0049] 103. The texture coordinates corresponding to the original texture are processed according to the number of mosaic particles to obtain a mosaic noise map, which includes mosaic particles that match the number.
[0050] The number of mosaic particles is a custom value, which can be preset or pre-generated according to the specific needs of the scenario. For example, the number of mosaic particles can be one-dimensional, such as 10, or two-dimensional, corresponding to the u-coordinate and v-coordinate dimensions respectively. For instance, if the number of particles in the u-coordinate dimension is 10 and the number in the v-coordinate dimension is 5, then there are 10 mosaic particles in the u-coordinate and 5 in the v-coordinate. It should be noted that this number is only for illustrative purposes; in reality, the number of mosaic particles is generally greater than this.
[0051] The texture coordinates (UV coordinates) corresponding to the original texture are processed according to the number of mosaic particles. For example, the texture coordinates corresponding to the original texture can be processed according to the number of mosaic particles and a noise function to obtain a mosaic noise map, which includes mosaic particles matching the number. The size of each mosaic particle in the mosaic noise map can be the same or different, and the brightness of each mosaic particle can be consistent or inconsistent.
[0052] In this context, "same" or "consistent" means completely identical, while any difference is considered "different" or "inconsistent." Regardless of whether the size or brightness of each mosaic particle in the mosaic noise image is the same, the number of mosaic particles in the generated mosaic noise image is the same as the number of custom mosaic particles. Consistent particle size means that each mosaic particle is the same size, i.e., the scattered / reunited mosaic particles are the same size. Inconsistent brightness means that the corresponding values of the mosaic particles are different, and this inconsistency affects the processing results of a series of processes performed based on the mosaic noise image later in this paper.
[0053] In one scenario, the step of processing the texture coordinates corresponding to the original texture according to the number of mosaic particles to obtain a mosaic noise map includes: performing noise processing on the texture coordinates of the original texture according to the number of mosaic particles to obtain an initial mosaic noise map, which includes mosaic particles of the same number, size, and brightness. This initial mosaic noise map is then used as the final mosaic noise map.
[0054] Correspondingly, the step of noise processing the texture coordinates of the original texture according to the number of mosaic particles to obtain an initial mosaic noise map includes: multiplying the texture coordinates of the original texture by the number of mosaic particles and then rounding the result to obtain a first rounded result; inputting the first rounded result into a noise function for noise processing to obtain the initial mosaic noise map. The rounding process includes rounding down.
[0055] The original texture coordinates range from [0,1]. If the number of mosaics is 10, the value obtained by multiplying the original texture coordinates by the number of mosaics ranges from [0,10]. Since the original texture coordinates range includes decimals, the obtained value [0,10] will also include decimals. Therefore, the obtained value [0,10] is rounded down to obtain the first rounding result, which includes integer values such as 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, etc. If the number of mosaic elements is two-dimensional, with 10 elements corresponding to the u-coordinate dimension and 5 elements corresponding to the v-coordinate dimension, then multiply all [0,1] elements of the u-coordinate in the texture coordinate by 10 to obtain [0,10], and multiply all [0,1] elements of the v-coordinate in the texture coordinate by 5 to obtain [0,5]. Round down both [0,10] and [0,5] to obtain the first rounded result.
[0056] After obtaining the first rounding result, the first rounding result is used as the input of the noise function. The noise function is used to process the noise and obtain the initial mosaic noise map. The mosaic noise map includes mosaic particles that match the number of determined mosaic particles, have the same size, and have different brightness.
[0057] The noise function is used to apply random noise to the values in the first rounding result to obtain a mosaic noise map. The input to this noise function is in float2 format, meaning it is two-dimensional, including u-coordinate and v-coordinate dimensions, and the output is one-dimensional, i.e., a mosaic noise map in one dimension. Figure 5 The image shown is a schematic diagram of the initial mosaic noise map obtained by processing the first rounding result according to the noise function. In this mosaic noise map, each mosaic particle corresponds to a particle block. Figure 5 As can be seen, each mosaic particle in the mosaic noise image is of uniform size but inconsistent in brightness. In this embodiment, the initial mosaic noise image is one-dimensional, and its size is consistent with the size of the u-coordinate or v-coordinate of the original texture.
[0058] In some cases, the one-dimensional mosaic noise map in the embodiments of this application may also include a u-coordinate dimension and a v-coordinate dimension. For example, the data of multiple points in the u-coordinate dimension is variable, while the u-coordinate values of multiple points in the v-coordinate dimension are the same. For example, the data size in the u-coordinate dimension is [0,1], while the data in the v-coordinate dimension are all the same.
[0059] like Figure 6 The diagram illustrates the key steps in obtaining the initial mosaic noise map. Specifically, `Get Local Var`'s `Var(UV)` represents obtaining the original texture, `Get Local Var`'s `Var(MosaicNumg)` represents obtaining the number of mosaic particles, `Multiply` multiplies the texture coordinates of the original texture with the number of mosaic particles, `Floor` rounds the multiplied value down to obtain the first rounded result, and `NoiseGenerator` uses the `snoise` function to generate the initial mosaic noise map. The generated initial mosaic noise is shown below. Figure 5 As shown.
[0060] In this case, after generating the initial mosaic noise map, the initial mosaic noise map is used as the final mosaic noise map.
[0061] In one scenario, the step of processing the texture coordinates corresponding to the original texture according to the number of mosaic particles to obtain a mosaic noise map includes: performing noise processing on the texture coordinates of the original texture according to the number of mosaic particles to obtain an initial mosaic noise map, which includes mosaic particles of the same number, size, and brightness; performing color processing and scaling processing on the initial mosaic noise map to obtain a final mosaic noise map, which includes mosaic particles of the same number, size, and brightness. In this embodiment, after obtaining mosaic particles of the same size and inconsistent brightness, the mosaic particles are further scaled to obtain mosaic particles of inconsistent size and brightness.
[0062] The method for obtaining the initial mosaic noise map is described above and will not be repeated here. After obtaining the initial mosaic noise map, the initial mosaic noise map can be color-processed according to the pixel values corresponding to the original texture to obtain an intermediate mosaic noise map with inconsistent colors; obtain the offset direction parameter of each mosaic particle; and scale the intermediate mosaic noise map according to the offset direction parameter to obtain the final mosaic noise map.
[0063] The process involves obtaining the pixel values of the original texture, multiplying the initial mosaic noise image with these pixel values to obtain an intermediate mosaic noise image with inconsistent colors. The color of each mosaic particle varies within each particle block. Multiplying the initial mosaic noise image with the pixel values prepares the groundwork for obtaining mosaic particles of inconsistent sizes.
[0064] Figure 7 This is a schematic diagram of the intermediate mosaic noise map. Figure 7 The intermediate mosaic noise map is obtained by multiplying the initial mosaic noise map with the pixel values of the original texture. Figure 8 An example diagram illustrating the key steps in obtaining the intermediate mosaic noise map. From this... Figure 7 and Figure 8 As can be seen from the corresponding diagram, the mosaic particles that were originally uneven in brightness and darkness become colored intermediate mosaic particles after being multiplied with the pixel values of the original texture. These intermediate mosaic particles are essentially mosaic particles that are uneven in brightness and darkness but uniform in size.
[0065] In one embodiment, after obtaining the intermediate mosaic noise map, a variable is further used to control the scaling of the pixel values of the original texture to obtain the final intermediate mosaic noise map.
[0066] After obtaining the intermediate mosaic noise map, the intermediate mosaic noise map is further scaled. For example, the offset direction parameter of each mosaic particle is obtained, and the intermediate mosaic noise map is scaled according to the offset direction parameter to obtain the final mosaic noise map.
[0067] The offset direction parameter can also be understood as a variable that controls the offset direction of the mask. It is a two-dimensional variable, corresponding to the values of the u-coordinate and v-coordinate, respectively. The offset direction parameter is used to control the movement of the mosaic particles, and its value can be either positive or negative.
[0068] The step of scaling the intermediate mosaic noise image according to the offset direction parameter to obtain the final mosaic noise image includes: adding the intermediate mosaic noise image and the offset direction parameter and then rounding the result to obtain a second rounding result; inputting the second rounding result into the noise function for noise processing to obtain the final mosaic noise image.
[0069] Understandably, after obtaining the offset direction parameters, the intermediate mosaic noise image is added to the offset direction parameters. Specifically, adding a positive number to the u-coordinate means the corresponding mosaic particle needs to be offset to the right, adding a negative number means the corresponding mosaic particle needs to be offset to the left, and adding positive and negative numbers to the v-coordinate means offsetting upwards and downwards, respectively. The values in the offset direction parameters can all be the same or different.
[0070] Because the brightness of the intermediate mosaic noise image is inconsistent, meaning that the value of each mosaic particle in the intermediate mosaic noise image is different, if the values in the offset direction parameter are the same, then the values obtained after addition will also be different, which means that the target movement position of each mosaic particle is different. If the values in the offset direction parameter are not the same, then the values obtained after addition will also be different, which also means that the target movement position of each mosaic particle is different.
[0071] The intermediate mosaic noise map is added to the offset direction parameter and then rounded down, including rounding up, to obtain a second rounding result. This second rounding is to ensure that the color values in the corresponding particle blocks of each mosaic particle are consistent. This is because the intermediate mosaic noise map is obtained by multiplying the pixel values of the original texture. Since the pixel values at each texture coordinate in the original texture vary, the color values in each particle block of the intermediate mosaic noise map also vary.
[0072] The second rounding result is input into a noise function, which may be the same as or different from the noise function used to process the first rounding result. This embodiment uses the same function as an example. The second rounding result is input into a `snoise` function for noise processing, such as random noise processing, to obtain the final mosaic noise image. In the final mosaic noise image, each mosaic particle has inconsistent size and brightness. Figure 9 As shown.
[0073] Figure 10 This is an example diagram illustrating the key steps in creating the final mosaic noise map. Figure 10 The leftmost "Add" step refers to adding the middle mosaic noise map to the offset direction parameter. The sum is then processed by "Ceil" (rounding up) to obtain a second rounded result. This second rounded result is then processed using a Noise Generator to obtain the final mosaic noise map. Figure 9 As shown.
[0074] In one scenario, the step of processing the texture coordinates corresponding to the original texture according to the number of mosaic particles to obtain a mosaic noise map includes: performing noise processing on the texture coordinates of the original texture according to the number of mosaic particles to obtain an initial mosaic noise map, which includes mosaic particles of the same number, size, and brightness; and setting the value of each mosaic particle in the initial mosaic noise map to be the same to obtain a final mosaic noise map, which includes mosaic particles of the same number, size, and brightness. This embodiment specifies obtaining mosaic particles of the same size and brightness.
[0075] The value of a mosaic particle is related to its brightness. Different values for mosaic particles mean that the brightness of the mosaic particles is inconsistent, while the same value for mosaic particles means that the brightness of the mosaic particles is consistent.
[0076] In one scenario, the step of processing the texture coordinates corresponding to the original texture according to the number of mosaic particles to obtain a mosaic noise map includes: performing noise processing on the texture coordinates of the original texture according to the number of mosaic particles to obtain an initial mosaic noise map, which includes mosaic particles of the same number, size, and brightness; performing color processing and scaling processing on the initial mosaic noise map to obtain a final mosaic noise map, which includes mosaic particles of the same number, size, and brightness; and setting the value of each mosaic particle in the final mosaic noise map to be the same to obtain a determined final mosaic noise map, which includes mosaic particles of the same number, size, and brightness. This embodiment specifies obtaining mosaic particles of inconsistent size and consistent brightness.
[0077] The resulting mosaic noise map shows that each mosaic particle is of inconsistent size, causing the scattered or re-aggregated mosaic particles to vary in size. For example... Figure 11 As shown, the size of each mosaic tile is inconsistent. Figure 11 The image in the middle shows the effect after sampling the original texture; the color of each mosaic particle is inconsistent.
[0078] It should be noted that the above process for obtaining a mosaic noise map is just an example, and other methods can also be used to obtain mosaic noise maps.
[0079] 104. Determine the target movement position and speed of each mosaic particle within its range of motion.
[0080] Specifically, the target movement position parameters are obtained. These target movement position parameters are custom parameters, corresponding to... Figure 10 The parameters of MosaicScattered in [the context of the text].
[0081] The target movement position parameters include the range values of the u coordinate and the v coordinate. For example, the range value of the u coordinate is [0, 1.03], and the range value of the v coordinate is [0, 2.5]. This means that the u coordinate moves from the original texture's coordinate position, such as 0, to 1.03, and the v coordinate moves from the original texture's coordinate position, such as 0, to 2.5. It should be noted that the maximum value of the original texture's coordinate is 1.
[0082] The target movement position parameter can further determine whether the current mosaic particles scatter or regroup. For example, if the u-coordinate range is [0, 1.03] and the v-coordinate range is [0, 2.5], it means that the mosaic particles scatter from [0, 0] to the target movement position of [1.03, 2.5], achieving the scattering effect. If the u-coordinate range is [1.03, 0] and the v-coordinate range is [2.5, 0], it means that the corresponding mosaic particles regroup from [1.03, 2.5] to [0, 0], that is, regroup to their original position in the original texture, achieving the regrouping effect.
[0083] It should be noted that the values of the target movement position parameters are for illustrative purposes and to facilitate understanding of the scheme, and do not constitute any limitations. In some other embodiments, a corresponding target movement position parameter value can be set for each mosaic particle.
[0084] The target movement position parameters were obtained, and the target movement position of each mosaic particle was determined based on the target movement position parameters, and the offset direction of each mosaic particle was determined.
[0085] For example, the value corresponding to the target movement position parameter can be added to the value of each mosaic particle in the mosaic noise map to obtain the target movement position of each mosaic particle.
[0086] If the brightness and darkness of the obtained mosaic noise map are inconsistent, it means that the value of each mosaic particle in the mosaic noise map is different. Even if the value of the target movement position parameter is the same, the determined target movement position is also different. If the brightness and darkness of the obtained mosaic noise map are consistent, it means that the value of each mosaic particle in the mosaic noise map is the same. When the value of the target movement position parameter is the same, the determined target movement position is the same.
[0087] The step of determining the offset direction of each mosaic particle includes: performing noise and color processing on the texture coordinates of the original texture according to the number of mosaic particles to obtain an intermediate mosaic noise map, which includes mosaic particles with a matching number but inconsistent colors; obtaining the offset direction parameter of each mosaic particle; and adding the intermediate mosaic noise map and the offset direction parameter to obtain the offset direction of each mosaic particle within its motion range.
[0088] The step of performing noise and color processing on the texture coordinates of the original texture according to the number of mosaic particles to obtain an intermediate mosaic noise map includes: performing noise processing on the texture coordinates of the original texture according to the number of mosaic particles to obtain an initial mosaic noise map, which includes mosaic particles of the same number, size, and brightness. Then, color processing is performed on the initial mosaic noise map according to the pixel values corresponding to the original texture to obtain an intermediate mosaic noise map with inconsistent colors. Next, the offset direction parameter of each mosaic particle is obtained. Finally, the intermediate mosaic noise map and the offset direction parameter are added together to obtain the offset direction of each mosaic particle within its motion range.
[0089] The inconsistency in brightness in the intermediate mosaic noise image means that the value of each mosaic particle in the mosaic noise image is different. Even if the values in the offset direction parameter are the same, the determined offset direction will be different.
[0090] After obtaining the target's moving position and offset direction, the moving speed of each mosaic particle within its range of motion can be determined based on these parameters. For example, movement time information can be further obtained, and then the moving speed of each mosaic particle within its range of motion can be determined based on the target's moving position, offset direction, and movement time.
[0091] If the target moves to the same location and for the same duration, the movement speed will be the same. However, because the offset directions are different, it is possible to achieve an animation effect where different mosaic particles scatter / aggregate in different directions. If the target moves to different locations but for the same duration, the movement speed will be different. Furthermore, because the offset directions are different, it is possible to achieve an animation effect where different mosaic particles scatter / aggregate in different directions at different speeds.
[0092] It is important to note that the inconsistency in brightness in the mosaic noise image means that the value of each mosaic particle in the mosaic noise image is different, and the value of the mosaic particle directly affects the values of the offset direction, the size of the mosaic particle, the target's moving position and moving speed, etc.
[0093] 105. Based on the movement speed and the mosaic noise map, determine the coordinate offset value of each mosaic particle in each frame.
[0094] For example, the movement speed is multiplied by the mosaic noise map to determine the coordinate offset of each mosaic particle in each frame. Furthermore, a noise function (not a snooze function) can be used to simulate the randomness of the movement speed. The result of processing with the noise function is then multiplied by the mosaic noise map to determine the coordinate offset of each mosaic particle in each frame; this coordinate offset refers to the UV coordinate offset.
[0095] If the brightness and darkness of the mosaic noise image are inconsistent, even if the moving speed value is the same, the coordinate offset value of each mosaic particle in each frame will be different after multiplying the moving speed with the mosaic noise image. Even if the brightness and darkness of the mosaic noise image are consistent and the moving speed value is the same, the coordinate offset value of each mosaic particle in each frame will be different due to the different offset directions.
[0096] 106. Obtain the corresponding pixel in the original texture based on the coordinate offset value in each frame, and control the pixel in each frame to move towards the target position according to the moving speed of the corresponding mosaic particle to generate the animation effect of the mosaic particle.
[0097] Based on the coordinate offset value and size of each mosaic particle in each frame, the corresponding pixels (including pixel blocks) in the original texture are sampled. The pixels (including pixel blocks) in the original texture that match the coordinate offset value and the size of the mosaic particle are obtained. Then, the pixel is controlled to move towards the target position according to the moving speed of the corresponding mosaic particle to generate the animation effect of the mosaic particles.
[0098] like Figure 12a and Figure 12b The image shows a schematic diagram of the animation effect of a certain frame of mosaic particles. As can be seen from the image, the mosaic particles move within the expanded model range, and no matter how the number of mosaic particles is subdivided, it only manipulates the pixels in the original texture and does not affect the number of models. There is always only one model, namely the original model.
[0099] In the above embodiments, since the corresponding pixels in the original texture are obtained according to the coordinate offset value of the mosaic particles, the mosaic particles are all the original pixels in the original texture that either fly out or aggregate back. The colors of the mosaic particles and the hollowed-out parts of the original texture can be completely matched. Moreover, the scattering and aggregation of the mosaic particles are all operations on the pixels of the original texture itself, without adding extra 3D surface models, thus improving the performance of the computer device.
[0100] It is important to note that the essence of this invention differs from the current method of using a VFX (Visual Effect Graph) editor to simulate particles using a GPU. While a VFX editor uses a GPU to create particles and calculates the position and color of each particle, the method still requires multiple particles. The more particles there are, the more 3D patch models are used, which reduces the performance of the computer device. Furthermore, using a VFX editor does not involve manipulating the pixels of an image to generate mosaic particles; it still uses particles.
[0101] All of the above technical solutions can be combined in any way to form optional embodiments of this application, and will not be described in detail here.
[0102] To facilitate better implementation of the mosaic particle animation effect generation method of this application embodiment, this application embodiment also provides a mosaic particle animation effect generation apparatus. Please refer to... Figure 13 , Figure 13 This is a schematic diagram of the structure of the mosaic particle animation effect generation device provided in an embodiment of this application. The mosaic particle animation effect generation device 200 may include an acquisition module 201, a zoom-in / zoom-out module 202, a particle determination module 203, a position and velocity determination module 204, an offset determination module 205, and an acquisition control module 206.
[0103] The acquisition module 201 is used to acquire the vertex information and original textures of the original model.
[0104] The scaling module 202 is used to expand the vertex information of the original model according to the movement range of the mosaic particles, while keeping the original texture unchanged.
[0105] Specifically, the scaling module 202 is used to scale up the original model according to the movement range of the mosaic particles to obtain scaled-up vertex information and scaled-up textures; restore the scaled-up textures to the original textures, and keep the size and position of the original textures relative to the screen unchanged.
[0106] The particle determination module 203 is used to process the texture coordinates corresponding to the original texture according to the number of mosaic particles to obtain a mosaic noise map, wherein the mosaic noise map includes mosaic particles that match the number.
[0107] The particle determination module 203 is specifically used to perform noise processing on the texture coordinates of the original texture according to the number of mosaic particles to obtain an initial mosaic noise map. The initial mosaic noise map includes mosaic particles that match the number, are the same size, and have different brightness. The initial mosaic noise map is used as the final mosaic noise map.
[0108] Specifically, the particle determination module 203, when used to perform noise processing on the texture coordinates of the original texture according to the number of mosaic particles to obtain an initial mosaic noise map, is used to: multiply the texture coordinates of the original texture by the number of mosaic particles and then perform rounding to obtain a first rounding result; input the first rounding result into a noise function for noise processing to obtain an initial mosaic noise map.
[0109] The particle determination module 203 is specifically used to perform noise processing on the texture coordinates of the original texture according to the number of mosaic particles to obtain an initial mosaic noise map. The initial mosaic noise map includes mosaic particles that match the number, have the same size, and have different brightness. The initial mosaic noise map is then subjected to color processing and scaling processing to obtain a final mosaic noise map. The final mosaic noise map includes mosaic particles that match the number, have different sizes, and have different brightness.
[0110] The particle determination module 203, when performing color processing and scaling on the initial mosaic noise image to obtain the final mosaic noise image, specifically performs the following: color processing on the initial mosaic noise image based on the pixel values corresponding to the original texture to obtain an intermediate mosaic noise image with inconsistent colors; obtains the offset direction parameter of each mosaic particle; and scales the intermediate mosaic noise image based on the offset direction parameter to obtain the final mosaic noise image.
[0111] Specifically, the particle determination module 203, when scaling the intermediate mosaic noise map according to the offset direction parameter to obtain the final mosaic noise map, is used to: add the intermediate mosaic noise map and the offset direction parameter and then perform rounding to obtain a second rounding result; input the second rounding result into the noise function for noise processing to obtain the final mosaic noise map.
[0112] The particle determination module 203, after obtaining the mosaic noise map corresponding to the mosaic particles with inconsistent brightness, is further used to set the value of each mosaic particle in the mosaic noise map to be the same, so as to obtain mosaic particles with consistent brightness.
[0113] The position and velocity determination module 204 is used to determine the target moving position and moving velocity of each mosaic particle within the range of motion.
[0114] Specifically, the position and velocity determination module 204, when determining the moving speed of each mosaic particle within the range of motion, is used to: determine the target moving position of each mosaic particle within the range of motion and determine the offset direction of each mosaic particle; and determine the moving speed of each mosaic particle within the range of motion based on the target moving position and offset direction.
[0115] The position and velocity determination module 204, when determining the offset direction of each mosaic particle, specifically performs the following: noise and color processing on the texture coordinates of the original texture according to the number of mosaic particles to obtain an intermediate mosaic noise map, wherein the intermediate mosaic noise map includes mosaic particles that match the number but have different colors; obtains the offset direction parameter of each mosaic particle; and adds the intermediate mosaic noise map and the offset direction parameter to obtain the offset direction of each mosaic particle within its motion range.
[0116] The offset determination module 205 is used to determine the coordinate offset value of each mosaic particle in each frame based on the moving speed and the mosaic noise map.
[0117] The acquisition control module 206 is used to acquire the corresponding pixel in the original texture according to the coordinate offset value in each frame, and control the pixel to move towards the target moving position according to the moving speed of the mosaic particles in each frame, so as to generate the animation effect of the mosaic particles.
[0118] All of the above technical solutions can be combined in any way to form optional embodiments of this application, and will not be described in detail here.
[0119] Accordingly, embodiments of this application also provide a computer device, which can be a terminal or a server. For example... Figure 14 As shown, Figure 14 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. The computer device 300 includes a processor 301 with one or more processing cores, a memory 302 with one or more computer-readable storage media, and a computer program stored in the memory 302 and executable on the processor. The processor 301 is electrically connected to the memory 302.
[0120] The processor 301 is the control center of the computer device 300. It connects various parts of the computer device 300 through various interfaces and lines. By running or loading software programs and / or modules stored in the memory 302, and calling data stored in the memory 302, it performs various functions of the computer device 300 and processes data, thereby monitoring the computer device 300 as a whole.
[0121] In this embodiment, the processor 301 in the computer device 300 loads the instructions corresponding to the processes of one or more application programs / computer programs into the memory 302 according to the following steps, and the processor 301 runs the application programs / computer programs stored in the memory 302 to realize various functions, such as: The process involves: acquiring vertex information and original textures of the original model; expanding the vertex information of the original model based on the movement range of the mosaic particles, while maintaining the size and position of the original texture relative to the screen; processing the texture coordinates corresponding to the original texture according to the number of mosaic particles to obtain a mosaic noise map, which includes mosaic particles matching the number; determining the target movement position and movement speed of each mosaic particle within the movement range; determining the coordinate offset value of each mosaic particle in each frame based on the movement speed and the mosaic noise map; obtaining the corresponding pixel in the original texture based on the coordinate offset value in each frame, and controlling the pixel to move towards the target movement position according to the movement speed of the mosaic particles in each frame to generate the animation effect of the mosaic particles.
[0122] Specifically, when the processor performs the step of processing the texture coordinates corresponding to the original texture according to the number of mosaic particles to obtain a mosaic noise map, it performs the following: noise processing on the texture coordinates of the original texture according to the number of mosaic particles to obtain an initial mosaic noise map, wherein the initial mosaic noise map includes mosaic particles that match the number, are the same size, and have inconsistent brightness; and the initial mosaic noise map is used as the final mosaic noise map.
[0123] Specifically, when the processor performs the step of noise processing on the texture coordinates of the original texture according to the number of mosaic particles to obtain an initial mosaic noise map, it performs the following steps: multiplying the texture coordinates of the original texture by the number of mosaic particles and then rounding the result to obtain a first rounded result; inputting the first rounded result into a noise function for noise processing to obtain the initial mosaic noise map.
[0124] After obtaining the initial mosaic noise image, the processor further performs color processing and scaling on the initial mosaic noise image to obtain a final mosaic noise image. The final mosaic noise image includes mosaic particles that match the number of particles but have different sizes and brightness.
[0125] Specifically, when the processor performs the step of color processing and scaling of the initial mosaic noise image to obtain the final mosaic noise image, it performs the following: color processing of the initial mosaic noise image based on the pixel values corresponding to the original texture to obtain an intermediate mosaic noise image with inconsistent colors; obtaining the offset direction parameter of each mosaic particle; and scaling of the intermediate mosaic noise image based on the offset direction parameter to obtain the final mosaic noise image.
[0126] Specifically, when the processor performs the step of scaling the intermediate mosaic noise map according to the offset direction parameter to obtain the final mosaic noise map, it performs the following steps: adding the intermediate mosaic noise map and the offset direction parameter and then rounding the result to obtain a second rounding result; inputting the second rounding result into a noise function for noise processing to obtain the final mosaic noise map.
[0127] In particular, after obtaining the mosaic noise map corresponding to the mosaic particles with inconsistent brightness, the processor further performs the following: setting the value of each mosaic particle in the mosaic noise map to be the same, so as to obtain mosaic particles with consistent brightness.
[0128] Specifically, when the processor performs the step of determining the moving speed of each mosaic particle within the range of motion, it performs the following: determining the target moving position of each mosaic particle within the range of motion and determining the offset direction of each mosaic particle; and determining the moving speed of each mosaic particle within the range of motion based on the target moving position and offset direction.
[0129] Specifically, when the processor performs the step of determining the offset direction of each mosaic particle, it performs the following: noise processing and color processing on the texture coordinates of the original texture according to the number of mosaic particles to obtain an intermediate mosaic noise map, the intermediate mosaic noise map including mosaic particles that match the number but have different colors; obtain the offset direction parameter of each mosaic particle; and add the intermediate mosaic noise map and the offset direction parameter to obtain the offset direction of each mosaic within the range of motion.
[0130] Specifically, when the processor performs the step of expanding the vertex information of the original model according to the movement range of the mosaic particles while keeping the original texture unchanged, it performs the following steps: expanding the original model according to the movement range of the mosaic particles to obtain expanded vertex information and expanded texture; restoring the expanded texture to the original texture while keeping the size and position of the original texture relative to the screen unchanged.
[0131] For details on the specific implementation of each of the above operations, please refer to the preceding embodiments, and for the beneficial effects achieved, please also refer to the preceding embodiments. They will not be repeated here.
[0132] Optional, such as Figure 14 As shown, the computer device 300 also includes: a touch screen display 303, a radio frequency circuit 304, an audio circuit 305, an input unit 306, and a power supply 307. The processor 301 is electrically connected to the touch screen display 303, the radio frequency circuit 304, the audio circuit 305, the input unit 306, and the power supply 307. Those skilled in the art will understand that... Figure 14 The computer device structure shown does not constitute a limitation on the computer device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0133] The touch display screen 303 can be used to display a graphical user interface (GUI) and receive operation commands generated by the user interacting with the GUI. The touch display screen 303 may include a display panel and a touch panel. The display panel can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of the computer device. These graphical user interfaces can be composed of graphics, text, icons, video, and any combination thereof. Optionally, the display panel can be configured using a liquid crystal display (LCD), organic light-emitting diode (OLED), or other similar technologies. The touch panel can be used to collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel), generate corresponding operation commands, and execute the corresponding program according to the operation commands. Optionally, the touch panel may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch location and the signal generated by the touch operation, transmitting the signal to the touch controller. The touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 301. It can also receive and execute commands from the processor 301. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it transmits the information to the processor 301 to determine the type of touch event. Subsequently, the processor 301 provides corresponding visual output on the display panel based on the type of touch event. In this embodiment, the touch panel and the display panel can be integrated into the touch display screen 303 to achieve input and output functions. However, in some embodiments, the touch panel and the touch display screen 303 can be implemented as two independent components to achieve input and output functions. That is, the touch display screen 303 can also be used as part of the input unit 306 to achieve input functions.
[0134] In this embodiment, a game application is executed by processor 301 to generate a graphical user interface (GUI) on touch display screen 303. The virtual scene on the GUI includes at least one skill control area, and the skill control area includes at least one skill control. The touch display screen 303 is used to present the GUI and receive operation commands generated by the user interacting with the GUI.
[0135] The radio frequency circuit 304 can be used to transmit and receive radio frequency signals to establish wireless communication with network devices or other computer devices, and to transmit and receive signals with network devices or other computer devices.
[0136] Audio circuitry 305 can be used to provide an audio interface between a user and a computer device via a speaker and a microphone. Audio circuitry 305 converts received audio data into electrical signals, transmits them to the speaker, and the speaker converts them into sound signals for output. Conversely, the microphone converts collected sound signals into electrical signals, which are then received by audio circuitry 305, converted back into audio data, and output to processor 301 for processing. The audio data is then transmitted via radio frequency circuitry 304 to, for example, another computer device, or output to memory 302 for further processing. Audio circuitry 305 may also include an earphone jack to facilitate communication between peripheral headphones and the computer device.
[0137] The input unit 306 can be used to receive input numbers, characters, or user characteristic information (such as fingerprints, iris, facial information, etc.), and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.
[0138] Power supply 307 is used to supply power to various components of computer device 300. Optionally, power supply 307 can be logically connected to processor 301 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. Power supply 307 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0139] although Figure 14 As not shown in the diagram, computer equipment 300 may also include a camera, sensor, wireless fidelity module, Bluetooth module, etc., which will not be described in detail here.
[0140] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0141] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0142] Therefore, embodiments of this application provide a computer-readable storage medium storing multiple computer programs that can be loaded by a processor to execute steps in any of the mosaic particle animation effect generation methods provided in this application. For example, the computer program can execute the following steps: The process involves: acquiring vertex information and original textures of the original model; expanding the vertex information of the original model based on the movement range of the mosaic particles, while maintaining the size and position of the original texture relative to the screen; processing the texture coordinates corresponding to the original texture according to the number of mosaic particles to obtain a mosaic noise map, which includes mosaic particles matching the number; determining the target movement position and movement speed of each mosaic particle within the movement range; determining the coordinate offset value of each mosaic particle in each frame based on the movement speed and the mosaic noise map; obtaining the corresponding pixel in the original texture based on the coordinate offset value in each frame, and controlling the pixel to move towards the target movement position according to the movement speed of the mosaic particles in each frame to generate the animation effect of the mosaic particles.
[0143] Specifically, when the processor performs the step of processing the texture coordinates corresponding to the original texture according to the number of mosaic particles to obtain a mosaic noise map, it performs the following: noise processing on the texture coordinates of the original texture according to the number of mosaic particles to obtain an initial mosaic noise map, wherein the initial mosaic noise map includes mosaic particles that match the number, are the same size, and have inconsistent brightness; and the initial mosaic noise map is used as the final mosaic noise map.
[0144] Specifically, when the processor performs the step of noise processing on the texture coordinates of the original texture according to the number of mosaic particles to obtain an initial mosaic noise map, it performs the following steps: multiplying the texture coordinates of the original texture by the number of mosaic particles and then rounding the result to obtain a first rounded result; inputting the first rounded result into a noise function for noise processing to obtain the initial mosaic noise map.
[0145] After obtaining the initial mosaic noise image, the processor further performs color processing and scaling on the initial mosaic noise image to obtain a final mosaic noise image. The final mosaic noise image includes mosaic particles that match the number of particles but have different sizes and brightness.
[0146] Specifically, when the processor performs the step of color processing and scaling of the initial mosaic noise image to obtain the final mosaic noise image, it performs the following: color processing of the initial mosaic noise image based on the pixel values corresponding to the original texture to obtain an intermediate mosaic noise image with inconsistent colors; obtaining the offset direction parameter of each mosaic particle; and scaling of the intermediate mosaic noise image based on the offset direction parameter to obtain the final mosaic noise image.
[0147] Specifically, when the processor performs the step of scaling the intermediate mosaic noise map according to the offset direction parameter to obtain the final mosaic noise map, it performs the following steps: adding the intermediate mosaic noise map and the offset direction parameter and then rounding the result to obtain a second rounding result; inputting the second rounding result into a noise function for noise processing to obtain the final mosaic noise map.
[0148] In particular, after obtaining the mosaic noise map corresponding to the mosaic particles with inconsistent brightness, the processor further performs the following: setting the value of each mosaic particle in the mosaic noise map to be the same, so as to obtain mosaic particles with consistent brightness.
[0149] Specifically, when the processor performs the step of determining the moving speed of each mosaic particle within the range of motion, it performs the following: determining the target moving position of each mosaic particle within the range of motion and determining the offset direction of each mosaic particle; and determining the moving speed of each mosaic particle within the range of motion based on the target moving position and offset direction.
[0150] Specifically, when the processor performs the step of determining the offset direction of each mosaic particle, it performs the following: noise processing and color processing on the texture coordinates of the original texture according to the number of mosaic particles to obtain an intermediate mosaic noise map, the intermediate mosaic noise map including mosaic particles that match the number but have different colors; obtain the offset direction parameter of each mosaic particle; and add the intermediate mosaic noise map and the offset direction parameter to obtain the offset direction of each mosaic within the range of motion.
[0151] Specifically, when the processor performs the step of expanding the vertex information of the original model according to the movement range of the mosaic particles while keeping the original texture unchanged, it performs the following steps: expanding the original model according to the movement range of the mosaic particles to obtain expanded vertex information and expanded texture; restoring the expanded texture to the original texture while keeping the size and position of the original texture relative to the screen unchanged.
[0152] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0153] The storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0154] Since the computer program stored in the storage medium can execute the steps in any of the mosaic particle animation effect generation methods provided in the embodiments of this application, the beneficial effects that any of the mosaic particle animation effect generation methods provided in the embodiments of this application can achieve can be realized. For details, please refer to the previous embodiments, which will not be repeated here.
[0155] The above provides a detailed description of a method, apparatus, storage medium, and computer device for generating mosaic particle animation effects according to embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for generating animation effects for mosaic particles, characterized in that, include: Obtain the vertex information and original textures of the original model; Expand the vertex information of the original model according to the range of motion of the mosaic particles, while keeping the size and position of the original texture relative to the screen unchanged; The texture coordinates corresponding to the original texture are processed according to the number of mosaic particles to obtain a mosaic noise map, which includes mosaic particles matching the number. Determine the target moving position and moving speed of each mosaic particle within the said range of motion; Based on the moving speed and the mosaic noise map, determine the coordinate offset value of each mosaic particle in each frame; The corresponding pixel in the original texture is obtained based on the coordinate offset value in each frame, and the pixel is controlled to move towards the target position according to the moving speed of the mosaic particles in each frame, so as to generate the animation effect of the mosaic particles.
2. The method according to claim 1, characterized in that, The step of processing the texture coordinates corresponding to the original texture according to the number of mosaic particles to obtain a mosaic noise map includes: The original texture coordinates are noise-processed according to the number of mosaic particles to obtain an initial mosaic noise map. The initial mosaic noise map includes mosaic particles that match the number, are the same size, and have different brightness. The initial mosaic noise map is used as the final mosaic noise map.
3. The method according to claim 2, characterized in that, The step of performing noise processing on the texture coordinates of the original texture according to the number of mosaic particles to obtain an initial mosaic noise map includes: The texture coordinates of the original texture are multiplied by the number of mosaics and then rounded to obtain the first rounded result. The first rounding result is input into the noise function for noise processing to obtain the initial mosaic noise map.
4. The method according to claim 2, characterized in that, After obtaining the initial mosaic noise map, the process also includes: The initial mosaic noise image is subjected to color processing and scaling to obtain a final mosaic noise image, which includes mosaic particles that match the number of particles but vary in size and brightness.
5. The method according to claim 4, characterized in that, The step of performing color processing and scaling on the initial mosaic noise image to obtain the final mosaic noise image includes: The initial mosaic noise image is color-processed based on the pixel values corresponding to the original texture to obtain an intermediate mosaic noise image with inconsistent colors. Obtain the offset direction parameter for each mosaic particle; The intermediate mosaic noise map is scaled according to the offset direction parameter to obtain the final mosaic noise map.
6. The method according to claim 5, characterized in that, The step of scaling the intermediate mosaic noise map according to the offset direction parameter to obtain the final mosaic noise map includes: The intermediate mosaic noise map and the offset direction parameter are added together and then rounded to obtain a second rounded result. The second rounding result is input into the noise function for noise processing to obtain the final mosaic noise map.
7. The method according to claim 2 or 4, characterized in that, After obtaining the mosaic noise map corresponding to the mosaic particles with inconsistent brightness, the following is also included: Set the value of each mosaic particle in the mosaic noise image to be the same to obtain mosaic particles with consistent brightness.
8. The method according to claim 1, characterized in that, The step of determining the movement speed of each mosaic particle within the range of motion includes: Determine the target movement position of each mosaic particle within its range of motion, and determine the offset direction of each mosaic particle; The movement speed of each mosaic particle within the range of motion is determined based on the target movement position and offset direction.
9. The method according to claim 8, characterized in that, The steps for determining the offset direction of each mosaic particle include: The original texture coordinates are subjected to noise and color processing according to the number of mosaic particles to obtain an intermediate mosaic noise map, which includes mosaic particles that match the number but have different colors. Obtain the offset direction parameter for each mosaic particle; The intermediate mosaic noise map and the offset direction parameter are added together to obtain the offset direction of each mosaic within the range of motion.
10. The method according to claim 1, characterized in that, The step of expanding the vertex information of the original model according to the movement range of the mosaic particles, while keeping the size and position of the original texture relative to the screen unchanged, includes: The original model is expanded based on the range of motion of the mosaic particles to obtain expanded vertex information and expanded textures; The enlarged texture is restored to the original texture, while keeping the size and position of the original texture relative to the screen unchanged.
11. A device for generating animation effects for mosaic particles, characterized in that, include: The acquisition module is used to acquire vertex information and original textures of the original model; The zoom-out module is used to zoom out the vertex information of the original model according to the movement range of the mosaic particles, while keeping the original texture unchanged; The particle determination module is used to process the texture coordinates corresponding to the original texture according to the number of mosaic particles to obtain a mosaic noise map, wherein the mosaic noise map includes mosaic particles that match the number. The position and velocity determination module is used to determine the target moving position and moving velocity of each mosaic particle within the range of motion; The offset determination module is used to determine the coordinate offset value of each mosaic particle in each frame based on the moving speed and the mosaic noise map. The acquisition control module is used to acquire the corresponding pixel in the original texture based on the coordinate offset value in each frame, and control the pixel to move towards the target position according to the moving speed of the mosaic particles in each frame, so as to generate the animation effect of the mosaic particles.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program adapted for loading by a processor to perform the steps in the method for generating animation effects of mosaic particles as described in any one of claims 1-10.
13. A computer device, characterized in that, The computer device includes a memory and a processor. The memory stores a computer program, and the processor executes the steps of the mosaic particle animation effect generation method as described in any one of claims 1-10 by calling the computer program stored in the memory.
Citation Information
Patent Citations
Particle effect processing method, device, equipment, medium and product
CN114445535A
Generation method and device of wind field effect picture, storage medium and computer equipment
CN114768251A
