Animation rendering method, device and electronic device
By combining the sub-components to be rendered into combined components and rendering them on them, the problem of large performance losses in Live2D animation rendering is solved, and more efficient rendering performance is achieved.
Patent Information
- Application Number
- CN202111240719.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-25
- Publication Date
- 2025-05-27
- Estimated Expiration
- 2041-10-25
AI Technical Summary
The existing Live2D animation rendering methods have a problem of large performance losses, especially when there are many objects in the scene, the additional consumption brought by dynamic batching technology is significant.
By combining multiple sub-components to be rendered into at least one combined component based on predefined component relationships, and animation rendering is performed on the combined component, reducing the performance consumption of real-time dynamic batch combinations.
Reduces performance consumption, improves rendering efficiency, and reduces the number of rendered objects, thereby reducing the burden on the CPU.
Smart Images

Figure CN113947655B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer graphics processing, and in particular to an animation rendering method, device and electronic equipment. Background Art
[0002] Live2D is a graphics rendering technology used in video games. It generates a two-dimensional image similar to a three-dimensional model through a series of continuous images and character modeling. As a 2D animation system, Live2D is increasingly being applied to actual projects in games. For animation systems, rendering effects and rendering performance need to reach an ideal level before they can be widely used in games. While ensuring the rendering effect, in order to achieve better rendering performance, it is necessary to minimize the consumption of CPU / GPU in animation updates and model processing.
[0003] In addition, this rendering method usually relies on dynamic batching technology to merge objects with the same material properties into a larger object, thereby reducing the number of object rendering times. However, dynamic batching itself also has additional performance losses. Dynamically checking whether objects can be batched and batch processing will generate additional CPU consumption, and these consumptions usually become more serious as the number of objects in the scene increases.
[0004] Therefore, the existing Live2D animation rendering method has the problem of large additional performance loss. Summary of the invention
[0005] The purpose of the present invention is to provide an animation rendering method, device and electronic device to alleviate the technical problem of large performance loss caused by rendering in the prior art.
[0006] In order to achieve the above purpose, the technical solution adopted by the embodiment of the present invention is as follows:
[0007] In a first aspect, an embodiment of the present invention provides an animation rendering method, comprising: based on a predefined component relationship, merging multiple sub-components to be rendered into at least one combined component, wherein the animation to be rendered includes multiple sub-components to be rendered; the sub-components include sub-component vertex information and sub-component-specific information, the sub-component vertex information includes one or more of the position, color, mapping coordinates corresponding to the vertex, and normal of the vertex; the sub-component-specific information includes one or more of occlusion information and blending mode information; and performing animation rendering based on the at least one combined component.
[0008] In some possible implementations, the method further includes: determining updated sub-component vertex information of the sub-component through a first thread; synchronizing the updated sub-component vertex information to at least one combined component through a second thread to obtain at least one updated combined component; the animation rendering based on the at least one combined component includes: performing animation rendering based on the at least one updated combined component through the first thread.
[0009] In some possible implementations, the above-mentioned merging of multiple sub-components to be rendered into at least one combined component based on a predefined component relationship, wherein the animation to be rendered includes multiple sub-components to be rendered, including: based on the predefined component relationship, merging the sub-component vertex information of the multiple sub-components to be rendered into initial combined component vertex information of at least one combined component; recording the above-mentioned sub-component-specific information into the corresponding initial combined component vertex information to obtain the target combined component vertex information.
[0010] In some possible implementations, the animation to be rendered includes multiple frames of animation images; the animation rendering based on the at least one combined component includes: determining component position information corresponding to the current frame image; updating sub-component vertex information in the at least one combined component based on the component position information corresponding to the current frame image; and rendering based on the updated at least one combined component to obtain the current frame image.
[0011] In some possible implementations, the above-mentioned determination of the component position information corresponding to the current frame image includes: determining the component position information corresponding to the current frame image based on animation data corresponding to the current frame image; or determining the component position information corresponding to the current frame image based on animation data corresponding to the previous frame image.
[0012] In some possible implementations, the method further includes: determining component visibility information corresponding to the current frame image based on animation data corresponding to the current frame image; and updating sub-component-specific information in the at least one combined component based on the component visibility information corresponding to the current frame image.
[0013] In some possible implementations, the updating of sub-component-specific information in the at least one combined component based on the component visibility information corresponding to the current frame image includes: when the sub-component needs to be hidden, updating the position of the vertex of the sub-component to be hidden to a specified position.
[0014] In some possible implementations, the above-mentioned blending mode information includes a normal blending mode, an overlay blending mode, and a dodge blending mode; for the normal blending mode, the RGB of the color is multiplied by the transparency of the color before the final color is output; for the overlay blending mode, the transparency of the color is set to 0 before the final color is output; for the dodge blending mode, the dodge effect is simulated in the merged material or all sub-components with the dodge blending effect are merged into one large component.
[0015] In some possible implementations, the predefined component relationships include hierarchical relationships between components and merge relationships between components.
[0016] In a second aspect, an embodiment of the present invention provides an animation rendering device, comprising: a merging module, used to merge multiple sub-components to be rendered into at least one combined component based on a predefined component relationship, wherein the animation to be rendered includes multiple sub-components to be rendered; and a rendering module, used to perform animation rendering based on the above-mentioned at least one combined component.
[0017] In a third aspect, an embodiment of the present invention provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program executable on the processor, and when the processor executes the computer program, the steps of any one of the methods described in the first aspect are implemented.
[0018] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores machine-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions cause the processor to execute any method described in the first aspect above.
[0019] The present invention provides an animation rendering method, device and electronic device, the method comprising: firstly merging multiple sub-components to be rendered into at least one combined component based on a predefined component relationship, wherein the animation to be rendered includes multiple sub-components to be rendered; and then performing animation rendering based on the at least one combined component. The method solves the technical problem of high performance consumption and achieves the technical effect of reducing performance consumption and improving rendering efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0021] Figure 1A schematic diagram of the principle of an existing Live2d rendering method provided by an embodiment of the present invention;
[0022] Figure 2 A schematic diagram of a flow chart of an animation rendering method provided by an embodiment of the present invention;
[0023] Figure 3 A schematic diagram of static batching in an animation rendering method provided by an embodiment of the present invention;
[0024] Figure 4 A schematic diagram of a data updating principle in an animation rendering method provided by an embodiment of the present invention;
[0025] Figure 5 A block diagram of an animation rendering device provided by an embodiment of the present invention;
[0026] Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0027] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0028] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0029] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0030] 3D games have been widely developed because they are closer to the real world. Mainstream 3D games generally require a large and sophisticated game world, which can also be called a game level, a game stage, a game scene, etc. The so-called game world not only refers to the 3D rendering environment visible to players, but also includes the virtual environment required by the gameplay system (game mechanism, physical collision, artificial intelligence, etc.).
[0031] Most 3D games use 3D triangle meshes to construct most of the game world, including terrain, buildings, vegetation, and other static objects. Some games that focus on natural outdoor environments use height fields to represent terrain; some games that focus on indoor environments use constructive solid geometry (CSG) technology to construct basic indoor environments.
[0032] However, the production of the above-mentioned three-dimensional games usually requires a large amount of production resources. A technology that can generate a two-dimensional image similar to a three-dimensional model through a series of continuous images and character modeling has also been widely developed due to its characteristic of requiring fewer production resources. For example, Live2D (a graphics rendering technology used in electronic games) generates similar three-dimensional models based on two-dimensional images.
[0033] Currently, when using Live2D for animation rendering, the animation is usually divided into several widgets, and then rendered based on each widget separately.
[0034] The reason is that the animation mechanism mode of Live2d itself is based on component "drive", that is, the component is the basic unit of Live2d animation.
[0035] For example, a character is divided into several parts such as head, hands, torso, etc., and the position and deformation of different parts are affected by set parameters to achieve the animation effect of the character. When rendering this character, the Live2d native rendering solution uses all the parts that make up the character as the most basic rendering objects. If the character has 300 body parts, 300 objects need to be rendered when rendering this character; if there are 10 similar characters in a game scene, 3,000 objects need to be rendered.
[0036] This rendering method of using a single component as the smallest rendering object will greatly increase the number of rendering objects when there are many components. In addition, because almost all parts of the character's body are moving during the animation, the position information of the vertices of each component needs to be synchronized to the engine for processing every frame. If the vertex position information of 3,000 components is synchronized to the engine every frame, the loss caused by context switching itself is also obvious.
[0037] In addition, Live2d's rendering method usually relies on the engine's dynamic batching technology to reduce the final call to the GPU rendering command, merging objects with the same material properties into a larger object, thereby reducing the number of object rendering times (see Figure 1). However, dynamic batching itself also has additional performance loss. Dynamically checking whether objects can be batched and batch processing will generate additional CPU consumption, and these consumptions usually become more serious as the number of objects in the scene increases. Therefore, the existing Live2D animation rendering method has the problem of large additional performance loss.
[0038] Based on this, the embodiments of the present invention provide an animation rendering method, device and electronic device to alleviate the technical problem of large performance loss caused by rendering in the prior art.
[0039] To facilitate understanding of this embodiment, firstly, an animation rendering method disclosed in an embodiment of the present invention is described in detail. Figure 2 The flowchart of an animation rendering method shown in FIG. 1 is a flowchart of an animation rendering method, which can be executed by an electronic device and mainly includes the following steps S110 to S120:
[0040] S110: Based on a predefined component relationship, merging a plurality of subcomponents to be rendered into at least one combined component, wherein the animation to be rendered includes a plurality of subcomponents to be rendered;
[0041] The subcomponents may include subcomponent vertex information and subcomponent-specific information. In one embodiment, the subcomponent vertex information includes one or more of the position, color, texture coordinates corresponding to the vertex, and normal; the subcomponent-specific information includes one or more of occlusion information and blending mode information.
[0042] Since the animation mechanism mode of Live2d is based on component "drive", components can be used as the basic unit of Live2d animation. In the Live2d animation system, an animation frame can be divided into several components. For example, an animation frame can include a virtual character, and the components that make up the virtual character can be the head, hands, torso, etc.
[0043] The predefined component relationships may include hierarchical relationships between components and merging relationships between components. Hierarchy means sorting; merging means merging into several components, for example, merging all components of a light-dodge blend effect into one large component, or merging the upper and lower body of a character into one component.
[0044] Occlusion information may include a mask and the encoding and offset information corresponding to the mask. Mask is an animation mechanism of Live2d, and its purpose is to achieve the effect that some body parts can be occluded by other parts in real time and dynamically, such as the blinking of a character. Occlusion information can be used to record the vertex position relationship before and after hiding the visible area of an element, that is, the offset information of the mask, for example, the vertex position relationship between the eyelids before and after the character blinks, that is, the offset information of the eyelid mask.
[0045] S120: Perform animation rendering based on at least one combined component.
[0046] The present invention provides an animation rendering method, which comprises: firstly, based on a predefined component relationship, merging multiple subcomponents to be rendered into at least one combined component, wherein the animation to be rendered comprises multiple subcomponents to be rendered; the subcomponents comprise subcomponent vertex information and subcomponent-specific information, the subcomponent vertex information comprises one or more of the position, color, mapping coordinates corresponding to the vertex, and normal of the vertex, and the subcomponent-specific information comprises one or more of occlusion information and mixed mode information; and then performing animation rendering based on at least one combined component. The method solves the technical problem of high performance consumption and achieves the technical effect of reducing performance consumption and improving rendering efficiency.
[0047] That is to say, when the animation resources are imported, they are batched in advance, that is, multiple sub-components to be rendered are batched statically, merged into a composite component, and then the batched composite component is rendered as a whole (see Figure 3 ).
[0048] The purpose of batching is to reduce the number of times objects are rendered, thereby saving CPU overhead. Assuming that there are 100 objects to be rendered, it takes 1 second to render the objects without dynamic batching. When dynamic batching is turned on, the 100 objects are merged into 10 objects, and it takes 0.2 seconds to render the objects, 0.2 seconds for dynamic batching, and 0.4 seconds in total. Unlike dynamic batching, the static batching process does not have performance loss, that is, it reduces the performance consumption of real-time dynamic batching. At the same time, merging the components in advance reduces the number of objects that need to be rendered, which can further reduce performance consumption and improve rendering efficiency.
[0049] In the above step S110, based on the predefined component relationship, multiple sub-components to be rendered are merged into at least one combined component, wherein the animation to be rendered includes multiple sub-components to be rendered, including:
[0050] S201: Based on a predefined component relationship, merging sub-component vertex information of a plurality of sub-components to be rendered into initial combined component vertex information of at least one combined component;
[0051] This process is mainly to merge the position, color, UV, normal and other data in the vertex together.
[0052] S202: Record the above sub-component-specific information into the corresponding initial assembly component vertex information to obtain the target assembly component vertex information.
[0053] Since each sub-component has its own exclusive Mask occlusion information and the blending mode used when rendering the object, after all the components are merged into a large component, the exclusive information of these original small components should be recorded in the vertices corresponding to the component. In this way, when the pixels covered by the object are finally shaded in the pixel shader, it can be rendered as a whole, and different rendering behaviors can be made according to the different vertex data of the components.
[0054] Different components can be rendered using any blending mode. Currently, there are only three rendering modes available when using Live2d: Normal, Overlay, and Dodge.
[0055] In one embodiment, the blending mode information includes a normal blending mode, an overlay blending mode, and a dodge blending mode; for the normal blending mode, the RGB of the color is multiplied by the transparency of the color before the final color is output; for the overlay blending mode, the transparency of the color is set to 0 before the final color is output; for the dodge blending mode, the dodge effect is simulated to a certain extent in the merged material, or all sub-components with the dodge blending effect are merged into a large component separately and then rendered.
[0056] As a specific example, in the normal and overlay blending modes, change the overall blending mode of the merged material to OneMinusSrcAlpha, and then determine whether it is overlay mode based on the blending mode recorded in the vertex. If it is normal blending mode, multiply the color's RGB by the color's transparency before outputting the final color in the fragment shader; if it is overlay blending mode, set the color's transparency to 0, which is fully compatible with normal and overlay blending modes.
[0057] For the Dodge blending mode, since the results of the blending factors are too different, the following two solutions can be adopted: simulate the Dodge effect to a certain extent in the merged material; or merge all the separate small components of the Dodge blending effect into one large component.
[0058] In the merged material, the way to process the mask occlusion information of the component is to update the mask that occludes the component in the merged target composite component, and then sample the mask atlas according to the corresponding mask id and offset information. That is, all the masks that are going to occlude other normal components are rendered in real time and merged into a large map, so as to reduce the number of mask maps.
[0059] In one embodiment, the animation to be rendered includes multiple frames of animation images.
[0060] In the above step S120, animation rendering is performed based on at least one combined component, including:
[0061] S203: Determine component position information corresponding to the current frame image;
[0062] S204: updating subcomponent vertex information in at least one combined component based on component position information corresponding to the current frame image;
[0063] S205: Rendering is performed based on the updated at least one combined component to obtain a current frame image.
[0064] In one embodiment, in the above step S203, determining the component position information corresponding to the current frame image includes:
[0065] Determine the component position information corresponding to the current frame image based on the animation data corresponding to the current frame image;
[0066] Alternatively, the component position information corresponding to the current frame image is determined based on the animation data corresponding to the previous frame image.
[0067] Since the batch processing method is used in advance, it is necessary to ensure that when the position of the parts changes, the corresponding parts in the merged large parts can also be synchronized in real time. Therefore, it is necessary to update the changed body parts every frame and synchronize the changed position information to the data of the corresponding parts in the large part.
[0068] Assume that a Live2d character originally has 300 parts, and the number of model vertices of all parts is 6000. Each part changes position in each frame, so the data of these 6000 vertices needs to be updated in each frame. This update process itself will also generate a lot of extra consumption. In order to reduce the impact of this extra consumption on the processing speed, an animation rendering method provided in an embodiment of the present application may also include:
[0069] First, the updated subcomponent vertex information of the subcomponent is determined by the first thread; then, the updated subcomponent vertex information is synchronized to at least one combined component by the first thread to obtain at least one updated combined component; and then, animation rendering is performed based on the at least one updated combined component by the second thread.
[0070] Among them, the first thread is the main thread, and the second thread is an independent thread that is opened separately. After the second thread is opened, it only does one thing per frame, that is, synchronizes all vertex data of the updated sub-components to the vertex information of the large component.
[0071] In order to synchronize the data synchronization tasks of the independent sub-threads with other tasks of the main thread, the following two solutions can be adopted:
[0072] Solution (1): The main thread puts the Live2d animation component position update at the beginning of each frame. Once the animation data is updated, an independent sub-thread is immediately started to synchronize the updated component position information with the large components that have been batched in advance (see Figure 4 ), while the main thread executes other update logic and rendering of the game in turn;
[0073] Solution (2): Delayed update, that is, the main thread updates the component position of the previous frame in each frame. This solution can allow a whole frame of time for the child thread to synchronize the component position information to the large component, but it needs to ensure that the logic can be coordinated with the delay of one frame.
[0074] By starting another thread to synchronize component positions, when the position of a sub-component changes, the position of the corresponding part of the merged large component can be synchronized in real time, and the multi-threaded real-time update of components further reduces performance loss.
[0075] In the process of updating vertex data, it is also necessary to deal with the visibility of components. Specifically, some components may be displayed or hidden within a period of time when animating. For example, when a character is fanning himself, he needs to take out a fan from behind. This fan only appears when the fan-shaking animation is playing and needs to be hidden at other times.
[0076] When processing the visibility of components, the method adopted is to set the positions of the components that need to be hidden to the same position. After this processing, on the one hand, the effect of hiding certain components can be achieved, and at the same time, the pixel fill rate can be reduced.
[0077] In one embodiment, the animation rendering method further includes:
[0078] S206: Determine the component visibility information corresponding to the current frame image based on the animation data corresponding to the current frame image;
[0079] S207: updating the sub-component-specific information in the at least one combined component based on the component visibility information corresponding to the current frame image.
[0080] In one embodiment, in the above step S206, the sub-component-specific information in the above at least one combined component is updated based on the component visibility information corresponding to the above current frame image, including: when the above sub-component needs to be hidden, the position of the vertex of the above sub-component to be hidden is updated to the specified position.
[0081] An animation rendering method provided in this embodiment first merges multiple sub-components to be rendered into at least one combined component based on a predefined component relationship, and then performs animation rendering based on the at least one combined component, thereby solving the technical problem of high performance consumption and achieving the technical effect of reducing performance consumption and improving rendering efficiency.
[0082] Figure 5 The following is a block diagram of an animation rendering device according to an embodiment of the present application. The functions implemented by the animation rendering device correspond to the steps performed by the above animation rendering method. The animation rendering device may include:
[0083] A merging module 410, configured to merge a plurality of subcomponents to be rendered into at least one combined component based on a predefined component relationship, wherein the animation to be rendered includes a plurality of subcomponents to be rendered;
[0084] The rendering module 420 is used to perform animation rendering based on the at least one combined component.
[0085] In one embodiment, the subcomponent includes subcomponent vertex information and subcomponent-specific information; the merging module 410 is specifically used to:
[0086] Based on a predefined component relationship, merging sub-component vertex information of a plurality of sub-components to be rendered into initial combined component vertex information of at least one combined component;
[0087] The above sub-component-specific information is recorded into the corresponding initial assembly component vertex information to obtain the target assembly component vertex information.
[0088] The above-mentioned predefined component relationships include hierarchical relationships between components and merging relationships between components.
[0089] In one embodiment, the subcomponent vertex information includes one or more of the vertex position, color, mapping coordinates corresponding to the vertex, and normal; the above-mentioned subcomponent-specific information includes one or more of occlusion information and blending mode information.
[0090] In one embodiment, the blending mode information includes a normal blending mode, an overlay blending mode, and a dodge blending mode;
[0091] For the normal blending mode, the color transparency is multiplied before the final color is output; for the overlay blending mode, the color transparency is set to 0 before the final color is output; for the dodge blending mode, the dodge effect is simulated to a certain extent in the merged material or all sub-components of the dodge blending effect are merged into a large component separately.
[0092] In one embodiment, the animation to be rendered includes multiple frames of animation images; the rendering module 420 is specifically used to:
[0093] Determine the component position information corresponding to the current frame image;
[0094] Update the subcomponent vertex information in the at least one combined component based on the component position information corresponding to the current frame image;
[0095] The current frame image is obtained by rendering based on the updated at least one combined component.
[0096] In one embodiment, the above-mentioned determination of the component position information corresponding to the current frame image further includes: determining the component position information corresponding to the current frame image based on the animation data corresponding to the current frame image; or determining the component position information corresponding to the current frame image based on the animation data corresponding to the previous frame image.
[0097] In one embodiment, the animation rendering device may further include:
[0098] A display and concealment information determination module, used to determine the display and concealment information of the component corresponding to the current frame image based on the animation data corresponding to the current frame image;
[0099] An updating module is used to update the sub-component-specific information in the at least one combined component based on the component visibility information corresponding to the current frame image.
[0100] In one embodiment, the updating module is specifically used to update the position of the vertex of the subcomponent to be hidden to a specified position when the subcomponent needs to be hidden.
[0101] An animation rendering device provided in this embodiment merges multiple sub-components to be rendered into at least one combined component based on predefined component relationships, and performs animation rendering based on at least one combined component, thereby solving the technical problem of high performance consumption and achieving the technical effect of reducing performance consumption and improving rendering efficiency.
[0102] like Figure 6As shown, an electronic device 500 provided in an embodiment of the present application includes: a processor 50, a memory 51, a bus 52 and a communication interface 53, wherein the memory 51 stores machine-readable instructions executable by the processor 50, and when the electronic device is running, the processor 50 communicates with the memory 51 through the bus, and the processor 50 executes the machine-readable instructions to perform the steps of the above method.
[0103] Specifically, the memory 51 and the processor 50 can be general-purpose memories and processors, which are not specifically limited here. When the processor 50 runs the computer program stored in the memory 51, the steps of the animation rendering method can be executed.
[0104] Corresponding to the above-mentioned animation rendering method, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned animation rendering method are executed.
[0105] The animation rendering device provided in the embodiment of the present application can be specific hardware on the device or software or firmware installed on the device. The device provided in the embodiment of the present application, its implementation principle and the technical effect produced are the same as those in the aforementioned method embodiment. For the sake of brief description, for the parts not mentioned in the device embodiment, reference can be made to the corresponding contents in the aforementioned method embodiment. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, devices and units described above can all refer to the corresponding processes in the aforementioned method embodiment, and will not be repeated here.
[0106] In the embodiments provided in the present application, it should be understood that the disclosed 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 the devices or units can be electrical, mechanical or other forms.
[0107] 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.
[0108] In addition, each functional unit in the embodiments provided in 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.
[0109] 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 computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes 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 methods 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.
[0110] It should be noted that similar numbers and letters represent similar items in the following figures. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. In addition, the terms "first", "second", "third", etc. are only used to distinguish the description and are not to be understood as indicating or implying relative importance.
[0111] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. An animation rendering method, characterized in that, it includes: Based on predefined part relationships, multiple sub-parts to be rendered are combined into at least one combined part, where the animation to be rendered includes multiple sub-parts to be rendered; the sub-parts include sub-part vertex information and sub-part exclusive information, and the sub-part vertex information includes one or more of the position, color, texture coordinates corresponding to the vertex, and normal of the vertex; the sub-part exclusive information includes one or more of occlusion information and blending mode information; the sub-part is a basic unit for generating an animation similar to a 3D model based on a 2D image; the predefined part relationships include hierarchical relationships between parts and merging relationships between parts; Performing animation rendering based on the at least one combined part; The method further includes: Determining the updated sub-part vertex information of the sub-parts through a first thread; Synchronizing the updated sub-part vertex information to the at least one combined part through a second thread to obtain at least one updated combined part; The performing animation rendering based on the at least one combined part includes: Performing animation rendering based on the at least one updated combined part through the first thread.
2. The method according to claim 1, characterized in that, the combining of multiple sub-parts to be rendered into at least one combined part based on predefined part relationships, where the animation to be rendered includes multiple sub-parts to be rendered, includes: Based on predefined part relationships, combining the sub-part vertex information of multiple sub-parts to be rendered into the initial combined part vertex information of at least one combined part; Recording the sub-part exclusive information into the corresponding initial combined part vertex information to obtain the target combined part vertex information.
3. The method according to claim 2, characterized in that, the animation to be rendered includes multiple frames of animation images; the performing animation rendering based on the at least one combined part includes: Determining the part position information corresponding to the current frame image; Updating the sub-part vertex information in the at least one combined part based on the part position information corresponding to the current frame image; Rendering based on the updated at least one combined part to obtain the current frame image.
4. The method according to claim 3, characterized in that, the determining of the part position information corresponding to the current frame image includes: Based on the animation data corresponding to the current frame image, determining the part position information corresponding to the current frame image; Or, Based on the animation data corresponding to the previous frame image, determining the part position information corresponding to the current frame image.
5. The method according to claim 2, characterized in that, it further includes: Based on the animation data corresponding to the current frame image, determining the part visibility information corresponding to the current frame image; Updating the sub-part exclusive information in the at least one combined part based on the part visibility information corresponding to the current frame image.
6. The method according to claim 5, characterized in that, the updating of the sub-part exclusive information in the at least one combined part based on the part visibility information corresponding to the current frame image includes: When the sub-component needs to be hidden, update the positions of the vertices of the sub-component to be hidden to specified positions.
7. The method according to claim 2, wherein, the blending mode information includes a normal blending mode, an overlay blending mode, and a dodge blending mode; For the normal blending mode, multiply the RGB of the color by the transparency of the color before outputting the final color; for the overlay blending mode, set the transparency of the color to 0 before outputting the final color; for the dodge blending mode, simulate a dodging effect in the combined material or combine all sub-components with a dodging blending effect into one large component.
8. The method according to claim 1, wherein, the predefined component relationships include the hierarchical relationship between components and the merging relationship between components.
9. An animation rendering device, wherein, comprising: a merging module, configured to merge a plurality of sub-components to be rendered into at least one combined component based on predefined component relationships, wherein the animation to be rendered includes a plurality of sub-components to be rendered; a rendering module, configured to perform animation rendering based on the at least one combined component; the rendering module is further configured to determine sub-component vertex information updated by a sub-component through a first thread; synchronize the updated sub-component vertex information to the at least one combined component through a second thread to obtain at least one updated combined component; and perform animation rendering based on the at least one updated combined component through the first thread.
10. An electronic device, comprising a memory and a processor, and a computer program stored in the memory that can run on the processor, wherein, when the processor executes the computer program, the steps of the method according to any one of claims 1 to 8 above are implemented.
11. A computer-readable storage medium, wherein, the computer-readable storage medium stores machine-executable instructions, and when the computer-executable instructions are called and run by a processor, the computer-executable instructions cause the processor to run the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Image drawing method and device
CN105894551A