Game animation processing method and device, electronic equipment and storage medium

By setting material properties on virtual objects and updating material properties in real time, the problems of low accuracy and large amount of resources when combining tween animation and material animation are solved, and efficient fusion and accurate playback of animations are achieved.

CN119818939APending Publication Date: 2025-04-15NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411891051.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-19
Publication Date
2025-04-15

AI Technical Summary

Technical Problem

In the process of combining tween animation and material animation, the accuracy of animation combination is low and the amount of animation resources is large.

Method used

By setting material properties on virtual objects, inserting material nodes, the material properties of virtual objects are updated in real time while playing tween animation, and simulating material animation by updating material properties in real time, realizing the fusion of tween animation and simulated material animation.

Benefits of technology

It avoids the problem of playback out of synchronization when playing tween animations with material animations. There is no need to insert sequence frame animations into tween animations, which reduces the amount of animation resources and improves the accuracy of animation combinations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119818939A_ABST
    Figure CN119818939A_ABST
Patent Text Reader

Abstract

The invention provides a game animation processing method and device, electronic equipment and a storage medium, and relates to the technical field of computers.The method comprises the steps that in response to the end of playing of a previous frame of inter-filling image, a current frame of inter-filling image is obtained, and whether the material attribute of a virtual object needs to be updated or not is determined; if it is determined that the material attribute of the virtual object needs to be updated, obtaining the material attribute of the current frame, and updating the material attribute of the virtual object by using the material attribute of the current frame; and based on the updated material attribute of the virtual object, playing the current frame complement image. By adopting the game animation processing method and device, the electronic equipment and the storage medium, the problems of low accuracy of animation combination and large animation resource quantity in the process of combining the complement animation and the material animation are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a game animation processing method, device, electronic device and storage medium. Background Art

[0002] In the field of animation and computer graphics, tween animation and material animation can be used in combination to create more vivid visual effects. The combination of tween animation and material animation can add more elements to the visual effects of games, animations and applications, making the animation more vivid and attractive. At present, when using the Egret engine to develop H5 game projects, tween animation and material animation are independent of each other, and the following two methods are usually used to combine animations: one is to start playing the material animation at a certain time node when playing the tween animation, or to start playing the tween animation at a certain time node when playing the material animation, that is, under two different timelines, the node animation playback is guaranteed to be consistent by controlling multiple factors such as the playback time and the number of frames. The other is to convert the material animation into a sequence frame animation, insert the sequence frame animation into the tween animation node, and then simulate the playback effect of the material animation by controlling the tween animation.

[0003] However, in the first animation combination method, in order to meet the playback effect, the playback time and frame rate need to be strictly controlled. Due to different computer usage environments, playback errors are easily generated, and multiple playback control functions need to be added when controlling and cleaning animations. In the second animation combination method, since sequence frames are used to simulate material animations, the number of nodes and animation resources of the tween animation will increase. Summary of the invention

[0004] In view of this, the purpose of the present application is to provide a game animation processing method, device, electronic device and storage medium to solve the problems of low animation combination accuracy and large amount of animation resources in the process of combining tween animation and material animation.

[0005] In a first aspect, an embodiment of the present application provides a method for processing game animation, wherein a tween animation of a virtual object is played through a terminal device, wherein the tween animation includes multiple frames of tween images, including:

[0006] In response to the completion of playing the previous frame of the interpolated image, obtaining the current frame of the interpolated image, and determining whether the material properties of the virtual object need to be updated;

[0007] If it is determined that the material properties of the virtual object need to be updated, the material properties of the current frame are obtained, and the material properties of the virtual object are updated using the material properties of the current frame;

[0008] Based on the updated material properties of the virtual object, play the current frame interpolated image.

[0009] In a second aspect, an embodiment of the present application further provides a game animation processing device, which plays a tween animation of a virtual object through a terminal device, wherein the tween animation includes multiple frames of tween images, and the device includes:

[0010] A material update determination module, used for obtaining the current frame of interpolated image in response to the completion of playing the previous frame of interpolated image, and determining whether the material attribute of the virtual object needs to be updated;

[0011] A material attribute updating module, for obtaining the material attributes of the current frame if it is determined that the material attributes of the virtual object need to be updated, and updating the material attributes of the virtual object using the material attributes of the current frame;

[0012] The image display module is used to play the interpolated image of the current frame based on the updated material properties of the virtual object.

[0013] In a third aspect, an embodiment of the present application further provides an electronic device, comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the game animation processing method as described above are performed.

[0014] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the game animation processing method as described above are executed.

[0015] The embodiments of the present application bring the following beneficial effects:

[0016] The embodiments of the present application provide a game animation processing method, device, electronic device and storage medium, which can insert material nodes by setting material properties on virtual objects, update the material properties of virtual objects in real time while playing tween animations, and simulate material animations by updating material properties in real time, thereby realizing the fusion of tween animations and simulated material animations, avoiding the problem of playback asynchrony when tween animations are played together with material animations, and eliminating the need to insert sequence frame animations in tween animations, thereby reducing the amount of animation resources. Compared with the game animation processing method in the prior art, the problems of low animation combination accuracy and large amount of animation resources in the process of combining tween animations with material animations are solved.

[0017] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0019] Figure 1 A flowchart of a game animation processing method provided by an embodiment of the present application is shown;

[0020] Figure 2 A flowchart of a game animation processing process provided by an embodiment of the present application is shown;

[0021] Figure 3 A schematic diagram showing the structure of a game animation processing device provided in an embodiment of the present application is shown;

[0022] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0023] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application usually described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, each other embodiment obtained by those skilled in the art without making creative work belongs to the scope of protection of the present application.

[0024] It is worth noting that before this application was filed, in the field of animation and computer graphics, tween animation and material animation can be used in combination to create more vivid visual effects. In practice, the combined use of the two animation techniques usually involves the following aspects:

[0025] First, interactive animation design: In game development and user interface design, Tween animation can be used to control basic animations such as the position, rotation, and scaling of virtual objects. At the same time, material animation can be combined to achieve material gradients, flickering, or texture transformations to enhance animation effects.

[0026] Second, special effects and environmental animation: In game development and film production, Tween animation can be used to control the movement of characters or objects, and combined with material animation to achieve special effects such as smoke, flames, water surface fluctuations, and material changes in the environment, thereby increasing the realism and details of the scene.

[0027] Third, state transition: Use Tween animation to achieve smooth transition of object states, and combine material animation to achieve material gradient, which can make the state change of scenes or characters more natural and smooth.

[0028] Fourth, enhance user experience: In the user interface design of the application, use Tween animation to achieve smooth movement and transition effects of interface elements, and combine material animation to increase the changes and feedback of interface elements to enhance user experience.

[0029] Tween motion combined with material animation can add more elements to the visual effects of games, animations, and applications, making the animation more vivid and attractive.

[0030] In the above application practices, the combined use of tween animation and material animation can add more elements to the visual effects of games, animations, and applications, making the animation more vivid and attractive.

[0031] At present, when using the Egret engine to develop H5 game projects, tween animation and material animation are independent of each other. Usually, the following two methods are used to combine animation: one is that the client program starts playing the material animation at a certain time node while playing the tween animation through program control, or starts playing the tween animation at a certain time node when playing the material animation, that is, under two different timelines, the program controls multiple factors such as the playback time and the number of frames to ensure the consistency of the node animation playback. The other is to convert the material animation into a sequence frame animation, insert the sequence frame animation into the tween animation node, and then simulate the playback effect of the material animation by controlling the tween animation. However, in the first animation combination method, in order to match the playback effect, the playback time and frame rate need to be strictly controlled. Due to different computer usage environments, it is easy to produce playback errors, such as: playback is not synchronized, and multiple playback control functions need to be added when controlling and cleaning animations. In the second animation combination method, since sequence frames are used to simulate material animations, the number of nodes and animation resources of the tween animation will increase.

[0032] The terms involved in the embodiments of the present application are explained below.

[0033] Graphical User Interface:

[0034] It is an interface display format for communication between people and computers, allowing users to manipulate icons, logos or menu options on the screen using input devices such as a mouse or keyboard, and also allowing users to manipulate icons or menu options on the screen by performing touch operations on the touch screen of a touch terminal to select commands, start programs or perform other tasks.

[0035] Game scene:

[0036] It is a virtual scene displayed (or provided) when the application is running on a terminal device or server, that is, the scene used in the normal game process. In other words, the game scene refers to the virtual game control that carries the virtual object during the game process. The virtual object can perform actions such as movement and skill release in the virtual scene under the operation instructions issued by the user (i.e., the player) to the terminal device. Optionally, the game scene can be a simulation environment of the real world, a semi-simulation and semi-fictitious virtual environment, or a purely fictitious virtual environment. The game scene can be any one of a two-dimensional virtual scene, a 2.5-dimensional virtual scene, and a three-dimensional virtual scene. The virtual environment can be the sky, land, ocean, etc., wherein the land includes environmental elements such as deserts and cities. Among them, the game scene is a scene in which the user controls the complete game logic of the virtual object. Optionally, the game scene can also be used for a virtual environment battle between at least two virtual objects, and there are virtual resources available for at least two virtual objects in the game scene. Exemplarily, the game scene may include any one or more of the following elements: game background elements, game virtual character elements, game prop elements, etc.

[0037] In an optional implementation, the game animation processing method in one embodiment of the present disclosure can be run on a local terminal device or a server. When the game animation processing method 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.

[0038] In an optional implementation, various cloud applications, such as cloud games, can be run under the cloud interaction system. Taking cloud games as an example, cloud games refer to a game mode based on cloud computing. In the operation mode of cloud games, the operating body of the game program and the main body of the game screen presentation are separated. The storage and operation of the game loading method are completed on the cloud game server. The role of the client device is used for receiving and sending data and presenting the game screen. For example, the client device 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, etc.; but the cloud game server in the cloud is used for information processing. When playing the game, the player operates the client device to send an operation instruction to the cloud game server. The cloud game server runs the game according to the operation instruction, encodes and compresses the game screen and other data, and returns it to the client device through the network. Finally, the client device decodes and outputs the game screen.

[0039] In an optional embodiment, taking a game as an example, a local terminal device stores a game program and is used to present a game screen. The local terminal device is used to interact with the player through a graphical user interface, that is, the game program is downloaded and installed by an electronic device and run conventionally. The local terminal device may provide the graphical user interface to the player in a variety of ways, for example, it may be rendered and displayed on a display screen of the terminal, or provided to the player through a holographic projection. For example, the local terminal device may include a display screen and a processor, the display screen is used to present a 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, and control the display of the graphical user interface on the display screen.

[0040] In a possible implementation, an embodiment of the present invention provides a game animation processing method, which provides a graphical user interface through a terminal device, wherein the terminal device can be the local terminal device mentioned above, or it can be a client device in the cloud interaction system mentioned above.

[0041] Based on this, an embodiment of the present application provides a game animation processing method to improve the accuracy of animation combination in the process of combining tween animation and material animation and reduce the amount of animation resources.

[0042] See also Figure 1 , Figure 1 This is a flow chart of a method for processing game animation provided by an embodiment of the present application. Figure 1 As shown, the game animation processing method provided in the embodiment of the present application includes:

[0043] Step S101, in response to the completion of playing the previous interpolated image frame, obtaining the current interpolated image frame, and determining whether the material properties of the virtual object need to be updated;

[0044] Step S102, if it is determined that the material attributes of the virtual object need to be updated, the material attributes of the current frame are obtained, and the material attributes of the virtual object are updated using the material attributes of the current frame;

[0045] Step S103: Play the interpolated image of the current frame based on the updated material properties of the virtual object.

[0046] The game animation processing method provided in the embodiment of the present application inserts a material node by setting material properties on a virtual object, updates the material properties of the virtual object in real time while playing the tween animation, and simulates the material animation by updating the material properties in real time, thereby realizing the fusion of the tween animation and the simulated material animation, avoiding the problem of playback asynchrony when the tween animation and the material animation are played together, and eliminating the need to insert sequence frame animation in the tween animation, thereby reducing the amount of animation resources, and solving the problems of low animation combination accuracy and large amount of animation resources in the process of combining the tween animation and the material animation.

[0047] To facilitate understanding of this embodiment, the following takes the game animation processing method applied to a terminal device as an example to illustrate the above exemplary steps provided in the embodiment of the present application. The tween animation of the virtual object is played by the terminal device, and the tween animation includes multiple frames of tween images.

[0048] In step S101 , in response to the completion of playing of the previous frame of interpolated image, the current frame of interpolated image is acquired to determine whether the material properties of the virtual object need to be updated.

[0049] In this step, the virtual object may refer to a virtual object visible in the game. As an example, the virtual object may be a controlled virtual character in the game, or an uncontrolled virtual character, such as an NPC, or a swinging plant in the game scene.

[0050] Tween animation may refer to Tween animation, and tween animation includes multiple frames of tween images, for example, tween animation includes 30 frames of images.

[0051] The previous tween image frame may refer to the previous frame image of the current tween image frame. For example, when the current tween image frame is the third frame image of the tween animation, the previous tween image frame is the second frame image of the tween animation.

[0052] In an embodiment of the present application, taking the virtual object as a controlled virtual character controlled by the current player in the game as an example, the interpolation animation of the controlled virtual character is being played in the graphical user interface. When the controlled virtual character needs to add material gradient, flashing and other animation effects due to changes in the game scene or interactions with other virtual characters, it can be achieved by setting material properties for the controlled virtual character and changing the variable values ​​of the material properties.

[0053] In one example, the material attribute of the virtual object is set based on the material attribute interface configured for the virtual object, and the material attribute interface is set through the shader of the game engine. The material attribute interface is not set in the existing game engine, so in order to set the material attribute for the virtual object, the material attribute interface can be set in the shader of the game engine, and the virtual object can be associated with the material attribute interface to set the material attribute for the virtual object through the material attribute interface.

[0054] Here, when setting material properties for a virtual object, a material property object for recording material property values ​​may be created, for example, a filter property object may be created, and the relevant parameters of the material property, for example, the first parameter, may be recorded through the filter. Then, the material property object may be associated with the virtual object through the material property interface to implement material property settings. For example, when a virtual object is bound to a material property, the material property (material uniform property) may be indirectly set by setting the uniform property of the virtual object. The set material property will act on the virtual object to display the effect of material animation through the continuous changes in the material property.

[0055] In step S102, if it is determined that the material attributes of the virtual object need to be updated, the material attributes of the current frame are obtained, and the material attributes of the virtual object are updated using the material attributes of the current frame.

[0056] In this step, during the playing of the tween animation, the set material properties will be passed into the shader as dynamic values. As an example, the dynamic value can be the time parameter uniformTime. After the shader receives the passed dynamic value, the game engine can display different rendering results of the virtual object through shading rendering processing.

[0057] Among them, when the game is a web game, the game engine may refer to a web game engine, for example: Egret engine, which is an HTML5 game engine written in TypeScript.

[0058] In the above example, in order to facilitate game developers to edit the material properties of virtual objects, a material property control module can be added to the animation editor of the game engine, that is, a material node module (Material NodePart) can be added. When adding animation frames in the animation editor of the game engine, the material properties of the virtual object can be judged to determine whether the virtual object has material properties, so as to control the display of the material property control module, that is, if the material property variable (material uniform property) exists in the current virtual object, the material property control module is displayed in the interface of the animation editor; if the material property variable (material uniform property) does not exist in the current virtual object, the material property control module is not displayed in the interface of the animation editor. If it is determined that the virtual object has material properties, the vertex shader and pixel shader are parsed, and the parameter values ​​of all material properties are obtained, and the obtained material property parameter values ​​are displayed in the material property control module, so that the game developer can view and edit the material properties.

[0059] During the game running and playing the tween animation, if it is determined that the material properties of the virtual object need to be updated, the initialization parameters are obtained to determine the value of the material properties of the current frame according to the initialization parameters. Then, the material properties of the virtual object are updated using the determined material properties of the current frame.

[0060] In step S103, the interpolated image of the current frame is played based on the updated material properties of the virtual object.

[0061] In this step, the updated material attribute may refer to the material attribute corresponding to the current frame.

[0062] The material properties of the latest virtual object have been updated, and the latest interpolated image can be displayed in the graphical user interface. The material properties of the virtual object in the latest interpolated image have been updated. In this way, while the interpolated image is continuously updated, the playback effect of the material animation is simulated by real-time updating of the material properties of the virtual object, indirectly realizing the fusion of the interpolated animation and the material animation.

[0063] Refer to the following Figure 2 To introduce the entire game animation processing process.

[0064] Figure 2 A flowchart of the game animation processing process provided by the embodiment of the present application is shown. Figure 2 As shown, the game animation processing process includes:

[0065] Step S201, initializing the tween animation.

[0066] When it is determined that the tween animation needs to be played in the game, before playing the tween animation of the virtual object, it is first necessary to configure the initialization parameters of the tween animation of the virtual object, and use the initialization parameters to initialize the tween animation of the virtual object.

[0067] The initialization parameters include a first parameter for determining the material attribute parameter values ​​under different frames, and a second parameter for describing the starting state and target state of the tween animation. The first parameter includes a first starting parameter and a preset material attribute calculation model, and the second parameter includes a second starting parameter and a second ending parameter. Here, the second starting parameter can be used to initialize the tween animation.

[0068] The second start parameter is used to characterize the values ​​of all tween animation properties at the start time. Multiple second start parameters jointly determine the start state of the tween animation. The second start parameters include but are not limited to: the coordinates, transparency, and scaling of the tween animation at the start time. The second end parameter is used to characterize the values ​​of all tween animation properties at the end time. Multiple second end parameters jointly determine the end state of the tween animation. The second end parameters include but are not limited to: the coordinates, transparency, and scaling of the tween animation at the end time.

[0069] After the tween animation is initialized, step S202 is executed.

[0070] Step S202, determining whether the virtual object has material attributes.

[0071] After initializing the interpolated animation, it is necessary to determine whether the virtual object has material attributes, that is, whether the material attributes of the virtual object include vertex shader information and / or pixel shader information. If the material attributes include vertex shader information and / or pixel shader information, it is determined that the virtual object has set valid material attributes, and the vertex shader and pixel shader are parsed to obtain the parameter values ​​of all material attributes.

[0072] If it is determined that the virtual object has material attributes, step 203 is executed; if it is determined that the virtual object does not have material attributes, step S204 is executed.

[0073] Step S203, initializing material properties.

[0074] Here, initializing material attributes may refer to initializing the material of the virtual object, that is, using the uniform parameter values ​​obtained by parsing the vertex shader and / or the pixel shader to assign values ​​to the material attributes of the virtual object. For example, if the uniform parameter values ​​obtained by parsing include the initial value of uniformTime, the initial value of uniformTime is assigned to the virtual object.

[0075] After the material properties are initialized, step S204 is executed.

[0076] Step S204, entering the animation main loop.

[0077] Tween animation includes multiple tween images, which are played in a loop. After initializing the material properties, the main loop of the animation begins. Here, a timer can usually be used to perform loop playback of tween animation, for example, the requestAnimationFrame function or the setInterval function can be used to play the current frame tween image.

[0078] Assume that the tween animation of the virtual object with material attributes needs to be played from the 10th frame to the last frame, which is equivalent to not playing the tween animation with material attributes in the first 9 frames, and playing the animation that combines material attributes and tween animation from the 10th frame. At this time, the virtual objects in the tween animation of the 1st to 9th frames do not have material attributes, and the animations played in the 1st to 9th frames are all simple tween images.

[0079] After entering the animation main loop, execute step S205.

[0080] Step S205, determining the current frame time.

[0081] Assuming that the current interpolated image is the 10th interpolated image, the 9th interpolated image is the previous interpolated image. Therefore, after the 9th interpolated image is played, the timestamp corresponding to the 10th interpolated image is determined.

[0082] After the current frame time is determined, step S206 is executed.

[0083] Step S206: updating the interpolated image.

[0084] The current frame tween animation attribute is determined based on the initialization parameter, and the previous frame tween image is updated using the current frame tween animation attribute to obtain the current frame tween image. The initialization parameter includes a second starting parameter and a second ending parameter, and the current frame tween animation attribute can be determined based on the second starting parameter and the second ending parameter using a preset interpolation algorithm.

[0085] Specifically, the target position of the current frame tween image in the entire animation cycle of the tween animation can be determined according to the current frame time, and the target parameter value corresponding to the target position between the second starting parameter and the second ending parameter can be determined as the value of the current frame tween animation attribute using a preset interpolation algorithm.

[0086] For example: the current frame time is n, the playback time of the entire tween animation is from moment A to moment B, the parameter at moment A is the second starting parameter, the parameter corresponding to moment B is the second ending parameter, and moment n is at the midpoint between moments A and B. If the second starting parameter includes a starting color value, the second ending parameter includes an ending color value, and the preset interpolation algorithm is linear interpolation, the color value at the midpoint position can be calculated based on the starting color value, the ending color value, and the linear interpolation function. This color value is the color value of the tween animation attribute of the current frame.

[0087] After the interpolated image is updated, step S207 is executed.

[0088] Step S207, determining whether the material properties need to be updated.

[0089] Here, when playing each frame of the interpolated image, it is necessary to determine whether the material properties of the virtual object need to be updated in the current frame. If it is determined that the material properties of the virtual object need to be updated, the parameter values ​​of the latest material properties in the current frame are calculated, and the material properties of the virtual object are updated using the latest parameter values ​​of the material properties to simulate the effect of playing material animation, thereby achieving the purpose of synchronously playing interpolated animation and material animation.

[0090] Based on the first starting parameter in the initialization parameter, the target frame image in the tween animation whose material properties need to be updated can be determined. If the current frame tween image is the target frame image, it is determined that the material properties of the virtual object need to be updated.

[0091] The first starting parameter includes the first starting frame and the first animation duration. The first starting frame is used to represent the starting frame for starting to update the material properties. For example, if the material properties of the virtual object are set starting from the 10th frame, the first starting frame is the 10th frame. The first animation duration may refer to the duration for updating the material properties of the virtual object. For example, if the material properties of the virtual object need to be set from the 10th frame to the 30th frame, the duration is 21 frames.

[0092] In this way, the target frame image in the tween animation can be calculated as the 10th to 30th frames according to the first starting frame and the first animation duration. If the current frame tween image is an image within the 10th to 30th frames, it is determined that the material properties of the virtual object need to be updated.

[0093] If it is determined that the material properties of the virtual object need to be updated, it means that the material properties of the virtual object need to be reflected in the current frame interpolated image, that is, the material animation is simulated and played in the current frame, then step S208 is executed; if it is determined that the material properties of the virtual object do not need to be updated, then step S210 is executed.

[0094] Step S208, determining the material attributes of the current frame.

[0095] In one example, when the value of the first starting parameter is used as the variable value of the material attribute at the start time of the attribute taking effect, the value of the material attribute of the current frame can be determined according to the current frame calculation result output by the preset material attribute calculation model. The preset material attribute calculation model can refer to a model for calculating the parameter value of the material attribute in the current frame.

[0096] For example: if the preset material attribute calculation model is an easing function, the parameter value of the material attribute in the first starting parameter and the current frame time can be substituted into the easing function to determine the calculation result output by the easing function as the value of the material attribute of the current frame. In addition, the preset material attribute calculation model can also be a linear interpolation function. Since the parameter value of the material attribute in the first starting frame (the material attribute at the starting time when the attribute takes effect) is known, that is, the parameter value of the material attribute in the first starting parameter is known, the linear interpolation function can be used to calculate the value of the material attribute at the current frame time, and this value is the value of the material attribute of the current frame. Those skilled in the art can choose which preset material attribute calculation model to use according to actual conditions, and this application does not limit it here.

[0097] Among them, the material attributes of the current frame include at least one of the following items: vertex shader attributes, fragment shader attributes, and the material attributes of the current frame include but are not limited to: uniformTime, color, transparency, reflection attributes, and highlight attributes. The type of the material attribute of the current frame corresponds to the type of the material attribute in the first starting parameter. If the material attribute in the first starting parameter includes color and reflection attributes, the material attribute of the current frame also includes color and reflection attributes, indicating that the color and reflection attributes of the virtual object model need to be changed simultaneously during the playback of the tween animation; if the material attribute in the first starting parameter includes color, the material attribute of the current frame also includes color, indicating that the color of the virtual object model needs to be changed simultaneously during the playback of the tween animation.

[0098] After determining the material attributes of the current frame, execute step S209.

[0099] Step S209, updating material properties.

[0100] The material attributes of the virtual object are updated using the current frame material attributes, that is, the calculated parameter values ​​of the current frame material attributes are assigned to the material attributes of the virtual object, that is, the attribute values ​​in the material attribute object are updated to simulate the update process of the material animation.

[0101] After the material properties are updated, step S210 is executed.

[0102] Step S210: image rendering.

[0103] The material properties of the latest virtual objects have been updated to simulate the playback effect of material animation by continuously updating the material properties of virtual objects. Here, since the material properties of virtual objects will be updated as the current frame tween image changes, when the tween animation is played, the effect of simulating the playback of material animation can be achieved, and since the material properties corresponding to each frame of the tween image are calculated in real time, the problem of playback asynchrony that may be caused when the tween animation and material animation are played separately on two timelines can be avoided.

[0104] After the image is rendered, step S211 is executed.

[0105] Step S211, determining whether the tween animation is finished.

[0106] Determine whether the current frame tween image is the last frame image of the tween animation. If it is not the last frame image, the current frame tween image is played, and the next frame tween image is started to be played, and the process returns to step S204. If it is the last frame image, the tween animation is ended, and animation-related resources are cleaned up, for example, created objects are cleaned up to prevent memory leaks.

[0107] Taking the above example, the current frame interpolation image is the 10th frame interpolation image. When the next round of animation playback starts, the current frame interpolation image is used as the latest previous frame interpolation image, that is, the 10th frame interpolation image is used as the latest previous frame interpolation image. Then, the current frame interpolation animation attribute corresponding to the latest 10th frame interpolation image is determined, and the 10th frame interpolation image is updated using the current frame interpolation animation attribute corresponding to the 11th frame interpolation image to obtain the latest current frame interpolation image required for the next round of animation playback, that is, the 11th frame interpolation image is obtained.

[0108] Based on the same inventive concept, the embodiment of the present application also provides a game animation processing device corresponding to the game animation processing method. Since the principle of solving the problem by the device in the embodiment of the present application is similar to the above-mentioned game animation processing method in the embodiment of the present application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.

[0109] See also Figure 3 , Figure 3 This is a schematic diagram of the structure of a game animation processing device provided in an embodiment of the present application. Figure 3 As shown in , the tween animation of the virtual object is played through the terminal device, and the tween animation includes multiple frames of tween images. The game animation processing device 300 includes:

[0110] The material update determination module 301 is used to obtain the current frame of interpolated image in response to the completion of playing the previous frame of interpolated image, and determine whether the material attribute of the virtual object needs to be updated;

[0111] The material attribute updating module 302 is used to obtain the material attributes of the current frame if it is determined that the material attributes of the virtual object need to be updated, and update the material attributes of the virtual object using the material attributes of the current frame;

[0112] The image display module 303 is used to play the interpolated image of the current frame based on the updated material properties of the virtual object.

[0113] In a possible implementation of the present application, the material update determination module 302 is specifically used to: determine the target frame image in the tween animation whose material properties need to be updated based on the initialization parameters; if the current frame tween image is the target frame image, determine that the material properties of the virtual object need to be updated.

[0114] In a possible implementation scheme of the present application, the initialization parameters include a first starting parameter and a preset material attribute calculation model, and the material attribute update module 302 is specifically used to: when the value of the first starting parameter is used as the variable value of the material attribute at the starting time when the attribute takes effect, determine the value of the material attribute of the current frame according to the current frame calculation result output by the preset material attribute calculation model.

[0115] In a possible implementation of the present application, the material attribute of the virtual object is set based on a material attribute interface configured for the virtual object, and the material attribute interface is set through a shader of the game engine.

[0116] In a possible implementation of the present application, the material attribute setting module is further specifically used to: create a material attribute object for recording material attribute values, and associate the material attribute object with the virtual object through a material attribute interface to implement material attribute setting.

[0117] In a possible implementation of the present application, the game animation processing device 300 also includes an animation initialization module, which is used to: initialize the interpolation animation of the virtual object and determine whether the virtual object has material attributes; if the material attributes exist, initialize the material of the virtual object.

[0118] In a possible implementation of the present application, the game animation processing device 300 also includes a play stop determination module and a next round animation play module. The play stop determination module is used to determine whether the current frame interpolated image is the last frame image of the interpolated animation; the next round animation play module is used to end the play of the current frame interpolated image and start the play of the next frame interpolated image if it is not the last frame image.

[0119] In a possible implementation of the present application, the material update determination module 302 includes a tween animation property determination module and a tween animation update module. The tween animation property determination module is used to: determine the current frame tween animation properties based on initialization parameters; the tween animation update module is used to: use the current frame tween animation properties to update the previous frame tween image to obtain the current frame tween image.

[0120] In a possible implementation of the present application, the initialization parameters include a second starting parameter and a second ending parameter, and the tween animation property determination module is specifically used to: determine the tween animation property of the current frame based on the second starting parameter and the second ending parameter using a preset interpolation algorithm.

[0121] In a possible implementation scheme of the present application, the tween animation attribute determination module is further specifically used to: determine the target position of the current frame tween image in the entire animation cycle of the tween animation; and use a preset interpolation algorithm to determine the target parameter value corresponding to the target position between the second starting parameter and the second ending parameter as the value of the current frame tween animation attribute.

[0122] In a possible implementation of the present application, the current frame material attribute includes at least one of the following items: a vertex shader attribute and a fragment shader attribute.

[0123] Through the above-mentioned game animation processing device, the present application can insert material nodes by setting material properties on virtual objects, update the material properties of virtual objects in real time while playing tween animations, and simulate material animations by updating material properties in real time, thereby realizing the fusion of tween animations and simulated material animations, avoiding the problem of playback asynchrony when tween animations are played together with material animations, and eliminating the need to insert sequence frame animations in tween animations, thereby reducing the amount of animation resources and solving the problems of low animation combination accuracy and large amount of animation resources in the process of combining tween animations with material animations.

[0124] See also Figure 4 , Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 4 As shown in , the electronic device 400 includes a processor 410 , a memory 420 and a bus 430 .

[0125] The memory 420 stores machine-readable instructions executable by the processor 410. When the electronic device 400 is running, the processor 410 communicates with the memory 420 via the bus 430. When the machine-readable instructions are executed by the processor 410, the above-mentioned Figure 1 The steps of the game animation processing method in the method embodiment shown are specifically implemented as follows:

[0126] A tween animation of a virtual object is played through a terminal device, wherein the tween animation includes multiple tween images. In response to the completion of the playback of the previous tween image, the current tween image is obtained to determine whether the material properties of the virtual object need to be updated. If it is determined that the material properties of the virtual object need to be updated, the material properties of the current frame are obtained and the material properties of the virtual object are updated using the material properties of the current frame. Based on the updated material properties of the virtual object, the current tween image is played.

[0127] In a possible implementation of the present application, when determining whether the material properties of a virtual object need to be updated, the processor 410 is specifically used to: determine, based on initialization parameters, a target frame image in the tween animation whose material properties need to be updated; if the current frame tween image is the target frame image, determine that the material properties of the virtual object need to be updated.

[0128] In a possible implementation of the present application, the initialization parameters include a first starting parameter and a preset material attribute calculation model. When the processor 410 executes to obtain the material attribute of the current frame, it is specifically used to: when using the value of the first starting parameter as the variable value of the material attribute at the starting time when the attribute takes effect, determine the value of the material attribute of the current frame according to the current frame calculation result output by the preset material attribute calculation model.

[0129] In a possible implementation of the present application, the material attribute of the virtual object is set based on a material attribute interface configured for the virtual object, and the material attribute interface is set through a shader of the game engine.

[0130] In a possible implementation of the present application, the processor 410 sets material attributes for the virtual object in the following manner: creating a material attribute object for recording material attribute values, and associating the material attribute object with the virtual object through a material attribute interface to implement material attribute setting.

[0131] In a possible implementation of the present application, the processor 410 is further used to: initialize the tween animation of the virtual object and determine whether the virtual object has material attributes; if the virtual object has material attributes, initialize the material of the virtual object before executing the tween animation of the virtual object.

[0132] In a possible implementation of the present application, after executing the current frame interpolated image of the virtual object after providing updated material properties in the graphical user interface, the processor 410 is also used to: determine whether the current frame interpolated image is the last frame image of the tween animation; if it is not the last frame image, end the playback of the current frame interpolated image and start the playback of the next frame interpolated image.

[0133] In a possible implementation of the present application, when executing the acquisition of the current frame interpolated image, the processor 410 is specifically used to: determine the current frame interpolated animation properties based on the initialization parameters, and use the current frame interpolated animation properties to update the previous frame interpolated image to obtain the current frame interpolated image.

[0134] In a possible implementation of the present application, the initialization parameters include a second starting parameter and a second ending parameter. When the processor 410 determines the current frame interpolation animation properties based on the initialization parameters, it is specifically used to: determine the current frame interpolation animation properties based on the second starting parameter and the second ending parameter using a preset interpolation algorithm.

[0135] In a possible implementation of the present application, when the processor 410 determines the current frame tween animation attribute based on the second starting parameter and the second ending parameter using a preset interpolation algorithm, it is specifically used to: determine the target position of the current frame tween image in the entire animation cycle of the tween animation; and use the preset interpolation algorithm to determine the target parameter value corresponding to the target position between the second starting parameter and the second ending parameter as the value of the current frame tween animation attribute.

[0136] In a possible implementation of the present application, the current frame material attribute includes at least one of the following items: a vertex shader attribute and a fragment shader attribute.

[0137] Through the above-mentioned electronic device, the present application can insert material nodes by setting material properties on virtual objects, update the material properties of virtual objects in real time while playing tween animations, and simulate material animations by updating material properties in real time, thereby realizing the fusion of tween animations and simulated material animations, avoiding the problem of playback asynchrony when tween animations are played together with material animations, and eliminating the need to insert sequence frame animations in tween animations, thereby reducing the amount of animation resources and solving the problems of low animation combination accuracy and large amount of animation resources in the process of combining tween animations with material animations.

[0138] The present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the computer program can execute the above-mentioned Figure 1 The steps of the game animation processing method in the method embodiment shown are specifically implemented as follows:

[0139] A tween animation of a virtual object is played through a terminal device, the tween animation including multiple tween images; in response to the completion of the playback of the previous tween image, the current tween image is obtained to determine whether it is necessary to update the material properties of the virtual object; if it is determined that the material properties of the virtual object need to be updated, the material properties of the current frame are obtained, the material properties of the virtual object are updated using the material properties of the current frame, and the tween image of the current frame is played based on the updated material properties of the virtual object.

[0140] In a possible implementation of the present application, when determining whether the material properties of a virtual object need to be updated, the processor is specifically used to: determine, based on initialization parameters, a target frame image in the tween animation whose material properties need to be updated; if the current frame tween image is the target frame image, determine that the material properties of the virtual object need to be updated.

[0141] In a possible implementation scheme of the present application, the initialization parameters include a first starting parameter and a preset material attribute calculation model. When the processor executes to obtain the material attribute of the current frame, it is specifically used to: when using the value of the first starting parameter as the variable value of the material attribute at the starting time when the attribute takes effect, determine the value of the material attribute of the current frame according to the current frame calculation result output by the preset material attribute calculation model.

[0142] In a possible implementation of the present application, the material attribute of the virtual object is set based on a material attribute interface configured for the virtual object, and the material attribute interface is set through a shader of the game engine.

[0143] In a possible implementation of the present application, the processor sets material attributes for the virtual object in the following manner: creates a material attribute object for recording material attribute values, and associates the material attribute object with the virtual object through a material attribute interface to implement material attribute setting.

[0144] In a possible implementation of the present application, before executing the tween animation of the virtual object, the processor is also used to: initialize the tween animation of the virtual object and determine whether the virtual object has material attributes; if the material attributes exist, initialize the material of the virtual object.

[0145] In a possible implementation of the present application, after executing the current frame interpolated image of the virtual object after providing updated material properties in the graphical user interface, the processor is also used to: determine whether the current frame interpolated image is the last frame image of the tween animation; if it is not the last frame image, end the playback of the current frame interpolated image and start the playback of the next frame interpolated image.

[0146] In a possible implementation of the present application, when executing the acquisition of the current frame interpolated image, the processor is specifically used to: determine the current frame interpolated animation properties based on the initialization parameters, and use the current frame interpolated animation properties to update the previous frame interpolated image to obtain the current frame interpolated image.

[0147] In a possible implementation of the present application, the initialization parameters include a second starting parameter and a second ending parameter. When the processor determines the current frame tween animation properties based on the initialization parameters, it is specifically used to: determine the current frame tween animation properties based on the second starting parameter and the second ending parameter using a preset interpolation algorithm.

[0148] In a possible implementation of the present application, when the processor determines the current frame tween animation attribute based on the second starting parameter and the second ending parameter using a preset interpolation algorithm, it is specifically used to: determine the target position of the current frame tween image in the entire animation cycle of the tween animation; and use the preset interpolation algorithm to determine the target parameter value corresponding to the target position between the second starting parameter and the second ending parameter as the value of the current frame tween animation attribute.

[0149] In a possible implementation of the present application, the current frame material attribute includes at least one of the following items: a vertex shader attribute and a fragment shader attribute.

[0150] Through the above-mentioned computer-readable storage medium, the present application can insert material nodes by setting material properties on virtual objects, update the material properties of virtual objects in real time while playing tween animations, and simulate material animations by updating material properties in real time, thereby realizing the fusion of tween animations and simulated material animations, avoiding the problem of playback asynchrony when tween animations are played together with material animations, and eliminating the need to insert sequence frame animations in tween animations, thereby reducing the amount of animation resources and solving the problems of low animation combination accuracy and large amount of animation resources in the process of combining tween animations with material animations.

[0151] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0152] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.

[0153] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0154] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0155] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present application can essentially be embodied in the form of a software product, or in other words, the part that contributes to the prior art or the part of the technical solution. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0156] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the above-mentioned embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-mentioned embodiments within the technical scope disclosed in the present application, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.

Claims

1. A method for processing game animation, characterized in that: Playing the tween animation of the virtual object by a terminal device, the tween animation including multiple frames of tween images, the method comprising: In response to the completion of playing the previous frame of the interpolated image, obtaining the current frame of the interpolated image, and determining whether the material attribute of the virtual object needs to be updated; If it is determined that the material attributes of the virtual object need to be updated, obtaining the material attributes of the current frame, and using the material attributes of the current frame to update the material attributes of the virtual object; Based on the updated material properties of the virtual object, the current frame interpolated image is played.

2. The method according to claim 1, characterized in that The determining whether the material attribute of the virtual object needs to be updated includes: Based on the initialization parameters, determine the target frame image in the tween animation whose material properties need to be updated; If the current frame interpolated image is the target frame image, it is determined that the material attribute of the virtual object needs to be updated.

3. The method according to claim 2, characterized in that The initialization parameters include the first starting parameters and the preset material attribute calculation model, and the material attributes of the current frame are obtained, including: When the value of the first starting parameter is used as the variable value of the material attribute at the starting time when the attribute takes effect, the value of the material attribute of the current frame is determined according to the current frame calculation result output by the preset material attribute calculation model.

4. The method according to claim 1, characterized in that: The material attribute of the virtual object is set based on a material attribute interface configured for the virtual object, and the material attribute interface is set through a shader of a game engine.

5. The method according to claim 4, characterized in that Set the material properties for the virtual object in the following way: A material attribute object for recording material attribute values ​​is created, and the material attribute object is associated with the virtual object through the material attribute interface to implement material attribute setting.

6. The method according to claim 1, characterized in that The method further comprises: Initializing the tween animation of the virtual object and determining whether the virtual object has material attributes; If the material attribute exists, the material of the virtual object is initialized.

7. The method according to claim 1, characterized in that After playing the current frame interpolated image based on the updated material property of the virtual object, the method further includes: Determine whether the current frame tween image is the last frame image of the tween animation; If it is not the last frame, the playback of the current frame of interpolated image ends and the playback of the next frame of interpolated image begins.

8. The method according to claim 1, characterized in that The step of obtaining the interpolated image of the current frame includes: The current frame tween animation attribute is determined based on the initialization parameter, and the previous frame tween image is updated using the current frame tween animation attribute to obtain the current frame tween image.

9. The method according to claim 8, characterized in that The initialization parameters include a second start parameter and a second end parameter, and determining the current frame tween animation attribute based on the initialization parameters includes: Based on the second starting parameter and the second ending parameter, a preset interpolation algorithm is used to determine the current frame tween animation attribute.

10. The method according to claim 9, characterized in that The determining the current frame tween animation attribute by using a preset interpolation algorithm based on the second starting parameter and the second ending parameter includes: Determine the target position of the current frame tween image in the entire animation cycle of the tween animation; By using the preset interpolation algorithm, the target parameter value corresponding to the target position between the second starting parameter and the second ending parameter is determined as the value of the tween animation attribute of the current frame.

11. The method according to claim 1, characterized in that: The current frame material attribute includes at least one of the following items: Vertex shader attributes, fragment shader attributes.

12. A game animation processing device, characterized in that: Playing the tween animation of the virtual object through the terminal device, the tween animation includes multiple frames of tween images, including: A material update determination module, configured to obtain the current frame of interpolated image in response to the completion of playing the previous frame of interpolated image, and determine whether the material attribute of the virtual object needs to be updated; A material attribute updating module, configured to obtain the material attributes of the current frame if it is determined that the material attributes of the virtual object need to be updated, and update the material attributes of the virtual object using the material attributes of the current frame; The image display module is used to play the interpolated image of the current frame based on the updated material properties of the virtual object.

13. An electronic device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate through the bus, and the processor executes the machine-readable instructions to perform the steps of the game animation processing method as described in any one of claims 1 to 11.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the game animation processing method according to any one of claims 1 to 11 are executed.