Method and device for processing special effect animation
By using the noise generation function in the special effect animation processing to generate noise information, determine the outline image of the special effect object and generate special effect pictures, the problem of high visual repetition in the traditional special effect production method is solved, and a more vivid and realistic special effect animation effect is achieved.
Patent Information
- Application Number
- CN202510020693.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-06
- Publication Date
- 2025-05-13
Smart Images

Figure CN119991886A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a method and device for processing special effect animation. Background Art
[0002] In the related art, special effect generation simulation can bring rich visual experience to games, animations, etc. The traditional special effect production method generally renders special effect animations based on special effect texture maps. For example, flame animations are rendered based on flame texture maps.
[0003] However, this related technology is limited by the resolution of the texture, and the special effects often have a high sense of visual repetition and are not vivid enough. Summary of the invention
[0004] The embodiments of the present application provide a method and device for processing special effect animation, which are helpful for improving the vivid performance of special effect animation.
[0005] In a first aspect, an embodiment of the present application provides a method for processing a special effects animation, including:
[0006] Obtaining the starting position information and stepping parameters of the first special effect object to be displayed in the image frame to be rendered in the screen space;
[0007] Determine first position information of the first special effect object after stepping based on the starting position information and the stepping parameter;
[0008] Generate first noise information corresponding to the step in the screen space based on the time information corresponding to the step and the first position information after the step by using a noise generation function;
[0009] Determine a contour image of a first special effect object based on the first noise information;
[0010] Determining a first special effect image of the first special effect object based on the contour image of the first special effect object and a first display parameter of the first special effect object;
[0011] Based on the first special effect graph, an image frame with a first special effect object is rendered to generate a special effect animation based on the image frame with the first special effect object.
[0012] In a second aspect, an embodiment of the present application provides a processing device for special effect animation, including:
[0013] An acquisition unit, used for acquiring the starting position information and stepping parameters of a first special effect object to be displayed in the image frame to be rendered in the screen space;
[0014] A position determination unit, used to determine first position information of the first special effect object after stepping based on the starting position information and the step parameter;
[0015] A noise generating unit, configured to generate first noise information corresponding to the step in the screen space based on the time information corresponding to the step and the first position information after the step by using a noise generating function;
[0016] A contour generating unit, configured to determine a contour image of a first special effect object based on the first noise information;
[0017] A special effect generating unit, configured to determine a first special effect image of the first special effect object based on the contour image of the first special effect object and a first display parameter of the first special effect object;
[0018] The rendering unit is used to render an image frame with a first special effect object based on the first special effect graph, so as to generate a special effect animation based on the image frame with the first special effect object.
[0019] In a third aspect, an embodiment of the present application further provides an electronic device, comprising a memory storing a plurality of instructions; a processor loads instructions from the memory to execute the steps of any special effects animation processing method provided in the embodiment of the present application.
[0020] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, which stores a plurality of instructions suitable for loading by a processor to execute the steps of any special effects animation processing method provided in an embodiment of the present application.
[0021] In a fifth aspect, an embodiment of the present application further provides a computer program product, including a computer program or instructions, which, when executed by a processor, implements the steps in any one of the special effects animation processing methods provided in the embodiments of the present application.
[0022] By adopting the scheme of the embodiment of the present application, the starting position information and stepping parameters of the first special effect object to be displayed in the image frame to be rendered can be obtained in the screen space; based on the starting position information and the stepping parameters, the first position information of the first special effect object after the stepping is determined; based on the time information corresponding to the stepping and the first position information after the stepping, the first noise information corresponding to the stepping is generated in the screen space through the noise generation function; based on the first noise information, the contour image of the first special effect object is determined; based on the contour image of the first special effect object and the first display parameter of the first special effect object, the first special effect graph of the first special effect object is determined; based on the first special effect graph, the image frame with the first special effect object is rendered, thereby, for each image frame, the contour image of the first special effect object under each stepping can be generated in the screen space, and then the first special effect graph can be obtained by combining the contour image of the first special effect object and the first display parameter, so as to render the image frame with the first special effect object, so as to generate the special effect animation based on the image frame with the first special effect object, and the multiple steps in each frame are conducive to improving the accuracy and detail performance of the first special effect graph, reducing the visual repetition of different image frames, and improving the vividness of the special effect animation. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0024] Figure 1 It is a scene schematic diagram of a special effects animation processing system provided in an embodiment of the present application;
[0025] Figure 2 This is a flow chart of an embodiment of a method for processing special effects animation provided in an embodiment of the present application;
[0026] Figure 3 is a schematic diagram of first noise information provided by an embodiment of the present application;
[0027] Figure 4 This is a schematic diagram of the principle of the clamp function provided in the embodiment of the present application;
[0028] Figure 5 is a schematic diagram of a first contour image provided in an embodiment of the present application;
[0029] Figure 6a is a schematic diagram of a contour image provided in an embodiment of the present application;
[0030] Figure 6b is a schematic diagram of a first special effect diagram provided in an embodiment of the present application;
[0031] Figure 7 is a schematic diagram of multiple UV regions provided in an embodiment of the present application;
[0032] Figure 8 is a schematic diagram of first distance field information provided in an embodiment of the present application;
[0033] Figure 9a is a schematic diagram of the first distance field information after rotation and scaling provided in an embodiment of the present application;
[0034] Figure 9b is a schematic diagram of the second distance field information after rotation and scaling provided in an embodiment of the present application;
[0035] Fig.10 is a schematic diagram of a single spark particle provided in an embodiment of the present application;
[0036] Fig.11 is a schematic diagram of a single spark particle superimposed halo provided in an embodiment of the present application;
[0037] Fig.12 is a schematic diagram of first mask information provided in an embodiment of the present application;
[0038] Fig.13a This is a schematic diagram of the effect of full screen spark particles provided in the embodiment of the present application;
[0039] Fig.13b It is provided in the embodiment of this application Fig.12 right Fig.13a Schematic diagram of the effect after processing;
[0040] Fig.14 is a schematic diagram of target mask information provided in an embodiment of the present application;
[0041] Fig.15 is a schematic diagram of an image frame provided in an embodiment of the present application;
[0042] Fig.16 It is a structural schematic diagram of a special effects animation processing device provided in the structural embodiment of the present application;
[0043] Fig.17 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0044] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present application. At the same time, in the description of the embodiments of the present application, the terms "first", "second", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more features. In the description of the embodiments of the present application, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.
[0045] The embodiments of the present application provide a method, device, electronic device and computer-readable storage medium for processing special effects animation. The method for processing special effects animation of the present application can generate special effects animation in an animation playback scene or in a game scene. Specifically, the present embodiment will be described from the perspective of a processing device for special effects animation, and the processing device for special effects animation can be specifically integrated in an electronic device, that is, the processing method for special effects animation of the embodiment of the present application can be executed by an electronic device, and optionally, the electronic device may include: a terminal device. The terminal device may be a mobile phone, a tablet computer, a smart Bluetooth device, a laptop computer, a game console, or a personal computer (PC) and other devices.
[0046] The processing method of special effect animation provided in the embodiment of the present application can be applied to a processing system of special effect animation. The processing system of special effect animation can include a player terminal device and a server, and the terminal can be a device including both receiving and transmitting hardware, that is, a device having receiving and transmitting hardware capable of performing two-way communication on a two-way communication link. The player terminal device and the server can perform two-way communication through a network.
[0047] Optionally, the server may be an independent server, or a server network or server cluster composed of servers, including but not limited to a computer, a network host, a single network server, a plurality of network server sets or a cloud server composed of multiple servers. The cloud server is composed of a large number of computers or network servers based on cloud computing.
[0048] The processing method of the special effect animation in one embodiment of the present disclosure can be run on a local terminal device or a server. When the processing method of the special effect animation is run on a server, the method can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and a client device.
[0049] For example, when the processing method of the special effects animation is run on a terminal, the terminal device stores a game application and is used to present a virtual scene in the game screen. The terminal device is used to interact with the user through a graphical user interface, for example, the game application is downloaded and installed through the terminal device and run. The terminal device may provide the graphical user interface to the user in a variety of ways, for example, it may be rendered and displayed on the display screen of the terminal device, or the graphical user interface may be presented through holographic projection. For example, the terminal device may include a touch display screen and a processor, the touch display screen is used to present the graphical user interface and receive the operation instructions generated by the user acting on the graphical user interface, the graphical user interface includes a game screen, and the processor is used to run the game, generate a graphical user interface, respond to the operation instructions, and control the display of the graphical user interface on the touch display screen.
[0050] For example, when the processing method of the special effects animation runs on the server, it can be a cloud game. Cloud gaming refers to a gaming method based on cloud computing. In the operation mode of cloud gaming, the operating body of the game application and the main body of the game screen presentation are separated, and the storage and operation of the processing method of the special effects animation are completed on the cloud gaming server. The game screen presentation is completed on the client of the cloud game. The cloud gaming client is mainly used for receiving and sending game data and presenting the game screen. For example, the cloud gaming client can be a display device with data transmission function close to the user side, such as a mobile terminal, a TV, a computer, a handheld computer, a personal digital assistant, etc., but the terminal device for processing game data is a cloud gaming server in the cloud. When playing the game, the user operates the cloud gaming client to send an operation instruction to the cloud gaming server. The cloud gaming server runs the game according to the operation instruction, renders each frame of the special effects animation through the scheme of this application, and then encodes and compresses the image frame and other data, and returns it to the cloud gaming client through the network. Finally, the cloud gaming client decodes and outputs the game screen with special effects.
[0051] See also Figure 1 , Figure 1A scene diagram of a processing system for special effects animation provided by an embodiment of the present application. The system may include at least one terminal, at least one server, at least one database, and a network. The terminal held by the user can be connected to the servers of different games through the network. The terminal is any device with computing hardware that can support and execute software products corresponding to the game. In addition, when the system includes multiple terminals, multiple servers, and multiple networks, different terminals can be connected to each other through different networks and different servers. The network can be a wireless network or a wired network, such as a wireless network such as a wireless local area network (WLAN), a local area network (LAN), a cellular network, a 2G network, a 3G network, a 4G network, a 5G network, etc. In addition, different terminals can also use their own Bluetooth network or hotspot network to connect to other terminals or to servers, etc. For example, multiple users can be online through different terminals and connected and synchronized with each other through appropriate networks to support multi-player games. In addition, the system may include multiple databases, multiple databases are coupled to different servers, and information related to the game environment can be continuously stored in the database when different users are online for multi-player games.
[0052] The embodiment of the present application provides a processing method for special effects animation, which can be executed by a terminal or a server. The embodiment of the present application takes the processing method of special effects animation executed by a terminal as an example for explanation. Among them, the terminal may include a touch display screen and a processor (of course, the terminal may also use peripherals such as a mouse and a keyboard as input devices, and only the touch display screen is used as an example for explanation here), and the touch display screen is used to present a graphical user interface and receive operation instructions generated by the user acting on the graphical user interface. When the user operates the graphical user interface through the touch display screen, the graphical user interface can control the local content of the terminal by responding to the received operation instructions, and can also control the content of the opposite server by responding to the received operation instructions. For example, the operation instructions generated by the user acting on the graphical user interface include instructions for starting a game application, and the processor is configured to start the game application after receiving the instructions for starting the game application provided by the user. In addition, the processor is configured to render and draw a graphical user interface associated with the game on the touch display screen. The touch display screen is a multi-touch sensitive screen that can sense touch or sliding operations performed simultaneously by multiple points on the screen. The user uses a finger to perform a touch operation on the graphical user interface, and when the graphical user interface detects the touch operation, different virtual objects in the graphical user interface of the game are controlled to perform actions corresponding to the touch operation.
[0053] It should be noted that Figure 1The scene diagram of the special effects animation processing system shown is merely an example. The special effects animation processing system and scene described in the embodiment of the present application are intended to more clearly illustrate the technical solution of the embodiment of the present application, and do not constitute a limitation on the technical solution provided in the embodiment of the present application. A person of ordinary skill in the art can appreciate that with the emergence of new business scenarios, the technical solution provided in the embodiment of the present application is equally applicable to similar technical problems.
[0054] The following is a detailed description in conjunction with the accompanying drawings. In this embodiment, the execution subject is a terminal device as an example. It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments. Although the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in an order different from that shown in the accompanying drawings.
[0055] Please also read Figure 2 , Figure 2 A flowchart of a method for processing special effects animation provided in an embodiment of the present application is shown in FIG. The specific flow of the method for processing special effects animation may include steps 201 to 206 as follows:
[0056] Step 201, obtaining the starting position information and stepping parameters of the first special effect object to be displayed in the image frame to be rendered in the screen space;
[0057] The special effects animation processing method of the present application can be used in real-time rendering of special effects animation.
[0058] The image frames to be rendered may be image frames to be rendered for special effect animations.
[0059] Optionally, the present application has no limitation on the application scenario of the special effects animation. For example, it may be a special effects animation that needs to be generated in an animation playback scenario or a game scenario.
[0060] The number of image frames that need to be rendered for the special effects animation can be set in advance, and this example has no limit on this.
[0061] Optionally, the shape of the first special effect object in this example may change over time. In an optional example, the first special effect object includes an object with Brownian motion phenomenon. Optionally, the type of the first special effect object is not limited, for example, the first special effect object includes but is not limited to flame, cloud, smoke, fog, water curtain, etc.
[0062] In this example, the starting position information of the first special effects object in the screen space in each image frame may be the same or different. For example, the starting position information of the first special effects object in the screen space in each image frame may be the position of the first special effects object in the screen space after the last step in the previous image frame.
[0063] Optionally, the starting position information r0 may include a screen space UV, and the starting position information r0 in the first image frame may be set by an animation developer.
[0064] In some examples, in order to make the special effects more detailed and vivid, the special effects animation may include the movement of a second special effects object drifting from the first special effects object. In this example, the first special effects object can be understood as the main object of the special effects, and the second special effects object is the product object of the movement of the main object. For example, the first special effects object is a flame, and the second special effects object is a spark particle.
[0065] In this example, steps 201-205 mainly describe a scheme for generating a special effect graph of a first special effect object in screen space. The scheme for generating a special effect graph of a second special effect object is described later.
[0066] Step 202: Determine first position information of the first special effect object after stepping based on the starting position information and the stepping parameter;
[0067] Optionally, the stepping parameters of the present application may include: number of steps q, stepping direction rd and stepping distance t, where the number of steps q is the number of times the first special effects object in an image frame needs to be stepped; wherein the number of steps for each image frame may be the same or different, and the number of steps may be set by the animation producer.
[0068] Optionally, step 202 may specifically include: determining the cumulative stepping distance after the first special effect object steps based on the stepping distance and the number of steps; and determining the first position information after the first special effect object steps based on the starting position information, the cumulative stepping distance and the stepping direction.
[0069] The accumulated stepping distance is used to accumulate the actual stepping distance of each step that has been performed, that is, it can be understood as the stepping distance of the first position information after stepping compared with the initial position information.
[0070] It is understandable that since the stepping may occur multiple times, the accumulated stepping distance after each stepping of the first special effect object may be determined based on the stepping distance and the number of steps to determine the first position information after each stepping of the first special effect object.
[0071] Optionally, the cumulative step distance after each step is obtained based on the sum of the previous cumulative step distance and the actual step distance of the current step.
[0072] In one example, the actual stepping distance of each step may be the same, which is the stepping distance t. In this example, the first position information after stepping from the starting position to the stepping direction is pos=r0+rd*t*current stepping number.
[0073] In another example, taking into account the softening of the flame edge contour, the step offset parameter of this step can be generated at each step, so as to obtain the distance increased by this step (i.e., the step offset amount in the previous text) Δt, and the cumulative step distance t+=Δt, that is, the previous cumulative step distance plus the step offset amount of this step is the cumulative step distance of this time. Optionally, the present application can randomly select the step offset parameter within a certain range through a preset function, for example, in the range of (0.1-1), or set the function to generate the step offset parameter within a certain range based on the parameters in the previous step. In this example, the first position information pos=r0+rd*t, t is the cumulative step distance, which is updated with each step.
[0074] Step 203: Generate first noise information corresponding to the step in the screen space based on the time information corresponding to the step and the first position information after the step by using a noise generation function;
[0075] The type of noise generation function in this example is not limited and can be selected based on the deformation characteristics, motion change characteristics and other information of the first special effect object. For example, if the first special effect object is an object with Brownian motion phenomenon, the noise generation function can select the Brownian motion function, that is, the FBM (Fractal Brown Motion) calculation function. The FBM model is mainly used to describe irregular shapes such as mountains, clouds, topography and simulated planetary surfaces in nature. FBM noise is to superimpose and combine single noise (such as Perlin noise) with different frequencies and amplitudes to produce different degrees of random details. It is often used to simulate effects such as clouds and fog. In this case, other special effects such as flame effects can also be simulated.
[0076] It is understandable that, since there may be multiple steps, the first noise information corresponding to each step may be generated in the screen space based on the time information corresponding to each step and the first position information after each step through a noise generation function.
[0077] Optionally, the present application can pass the value of pos into the FBM calculation function, and use the FBM function to calculate the noise value of the current pos in the screen space to obtain the first noise information. The present application calculates the noise in the FBM function instead of using a noise map, which can improve the accuracy of the noise effect as much as possible, so that the special effect is not affected by the size of the map texture. By adjusting the value in the fbm function, the outline of the flame and the degree of virtuality can be controlled. Optionally, the calculated first noise information can be found in Figure 3 .
[0078] Optionally, the time information of the present application is FrameTime, i.e., "frame rendering time", which is a parameter of the noise generation function. "Frame rendering time" is the time consumed to draw a frame of the picture. It can be understood that in the present application, the time information will be updated as the number of steps is updated, and will also be updated as the image frames are continuously rendered.
[0079] In this example, the step of “determining the cumulative step distance after each step based on the step distance and the number of steps” may include:
[0080] Determine the stepping distance as the cumulative stepping distance after the first stepping;
[0081] For each step after the first step, based on the first noise information of the previous step and the mapping relationship between the noise information and the step offset parameter, a target step offset parameter corresponding to the first noise information is calculated;
[0082] Mapping the target step offset parameter into the first range to obtain the step offset corresponding to the step;
[0083] Based on the accumulated stepping distance corresponding to the previous stepping and the stepping offset, the accumulated stepping distance corresponding to the stepping is determined.
[0084] It can be understood that the stepping in this example can be implemented through a loop. Each time a step is completed, the cumulative stepping distance is updated, and the next loop is entered, and step 202 is restarted until the actual number of steps reaches the number of steps q corresponding to the image frame to be rendered, the accumulation of q stepping results is completed, and the first special effect image is obtained, and the loop ends.
[0085] In the above example, the mapping relationship between noise information and step offset parameter may include: step offset parameter = 0.5-fbm*fbm*0.1, where fbm represents noise information and is a floating point value. Optionally, 0.5 and 0.1 are only examples, and other values may be selected, which are not limited here.
[0086] Optionally, the first range can be set as needed, for example, to 0.1-1, and this example has no limitation on this. The function for range mapping is not limited, for example, it can be a clamp function. For a schematic diagram of the clamp function, see Figure 4 , used to limit the value x to the specified range [minval, maxval].
[0087] The calculation formula of the step offset can be: clamp(0.5-fbm*fbm*0.1,0.1,1), and the cumulative step distance of each step can be expressed as t+=clamp(0.5-fbm*fbm*0.1,0.1,1).
[0088] Step 204: determining a contour image of a first special effect object based on the first noise information;
[0089] It is understandable that each time a step is taken, a different contour image is generated to provide a different contour of the first special effect object. Therefore, the contour of the first special effect object in the first special effect image obtained in step 205 is more natural and vivid.
[0090] Optionally, the process of obtaining a contour object based on the first noise information may include: performing inversion processing on the first noise information corresponding to the step to obtain processed noise information; mapping the processed noise information to the second range to obtain a first contour image of the first special effect object after the step; and superimposing the first contour image to obtain a contour image of the first special effect object.
[0091] Optionally, the value of the second range can be set according to actual needs, for example, the value can be 0-1. In one example, the first noise information corresponding to each step is inverted, that is, 1-first noise information is used. Mapping the processed noise information into the second range may include: remapping the noise value not less than 1 in the processed noise information to 0, and when the noise value is not less than 0, the remapping value is 1, and the noise value between 0-1 remains unchanged. The above mapping of this example can simulate the characteristics of different brightness of flames from the inside to the outside, and improve the refinement of the flame special effect. For example, see Figure 5 as well as Figure 6a and Figure 6b , Figure 5 FIG. 4 is an example of a first contour image. In a flame, the brightness of the flame core inside the flame is lower than the brightness outside the flame. Figure 6a The contour image of the first special effect object is formed by superimposing multiple first contour images. In this image, the special effect contour is soft and vivid. Figure 6b It is the result of multiplying the contour image by the color parameter and brightness value.
[0092] Step 205: determining a first special effect image of the first special effect object based on the contour image of the first special effect object and the first display parameter of the first special effect object;
[0093] Optionally, the first display parameter includes but is not limited to a color parameter and a brightness parameter. Optionally, the first display parameter in different image frames may remain unchanged, or the first display parameter used in different image frames may be set according to the life cycle characteristics of the first special effect object. For example, when a flame burns from dark-bright-dark, the brightness parameter may be set to increase as the number of image frames of the special effect animation increases, and then decrease as the number of image frames increases after reaching the brightness threshold.
[0094] For example, taking flame as an example, the first special effect image = flame outline image * flame color * flame brightness value. Thus, the effect of the main flame can be obtained.
[0095] Step 206: Render the image frame with the first special effect object based on the first special effect graph, so as to generate a special effect animation based on the image frame with the first special effect object.
[0096] Optionally, the first special effect image and the current camera rendering image may be superimposed to obtain a screen space special effect.
[0097] In the embodiment of the present application, the steps for generating the second special effect graph of the second special effect object are as follows:
[0098] Determining the number of object layers of a second special effect object that needs to be displayed in the image frame to be rendered, wherein the second special effect object is associated with the first special effect object;
[0099] Based on the number of object layers, the screen space UV is divided into multiple UV regions for the target object layer;
[0100] Determine, based on the time information and the first movement parameter of the second special effect object, an object position point of the second special effect object in each UV region under the target object layer;
[0101] Determine first distance field information of a second special effect object in the screen space under the target object layer based on the object position point;
[0102] A second special effect graph of the second special effect object is determined based on the first distance field information and a second display parameter of the second special effect object.
[0103] The target object layer may be each object layer, or may be at least one specific object layer.
[0104] Optionally, in the present application, the number of object layers can be used as the number of loops, and each loop calculates the first distance field information under one object layer and the second special effect map that should be obtained after the loop.
[0105] Optionally, there may be no correlation between the number of object layers and the value of the number of steps mentioned above, and they can be set separately as needed.
[0106] In this example, a distance field may be generated in each UV region according to the object position point, so that a second special effect object corresponding to the UV region may be generated in the second special effect map.
[0107] Optionally, in the same object layer in this example, the relative positions of the object position points in each UV region can be processed differently, so that the distribution of multiple second special effect objects in one object layer is more random.
[0108] In one example, the second special effect objects generated by the first distance field information of different object layers may have differences in display effects, such as differences in size, color, brightness, etc. Therefore, the first distance field information of multiple object layers can ensure the generation of multiple second special effect objects with different display effects, thereby increasing the refinement and vividness of the special effect animation.
[0109] Optionally, in this example, rendering an image frame with a first special effect object based on the first special effect graph may include: rendering an image frame with a first special effect object and a second special effect object based on the first special effect graph and the second special effect graph.
[0110] Specifically, an image frame to be displayed may be generated based on the first special effect image, the second special effect image, and the current camera rendering image.
[0111] Optionally, the step of “determining a second special effect graph of the second special effect object based on the first distance field information and the second display parameter of the second special effect object” may include:
[0112] Determine an object special effect map of the second special effect object under the target object layer based on the first distance field information under the target object layer and the second display parameter of the second special effect object;
[0113] Based on the object special effect graph corresponding to the target object layer, a second special effect graph of the second special effect object is obtained.
[0114] Optionally, the object special effect graph corresponding to the target object layer may be superimposed to obtain a second special effect graph of a second special effect object.
[0115] The second display parameter may include: color information, size parameter, etc. Optionally, the color information in the first display parameter and the second display parameter may be the same or different, and this example has no limitation on this.
[0116] For ease of understanding, this example first introduces a solution for dividing the screen space UV into multiple UV regions. Optionally, for the target object layer, dividing the screen space UV into multiple UV regions may include:
[0117] For the target object layer, determining a moving distance vector based on the corresponding time information and a second moving parameter of the second special effect object;
[0118] The screen space UV is enlarged, and the enlarged screen space UV and the moving distance vector are summed to obtain the moved screen space UV;
[0119] The shifted screen space UV is processed based on the floor function to obtain multiple UV regions.
[0120] Optionally, the second movement parameter includes but is not limited to a second movement speed and a second movement direction vector, and the movement distance vector may be the product of time information and the second movement speed and the second movement direction vector. The magnification factor used for magnifying the screen space UV may be selected according to actual needs, and this example has no limitation on this.
[0121] Optionally, dividing the screen space UV into multiple UV regions can be achieved by the following code:
[0122] root=floor(uv*size+FrameTime*dir1*speed)
[0123] Among them, root: is the uv coordinate corresponding to each UV area; floor: is the floor function, that is, the rounding function; uv: is the screen space uv, the value is 0-1; size: is the uv scaling factor; FrameTime: see the above explanation and will not be repeated here; dir1: the second moving direction; speed: the second moving speed.
[0124] It is understandable that the same UV area has the same root.
[0125] The embodiment of the present application enlarges the screen space UV and gives it speed and direction, and then rounds it down through the floor function to make the UV value integer layered, and divides the space into multiple Voronoi blocks (i.e., the UV area in this article), and the coordinates of the points in each Voronoi block can be obtained. The scaling factor of the screen UV will affect the number of second special effect objects to a certain extent, while the speed and direction determine the overall floating direction trend of the second special effect objects. Optional, see Figure 7 , Figure 7 A schematic diagram showing the division of UV space into multiple Voronoi cubes.
[0126] Optionally, in the present application, in order to make the object position points in different UV regions in the same object layer different, a dynamic random offset value may be applied to the points in the UV region.
[0127] Optionally, the step of “determining the object position points of the second special effect object in each UV area under the target object layer based on the time information and the first movement parameter of the second special effect object” may include:
[0128] The UV coordinates corresponding to each UV area are hashed by a hash algorithm to obtain a hash value corresponding to each UV area;
[0129] Generate a region offset corresponding to each UV region under the target object layer based on the time information, the first moving direction vector of the second special effect object, and the hash value corresponding to each UV region;
[0130] The center point coordinates of each UV region are offset based on the region offset to obtain the object position point of each UV region.
[0131] Optionally, in an example, the first movement parameter includes a first movement direction vector, and optionally, the first movement parameter may also include a movement distance. The region offset may be expressed as: offset1 = FrameTime*dir2*(hash(root)-0.5)*2.0.
[0132] Where, dir2 is the first moving direction vector, FrameTime: frame time, which will increase with time. hash: hash function. Optional, 0.5 and 2.0 are empirical values, which are only used as examples here, and other reasonable values can be selected as needed.
[0133] Optionally, the first moving direction vector corresponding to each UV region may be different, so that a single second special effect object floats up, down, left, and right to a certain extent within the square area.
[0134] The UV coordinates of the Voronoi block are randomly selected using a hash function and multiplied by time and a velocity direction to obtain the dynamic random offset value of the point in the Voronoi cell. This allows the point coordinates to be displaced to a certain extent within the Voronoi cell, adding randomness to the drifting of the spark particles.
[0135] See also Figure 8 , Figure 8 The first distance field information obtained after determining the object position point based on the area offset under an object layer is shown. It can be seen that in different UV areas, the center of the distance field has different positions in the UV area, thereby increasing the randomness of the generated second special effect object.
[0136] Optionally, to further avoid producing repeated second special effect objects, in the embodiment of the present application, an offset may be added to the screen space UV after the UV area is partitioned. Optionally, the step of "processing the screen space UV after the movement based on the floor function to obtain multiple UV areas" may include: performing floor processing on the screen space UV after the movement based on the floor function to obtain multiple initial UV areas; obtaining the screen offset corresponding to the target object layer, and offsetting the multiple initial UV areas based on the screen offset to obtain multiple UV areas after the offset. After the offset, the object position point is determined.
[0137] In an optional example, the screen offset of the target object layer is obtained based on the sum of the screen offset of the previous object layer and the random offset, and the screen offset of the first object layer is a preset value.
[0138] Optionally, the screen offset is offset2, and its initial value may be a preset value: root = floor(uv*size+FrameTime*dir*speed)+offset2.
[0139] Optionally, the random offset can be obtained by processing a function that can generate random numbers, such as by a hash function. Optionally, offset2 satisfies offset2+=hash2_2(vec2(y,y))*10.0, where y is a value that changes in each loop, and there is no limit to how y is obtained. For example, the y value can be generated by a random function, or the y value can be a parameter in the processing of the previous object layer (the parameter varies with the number of object layers or the number of loops).
[0140] In an example, a calculation scheme for the first distance field information may include: calculating distance vectors from each position in the screen space to an object position point in each UV region to obtain first distance fields corresponding to the plurality of object position points in the screen space; and obtaining first distance field information of a second special effect object in the screen space under the target object layer based on the first distance field under the target object layer.
[0141] Optionally, the distance field may be obtained by using a length function. For example, the first distance field information is expressed as sparkSDF=length(uv-voronoiUV).
[0142] Among them, sparkSDF: the first distance field information of the second special effect object; length: length function; uv: UV coordinates of the pixel in the screen space; voronoiUV: UV coordinates of the object position point in the voronoi cell. Among them, the distance field is a field used to describe the minimum distance from any point in space to the nearest geometric surface. The distance field calculated by this example is circular, for example Figure 8 .
[0143] The embodiment of the present application also provides another distance field generation scheme, which can realize the shape prototype (non-circular) of the second special effect object. Optionally, the step of "determining the first distance field information of the second special effect object in the screen space under the target object layer based on the object position point" may include:
[0144] Calculate the distance vector from each position in the screen space to the object position point in each UV area;
[0145] Rotating the distance vector based on a first rotation parameter, and scaling the rotated distance vector based on a first scaling parameter to obtain a first scaled vector;
[0146] Based on the first scaled vectors of each object position point under the target object layer, the first distance field corresponding to each object position point is determined to obtain the first distance field information of the second special effect object in the screen space under the target object layer.
[0147] Optionally, in different object layers, the first rotation parameter and the first scaling parameter may be the same or different, and may be set according to the actual required floating effect. The first rotation parameter may be a rotation matrix.
[0148] For example, the first distance field information can be expressed as: sparkSDF=length(rotate(uv-voronoiUV,0.7)*float2(0.5,1.6)).
[0149] Where, length: length function, rotate: rotate function; uv: UV coordinate of pixel in screen space; voronoiUV: coordinate of object position point in voronoi cell; rotate(uv-voronoiUV,0.7) is actually the distance vector calculated by uv–voronoiUV rotated 70% of 360 degrees by the rotate function, where the rotate function is a rotation matrix, which is the first rotation parameter in the example of this application. The value of 0.7 is only used as an example and can be adjusted according to actual needs in actual application. float2(0.5,1.6) represents a two-dimensional vector (0.5,1.6), which is the first scaling parameter in this application, used to scale the result of rotate(uv-voronoiUV,0.7) to change the distance field from a circle to an ellipse. Optionally, 0.5 and 1.6 are empirical values and can be adjusted according to actual effects. See Figure 9a , Figure 9a The first distance field information after rotation and scaling is shown. It is obvious that the first distance fields in the first distance field information are different from those in the first distance field information. Figure 8 It turned into an oblique oval.
[0150] Optionally, in this example, the size of the second special effect object under each object layer can be adjusted by using different size parameters of each object layer, so that second special effect objects of various sizes exist in the generated image frame, thereby enhancing the vividness of the special effect animation.
[0151] For example, the step of “determining an object special effect graph of the second special effect object under the target object layer based on the first distance field information and the second display parameter of the second special effect object” may include: adjusting the size of each first distance field in the first distance field information under the target object layer based on the size parameter corresponding to the second special effect object under the target object layer to obtain first adjusted distance field information, wherein the size parameter is different for different object layers; and determining the object special effect graph of the second special effect object under the target object layer based on the first adjusted distance field information under the target object layer and the second display parameter of the second special effect object.
[0152] Optionally, the size parameter of the second special effect object decreases as the number of object layers increases. In one example, an initial value can be set for the size parameter spark_size, as the spark_size of the first object layer, and the spark_size of subsequent object layers satisfies Spark_size*=sizeInt, and optionally, sizeInt is less than 1.
[0153] Optionally, the object special effect graph of the second special effect object can be expressed as spark=(1.0-smoothstep(spark_size*0.6, spark_size*3.0, sdf))*color.
[0154] Among them, spark_size is the size parameter of the second special effect object under the current object layer; sdf is the first distance information, and color is a second display parameter, a color value preset by the production staff. Through the smoothstep function, an interval can be calculated to draw a second special effect object with a smooth edge transition. Among them, 0.6 or 3.0 is only an example, and 0.6 or 3.0 can also be other values as needed, which are not limited here.
[0155] Optionally, in this example, in order to improve the fineness of the second special effect object, the edge of the second special effect object may be set to present a blurred effect, such as a halo effect on the edge of spark particles.
[0156] Optionally, a distance field with a larger range may be generated based on the first distance field information of the second special effect object as the distance field of the second special effect object to generate an edge blur special effect map of the second special effect object for use.
[0157] Optionally, the process of generating an edge blur special effects image corresponding to the edge blur effect includes:
[0158] Rotating the distance vector under the target object layer based on a second rotation parameter, and scaling the rotated distance vector based on a second scaling parameter to obtain a second scaled vector;
[0159] Determine a second distance field of each UV region based on the second scaled vector of each UV region under the target object layer, and obtain second distance field information of a second special effect object in the screen space, wherein the coverage of the second distance field in the same UV region under the same object layer is greater than that of the first distance field;
[0160] An edge blur special effect map of the second special effect object under the target object layer is determined based on the second distance field information under the target object layer and the third display parameter of the second special effect object.
[0161] Optionally, for the same object layer, the first rotation parameter is the same as the second rotation parameter, and the second scaling parameter is different from the first scaling parameter. If the scaling effect of the first and second scaling parameters is magnification, the magnification factor of the second scaling parameter is larger; if the scaling effect of the first and second scaling parameters is reduction, the reduction factor of the second scaling parameter is smaller.
[0162] For example, the second distance field information can be expressed as: sparkSDF2=length(rotate(uv-voronoiUV,0.7)*float2(k1,k2)), where float2(k1,k2) is the second scaling parameter.
[0163] Optionally, similar to the object special effects map, the edge blur special effects map can also be obtained by processing spark = (1.0-smoothstep (spark_size*n1, spark_size*n2, sdf)) * color, where the third display parameter can be the same as the second display parameter. Or, if necessary, these two display parameters can also be different. Optionally, for the object special effects map under the same object layer, the values of the parameters "n1" and "n2" in smoothstep() can be different from those of the edge blur special effects map. Optionally, the parameter takes a value between 0 and 1. See Figure 9b , Figure 9b The second distance field information corresponding to the first distance field information is shown. Obviously, the range of the second distance field is larger.
[0164] Thus, the size and range of the second special effect object are controlled by the smoothstep function and a color is given. The object special effect map and the edge blur special effect map under each object layer are fused and superimposed to obtain a new object special effect map under each object layer. In the new object special effect map, the edge of the second special effect object presents a blur effect, such as a halo effect on the edge of a spark particle. Fig.10 and Fig.11 , Fig.10 and Fig.11 They are the effect of a second special effect object, namely the single spark particle effect, and the effect of the spark particles after superimposing the halo.
[0165] Optionally, the present application may also set transparency for second special effects objects of different object layers, so that second special effects objects of different transparencies exist in the rendered image frame, thereby enhancing the realism of the second special effects objects.
[0166] In one example, the step of "fusing the object special effects map and the edge blur special effects map under each object layer to obtain a new object special effects map under each object layer" includes: superimposing the object special effects map and the edge blur special effects map under the target object layer to obtain a superimposed special effects map under the target object layer; processing the corresponding superimposed special effects map based on the transparency parameter of the target object layer to obtain a new object special effects map of the target object layer, wherein the larger the number of object layers, the larger the transparency parameter.
[0167] Optionally, similar to the size parameter, the transparency parameter alpha of the first object layer can be set to an initial value, and the transparency parameters alpha of other object layers can be obtained based on the multiplication of the initial value and the transparency coefficient alphaInt. Optionally, alpha*=alphaInt, which means that as the number of object layers increases, the transparency of the second special effect object increases and the transparency parameter becomes larger.
[0168] Furthermore, in order to avoid the second special effect object that fills the entire screen from affecting the visual experience and to create a dissipation effect of the second special effect object, the intensity range of the spark particles in the screen space can be calculated so that the brightness gradually decreases at the edge of the screen and the spark particles gradually disappear.
[0169] Optionally, the step of “rendering an image frame with a first special effect object and a second special effect object based on the first special effect graph and the second special effect graph” includes:
[0170] Acquire first mask information of the second special effect object in the screen space, wherein the first mask information is used to indicate the intensity of the second special effect object at each screen space position;
[0171] Processing the second special effect graph based on the first mask information to obtain a target second special effect graph of the second special effect object;
[0172] Based on the superposition of the target second special effect graph and the first special effect graph, an image frame with the first special effect object and the second special effect object is rendered.
[0173] The closer the intensity of the second special effect object indicated in the first mask information is to the edge of the screen space, the weaker the intensity is.
[0174] Optionally, the first mask information is generated based on the screen space UV. For example, the first mask information is expressed as: smooth=1.0-smoothstep(0.4,1.4,length(uv+vec2(0.0,0.3))).
[0175] Among them, smoothstep is a smooth step function used to generate a smooth transition value from 0 to 1; uv is the current screen space UV, vec2(0.0,0.3) is the center offset value of the screen space UV, and when the value is vec2(0.0,0.0), the center of the intensity range is located at the center of the screen.
[0176] For example, see Fig.12 , Fig.12 The first mask information showing the center shift of the intensity range. Fig.13b Based on Fig.12 The mask information of Fig.13a The processing result of the second special effect graph is that the closer to the edge of the screen space, the weaker the intensity of the second special effect object. This avoids the phenomenon of spark particles floating all over the screen.
[0177] In one example, considering that the second special effect object appears to be floating out of the first special effect object in terms of visual effect performance, when the two are superimposed, the range of the first special effect object needs to be calculated, and the range of the first special effect object is subtracted from the intensity mask of the second special effect object.
[0178] An embodiment of the present application may further include: determining second mask information of the second special effects object in the screen space based on the contour image of the above-mentioned first special effects object, wherein the second mask information is used to indicate that the display range of the first special effects object in the screen space is the mask range of the second special effects object, wherein the second mask information is used to indicate that the display range of the first special effects object in the screen space is the mask range of the second special effects object.
[0179] The contour image of the first special effect object may be used as the second mask information, or the second mask information may be obtained based on binarization processing of the contour image.
[0180] Optionally, the step of “processing the second special effects graph based on the first mask information to obtain a target second special effects graph of the second special effects object” includes: processing the second special effects graph based on the first mask information and the second mask information to obtain a target second special effects graph of the second special effects object.
[0181] For example, the first mask information is merged with the second mask information to obtain target mask information, and the second special effect graph is processed based on the target mask information to obtain the target second special effect graph of the second special effect object. Fig.14 , is the fused target mask information.
[0182] It is understandable that the camera currently also renders an image with the special effects of the present application added, such as the game screen. The present application obtains the final screen space flame effect by superimposing the final result of the spark particle calculation and the final effect of the main flame, and superimposing them with the current camera rendering image. By adopting the scheme of the present application, the screen of the special effects animation can not only display the flame body that changes with time, but also present the visual effect that the flames escaping from the flame body gradually disperse and disappear in the screen space, which increases the realism of the special effects. For example, see Fig.15 , which is a game screen containing flame special effects generated by the solution of this application.
[0183] By adopting the scheme of the embodiment of the present application, the starting position information and stepping parameters of the first special effect object to be displayed in the image frame to be rendered can be obtained in the screen space; based on the starting position information and the stepping parameters, the first position information of the first special effect object after the stepping is determined; based on the time information corresponding to the stepping and the first position information after the stepping, the first noise information corresponding to the stepping is generated in the screen space through the noise generation function; based on the first noise information, the contour image of the first special effect object is determined; based on the contour image of the first special effect object and the first display parameter of the first special effect object, the first special effect graph of the first special effect object is determined; based on the first special effect graph, the image frame with the first special effect object is rendered, thereby, for each image frame, the contour image of the first special effect object under each stepping can be generated in the screen space, and then the first special effect graph can be obtained by combining the contour image of the first special effect object and the first display parameter, so as to render the image frame with the first special effect object, so as to generate the special effect animation based on the image frame with the first special effect object, and the multiple steps in each frame are conducive to improving the accuracy and detail performance of the first special effect graph, reducing the visual repetition of different image frames, and improving the vividness of the special effect animation. The realism of dynamic flame simulation is enhanced, and the impact of visual experience is improved. And the flexible adjustment of parameters makes the flame effect more diverse and adaptable.
[0184] This embodiment also provides a processing device for special effect animation, which can be integrated into a terminal device or a server. Fig.16 As shown, the processing device of the special effect animation may include:
[0185] An acquisition unit 1601 is used to acquire the starting position information and step parameters of a first special effect object to be displayed in an image frame to be rendered in the screen space;
[0186] The position determination unit 1602 is used to determine the first position information of the first special effect object after stepping based on the starting position information and the stepping parameter;
[0187] The noise generating unit 1603 is used to generate first noise information corresponding to the step in the screen space based on the time information corresponding to the step and the first position information after the step by using a noise generating function;
[0188] The contour generating unit 1604 is used to determine a contour image of a first special effect object based on the first noise information;
[0189] The special effect generating unit 1605 is used to determine a first special effect image of the first special effect object based on the contour image of the first special effect object and the first display parameter of the first special effect object;
[0190] The rendering unit 1606 is configured to render the image frame with the first special effect object based on the first special effect graph, so as to generate a special effect animation based on the image frame with the first special effect object.
[0191] In an optional example, the stepping parameters include: the number of steps, the stepping direction, and the stepping distance, and the number of steps is the number of times the first special effect object needs to step in an image frame;
[0192] The position determination unit is used to determine the cumulative stepping distance after the first special effect object steps based on the stepping distance and the number of steps; and to determine the first position information after the first special effect object steps based on the starting position information, the cumulative stepping distance and the stepping direction.
[0193] In an optional example, a position determination unit is used to determine that the stepping distance is the cumulative stepping distance after the first step; for each step after the first step, based on the first noise information of the previous step and the mapping relationship between the noise information and the stepping offset parameter, the target stepping offset parameter corresponding to the first noise information is calculated; the target stepping offset parameter is mapped into a first range to obtain the stepping offset corresponding to the step; based on the cumulative stepping distance corresponding to the previous step and the stepping offset, the cumulative stepping distance corresponding to the step is determined.
[0194] In an optional example, a contour generation unit is used to perform inversion processing on the first noise information corresponding to the step to obtain processed noise information; map the processed noise information to a second range to obtain a first contour image of the first special effect object after the step; and superimpose the first contour image to obtain a contour image of the first special effect object.
[0195] In an optional example, the device further includes:
[0196] The second special effect object processing unit is used to determine the number of object layers of the second special effect object to be displayed in the image frame to be rendered, wherein the second special effect object is associated with the first special effect object; based on the number of object layers, for a target object layer, the screen space UV is divided into a plurality of UV regions; based on the time information and the first movement parameter of the second special effect object, the object position point of the second special effect object in each UV region under the target object layer is determined; based on the object position point, the first distance field information of the second special effect object in the screen space under the target object layer is determined; based on the first distance field information and the second display parameter of the second special effect object, a second special effect map of the second special effect object is determined;
[0197] The rendering unit is used to render an image frame with a first special effect object and a second special effect object based on the first special effect graph and the second special effect graph.
[0198] In an optional example, a second special effect object processing unit is used to determine an object special effect graph of the second special effect object under the target object layer based on the first distance field information and the second display parameter of the second special effect object; and obtain a second special effect graph of the second special effect object based on the object special effect graph corresponding to the target object layer.
[0199] In an optional example, the second special effect object processing unit is used to calculate the distance vectors from each position in the screen space to the object position points in each UV area to obtain the first distance field corresponding to the multiple object position points in the screen space; based on the first distance field under the target object layer, obtain the first distance field information of the second special effect object under the target object layer in the screen space.
[0200] In an optional example, the second special effect object processing unit is used to calculate the distance vector from each position in the screen space to the object position point in each UV area; rotate the distance vector based on a first rotation parameter, and scale the rotated distance vector based on a first scaling parameter to obtain a first scaled vector; determine the first distance field corresponding to each object position point based on the first scaled vector of each object position point under the target object layer, and obtain the first distance field information of the second special effect object in the screen space under the target object layer.
[0201] In an optional example, the second special effect object processing unit is used to adjust the size of each first distance field in the first distance field information under the target object layer based on the size parameter corresponding to the second special effect object under the target object layer to obtain first adjusted distance field information, wherein the size parameter is different for different object layers; based on the first adjusted distance field information under the target object layer and the second display parameter of the second special effect object, determine the object special effect map of the second special effect object under the target object layer.
[0202] In an optional example, the second special effect object processing unit is further used to rotate the distance vector under the target object layer based on the second rotation parameter, and scale the rotated distance vector based on the second scaling parameter to obtain a second scaled vector; determine the second distance field of each UV area based on the second scaled vector of each UV area under the target object layer, and obtain the second distance field information of the second special effect object in the screen space, wherein the coverage of the second distance field in the same UV area under the same object layer is greater than the first distance field; determine the edge blur special effect map of the second special effect object under the target object layer based on the second distance field information under the target object layer and the third display parameter of the second special effect object;
[0203] The second special effect object processing unit is also used to fuse the object special effect graphs and edge blur special effect graphs under each object layer before obtaining the second special effect graph of the second special effect object based on the object special effect graph corresponding to the target object layer, so as to obtain new object special effect graphs under each object layer.
[0204] In an optional example, a second special effect object processing unit is used to superimpose the object special effect map and the edge blur special effect map under the target object layer to obtain a superimposed special effect map under the target object layer; and process the superimposed special effect map based on a transparency parameter of the target object layer to obtain a new object special effect map of the target object layer, wherein the larger the number of object layers, the larger the transparency parameter.
[0205] In an optional example, the second special effect object processing unit is used to determine, for the target object layer, a moving distance vector based on corresponding time information and a second moving parameter of the second special effect object; amplify the screen space UV, and sum the amplified screen space UV and the moving distance vector to obtain the moved screen space UV; and process the moved screen space UV based on a floor function to obtain multiple UV areas.
[0206] In an optional example, the second special effect object processing unit is used to round down the screen space UV after movement based on a rounding down function to obtain multiple initial UV areas; obtain the screen offset corresponding to the target object layer, and offset the multiple initial UV areas based on the screen offset to obtain multiple UV areas after offset.
[0207] In an optional example, the screen offset of the target object layer is obtained based on the sum of the screen offset of the previous object layer and the random offset, and the screen offset of the first object layer is a preset value.
[0208] In an optional example, a rendering unit is used to obtain first mask information of a second special effects object in screen space, wherein the first mask information is used to indicate the intensity of the second special effects object at each screen space position; based on the first mask information, the second special effects graph is processed to obtain a target second special effects graph of the second special effects object; based on the superposition of the target second special effects graph and the first special effects graph, an image frame with the first special effects object and the second special effects object is rendered.
[0209] In an optional example, the rendering unit is further used to determine second mask information of the second special effects object in the screen space based on the contour image of the first special effects object, wherein the second mask information is used to indicate that the display range of the first special effects object in the screen space is the mask range of the second special effects object; and the second special effects image is processed based on the first mask information and the second mask information to obtain a target second special effects image of the second special effects object.
[0210] By using the device of the present application, the accuracy and detail expression of the first special effect object can be improved, the visual sense of repetition can be reduced, the realism of the special effects and the impact of the visual experience can be enhanced, and the special effects can be made more diverse and adaptable through flexible adjustment of parameters.
[0211] Accordingly, an embodiment of the present application further provides an electronic device, which may be a terminal, and the terminal may be a smart phone, a tablet computer, a laptop computer, a touch screen, a game console, a personal computer (PC, Personal Computer), a personal digital assistant (Personal Digital Assistant, PDA) and other terminal devices. Alternatively, the electronic device may be a server.
[0212] like Fig.17 As shown, Fig.17 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device 1700 includes a processor 1701 having one or more processing cores, a memory 1702 having one or more computer-readable storage media, and a computer program stored in the memory 1702 and executable on the processor. The processor 1701 is electrically connected to the memory 1702. It will be understood by those skilled in the art that the electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0213] The processor 1701 is the control center of the electronic device 1700, and uses various interfaces and lines to connect various parts of the entire electronic device 1700. By running or loading software programs and / or units stored in the memory 1702, and calling data stored in the memory 1702, the processor 1701 executes various functions of the electronic device 1700 and processes data, thereby monitoring the electronic device 1700 as a whole. The processor 1701 can be a central processing unit CPU, a graphics processing unit GPU, a network processor (Network Processor, NP), etc., and can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application.
[0214] In the embodiment of the present application, the processor 1701 in the electronic device 1700 will load instructions corresponding to the processes of one or more application programs into the memory 1702 according to the following steps, and the processor 1701 will run the application programs stored in the memory 1702 to implement various functions, such as:
[0215] Obtaining the starting position information and stepping parameters of the first special effect object to be displayed in the image frame to be rendered in the screen space;
[0216] Determine first position information of the first special effect object after stepping based on the starting position information and the stepping parameter;
[0217] Generate first noise information corresponding to the step in the screen space based on the time information corresponding to the step and the first position information after the step by using a noise generation function;
[0218] Determine a contour image of a first special effect object based on the first noise information;
[0219] Determining a first special effect image of the first special effect object based on the contour image of the first special effect object and a first display parameter of the first special effect object;
[0220] Based on the first special effect graph, an image frame with a first special effect object is rendered to generate a special effect animation based on the image frame with the first special effect object.
[0221] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0222] Optional, such as Fig.17 As shown, the electronic device 1700 further includes: a touch screen 1703, a radio frequency circuit 1704, an audio circuit 1705, an input unit 1706, and a power supply 1707. The processor 1701 is electrically connected to the touch screen 1703, the radio frequency circuit 1704, the audio circuit 1705, the input unit 1706, and the power supply 1707, respectively. Those skilled in the art can understand that Fig.17The electronic device structure shown in the figure does not constitute a limitation of the electronic device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0223] The touch display screen 1703 can be used to display a graphical user interface and receive operation instructions generated by the user acting on the graphical user interface. The touch display screen 1703 may include a display panel and a touch panel. Among them, the display panel may be used to display information input by the user or information provided to the user and various graphical user interfaces of the electronic device, and these graphical user interfaces may be composed of graphics, text, icons, videos and any combination thereof. Optionally, the display panel may be configured in the form of a liquid crystal display (LCD, Liquid Crystal Display), an organic light emitting diode (OLED, Organic Light-EmittingDiode) and the like. The touch panel may be used to collect the user's touch operation on or near it (such as the user using any suitable object or attachment such as a finger, a stylus, etc. on the touch panel or near the touch panel), and generate corresponding operation instructions, and the operation instructions execute corresponding programs. Optionally, the touch panel may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into the touch point coordinates, and then sends it to the processor 1701, and can receive the command sent by the processor 1701 and execute it. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it is transmitted to the processor 1701 to determine the type of touch event, and then the processor 1701 provides a corresponding visual output on the display panel according to the type of touch event. In an embodiment of the present application, the touch panel and the display panel can be integrated into the touch display screen 1703 to realize the input and output functions. However, in some embodiments, the touch panel and the touch panel can be used as two independent components to realize the input and output functions. That is, the touch display screen 1703 can also be used as a part of the input unit 1706 to realize the input function.
[0224] The radio frequency circuit 1704 may be used to send and receive radio frequency signals, so as to establish wireless communication with a network device or other electronic devices through wireless communication, and to send and receive signals between the network device or other electronic devices.
[0225] The audio circuit 1705 can be used to provide an audio interface between the user and the electronic device through a speaker and a microphone. The audio circuit 1705 can transmit the electrical signal converted from the received audio data to the speaker, which is converted into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 1705 and converted into audio data, and then the audio data is output to the processor 1701 for processing, and then sent to another electronic device through the radio frequency circuit 1704, or the audio data is output to the memory 1702 for further processing. The audio circuit 1705 may also include an earplug jack to provide communication between an external headset and an electronic device.
[0226] The input unit 1706 may be used to receive input numbers, character information or user feature information (such as fingerprint, iris, facial information, etc.), and to generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
[0227] The power supply 1707 is used to supply power to various components of the electronic device 1700. Optionally, the power supply 1707 can be logically connected to the processor 1701 through a power management system, so that the power management system can manage charging, discharging, and power consumption. The power supply 1707 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0228] although Fig.17 Not shown, the electronic device 1700 may also include a camera, a sensor, a wireless fidelity module, a Bluetooth module, etc., which will not be described in detail here.
[0229] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0230] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0231] To this end, an embodiment of the present application provides a computer-readable storage medium, in which a plurality of computer programs are stored, and the computer program can be loaded by a processor to execute any one of the special effect animation processing methods provided in the embodiments of the present application. The computer program can execute the following steps of the special effect animation processing method:
[0232] Obtaining the starting position information and stepping parameters of the first special effect object to be displayed in the image frame to be rendered in the screen space;
[0233] Determine first position information of the first special effect object after stepping based on the starting position information and the stepping parameter;
[0234] Generate first noise information corresponding to the step in the screen space based on the time information corresponding to the step and the first position information after the step by using a noise generation function;
[0235] Determine a contour image of a first special effect object based on the first noise information;
[0236] Determining a first special effect image of the first special effect object based on the contour image of the first special effect object and a first display parameter of the first special effect object;
[0237] Based on the first special effect graph, an image frame with a first special effect object is rendered to generate a special effect animation based on the image frame with the first special effect object.
[0238] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0239] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0240] Since the computer program stored in the computer-readable storage medium can execute any one of the special effects animation processing methods provided in the embodiments of the present application, the beneficial effects that can be achieved by any one of the special effects animation processing methods provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0241] According to one aspect of the present application, a computer program product or a computer program is also provided, the computer program product or the computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device executes the methods provided in various optional implementations of the above embodiments.
[0242] In the above-mentioned special effects animation processing device, computer-readable storage medium, electronic device, and computer program product embodiments, the description of each embodiment has its own emphasis. For parts not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process and beneficial effects of the special effects animation processing device, computer-readable storage medium, computer program product, electronic device and its corresponding units described above can refer to the description of the special effects animation processing method in the above embodiment, and will not be repeated here.
[0243] The above is a detailed introduction to a special effects animation processing method, device, electronic device, computer-readable storage medium and computer program product provided in an embodiment of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A special effects animation processing method, characterized in that: include: Obtaining the starting position information and stepping parameters of the first special effect object to be displayed in the image frame to be rendered in the screen space; Determining first position information of the first special effect object after stepping based on the starting position information and the stepping parameter; Generate first noise information corresponding to the step in the screen space based on the time information corresponding to the step and the first position information after the step by using a noise generation function; Based on the first noise information, determining a contour image of the first special effect object; Determining a first special effect image of the first special effect object based on the outline image of the first special effect object and a first display parameter of the first special effect object; Based on the first special effect graph, an image frame with the first special effect object is rendered to generate a special effect animation based on the image frame with the first special effect object.
2. The special effects animation processing method according to claim 1, characterized in that: The stepping parameters include: stepping times, stepping directions and stepping distances, wherein the stepping times are the times the first special effect object needs to step in an image frame; The determining, based on the starting position information and the stepping parameter, first position information of the first special effect object after stepping, comprises: Determine, based on the stepping distance and the number of steps, a cumulative stepping distance after the first special effect object has stepped; Based on the starting position information, the accumulated stepping distance and the stepping direction, first position information of the first special effect object after stepping is determined.
3. The special effects animation processing method according to claim 2, characterized in that: The stepping distance and the number of steps are used to determine the cumulative stepping distance after each stepping, including: Determine the stepping distance as the accumulated stepping distance after the first stepping; For each step after the first step, based on the first noise information of the previous step and the mapping relationship between the noise information and the step offset parameter, calculate the target step offset parameter corresponding to the first noise information; Mapping the target step offset parameter into a first range to obtain a step offset corresponding to the step; Based on the accumulated step distance corresponding to the previous step and the step offset, the accumulated step distance corresponding to the step is determined.
4. The special effects animation processing method according to claim 1, characterized in that: The step of determining the contour image of the first special effect object based on the first noise information includes: Performing inversion processing on the first noise information corresponding to the step to obtain processed noise information; Mapping the processed noise information into a second range to obtain a first contour image of the first special effect object after stepping; The first contour images are superimposed to obtain a contour image of the first special effect object.
5. The special effects animation processing method according to any one of claims 1 to 4, characterized in that: Also includes: Determining the number of object layers of a second special effect object that needs to be displayed in the image frame to be rendered, wherein the second special effect object is associated with the first special effect object; Based on the number of object layers, for a target object layer, dividing the screen space UV into a plurality of UV regions; Determine, based on the time information and the first movement parameter of the second special effect object, an object position point of the second special effect object in each UV region under the target object layer; Determine, based on the object position point, first distance field information of the second special effect object in the screen space under the target object layer; Determining a second special effect graph of the second special effect object based on the first distance field information and a second display parameter of the second special effect object; The rendering of the image frame with the first special effect object based on the first special effect graph includes: Based on the first special effect graph and the second special effect graph, an image frame with the first special effect object and the second special effect object is rendered.
6. The special effects animation processing method according to claim 5, characterized in that: The determining, based on the first distance field information and the second display parameter of the second special effect object, a second special effect graph of the second special effect object comprises: Determine an object special effect map of the second special effect object under the target object layer based on the first distance field information and a second display parameter of the second special effect object; Based on the object special effect graph corresponding to the target object layer, a second special effect graph of the second special effect object is obtained.
7. The special effects animation processing method according to claim 6, characterized in that: The determining, based on the object position point, first distance field information of the second special effect object in the screen space under the target object layer includes: Calculate the distance vectors from each position in the screen space to the object position points in each UV region to obtain a first distance field corresponding to the multiple object position points in the screen space; Based on the first distance field under the target object layer, first distance field information of the second special effect object under the target object layer in the screen space is obtained.
8. The special effects animation processing method according to claim 6, characterized in that: The determining, based on the object position point, first distance field information of the second special effect object in the screen space under the target object layer includes: Calculate the distance vector from each position in the screen space to the object position point in each UV area; Rotating the distance vector based on a first rotation parameter, and scaling the rotated distance vector based on a first scaling parameter to obtain a first scaled vector; Based on the first scaled vectors of each object position point under the target object layer, the first distance field corresponding to each object position point is determined to obtain the first distance field information of the second special effect object in the screen space under the target object layer.
9. The special effects animation processing method according to claim 8, characterized in that: The determining, based on the first distance field information and the second display parameter of the second special effect object, an object special effect graph of the second special effect object under the target object layer includes: Based on the size parameter corresponding to the second special effect object under the target object layer, adjust the size of each first distance field in the first distance field information under the target object layer to obtain first adjusted distance field information, wherein the size parameter is different for different object layers; An object special effect map of the second special effect object under the target object layer is determined based on the first adjusted distance field information under the target object layer and the second display parameter of the second special effect object.
10. The special effects animation processing method according to claim 8, characterized in that: Also includes: Rotating the distance vector under the target object layer based on a second rotation parameter, and scaling the rotated distance vector based on a second scaling parameter to obtain a second scaled vector; Determine, based on the second scaled vector of each UV region under the target object layer, a second distance field of each UV region, and obtain second distance field information of the second special effect object in the screen space, wherein the coverage of the second distance field in the same UV region under the same object layer is greater than that of the first distance field; Determine an edge blur special effect map of the second special effect object under the target object layer based on the second distance field information under the target object layer and the third display parameter of the second special effect object; Before obtaining the second special effect graph of the second special effect object based on the object special effect graph corresponding to the target object layer, the method further includes: The object special effects map and the edge blur special effects map under each object layer are fused to obtain a new object special effects map under each object layer.
11. The special effects animation processing method according to claim 10, characterized in that: The object special effect graph and the edge blur special effect graph under each object layer are fused to obtain a new object special effect graph under each object layer, including: Superimposing the object special effect image and the edge blur special effect image under the target object layer to obtain a superimposed special effect image under the target object layer; The superimposed special effect image is processed based on the transparency parameter of the target object layer to obtain a new object special effect image of the target object layer, wherein the larger the number of object layers is, the larger the transparency parameter is.
12. The special effects animation processing method according to claim 5, characterized in that: For the target object layer, the screen space UV is divided into multiple UV areas, including: For the target object layer, determining a moving distance vector based on the corresponding time information and a second moving parameter of the second special effect object; Amplifying the screen space UV, and summing the amplified screen space UV and the moving distance vector to obtain the moved screen space UV; The moved screen space UV is processed based on a floor function to obtain a plurality of UV regions.
13. The special effects animation processing method according to claim 12, characterized in that: The moved screen space UV is processed based on the floor function to obtain a plurality of UV regions, including: The moved screen space UV is rounded down based on a rounding down function to obtain a plurality of initial UV regions; A screen offset corresponding to the target object layer is obtained, and the plurality of initial UV regions are offset based on the screen offset to obtain a plurality of UV regions after offset.
14. The special effects animation processing method according to claim 13, characterized in that: The screen offset of the target object layer is obtained based on the sum of the screen offset of the previous object layer and the random offset, and the screen offset of the first object layer is a preset value.
15. The special effects animation processing method according to claim 5, characterized in that: The rendering of the image frame with the first special effect object and the second special effect object based on the first special effect graph and the second special effect graph includes: Acquire first mask information of the second special effect object in the screen space, wherein the first mask information is used to indicate the intensity of the second special effect object at each screen space position; Processing the second special effect graph based on the first mask information to obtain a target second special effect graph of the second special effect object; Based on the superposition of the target second special effect graph and the first special effect graph, an image frame with the first special effect object and the second special effect object is rendered.
16. The method according to claim 15, characterized in that Also includes: Determining, based on the contour image of the first special effect object, second mask information of the second special effect object in the screen space, wherein the second mask information is used to indicate that a display range of the first special effect object in the screen space is a mask range of the second special effect object; The processing of the second special effect graph based on the first mask information to obtain a target second special effect graph of the second special effect object includes: The second special effect graph is processed based on the first mask information and the second mask information to obtain a target second special effect graph of the second special effect object.
17. A special effects animation processing device, characterized in that: include: An acquisition unit, used for acquiring the starting position information and stepping parameters of a first special effect object to be displayed in the image frame to be rendered in the screen space; a position determination unit, configured to determine first position information of the first special effect object after stepping based on the starting position information and the stepping parameter; A noise generating unit, configured to generate first noise information corresponding to the step in the screen space based on the time information corresponding to the step and the first position information after the step by using a noise generating function; a contour generating unit, configured to determine a contour image of the first special effect object based on the first noise information; A special effect generating unit, configured to determine a first special effect image of the first special effect object based on the outline image of the first special effect object and a first display parameter of the first special effect object; A rendering unit is used to render an image frame with the first special effect object based on the first special effect graph, so as to generate a special effect animation based on the image frame with the first special effect object.