Method, system, electronic device and storage medium for producing skeletal animation

By combining the bone index of the LOD bone model corresponding to the animation characters on the same screen in mobile games, a drawing instruction is generated, which solves the problem of unsmooth picture caused by excessive Draw Calls and improves rendering efficiency.

CN112489172BActive Publication Date: 2025-02-14HANGZHOU ELECTRONICS SOUL NETWORK TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011265388.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-12
Publication Date
2025-02-14
Estimated Expiration
2040-11-12

AI Technical Summary

Technical Problem

When there are too many characters in the same screen animation in mobile games, there are too many Draw Calls, resulting in poor picture flow and low rendering efficiency. No effective solution has been proposed in the existing technology.

Method used

By creating a skeleton animation object, export the LOD bone model as the first LOD bone model and the second LOD bone model, merge the bone index, generate a draw instruction at a time, and make one DrawCall draw multiple LOD bone models.

Benefits of technology

It effectively reduces the number of Draw Calls, improves rendering efficiency, and solves the problem of unsmooth picture caused by too many animation characters on the same screen in mobile games.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112489172B_ABST
    Figure CN112489172B_ABST
Patent Text Reader

Abstract

The present application relates to a method, system, electronic device and storage medium for producing skeletal animation. By creating a skeletal animation object, the LOD skeletal model of the skeletal animation object is derived as a first LOD skeletal model and a second LOD skeletal model, the number of bones of the first LOD skeletal model and the second LOD skeletal model are both X; the first bone index of the first LOD skeletal model is 0 to X-1, the second bone index of the second LOD skeletal model is X to 2X-1, the first LOD skeletal model and the second LOD skeletal model are merged to obtain a third bone index of 0 to 2X-1; a drawing instruction is generated for the merged model, wherein the third bone index corresponds to a merged model, so that one DrawCall draws multiple LOD skeletal models, which solves the problem that the OPENGLES2.0 version device does not support instantiation technology and can only render one model at a time when rendering models, resulting in an unsmooth picture and low rendering efficiency, thereby improving the rendering efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of computer animation, and in particular to a method, an electronic device and a storage medium for producing skeletal animation. Background Art

[0002] Animated characters are widely used in games, movies and TV series. When producing animated characters in games or movies, the appearance model of the animated characters is mainly determined by the skeleton posture of the animated characters. Each animated character has a corresponding skeleton posture. The more animated characters and skeleton postures there are, the more Draw Calls there are. When there are too many animated characters on the same screen in a mobile game, the central processing unit (CPU) has a heavy computing load, and too many Draw Calls cause the CPU to wait for a long time for the graphics processing unit (GPU) to complete its work, and the CPU cannot be effectively utilized.

[0003] At present, there is no effective solution to the problem that when there are too many animated characters on the same screen in mobile games, there are too many Draw Calls, resulting in unsmoothness. Summary of the invention

[0004] The embodiments of the present application provide a method, system, electronic device and storage medium for producing skeletal animation, so as to at least solve the problem of too many Draw Calls and resulting in unsmoothness when there are too many animated characters on the same screen in mobile games in the related art.

[0005] In a first aspect, an embodiment of the present application provides a method for producing skeletal animation, the method comprising:

[0006] Create a skeletal animation object, and derive the LOD skeletal model of the skeletal animation object as a first LOD skeletal model and a second LOD skeletal model, wherein the number of bones of the first LOD skeletal model and the second LOD skeletal model is X;

[0007] The first bone index of the first LOD bone model is 0 to X-1, the second bone index of the second LOD bone model is X to 2X-1, and the first LOD bone model and the second LOD bone model are merged to obtain a third bone index of 0 to 2X-1;

[0008] A drawing instruction is generated for the merged model, wherein the third bone index corresponds to one of the merged models.

[0009] In some of the embodiments, before generating a drawing instruction for the merged model, the method includes: saving the relative matrix information of the first LOD skeletal model and the second LOD skeletal model into files respectively, and constructing a tree data structure according to the files.

[0010] In some embodiments, the skeleton relative matrix information is saved in a file, and after a tree data structure is constructed according to the file, the method includes:

[0011] Obtain the bone relative matrix index of the bone node in the tree data structure according to the animation time, traverse the tree data structure, multiply the default matrix when exporting MAX, the bone relative matrix index of the current bone node and the bone relative matrix index of the parent bone node of the current bone node to obtain the bone world matrix of the bone node, and pass the bone world matrix to the vertex shader.

[0012] In some embodiments, after passing the skeletal world matrix to the vertex shader, the method further comprises:

[0013] Obtain a vertex skinning matrix index and a bone weight matrix, and obtain the bone world matrix according to the vertex skinning matrix index;

[0014] The bone weight matrix, the bone world matrix and the model space vertex position matrix are multiplied to obtain the post-animation model space vertex position matrix, and the post-animation model space vertex position matrix and the bone world matrix are multiplied to obtain the post-animation world space vertex position matrix.

[0015] In some embodiments, after obtaining the post-animation world space vertex position matrix, the method includes: rendering the merged model according to the post-animation world space vertex position matrix and the skeleton world matrix.

[0016] In a second aspect, an embodiment of the present application provides a system for making skeletal animation, the system comprising an export module, a merging module and a drawing instruction module:

[0017] The export module is used to export the LOD skeleton model into a first LOD skeleton model and a second LOD skeleton model, and the number of bones of the first LOD skeleton model and the second LOD skeleton model are both X;

[0018] The merging module is used to merge the first LOD skeleton model with the second LOD skeleton model to obtain a third skeleton index of 0 to 2X-1, wherein the first skeleton index of the first LOD skeleton model is 0 to X-1, and the second skeleton index of the second LOD skeleton model is X to 2X-1;

[0019] The drawing instruction module is used to generate a drawing instruction for the merged model, wherein the third bone index corresponds to one of the merged models.

[0020] In some embodiments, the system also includes a construction module; before generating a drawing instruction for the merged model, the relative matrix information of the skeleton of the first LOD skeleton model and the second LOD skeleton model are saved in files respectively, and a tree data structure is constructed according to the files.

[0021] In some embodiments, the system also includes a calculation module; the calculation module is used to save the information of the bone relative matrix into a file, build a tree data structure according to the file, obtain the bone relative matrix index of the bone node in the tree data structure according to the animation time, traverse the tree data structure, multiply the default matrix when exporting MAX, the bone relative matrix index of the current bone node and the bone relative matrix index of the parent bone node of the current bone node, obtain the bone world matrix of the bone node, and pass the bone world matrix to the vertex shader.

[0022] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for producing skeletal animation as described in the first aspect above is implemented.

[0023] In a fourth aspect, an embodiment of the present application provides a storage medium having a computer program stored thereon, which, when executed by a processor, implements the method for producing skeletal animation as described in the first aspect above.

[0024] Compared with the related art, the method for making skeletal animation provided by the embodiment of the present application creates a skeletal animation object, and the LOD skeletal model of the skeletal animation object is exported as a first LOD skeletal model and a second LOD skeletal model, the number of bones of the first LOD skeletal model and the second LOD skeletal model are both X; the first bone index of the first LOD skeletal model is 0 to X-1, and the second bone index of the second LOD skeletal model is X to 2X-1, the first LOD skeletal model and the second LOD skeletal model are merged to obtain a third bone index of 0 to 2X-1; a drawing instruction is generated for the merged model, wherein the third bone index corresponds to a merged model, so that one DrawCall draws multiple LOD skeletal models, which solves the problem that the OPENGLES2.0 version device does not support instantiation technology, and can only render one model at a time when rendering models, resulting in an unsmooth picture and low rendering efficiency, thereby improving the rendering efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0026] Figure 1 is a flow chart of a method for producing skeletal animation according to an embodiment of the present application;

[0027] Figure 2 is a schematic diagram of a file storage format according to an embodiment of the present application;

[0028] Figure 3 is a schematic diagram of a tree data structure according to an embodiment of the present application;

[0029] Figure 4 is a structural block diagram of a system for producing skeletal animation according to an embodiment of the present application;

[0030] Figure 5 It is a schematic diagram of the internal structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0031] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is described and illustrated 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 provided in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application. In addition, it can also be understood that although the efforts made in this development process may be complex and lengthy, for ordinary technicians in the field related to the contents disclosed in the present application, some changes such as design, manufacturing or production based on the technical contents disclosed in the present application are only conventional technical means, and should not be understood as insufficient contents disclosed in the present application.

[0032] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.

[0033] Unless otherwise defined, the technical terms or scientific terms involved in this application should be understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the" and the like involved in this application do not indicate a quantitative limitation, and may represent the singular or plural. The terms "include", "comprise", "have" and any of their variations involved in this application are intended to cover non-exclusive inclusions; for example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units that are not listed, or may also include other steps or units inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application refers to greater than or equal to two. "And / or" describes the association relationship of associated objects, indicating that there may be three relationships, for example, "A and / or B" can represent: A exists alone, A and B exist at the same time, and B exists alone. The terms "first", "second", "third" and the like involved in the present application are merely used to distinguish similar objects and do not represent a specific ordering of the objects.

[0034] This embodiment provides a method for making skeletal animation. Figure 1 is a flow chart of a method for producing skeletal animation according to an embodiment of the present application. Figure 1 As shown, the process includes the following steps:

[0035] Step S101, creating a skeletal animation object, exporting the LOD skeletal model of the skeletal animation object as a first LOD skeletal model and a second LOD skeletal model, the number of bones of the first LOD skeletal model and the second LOD skeletal model are both X; in this embodiment, the LOD skeletal skinning model is a model derived using LOD technology, wherein LOD technology (Levels of Detail) refers to determining the resource allocation for object rendering according to the position and importance of the nodes of the object model in the display environment, reducing the number of faces and detail of non-important objects, thereby obtaining efficient rendering operations, and the number of bones of the LOD skeletal model can be set as needed;

[0036] Step S102, the first bone index of the first LOD bone model is 0 to X-1, the second bone index of the second LOD bone model is X to 2X-1, the first LOD bone model is merged with the second LOD bone model, and the third bone index is 0 to 2X-1; in this embodiment, the number of model mergers is determined according to the maximum number of bones supported by the current device and the number of bones of the LOD bone model. For example, most OPENGLES2.0 devices only support 256 constant registers. After removing the registers used by the engine by default, an animated character with a maximum of 35 bones is supported. If the number of bones of the exported LOD bone model is 15, the two models can be merged. If the number of bones of the exported LOD bone model is 10, the three models can be merged. The number of bones of the exported LOD model is determined by the distance of the model from the camera. If the distance is close to the camera, the number of bones is large, and if the distance is far from the camera, the number of bones can be relatively small.

[0037] Step S103, generating a drawing instruction for the merged model, wherein the third bone index corresponds to a merged model. The drawing instruction (Draw Call) is a rendering instruction submitted by the central processing unit (Central Processing Unit, referred to as CPU) to the graphics processing unit (Graphics Processing Unit, referred to as GPU). The number of Draw Calls is an important indicator affecting game performance. Too many Draw Calls will lead to high CPU occupancy and longer frame time, which will cause problems such as game freezes. An animation model has at least one Draw Call. After merging two models, one Draw Call can draw two models. After merging three models, one Draw Call can draw three models.

[0038] Through the above steps S101 to S103, compared with the prior art in which the OPENGLES2.0 version of the device does not support instantiation technology, only one model can be rendered at a time when rendering the model, resulting in low rendering efficiency, and the OPENGLES2.0 version of the device supports animated characters with a maximum of 35 bones. The system reduces the number of bones of the animated character by exporting the LOD skeleton model, and then merges the skeleton indexes of multiple LOD skeleton models to synthesize multiple LOD skeleton models into one model, so that one DrawCall can draw multiple LOD skeleton models, thereby solving the problem of too many Draw Calls when there are too many animated characters on the same screen in mobile games, resulting in an unsmooth picture, and improving rendering efficiency.

[0039] In some embodiments, before generating a drawing instruction for the merged model, the skeleton relative matrix information of the first LOD skeleton model and the second LOD skeleton model are saved in files respectively, and a tree data structure is constructed according to the files. In this embodiment, because OPENGLES 2.0 does not support instantiation (Instance refers to a series of processes in the operating system and the memory blocks allocated for these processes, and does not support vertex shader sampling maps, the skeleton relative matrix information must be saved in a file. Figure 2 is a schematic diagram of a file storage format according to an embodiment of the present application, such as Figure 2 As shown, the saved information includes the bone name, parent bone name, number of child bones, 0 or more child bone names and bone relative matrix, and then a tree data structure is constructed according to the file format. Figure 3 is a schematic diagram of a tree data structure according to an embodiment of the present application, such as Figure 3 As shown, the upper-level bone is the parent bone of the lower-level bone, and the lower-level bone is the parent bone of the upper-level bone. A parent bone can have 0 or more child bones. The movement of the parent bone will drive the child bones to move together. For example, if a character raises his upper arm, the forearm, as the child bone of the upper arm, will also be raised.

[0040] In some of the embodiments, the bone relative moment information is saved in a file, and after a tree data structure is constructed based on the file, the bone relative matrix index of the bone node in the tree data structure is obtained according to the animation time, the tree data structure is traversed, and the default matrix when exporting MAX, the bone relative matrix index of the current bone node and the bone relative matrix index of the parent bone node of the current bone node are multiplied to obtain the bone world matrix of each bone node, and the bone world matrix is ​​passed to the vertex shader.

[0041] In this embodiment, after the bone relative matrix index of each bone node is calculated according to the current animation time and assigned to Cbone, the created tree data structure is traversed to make the bone world matrix of each bone node = Tpos (the default matrix when exporting MAX) * cbone of the current bone node * cbone of the parent bone node of the current bone node, and the calculated bone world matrices of all bone nodes are passed to the vertex shader. The bone world matrix includes the first bone world matrix of the first LOD bone model and the second bone world matrix of the second LOD bone model. After the bone world matrix is ​​passed to the vertexshader, during rendering, the graphics card will execute the vertex shader, and the vertex shader will calculate the world space vertex position matrix after the animation.

[0042] In some of the embodiments, after the skeleton world matrix is ​​passed to the vertex shader, a vertex skinning matrix index and a skeleton weight matrix are obtained, and the skeleton world matrix is ​​obtained according to the vertex skinning matrix index;

[0043] The bone weight matrix, the bone world matrix and the model space vertex position matrix are multiplied to obtain the post-animation model space vertex position matrix, and the post-animation model space vertex position matrix and the bone world matrix are multiplied to obtain the post-animation world space vertex position matrix.

[0044] In this embodiment, the vertex skinning matrix indexes are i1, i2, i3, i4, and the bone weight matrices are W1, W2, W3, W4. According to i1, i2, i3, i4, the bone world matrices T1, T2, T3, T4 stored in the vertex shader are obtained. Then the post-animation model space vertex position matrix Vt = V(model space vertex position) * T1 * W1 + V* T2 * W2 + V* T3 * W3 + V* T4 * W4, and the post-animation world space vertex position matrix Vo = Vt * mat (mat is the bone world matrix). The post-animation world space vertex position matrix includes the first post-animation world space vertex position matrix of the first LOD bone model and the second post-animation world space vertex position matrix of the second LOD bone model.

[0045] In some of the embodiments, after obtaining the post-animation world space vertex position matrix, the merged model is rendered according to the post-animation world space vertex position matrix and the skeleton world matrix. In the present embodiment, when rendering the merged model, the first skeleton world matrix and the first post-animation world space vertex position matrix of the first LOD skeleton model, the second skeleton world matrix and the second post-animation world space vertex position matrix of the second LOD skeleton model are found according to the third skeleton index of the merged model, and then the first LOD skeleton model and the second LOD skeleton model are rendered simultaneously.

[0046] It should be noted that the steps shown in the above process or the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0047] This embodiment also provides a system for making skeletal animation, which is used to implement the above-mentioned embodiments and preferred implementation modes, and will not be repeated hereafter. As used below, the terms "module", "unit", "subunit", etc. can be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0048] Figure 4 is a structural block diagram of a system for producing skeletal animation according to an embodiment of the present application, such as Figure 4 As shown, the system includes an export module 41, a merging module 42 and a drawing instruction module 43:

[0049] The export module 41 is used to export the LOD skeleton model as the first LOD skeleton model and the second LOD skeleton model, and the number of bones of the first LOD skeleton model and the second LOD skeleton model are both X; the merging module 42 is used to merge the first LOD skeleton model with the second LOD skeleton model to obtain a third skeleton index 0 to 2X-1, wherein the first skeleton index of the first LOD skeleton model is 0 to X-1, and the second skeleton index of the second LOD skeleton model is X to 2X-1; the drawing instruction module 43 is used to generate a drawing instruction for the merged model, wherein the third skeleton index corresponds to one of the merged models. In this embodiment, the LOD skeleton model is exported by the export module 41, and the merging module 42 merges multiple LOD skeleton models, and the drawing instruction module 43 renders the merged model, so that one DrawCall draws multiple LOD skeleton models, which solves the problem that the OPENGLES2.0 version of the device does not support instantiation technology, and can only render one model at a time when rendering the model, resulting in an unsmooth picture and low rendering efficiency, thereby improving the rendering efficiency.

[0050] It should be noted that the above modules can be functional modules or program modules, and can be implemented by software or hardware. For modules implemented by hardware, the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.

[0051] This embodiment further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0052] In addition, in combination with the method for making skeletal animation in the above embodiment, the embodiment of the present application can provide a storage medium for implementation. The storage medium stores a computer program; when the computer program is executed by a processor, any one of the methods for making skeletal animation in the above embodiment is implemented.

[0053] In one embodiment, a computer device is provided, which may be a terminal. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a method for making a skeletal animation is implemented. The display screen of the computer device may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device may be a touch layer covering the display screen, or a key, trackball, or touchpad provided on the housing of the computer device, or an external keyboard, touchpad, or mouse, etc.

[0054] In one embodiment, Figure 5 is a schematic diagram of the internal structure of an electronic device according to an embodiment of the present application, such as Figure 5 As shown, an electronic device is provided, which may be a server, and its internal structure diagram may be as shown in Figure 5 As shown. The electronic device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the electronic device is used to store data. The network interface of the electronic device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for making skeletal animation is implemented.

[0055] Those skilled in the art will understand that Figure 5 The structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the electronic device to which the scheme of the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.

[0056] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0057] Those skilled in the art should understand that the technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0058] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A method for producing skeletal animation, characterized in that: The method comprises: Create a skeletal animation object, and derive the LOD skeletal model of the skeletal animation object as a first LOD skeletal model and a second LOD skeletal model, wherein the number of bones of the first LOD skeletal model and the second LOD skeletal model is X; The first bone index of the first LOD bone model is 0 to X-1, the second bone index of the second LOD bone model is X to 2X-1, and the first LOD bone model and the second LOD bone model are merged to obtain a third bone index of 0 to 2X-1; A drawing instruction is generated for the merged model, wherein the third bone index corresponds to one of the merged models.

2. The method according to claim 1, characterized in that Before generating a drawing instruction for the merged model, the method includes: saving the skeleton relative matrix information of the first LOD skeleton model and the second LOD skeleton model into files respectively, and constructing a tree data structure according to the files.

3. The method according to claim 2, characterized in that After the skeleton relative matrix information is saved in a file and a tree data structure is constructed according to the file, the method comprises: Obtain the bone relative matrix index of the bone node in the tree data structure according to the animation time, traverse the tree data structure, multiply the default matrix when exporting MAX, the bone relative matrix index of the current bone node and the bone relative matrix index of the parent bone node of the current bone node to obtain the bone world matrix of the bone node, and pass the bone world matrix to the vertex shader.

4. The method according to claim 3, characterized in that: After passing the skeleton world matrix to the vertex shader, the method further comprises: Obtain a vertex skinning matrix index and a bone weight matrix, and obtain the bone world matrix stored in the vertex shader according to the vertex skinning matrix index; The bone weight matrix, the bone world matrix and the model space vertex position matrix are multiplied to obtain the post-animation model space vertex position matrix, and the post-animation model space vertex position matrix and the bone world matrix are multiplied to obtain the post-animation world space vertex position matrix.

5. The method according to claim 4, characterized in that After obtaining the post-animation world space vertex position matrix, the method includes: rendering the merged model according to the post-animation world space vertex position matrix and the skeleton world matrix.

6. A system for producing skeletal animation, characterized in that: The system includes an export module, a merging module and a drawing instruction module: The export module is used to export the LOD skeleton model into a first LOD skeleton model and a second LOD skeleton model, and the number of bones of the first LOD skeleton model and the second LOD skeleton model are both X; The merging module is used to merge the first LOD skeleton model with the second LOD skeleton model to obtain a third skeleton index of 0 to 2X-1, wherein the first skeleton index of the first LOD skeleton model is 0 to X-1, and the second skeleton index of the second LOD skeleton model is X to 2X-1; The drawing instruction module is used to generate a drawing instruction for the merged model, wherein the third bone index corresponds to one of the merged models.

7. The system according to claim 6, characterized in that The system also includes a construction module; the construction module is used to save the relative matrix information of the first LOD skeleton model and the second LOD skeleton model into files respectively before generating a drawing instruction for the merged model, and construct a tree data structure according to the files.

8. The system according to claim 7, characterized in that The system also includes a calculation module; the calculation module is used to save the information of the bone relative matrix into a file, build a tree data structure according to the file, obtain the bone relative matrix index of the bone node in the tree data structure according to the animation time, traverse the tree data structure, multiply the default matrix when exporting MAX, the bone relative matrix index of the current bone node and the bone relative matrix index of the parent bone node of the current bone node, obtain the bone world matrix of the bone node, and pass the bone world matrix to the vertex shader.

9. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to execute the method for producing skeletal animation according to any one of claims 1 to 5.

10. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the method for producing skeletal animation according to any one of claims 1 to 5 when running.

Citation Information

Patent Citations

  • Method and apparatus for drafting role

    CN101350107A

  • Animation generation method, device and system and terminal

    CN107180444A