Animation rendering method and device

Through the animation rendering method, the animation drawing interface of the rendering library is used to create rendering instances and render based on animation data, which solves the problem of insufficient flexibility and adaptability of the existing rendering library in animation rendering, and achieves efficient and flexible animation rendering effects.

CN119888026APending Publication Date: 2025-04-25SHANGHAI BILIBILI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510015327.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-03
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

The existing rendering library lacks business perception in animation rendering and cannot complete animation rendering independently, resulting in complex access and increased development costs. The animation pipeline is fixed and cannot be adjusted dynamically, limiting the flexibility and adaptability of rendering.

Method used

Provides an animation rendering method, by obtaining the animation data of the target animation, calling the animation drawing interface provided by the rendering library to create a rendering instance, and passing the animation data to the rendering instance, controlling the rendering instance to render based on the animation data, and generating a series of animation frames. This method supports dynamic update of attachments, and through texture replacement, it improves the flexibility and scalability of animation drawing.

Benefits of technology

The full-link output of animation rendering is realized, which reduces the time cost of service layer access, supports dynamic updates, and improves the flexibility and adaptability of animation drawing without increasing art resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119888026A_ABST
    Figure CN119888026A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an animation rendering method. The animation rendering method comprises the steps of obtaining animation data of a target animation; calling an animation drawing interface provided by a rendering library to create a rendering instance, and transmitting the animation data to the rendering instance; and controlling the rendering instance to perform rendering based on the animation data to generate a series of animation frames corresponding to the target animation. The interface of the rendering library provided by the technical scheme of the embodiment of the invention is simple and clear, and the time cost of service layer access is greatly reduced; an interface is called to create a rendering instance, and full-link output such as animation data loading, analysis, splicing and rendering can be achieved; and dynamic updating based on animation data is supported, and the flexibility of animation drawing is improved on the premise that art resources are not increased.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of data processing technology, and in particular to an animation rendering method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art

[0002] Animation rendering is a core function of the graphics system, especially in games and virtual reality. Although the current rendering library supports animation editing, it lacks business awareness and cannot independently complete animation rendering, which makes access complicated and increases development costs. At the same time, the animation pipeline of the rendering library is fixed and cannot be adjusted dynamically, which limits the flexibility and adaptability of rendering.

[0003] It should be noted that the above content is not necessarily prior art, nor is it intended to limit the scope of patent protection of this application. Summary of the invention

[0004] Embodiments of the present application provide an animation rendering method, apparatus, computer device, computer-readable storage medium, and computer program product to solve or alleviate one or more of the technical problems raised above.

[0005] An aspect of an embodiment of the present application provides an animation rendering method, the method comprising: Get the animation data of the target animation; Calling the animation drawing interface provided by the rendering library to create a rendering instance, and passing the animation data to the rendering instance; The rendering instance is controlled to perform rendering based on the animation data to generate a series of animation frames, where the series of animation frames correspond to the target animation.

[0006] Optionally, the rendering library includes a rendering interface layer, a rendering management layer, a rendering instance layer and an underlying rendering engine; wherein: The rendering interface layer is used to: provide the animation drawing interface, receive the animation data, and pass the animation data to the rendering management layer; The rendering management layer is used to: manage the life cycle of the rendering instance layer, including creating and destroying the rendering instance, and distributing the animation data to the rendering instance layer; The rendering instance layer is used to generate the series of animation frames by rendering through the underlying rendering engine based on the animation data.

[0007] Optionally, the animation data includes an animation protocol, which is used to define the animation time identifiers corresponding to each of the series of animation frames, and the bone states and slot states corresponding to each of the series of animation frames; wherein a bone includes multiple slots, a slot is associated with multiple attachments, and in the same animation frame, only one of the attachments in the same slot is rendered; the bone controls the attachments through the slots.

[0008] Optionally, controlling the rendering instance to render based on the animation data includes: Based on the animation data, determining the playback step length of the target animation; A timer is set according to the playback step length, and the timer is used to periodically trigger the rendering instance to perform rendering based on the animation data.

[0009] Optionally, rendering based on the animation data includes: In response to the triggering of the timer, obtaining a current animation time identifier; Determine a current bone state and a current slot state based on the current animation time identifier and the animation data; Rendering is performed based on the current skeleton state and the current slot state to obtain a current animation frame.

[0010] Optionally, the current slot state includes a target state of a current attachment; correspondingly, rendering based on the current bone state and the current slot state includes: Determining a target texture map according to the target state of the current accessory, the target texture map comprising a texture that matches the target state of the current accessory; Determining mesh data of the current attachment based on the current skeleton state and the current slot state; Rendering is performed based on the mesh data of the current attachment and the target texture map to obtain the current animation frame.

[0011] Optionally, the animation data includes textures of a plurality of attachments in different states, each attachment having an attachment identifier; Correspondingly, according to the target state of the current attachment, determining the target texture map includes: Acquire an original texture map, wherein the original texture map includes textures of a plurality of original attachments; Determine whether the multiple original attachments have the same attachment identifier as the current attachment; In the case where the same attachment identifier exists, determining whether the original texture map has a texture that matches the target state of the current attachment; In the case where there is a matching texture, the original texture map is determined as the target texture map.

[0012] Optionally, each attachment is associated with a texture coordinate; and the animation rendering method further comprises: If there is no matching texture, acquiring a texture matching the target state of the current attachment based on the animation data; Determine a target texture area in the original texture map according to the texture coordinates of the current attachment; Based on the texture matching the target state of the current attachment, updating the target texture region to obtain an updated original texture map; The updated original texture map is determined as the target texture map.

[0013] Another aspect of an embodiment of the present application provides an animation rendering device, the device comprising: An acquisition module is used to acquire animation data of a target animation; A calling module, used for calling the animation drawing interface provided by the rendering library to create a rendering instance, and passing the animation data to the rendering instance; The control module is used to control the rendering instance to perform rendering based on the animation data to generate a series of animation frames, where the series of animation frames correspond to the target animation.

[0014] Another aspect of an embodiment of the present application provides a computer device, including: at least one processor; and a memory communicatively coupled to the at least one processor; Wherein: the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method as described above.

[0015] Another aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method described above is implemented.

[0016] Another aspect of an embodiment of the present application provides a computer program product, including a computer program, which implements the method described above when executed by a processor.

[0017] The above technical solution adopted in the embodiment of the present application may have the following advantages: The rendering library is configured with an animation drawing interface. The business layer can call the animation drawing interface to create a rendering instance and pass the pre-acquired animation data of the target animation to the rendering instance. The rendering instance is controlled to render based on the animation data to generate a series of animation frames of the target animation. It can be seen that the interface of the rendering library provided in the embodiment of the present application is concise and clear, which greatly reduces the time cost of business layer access; calling the interface to create a rendering instance can realize full-link output such as animation data loading, parsing, assembly, and rendering; it also supports dynamic updates based on animation data, which improves the flexibility of animation drawing without increasing art resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The accompanying drawings exemplarily illustrate the embodiments and constitute a part of the specification, and together with the text description of the specification, are used to explain the exemplary implementation of the embodiments. The embodiments shown are for illustrative purposes only and do not limit the scope of the claims. In all drawings, the same reference numerals refer to similar but not necessarily identical elements.

[0019] Figure 1 The flowchart of the animation rendering method according to the first embodiment of the present application is schematically shown; Figure 2 The hierarchical structure of the rendering library according to the first embodiment of the present application is schematically shown; Figure 3 The entire link of animation rendering according to the first embodiment of the present application is schematically shown; Figure 4 Schematically shows Figure 1 Flow chart of sub-steps of step S104; Figure 5 Schematically shows Figure 1 Flow chart of sub-steps of step S104; Figure 6 Schematically shows Figure 5 Flow chart of sub-steps of step S504; Figure 7 Schematically shows Figure 6 Flow chart of sub-steps of step S600; Figure 8 A newly added flow chart of the animation rendering method according to the first embodiment of the present application is schematically shown; Fig. 9 A flowchart for dynamically updating an attachment according to the first embodiment of the present application is schematically shown; Fig.10 A block diagram of an animation rendering device according to a second embodiment of the present application is schematically shown; and Fig.11 The hardware architecture diagram of the computer device according to the third embodiment of the present application is schematically shown. DETAILED DESCRIPTION

[0020] In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.

[0021] It should be noted that the descriptions involving "first", "second", etc. in the embodiments of the present application are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.

[0022] In the description of the present application, it should be understood that the numerical labels before the steps do not indicate the order in which the steps are executed, but are only used to facilitate the description of the present application and to distinguish each step, and therefore should not be understood as a limitation on the present application.

[0023] First, the following terms are explained: API (Application Programming Interface): Application programming interface.

[0024] OpenGL (Open Graphics Library): Open Graphics Library is a cross-language, cross-platform application programming interface for rendering 2D and 3D vector graphics.

[0025] Secondly, in order to facilitate those skilled in the art to understand the technical solutions provided in the embodiments of the present application, the relevant technologies are described below: Animation rendering is a core function of the graphics system, especially in games and virtual reality. Although the current rendering library supports animation editing, it lacks business awareness and cannot independently complete animation rendering, which makes access complicated and increases development costs. At the same time, the animation pipeline of the rendering library is fixed and cannot be adjusted dynamically, which limits the flexibility and adaptability of rendering.

[0026] To this end, an embodiment of the present application provides a technical solution for animation rendering. In this technical solution: (1) A rendering library is provided, which can be used to render skeletal animation. Its interface is concise and clear, and is basically divided into "animation drawing interface" and "information callback interface", which greatly reduces the time cost of business layer access and can better serve the needs of upper-level business programs. (2) The rendering engine is embedded in the rendering library, which can realize full-link output such as animation data loading, parsing, assembly, and rendering. (3) Dynamic update of attachments is supported by texture replacement, which enriches the form of animation drawing without increasing a large amount of resources, and improves flexibility and scalability. See below for details.

[0027] The technical solutions of the present application are described below through multiple embodiments. It should be noted that these embodiments can be implemented in a variety of different forms and should not be construed as being limited to the embodiments described here.

[0028] Embodiment 1 Figure 1 The flowchart of an animation rendering method according to an embodiment of the present application is schematically shown.

[0029] like Figure 1 As shown, the animation rendering method may include steps S100 to S104, wherein: Step S100, obtaining animation data of a target animation.

[0030] Step S102: calling the animation drawing interface provided by the rendering library to create a rendering instance, and passing the animation data to the rendering instance.

[0031] Step S104 , controlling the rendering instance to perform rendering based on the animation data to generate a series of animation frames, wherein the series of animation frames correspond to the target animation.

[0032] The animation rendering method provided in this embodiment is that the rendering library is configured with an animation drawing interface. The business layer can call the animation drawing interface to create a rendering instance, and pass the pre-acquired animation data of the target animation to the rendering instance. The rendering instance is controlled to render based on the animation data to generate a series of animation frames of the target animation. It can be seen that the interface of the rendering library provided in the embodiment of the present application is concise and clear, which greatly reduces the time cost of business layer access; calling the interface to create a rendering instance can realize full-link output such as animation data loading, parsing, assembly, and rendering; it also supports dynamic updates based on animation data, which improves the flexibility of animation drawing without increasing art resources.

[0033] The following combination Figure 1 , each step in steps S100~S104 and other optional steps are explained in detail.

[0034] Step S100 , get the animation data of the target animation.

[0035] The target animation can be any type of animation, such as frame-by-frame animation, skeletal animation, etc. The following will take skeletal animation as an example to exemplarily introduce the animation rendering method provided in the embodiment of the present application. The target animation can be composed of a series of animation frames. The animation data may include animation resources and animation protocols. Among them, the animation resources are the materials required for animation rendering, such as texture maps. The animation protocol is used to specify the playback rules of the animation. In an optional embodiment, the animation protocol can define the animation time identifiers (such as timestamps) corresponding to a series of animation frames that constitute the target animation, and can also define the skeletal states and slot states corresponding to a series of animation frames. Among them, the skeleton is the basic unit of skeletal animation, and each skeleton has attributes such as position, rotation, scaling, and parent-child relationship. The animation effect can be achieved by transforming these attributes. A skeleton can include multiple slots, and the slot is a container for binding accessories to the skeleton. The attachment is an object that needs to be rendered, which is bound to the skeleton through the slot and changes with the movement of the skeleton (such as moving, rotating, scaling). The attachment can be an arm, an accessory, hair, a weapon, an expression, etc. The attachment can be a picture, a bounding box for detecting collision, and other types. The slot can control the rendering properties of the attachment, such as color, mixing, etc. A slot can include multiple attachments, but only one attachment is displayed in the same slot in the same animation frame, that is, only one of the attachments is rendered. An attachment can have multiple states, for example, a hat can have two states: red and blue. Animation resources can include textures of multiple attachments in different states. For example, the textures of a red hat and a blue hat. Based on animation resources, the form of animation drawing can be enriched.

[0036] Step S102 , call the animation drawing interface provided by the rendering library to create a rendering instance, and pass the animation data to the rendering instance.

[0037] The rendering library can be a highly encapsulated graphics processing tool that provides functions such as animation editing and rendering, and is configured with a simple and easy-to-use interface for easy calling by the business layer. Taking skeletal animation rendering as an example, the rendering library can be a rendering library improved based on the Spine kernel. Among them, Spine is a 2D skeletal animation editing tool that can be used for animation production in the fields of games, virtual reality, etc., providing an efficient and concise workflow. Spine consists of bones, slots and accessories. It drives the slots through the bones and drives the accessories through the slots to achieve operations such as movement, rotation, and scaling, thereby building and displaying 2D skeletal animation. Spine provides a large number of APIs to facilitate programs to access data such as bones, slots, and accessories to achieve complex animation effects. However, a large number of APIs lack business awareness, which increases the cost of business access. And Spine itself does not have rendering capabilities, does not support dynamic updates of attachments, and the animation pipeline is fixed and lacks flexibility. To alleviate the above problems, the embodiment of the present application creatively designs a rendering library based on the Spine kernel improvement. By configuring a simple and easy-to-use interface and an embedded rendering engine, the business access cost can be reduced and the full process of animation rendering can be realized. The business layer can create a rendering instance by calling the animation drawing interface provided by the rendering library, and pass the animation data to the rendering instance to implement animation rendering based on the rendering instance. The business layer does not need to pay attention to the underlying rendering details. The rendering library provided in this embodiment has the following advantages: (1) A more concise API makes the upper-layer business use more convenient. (2) It provides rendering capabilities without the need for an additional rendering engine. (3) It supports the ability to dynamically replace attachments, which can make the animation form richer. (4) It is small in size and has high loading and running efficiency. (5) It requires few art resources. (6) The rendered skeletal animation is highly smooth. (7) It is easy to control and secondary development. An exemplary solution is provided below.

[0038] In an optional embodiment, if Figure 2 As shown, the rendering library can have a three-layer structure, namely, a rendering interface layer, a rendering management layer, and a rendering instance layer. To achieve animation rendering, the rendering library can also embed the underlying rendering engine, such as: cross-platform rendering engines OpenGL, Unity, etc. Among them, the rendering interface layer can provide an animation drawing interface, and the animation drawing interface is used to hand over the animation data to the rendering management layer to start the animation rendering link. The rendering management layer can manage the life cycle of the rendering instance layer, including creating and destroying rendering instances, and distributing animation data to the rendering instances to initialize the rendering instances. The rendering instance layer is used to parse the animation data, perform animation rendering through the underlying rendering engine based on the parsing results, generate animation frames and output them. In some embodiments, the rendering interface layer may also include an information callback interface, which can be used to pass status or event information during the animation operation for business logic processing.

[0039] In this embodiment, a rendering library is established based on a three-layer structure, which can efficiently realize full-link processing such as animation data loading, parsing, assembly, and rendering. It is more convenient to use, has more complete functions, and effectively improves rendering performance and flexibility.

[0040] Step S104 , controlling the rendering instance to render based on the animation data to generate a series of animation frames, wherein the series of animation frames corresponds to the target animation.

[0041] like Figure 3 As shown, after creating a rendering instance and completing initialization based on animation data, the rendering instance can be controlled to render. The rendering instance generates a series of animation frames according to the animation data and returns them to the business layer, thereby realizing the display and playback of the target animation. Several exemplary solutions are provided below.

[0042] In an optional embodiment, if Figure 4 As shown, step S104 may include: Step S400: determining the playback step length of the target animation based on the animation data.

[0043] Step S402: setting a timer according to the playback step length, wherein the timer is used to periodically trigger the rendering instance to perform rendering based on the animation data.

[0044] Exemplarily, the animation data is parsed, and the playback step length of the target animation can be determined based on the animation time identifiers corresponding to a series of animation frames. According to the playback step length, the timer of the working thread can be started. The timer triggers the rendering thread to process the rendering instance at a fixed time interval T (matching the playback step length, for example: 1 / 30 second, that is, 30 frames are played per second), that is, rendering frame by frame based on the animation data to obtain a series of animation frames. After each animation frame is rendered, it can be immediately returned to the business layer, and the business layer displays it on the screen, thereby achieving smooth playback of the target animation.

[0045] In this embodiment, the rendering link is optimized by using timers and working threads to accurately control the rendering process, improve rendering efficiency, and achieve smooth animation playback.

[0046] In an optional embodiment, if Figure 5 As shown, step S104 may include: Step S500, in response to the triggering of the timer, obtaining the current animation time identifier.

[0047] Step S502, determining the current bone state and the current slot state based on the current animation time identifier and the animation data.

[0048] Step S504, rendering is performed based on the current skeleton state and the current slot state to obtain a current animation frame.

[0049] Exemplarily, in response to the triggering of the timer, the current animation time identifier is obtained, that is, it is determined which animation frame needs to be rendered at present. Based on the current animation time identifier and the animation data, the current bone state and the current slot state can be determined. The current bone state may include the position of the bone in two-dimensional or three-dimensional space, the rotation angle, the scaling value on the X, Y (or even Z) axis, and the parent-child relationship (the hierarchical relationship between bones). The current slot state may include the position of the slot relative to the bone where it is located, the rotation angle around the bone where it is located, the scaling value, and the information of the current attachment (such as the attachment identifier, type, and status). The bones and slots are invisible and are not rendered. The object of animation rendering is the attachment, but the position, rotation, and scaling of the attachment are determined by the transformation of the bones and slots to which it belongs. Therefore, the current attachment can be rendered based on the current bone state and the current slot state to obtain the current animation frame.

[0050] In this embodiment, the transformation of the attachment is dynamically calculated according to the current skeleton state and the current slot state, so that accurate animation rendering can be achieved, thereby achieving smooth animation playback.

[0051] In an optional embodiment, the current slot state may include the target state of the current attachment. Figure 6 As shown, step S504 may include: Step S600: determining a target texture map according to the target state of the current accessory, wherein the target texture map includes a texture that matches the target state of the current accessory.

[0052] Step S602: Determine mesh data of the current attachment based on the current skeleton state and the current slot state.

[0053] Step S604: Rendering is performed based on the mesh data of the current attachment and the target texture map to obtain the current animation frame.

[0054] Exemplarily, the current attachment may include a hat, which has different states such as red and blue. The target state may be any state, such as blue, which means that the hat needs to be blue in the current animation frame. As mentioned above, the animation data may include animation resources, and the animation resources may include textures of multiple attachments in different states, which may be collected on a texture map or scattered on multiple texture maps. Based on the target state of the current attachment, the target texture map is obtained from the animation data, and the target texture map may include a texture that matches the target state of the current attachment. For example: a blue hat, a gem sword, curly hair, an upward arm, etc. Based on the current bone state and the current slot state, the mesh data of the current attachment may be calculated in real time, including vertex positions, normals, texture coordinates, and indices, etc., to ensure that the vertices are correctly transformed and to enhance the effect of the skeletal animation. Based on the mesh data and the target texture map of the current attachment, rendering may be achieved through the underlying rendering engine to obtain the current animation frame.

[0055] In this embodiment, by calculating the mesh data of the current attachment based on the current bone state and the current slot state and applying the target texture map, accurate rendering can be achieved to obtain the correct current animation frame, thereby obtaining efficient and smooth bone animation performance.

[0056] In an optional embodiment, if Figure 7 As shown, step S600 may include: Step S700: obtaining an original texture map, wherein the original texture map includes textures of a plurality of original attachments.

[0057] Step S702: Determine whether any of the multiple original attachments has the same attachment ID as the current attachment.

[0058] Step S704: if the same accessory identifier exists, determine whether the original texture map has a texture that matches the target state of the current accessory.

[0059] Step S706: if there is a matching texture, determine the original texture map as the target texture map.

[0060] Exemplarily, the original texture map can be obtained by directly parsing the animation data, or it can be a texture map used to render the previous animation frame. The original texture map can include textures of multiple original attachments. Accordingly, the original attachment can be a default attachment, or it can be an attachment corresponding to the previous animation frame. Determine whether there is an attachment identifier that is the same as the current attachment among the multiple original attachments, that is, whether there is an attachment with the same name. If there is an attachment with the same name, determine whether the original texture map exists in a texture that matches the target state of the current attachment. If there is a matching texture, the original texture map can be determined as the target texture map.

[0061] In this embodiment, by determining and reusing the original texture map, repeated loading of texture resources can be effectively reduced, rendering efficiency can be improved, and skeletal animation can be optimized.

[0062] In an optional embodiment, if Figure 8 As shown, the animation rendering method may further include: Step S800: If no matching texture exists, a texture matching the target state of the current accessory is acquired based on the animation data.

[0063] Step S802: determining a target texture area in the original texture map according to the texture coordinates of the current attachment.

[0064] Step S804: based on the texture matching the target state of the current attachment, the target texture region is updated to obtain an updated original texture map.

[0065] Step S806: determine the updated original texture map as the target texture map.

[0066] For example, Fig. 9 As shown, in the absence of a matching texture, a texture matching the target state of the current attachment can be obtained based on animation data or user-defined attachment data. Based on the texture coordinates of the current attachment, the target texture area is determined in the original texture map, and the target texture area is updated with a new texture that matches the target state of the current attachment to obtain an updated original texture map. For example, the target texture area is replaced pixel by pixel based on the new texture, and the pixels outside the target texture area can be kept as they are. The updated original texture map is determined as the target texture map, which can be used to assemble and draw skeletal animations later.

[0067] In this embodiment, attachments are dynamically updated by texture replacement, the use of texture resources is optimized, and the rendering effect, flexibility and scalability of skeletal animation are improved without increasing a large amount of art resources.

[0068] like Figure 3 As shown, after the last animation frame of the target animation is rendered and played, the rendering can be stopped, that is, the timer of the working thread is stopped and the rendering instance is destroyed. In some embodiments, if the initialization of the rendering instance based on the animation data fails, the rendering process can also be terminated, the timer of the working thread is stopped and the rendering instance is destroyed.

[0069] In order to make the present application easier to understand, an exemplary application is provided below.

[0070] S1: Get animation data of target animation.

[0071] S2: Call the animation drawing interface provided by the rendering library to create a rendering instance, and pass the animation data to the rendering instance.

[0072] The rendering library includes the rendering interface layer, the rendering management layer, the rendering instance layer and the underlying rendering engine. The rendering interface layer is used to provide an animation drawing interface and an information callback interface, receive the animation data, and pass the animation data to the rendering management layer.

[0073] The rendering management layer is used to manage the life cycle of the rendering instance layer, including creating and destroying rendering instances, and distributing animation data to the rendering instance layer.

[0074] The rendering instance layer is used to generate a series of animation frames of the target animation by rendering through the underlying rendering engine based on the animation data.

[0075] S3: setting a timer according to the playback step length of the target animation, and controlling the rendering instance to perform rendering through the timer to obtain a series of animation frames of the target animation.

[0076] Each time the timer is triggered, the current animation time identifier is obtained to determine the current bone state and the current slot state. The current slot state includes the target state of the current attachment, and the texture matching the target state is obtained to determine the target texture map. The mesh data of the current attachment is calculated in real time based on the current bone state and the current slot state. Based on the mesh data and the target texture map, rendering is achieved through the underlying rendering engine.

[0077] In this exemplary application: (1) A rendering library is provided for rendering skeletal animation. Its interface is concise and clear, and is basically divided into "animation drawing interface" and "information callback interface", which greatly reduces the time cost of business layer access and can better serve the needs of upper-level business programs. (2) The rendering engine is embedded in the rendering library, which can realize the full-link output of animation data loading, parsing, assembly, rendering, etc. (3) It supports dynamic update of attachments by texture replacement, enriches the form of animation drawing without adding a lot of resources, and improves flexibility and scalability.

[0078] Embodiment 2 Fig.10 The block diagram of the animation rendering device according to the second embodiment of the present application is schematically shown. The device can be divided into one or more program modules, one or more program modules are stored in a storage medium, and are executed by one or more processors to complete the embodiment of the present application. The program module referred to in the embodiment of the present application refers to a series of computer program instruction segments that can complete specific functions. The following description will specifically introduce the functions of each program module in this embodiment. Fig.10As shown, the device 1000 may include: an acquisition module 1100, a calling module 1200 and a control module 1300, wherein: An acquisition module 1100 is used to acquire animation data of a target animation; A calling module 1200 is used to call the animation drawing interface provided by the rendering library to create a rendering instance, and pass the animation data to the rendering instance; The control module 1300 is used to control the rendering instance to perform rendering based on the animation data to generate a series of animation frames, where the series of animation frames correspond to the target animation.

[0079] As an optional embodiment, the rendering library includes a rendering interface layer, a rendering management layer, a rendering instance layer and an underlying rendering engine; wherein: The rendering interface layer is used to: provide the animation drawing interface, receive the animation data, and pass the animation data to the rendering management layer; The rendering management layer is used to: manage the life cycle of the rendering instance layer, including creating and destroying the rendering instance, and distributing the animation data to the rendering instance layer; The rendering instance layer is used to generate the series of animation frames by rendering through the underlying rendering engine based on the animation data.

[0080] As an optional embodiment, the animation data includes an animation protocol, which is used to define the animation time identifiers corresponding to each of the series of animation frames, and the bone states and slot states corresponding to each of the series of animation frames; wherein a bone includes multiple slots, a slot is associated with multiple attachments, and in the same animation frame, only one of the attachments in the same slot is rendered; the bone controls the attachments through the slots.

[0081] As an optional embodiment, controlling the rendering instance to render based on the animation data includes: Based on the animation data, determining the playback step length of the target animation; A timer is set according to the playback step length, and the timer is used to periodically trigger the rendering instance to perform rendering based on the animation data.

[0082] As an optional embodiment, rendering based on the animation data includes: In response to the triggering of the timer, obtaining a current animation time identifier; Determine a current bone state and a current slot state based on the current animation time identifier and the animation data; Rendering is performed based on the current skeleton state and the current slot state to obtain a current animation frame.

[0083] As an optional embodiment, the current slot state includes a target state of a current attachment; correspondingly, rendering based on the current bone state and the current slot state includes: Determining a target texture map according to the target state of the current accessory, the target texture map comprising a texture that matches the target state of the current accessory; Determining mesh data of the current attachment based on the current skeleton state and the current slot state; Rendering is performed based on the mesh data of the current attachment and the target texture map to obtain the current animation frame.

[0084] As an optional embodiment, the animation data includes textures of a plurality of attachments in different states, each attachment having an attachment identifier; Correspondingly, according to the target state of the current attachment, determining the target texture map includes: Acquire an original texture map, wherein the original texture map includes textures of a plurality of original attachments; Determine whether the multiple original attachments have the same attachment identifier as the current attachment; In the case where the same attachment identifier exists, determining whether the original texture map has a texture that matches the target state of the current attachment; In the case where there is a matching texture, the original texture map is determined as the target texture map.

[0085] As an optional embodiment, each attachment is associated with a texture coordinate; the apparatus 1000 is further used for: If there is no matching texture, acquiring a texture matching the target state of the current attachment based on the animation data; Determine a target texture area in the original texture map according to the texture coordinates of the current attachment; Based on the texture matching the target state of the current attachment, updating the target texture region to obtain an updated original texture map; The updated original texture map is determined as the target texture map.

[0086] Embodiment 3 Fig.11The schematic diagram of the hardware architecture of a computer device 10000 suitable for implementing the animation rendering method according to the third embodiment of the present application is schematically shown. In some embodiments, the computer device 10000 may be a terminal device such as a smart phone, a wearable device, a tablet computer, a personal computer, a vehicle terminal, a game console, a virtual device, a workbench, a digital assistant, a set-top box, a robot, etc. In other embodiments, the computer device 10000 may be a rack server, a blade server, a tower server, or a cabinet server (including an independent server, or a server cluster composed of multiple servers), etc. Fig.11 As shown, the computer device 10000 includes but is not limited to: a memory 10010, a processor 10020, and a network interface 10030 that can communicate with each other through a system bus. Among them: The memory 10010 includes at least one type of computer-readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (such as SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 10010 can be an internal storage module of the computer device 10000, such as a hard disk or memory of the computer device 10000. In other embodiments, the memory 10010 can also be an external storage device of the computer device 10000, such as a plug-in hard disk equipped on the computer device 10000, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the memory 10010 can also include both the internal storage module of the computer device 10000 and its external storage device. In this embodiment, the memory 10010 is generally used to store the operating system and various application software installed in the computer device 10000, such as program codes of the animation rendering method, etc. In addition, the memory 10010 can also be used to temporarily store various data that have been output or will be output.

[0087] In some embodiments, the processor 10020 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other chips. The processor 10020 is generally used to control the overall operation of the computer device 10000, such as performing control and processing related to data interaction or communication with the computer device 10000. In this embodiment, the processor 10020 is used to run the program code stored in the memory 10010 or process data.

[0088] The network interface 10030 may include a wireless network interface or a wired network interface, and the network interface 10030 is generally used to establish a communication link between the computer device 10000 and other computer devices. For example, the network interface 10030 is used to connect the computer device 10000 to an external terminal through a network, and to establish a data transmission channel and a communication link between the computer device 10000 and the external terminal. The network may be a wireless or wired network such as an intranet, the Internet, the Global System of Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, Bluetooth, Wi-Fi, etc.

[0089] It should be pointed out that Fig.11 Only a computer device having components 10010 - 10030 is shown, but it should be understood that implementation of all of the components shown is not a requirement, and more or fewer components may alternatively be implemented.

[0090] In this embodiment, the animation rendering method stored in the memory 10010 can also be divided into one or more program modules and executed by one or more processors (such as processor 10020) to complete the embodiment of the present application.

[0091] Embodiment 4 An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps of the animation rendering method in the embodiment are implemented.

[0092] In this embodiment, the computer-readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the computer-readable storage medium can be an internal storage unit of a computer device, such as a hard disk or memory of the computer device. In other embodiments, the computer-readable storage medium can also be an external storage device of a computer device, such as a plug-in hard disk equipped on the computer device, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the computer-readable storage medium can also include both the internal storage unit of the computer device and its external storage device. In this embodiment, the computer-readable storage medium is generally used to store an operating system and various application software installed on the computer device, such as the program code of the animation rendering method in the embodiment. In addition, the computer-readable storage medium can also be used to temporarily store various types of data that have been output or are to be output.

[0093] Embodiment 5 An embodiment of the present application also provides a computer program product, including a computer program, which implements the method in the above embodiment when executed by a processor.

[0094] Obviously, those skilled in the art should understand that the modules or steps of the above-mentioned embodiments of the present application can be implemented by general-purpose computer devices, they can be concentrated on a single computer device, or distributed on a network composed of multiple computer devices, optionally, they can be implemented by executable program codes of computer devices, so that they can be stored in a storage device and executed by the computer device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the embodiments of the present application are not limited to any specific combination of hardware and software.

[0095] It should be noted that the above are only preferred embodiments of the present application, and the patent protection scope of the present application is not limited thereto. Any equivalent structure or equivalent process transformation made using the contents of the specification and drawings of the present application, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. An animation rendering method, characterized in that: The method comprises: Get the animation data of the target animation; Calling the animation drawing interface provided by the rendering library to create a rendering instance, and passing the animation data to the rendering instance; The rendering instance is controlled to perform rendering based on the animation data to generate a series of animation frames, where the series of animation frames correspond to the target animation.

2. The method according to claim 1, characterized in that The rendering library includes a rendering interface layer, a rendering management layer, a rendering instance layer and an underlying rendering engine; wherein: The rendering interface layer is used to: provide the animation drawing interface, receive the animation data, and pass the animation data to the rendering management layer; The rendering management layer is used to: manage the life cycle of the rendering instance layer, including creating and destroying the rendering instance, and distributing the animation data to the rendering instance layer; The rendering instance layer is used to generate the series of animation frames by rendering through the underlying rendering engine based on the animation data.

3. The method according to claim 1 or 2, characterized in that: The animation data includes an animation protocol, which is used to define the animation time identifiers corresponding to each of the series of animation frames, as well as the bone states and slot states corresponding to each of the series of animation frames; wherein a bone includes multiple slots, a slot is associated with multiple attachments, and in the same animation frame, only one of the attachments in the same slot is rendered; the bone controls the attachments through the slots.

4. The method according to claim 3, characterized in that Controlling the rendering instance to render based on the animation data includes: Based on the animation data, determining the playback step length of the target animation; A timer is set according to the playback step length, and the timer is used to periodically trigger the rendering instance to perform rendering based on the animation data.

5. The method according to claim 4, characterized in that Rendering based on the animation data includes: In response to the triggering of the timer, obtaining a current animation time identifier; Determine a current bone state and a current slot state based on the current animation time identifier and the animation data; Rendering is performed based on the current skeleton state and the current slot state to obtain a current animation frame.

6. The method according to claim 5, characterized in that The current slot state includes the target state of the current attachment; Correspondingly, rendering based on the current bone state and the current slot state includes: Determining a target texture map according to the target state of the current accessory, the target texture map comprising a texture that matches the target state of the current accessory; Determining mesh data of the current attachment based on the current skeleton state and the current slot state; Rendering is performed based on the mesh data of the current attachment and the target texture map to obtain the current animation frame.

7. The method according to claim 6, characterized in that The animation data includes textures of a plurality of attachments in different states, each attachment having an attachment identifier; Correspondingly, according to the target state of the current attachment, determining the target texture map includes: Acquire an original texture map, wherein the original texture map includes textures of a plurality of original attachments; Determine whether the multiple original attachments have the same attachment identifier as the current attachment; In the case where the same attachment identifier exists, determining whether the original texture map has a texture that matches the target state of the current attachment; In the case where there is a matching texture, the original texture map is determined as the target texture map.

8. The method according to claim 7, characterized in that Each attachment is associated with a texture coordinate; the method further comprising: If there is no matching texture, acquiring a texture matching the target state of the current attachment based on the animation data; Determine a target texture area in the original texture map according to the texture coordinates of the current attachment; Based on the texture matching the target state of the current attachment, updating the target texture region to obtain an updated original texture map; The updated original texture map is determined as the target texture map.

9. An animation rendering device, characterized in that: The device comprises: An acquisition module is used to acquire animation data of a target animation; A calling module, used for calling the animation drawing interface provided by the rendering library to create a rendering instance, and passing the animation data to the rendering instance; The control module is used to control the rendering instance to perform rendering based on the animation data to generate a series of animation frames, where the series of animation frames correspond to the target animation.

10. A computer device, characterized in that: include: at least one processor; and a memory communicatively connected to the at least one processor; wherein: The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method according to any one of claims 1 to 8 is implemented.

12. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to claims 1 to 8 are implemented.