Cluster animation generation method and device, electronic equipment and storage medium

By employing vertex textures and static mesh bodies on GPUs, the method addresses resource-intensive issues in traditional bone animation systems, enabling efficient and high-quality large-scale crowd animation generation.

CN120318387APending Publication Date: 2025-07-15广东精鹰传媒科技集团股份有限公司
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510477792.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-16
Publication Date
2025-07-15

AI Technical Summary

Technical Problem

Traditional skeletal animation systems consume too much resources when generating large-scale cluster animations, resulting in a bottleneck in equipment performance, reducing production efficiency and difficulty in achieving complex and high-quality dynamic effects.

Method used

Vertex data calculation and update on the GPU, vertex texture and static mesh are generated, mesh deformation is driven through the material system, and dynamic control is carried out in combination with the Niagara particle system, abandoning the traditional skeletal animation system.

Benefits of technology

Without improving equipment performance, it significantly reduces resource usage, improves production efficiency and quality, and achieves complex and high-quality particle animations and special effects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120318387A_ABST
    Figure CN120318387A_ABST
Patent Text Reader

Abstract

The invention provides a cluster animation generation method and device, electronic equipment and a storage medium, and relates to the technical field of animation rendering. The method comprises the following steps: acquiring skeleton animation data of a role; calculating and updating vertex data on a GPU (Graphics Processing Unit) on the basis of the skeletal animation data, and generating a vertex texture and a static grid body; applying the position texture map and the normal texture map to the static grid body to obtain a role attitude; material control parameters corresponding to the static grid bodies of the application position texture map and the normal texture map are linked to a Niagara particle system; and repeatedly executing the steps S1-S4, and generating a cluster animation containing a plurality of roles. According to the cluster animation generation method, the problem that a large number of resources are consumed when a traditional skeleton animation system is used for generating the cluster animation is solved, on the premise that the equipment performance is not improved, resource occupation is greatly reduced, and the effect of improving the manufacturing efficiency and the manufacturing quality is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of animation rendering, and in particular, to a method, device, electronic device, and storage medium for generating cluster animations. Background Art

[0002] In the film and television production industry, character animations are generally processed through traditional skeletal animation systems. The skeletal animation system usually generates characters and controls their postures based on blueprints + skeletal body animations. However, when dealing with large-scale cluster animations (such as a large number of extras and special effects particles), due to performance bottlenecks in the equipment, this "blueprint + skeletal body animation" processing method often consumes a large amount of resources, and even causes the processing system to become unresponsive, thereby reducing production efficiency and making it difficult to achieve complex and high-quality dynamic effects.

[0003] In response to the above problems, there is currently no effective technical solution. Summary of the Invention

[0004] The purpose of the present invention is to provide a method, device, electronic device, and storage medium for generating cluster animations, which solves the problem of consuming a large amount of resources when using traditional skeletal animation systems to generate cluster animations. Without increasing the performance of the equipment, it significantly reduces resource occupancy and achieves the effects of improving production efficiency and production quality.

[0005] In a first aspect, the present invention provides a method for generating cluster animations, including the following steps: S1. Obtain the skeletal animation data of a character, where the skeletal animation data includes the skeletal body corresponding to the character and the animation file; S2. Based on the skeletal animation data, perform calculations and updates on vertex data on the GPU, and generate vertex textures and static meshes; the vertex textures include a position texture map containing vertex position offset data and a normal texture map containing normal direction change data; S3. After binding the position texture map and the normal texture map to the material system through a material function, apply the position texture map and the normal texture map to the static mesh to obtain the character posture; S4. Link the material control parameters corresponding to the static mesh to which the position texture map and the normal texture map are applied to the Niagara particle system, so as to bind the static mesh to the particle animation in the Niagara particle system, thereby dynamically controlling the character through the Niagara particle system; S5. Repeat steps S1 - S4 to generate a cluster animation including multiple characters.

[0006] The cluster animation generation method provided by the present invention abandons the use of traditional skeletal animation systems and instead generates characters and controls their poses in a "texture + static mesh" processing manner, generating cluster animations in a more efficient and cost-saving way while improving device performance.

[0007] Further, the specific steps in step S2 include: S21. According to the data of each frame of the animation file, use a preset first function to extract vertex position offset data and encode it as a color value and store it in the first color texture, and extract normal direction change data and encode it as a color value and store it in the second color texture; S22. Use a preset second function to obtain corresponding position texture maps and normal texture maps according to the first color texture and the second color texture; S23. Use a preset third function to extract corresponding static meshes from the skeleton body and bind the position texture maps and the normal texture maps to the static meshes.

[0008] Through these steps, vertex animation data is effectively prepared and organized to efficiently drive cluster animations on the GPU.

[0009] Further, the specific steps in step S22 include: Use the second function to perform the following steps: S221. Create texture resources with a specified resolution; S222. Write the first color texture into the texture resources to obtain a position texture; S223. Write the second color texture into the texture resources to obtain a normal texture; S224. Convert the position texture and the normal texture into a format suitable for GPU rendering to optimize the position texture and the normal texture, and obtain the position texture maps and the normal texture maps.

[0010] The optimized position texture maps and normal texture maps can be quickly read and efficiently processed during GPU rendering, improving the rendering performance of cluster animations.

[0011] Further, the third function is also used to create an animation sequence and associate the animation sequence with the position texture maps and the normal texture maps.

[0012] By performing the creation and association operations of the animation sequence through the third function, the problem of the lack of association between the animation sequence and the texture maps is solved, making the subsequent playback and control of animations more accurate and reliable.

[0013] Further, the specific steps in step S3 include: S31. Convert the vertex position offset data and the normal direction change data from the local space to the world space for representation; S32. According to the vertex position offset data represented in the world space, call the position texture map into the static mesh through the material function, and at the same time, according to the normal direction change data represented in the world space, call the normal texture map into the static mesh.

[0014] Further, the specific steps in step S4 include: S41. Bind the static mesh to the particle animation on the premise of ensuring that the particles in the particle animation are emitted only once and will not be deleted due to the life cycle.

[0015] Further, after step S5, it further includes: S6. Obtain the distance between the character and the camera, and when the distance exceeds a preset value, adjust the material accuracy in the material control parameters through the static mesh LOD technology to optimize the rendering performance.

[0016] In a second aspect, the present invention provides a cluster animation generation device, including: An acquisition module, configured to acquire the skeletal animation data of a character, where the skeletal animation data includes the skeleton body corresponding to the character and the animation file; A generation module, configured to perform calculations and updates on vertex data on the GPU based on the skeletal animation data, and generate vertex textures and static meshes; the vertex textures include a position texture map containing vertex position offset data and a normal texture map containing normal direction change data; An application module, configured to apply the position texture map and the normal texture map on the static mesh after binding the position texture map and the normal texture map to the material system through a material function to obtain the character pose; A control module, configured to link the material control parameters corresponding to the static mesh to which the position texture map and the normal texture map are applied to the Niagara particle system, so as to bind the static mesh to the particle animation in the Niagara particle system, thereby dynamically controlling the character through the Niagara particle system; A loop module, configured to repeatedly execute steps S1 - S4 to generate a cluster animation including multiple characters.

[0017] The cluster animation generation device provided by the present invention realizes efficient cluster animation generation through technical means such as GPU-accelerated vertex calculation, texture storage of animation data, material system-driven mesh deformation, and particle system linkage control, effectively solving the technical problem of low efficiency in traditional methods when dealing with large-scale cluster animations.

[0018] In a third aspect, the present invention provides an electronic device, including a processor and a memory, where the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps in the cluster animation generation method provided in the first aspect above are run.

[0019] In a fourth aspect, the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps in the cluster animation generation method provided in the first aspect above are run.

[0020] As can be seen from the above, in the cluster animation generation method provided by the present invention, the vertex texture technology directly calculates and updates vertex data on the GPU, reducing the resource occupancy of the CPU and avoiding the performance limitation of the CPU; at the same time, the characters are generated and the character postures are controlled in the way of "texture map + static mesh" (driving the static mesh animation through programmatically generated texture maps), abandoning the traditional skeletal animation system, and realizing the production of cluster animations in a way with lower resource occupancy and higher processing efficiency; in addition, combined with the Niagara system, complex and high-quality particle animations and special effects can be more easily realized without improving the device performance.

[0021] Other features and advantages of the present invention will be described in the subsequent description, and part of them will become obvious from the description, or be understood by implementing the embodiments of the present invention. The objectives and other advantages of the present invention can be realized and obtained through the structures specifically pointed out in the written description and the drawings. Description of the Drawings

[0022] Figure 1 It is a flowchart of a cluster animation generation method provided by an embodiment of the present invention.

[0023] Figure 2 It is the skeletal animation data of a certain character in an embodiment of the present invention.

[0024] Figure 3 It is the character posture before applying the position texture map and the normal texture map to the static mesh in an embodiment of the present invention.

[0025] Figure 4 It is the character posture after applying the position texture map and the normal texture map to the static mesh in an embodiment of the present invention.

[0026] Figure 5 This is an example of generating a cluster animation containing a large number of characters in an embodiment of the present invention.

[0027] Figure 6 This is a schematic structural diagram of a cluster animation generation device provided in an embodiment of the present invention.

[0028] Figure 7 This is a schematic structural diagram of an electronic device provided in an embodiment of the present invention.

[0029] Label description: 100, acquisition module; 200, generation module; 300, application module; 400, control module; 500, loop module; 13, electronic device; 1301, processor; 1302, memory; 1303, communication bus. Specific implementation manners

[0030] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Usually, the components of the embodiments of the present invention described and illustrated herein can be arranged and designed in various different configurations. 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 claimed present invention, but merely represents the selected embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts fall within the scope of protection of the present invention.

[0031] It should be noted that similar reference numerals and letters indicate similar items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of the present invention, terms such as "first" and "second" are only used for distinguishing descriptions and cannot be understood as indicating or implying relative importance.

[0032] Refer to the attached Figure 1 、attached Figure 2 、attached Figure 3 、attached Figure 4 、and attached Figure 5 , the present invention provides a method for generating a cluster animation, including the following steps: S1. Obtain the skeletal animation data of the character, where the skeletal animation data includes the skeletal body corresponding to the character and the animation file; S2. Based on the skeletal animation data, perform calculations and updates on the vertex data on the GPU, and generate vertex textures and static meshes; the vertex textures include a position texture map containing vertex position offset data and a normal texture map containing normal direction change data; S3. After binding the position texture map and the normal texture map to the material system through a material function, apply the position texture map and the normal texture map to the static mesh to obtain the character pose; S4. Link the material control parameters corresponding to the static mesh with the applied position texture map and normal texture map to the Niagara particle system, so that the static mesh is bound to the particle animation in the Niagara particle system, thereby dynamically controlling the character through the Niagara particle system; S5. Repeat steps S1 - S4 to generate a cluster animation containing multiple characters.

[0033] In step S1, the way to obtain the skeletal animation data can be to read the pre - stored skeletal animation data file from the local file system, or download the skeletal animation data from a remote server through a network connection. The skeletal body is the skeletal structure information of the character. For example, the hierarchical relationship and initial pose of the skeletal nodes. The animation file is a file that describes the movement information of the character's skeleton over time. For example, key - frame data, skinning weight data, or fbx files containing actions such as running and walking.

[0034] In step S2, the calculation and update of the vertex data are executed in parallel on the GPU, thereby accelerating the calculation process and improving the efficiency of generating vertex textures and static meshes. The vertex position offset data is encoded as a color value and stored in the position texture map. The normal direction change data is encoded as a color value and stored in the normal texture map. The static mesh is the initial mesh model extracted from the skeletal body and does not contain animation information.

[0035] In step S3, the material function is a pre - defined shader code snippet used to process texture data in the material system. The position texture map and the normal texture map are passed to the material system through the material function for use when rendering the static mesh. The static mesh deforms by applying the position texture map and the normal texture map, thereby presenting the animated character pose.

[0036] In step S4, the Niagara particle system is a particle effect system in the Unreal Engine used to create and control particle animations. The material control parameters corresponding to the static mesh, such as the parameters controlling the sampling of the position texture map, are linked to the Niagara particle system. Thus, the Niagara particle system can control the animation playback and dynamic effects of the static mesh, realizing the synchronization and linkage of particle animations and character animations.

[0037] In step S5, by repeating steps S1 - S4, multiple characters with different animations or the same animation can be generated, thereby realizing the cluster animation effect containing a large number of characters.

[0038] Specifically, the cluster animation generation method proposed in this application aims to solve the problem of low efficiency in the processing of large-scale cluster animations by traditional skeletal animation systems. This method first obtains character skeletal animation data, including the skeletal body and animation files, providing a data basis for subsequent animation generation. Then, vertex data is calculated and updated based on the skeletal animation data on the GPU, and vertex textures and static meshes are generated. The vertex textures include position texture maps and normal texture maps, which store vertex position offset data and normal direction change data respectively. This step transfers the animation calculation to GPU parallel processing, improving the calculation efficiency and making it possible to generate large-scale cluster animations in real time. Next, the position texture map and the normal texture map are bound to the material system through a material function, and these texture maps are applied to the static mesh, thereby obtaining the character pose. This step realizes driving the deformation of the static mesh by animation data and is the core of character animation generation. In actual application, by replacing these texture maps, the character pose can be changed, thereby controlling the character to show different actions. This control method of replacing texture maps occupies less resources compared to the traditional method of controlling skeletal data, which is beneficial to the smooth rendering of different actions of millions of characters. After that, the material control parameters of the static mesh are linked to the Niagara particle system, binding the static mesh to the particle animation, and the character is dynamically controlled through the Niagara particle system. This step realizes the linkage between the animation and the particle special effects, enhancing the dynamic effect and expressiveness of the animation. Finally, steps S1 - S4 are repeatedly executed to generate a cluster animation containing a large number of characters, reflecting the application value of this method in cluster animation generation. In summary, the technical solution proposed in this application realizes efficient cluster animation generation through technical means such as GPU-accelerated vertex calculation, texture storage of animation data, material system-driven mesh deformation, and particle system linkage control, effectively solving the technical problem of low efficiency in the traditional method when dealing with large-scale cluster animations.

[0039] In some specific embodiments, the cluster animation generation method is applied to the production of large-scale character animations in a game scene. First, an art designer creates multiple character models and binds skeletons and skins to each character model. An animator designs different animation sequences for each character, such as walking, running, jumping, etc. A technician imports the character models and animation data into the game engine. Using the cluster animation generation method proposed in this application, for each character, steps S1 - S4 are executed to generate the corresponding vertex texture and static mesh, and the material control parameters are linked to the Niagara particle system. When large-scale cluster animations need to be displayed in the game scene, for example, a scene where soldiers charge on the battlefield, step S5 is repeatedly executed to instantiate a large number of static mesh characters and use the Niagara particle system to uniformly control the animation playback and special effect display of these characters. Thus, high-quality and high-efficiency large-scale cluster animation effects can be achieved while ensuring the smooth running of the game.

[0040] In certain embodiments, the specific steps in step S2 include: S21. According to the data of each frame of the animation file, using a preset first function, extract the vertex position offset data and encode it as a color value and store it in the first color texture, and extract the normal direction change data and encode it as a color value and store it in the second color texture; S22. Using a preset second function, obtain the corresponding position texture map and normal texture map according to the first color texture and the second color texture; S23. Using a preset third function, extract the corresponding static mesh from the skeleton body and bind the position texture map and the normal texture map to the static mesh.

[0041] In step S21, the data of each frame of the animation file is read, and the preset first function is used to extract the vertex position offset data and the normal direction change data from each frame of data. The vertex position offset data and the normal direction change data are then respectively encoded as color values. The encoded vertex position offset data is stored in the first color texture, and the encoded normal direction change data is stored in the second color texture.

[0042] In step S22, the preset second function is used to process the first color texture and the second color texture to generate the position texture map and the normal texture map. Specifically, the second function can perform operations such as conversion and formatting of color values to texture data to generate texture maps that can be efficiently read and processed by the GPU.

[0043] In step S23, a preset third function is used to extract a static mesh from the skeleton corresponding to the character. The static mesh represents the basic model structure of the character. The extracted static mesh is then bound to the position texture map and normal texture map generated in step S22. This binding enables the texture map to drive the vertex animation of the static mesh.

[0044] Specifically, to more clearly implement the calculation and update of vertex data, step S2 is refined into S21, S22, and S23. In step S21, the animation data is parsed, and the vertex position offset and normal direction change information are extracted and converted into a color texture. This conversion is to utilize the ability of the texture to store and the GPU to process the color texture in parallel. Step S22 is responsible for converting the color texture into the position texture map and normal texture map finally used for rendering, ensuring that the texture format is compatible with the GPU rendering pipeline. Step S23 focuses on the preparation of the static mesh and texture binding, preparing for subsequent animation driving. Through these steps, the skeletal animation data is effectively prepared and organized to efficiently drive the cluster animation on the GPU.

[0045] In some specific embodiments, the first function can be a data parsing script configured to read a specific animation file format, such as an FBX file or a glTF file. The vertex position offset data and normal direction change data can be encoded as RGB color values, where the red channel, green channel, and blue channel respectively represent the offset or change amount in the X-axis, Y-axis, and Z-axis directions. The second function can include texture creation and data writing operations, such as using a graphics API like DirectX or OpenGL to create a 2D texture with a specified resolution and writing the color texture data into the pixel data of the texture. The third function can utilize the API provided by the game engine or 3D modeling software, such as the mesh extraction function of Unreal Engine or Unity, to extract the static mesh from the skeletal resources and bind the position texture map and normal texture map to the material of the static mesh through the material interface. Thus, a specific implementation method for efficiently generating and applying vertex textures on the GPU to drive the cluster animation is provided.

[0046] In certain embodiments, the specific steps in step S22 include: Executing the following steps using the second function: S221. Create a texture resource with a specified resolution; S222. Write the first color texture into the texture resource to obtain a position texture; S223. Write the second color texture into the texture resource to obtain a normal texture; S224. Convert the position texture and the normal texture into formats suitable for GPU rendering to optimize the position texture and the normal texture, and obtain the position texture map and the normal texture map.

[0047] In step S221, create a texture resource as a container for storing texture data. Set a specified resolution to meet the storage requirements of the vertex position offset data and the normal direction change data.

[0048] In steps S222 and S223, the first color texture and the second color texture are respectively written into the texture resource. Thus, the color-coded position offset data and the normal change data are converted into the position texture and the normal texture that can be stored and processed by the texture resource.

[0049] In step S224, convert the formats of the position texture and the normal texture to meet the format requirements of GPU rendering. Further, through format conversion, the texture data is optimized, such as data compression or rearrangement, to improve the GPU reading and processing efficiency, and finally generate the position texture map and the normal texture map.

[0050] Specifically, this embodiment aims to solve the problem that directly using color textures may not be suitable for GPU rendering, affecting the rendering efficiency and performance. In this embodiment, a texture resource is created in step S221 to provide storage space for subsequent writing of texture data. In steps S222 and S223, the data in the first color texture and the second color texture are transferred to the texture resource to initially form the position texture and the normal texture. The key lies in step S224. By performing format conversion and optimization operations, the position texture and the normal texture can exist in a format that can be processed more efficiently by the GPU. Thus, the optimized position texture map and normal texture map can be quickly read and efficiently processed during GPU rendering, improving the rendering performance of the cluster animation.

[0051] In some specific embodiments, the texture resource can be a 2D texture. The specified resolution can be determined according to the number of vertices of the character mesh model and the number of animation frames. For example, it can be set to 256x256 or larger. In step S224, the format conversion can include converting the texture format from a format for the CPU to a format for the GPU. For example, convert the texture format to floating-point formats such as R32F or RGBA32F to improve data accuracy and rendering efficiency. The optimization can include performing texture compression, such as DXT compression, to reduce texture memory occupancy and bandwidth requirements, or generating mipmaps to optimize the rendering quality and performance at different viewing distances. As a preferred embodiment, step S224 can utilize the GPU hardware acceleration function for texture format conversion and optimization to further improve the processing speed.

[0052] In some embodiments, the third function is further configured to create an animation sequence and associate the animation sequence with a position texture map and a normal texture map.

[0053] The animation sequence creation process may be as follows: predefined animation frame rate and total animation duration are used to determine the total number of animation frames; then, a container for storing animation data of each frame, such as an array or a list, is created according to the total number of frames; the animation sequence association process may be: establishing a reference relationship between the created animation sequence object and the position texture map and the normal texture map, for example, by means of a pointer or an ID index, so that when accessing or using the texture map, the corresponding animation sequence can be indexed, ensuring that the texture map is played and applied in the frame order of the animation sequence.

[0054] Specifically, while extracting the static mesh from the skeletal body, the third function further performs the following steps: first, initializes an animation sequence data structure according to preset animation parameters, and this data structure is used to store the frame data and playback control information of the animation; then, adds the generated position texture map and normal texture map to this animation sequence data structure as the frame data of the animation sequence; thus, a clear association is established between the animation sequence and the position texture map and the normal texture map, ensuring that during the subsequent animation playback process, the texture map can be called and rendered according to the correct frame order and time axis, thereby driving the static mesh to present continuous and correct animation effects; by executing the creation and association operations of the animation sequence through the third function, the problem of lack of association between the animation sequence and the texture map is solved, making the subsequent animation playback and control more accurate and reliable.

[0055] In some specific embodiments, the animation sequence may be created as a texture set resource containing multiple texture frames, and each texture frame stores the vertex position offset data and normal direction change data of one frame in the animation sequence; when creating the animation sequence, the third function arranges the generated position texture map and normal texture map in the order of animation frames and stores them in the texture set resource; when associating the animation sequence, stores the index information of the texture set resource in the attributes of the static mesh; when the material system needs to apply the animation sequence, obtains the index of the texture set resource by accessing the attributes of the static mesh, and reads the corresponding texture frame from the texture set resource according to the current animation frame index to implement the playback of the animation sequence; thus, the creation and association process of the animation sequence is specifically the organization and indexing process of the texture set resource, making the association between the animation data and the static mesh closer and more efficient.

[0056] In some embodiments, the specific steps in step S3 include: S31. Converting the vertex position offset data and the normal direction change data from the local space to the world space for representation; S32. According to the vertex position offset data represented in world space, the position texture map is called into the static mesh through a material function. At the same time, according to the normal direction change data represented in world space, the normal texture map is called into the static mesh.

[0057] In step S31, the conversion of the vertex position offset data and the normal direction change data from local space to world space can be achieved through matrix transformation. Specifically, the vertex position and normal direction in local space can be multiplied by the world space transformation matrix to obtain their representations in world space. The world space transformation matrix can include transformations such as rotation, translation, and scaling, which reflect the position, orientation, and size of the character in the world coordinate system.

[0058] In step S32, the material function, as a pre-defined program code in the material system, is used to control the rendering method of the material. The position texture map and the normal texture map are sampled through the material function, and the data in the texture can be used to modify the vertex position and normal direction of the static mesh. The material function can receive the vertex position in world space as input, find the corresponding texture data based on this position, and then apply the texture data to the static mesh.

[0059] Specifically, for the situation where applying the vertex position offset data and the normal direction change data in local space may cause problems in world space rendering and interaction, this embodiment proposes a specific implementation method of applying vertex texture maps in world space. In step S31, the vertex position offset data and the normal direction change data are first converted to world space. This conversion is necessary because subsequent rendering and special effect processing are usually carried out in world space. For example, lighting calculations, shadow casting, particle effects, etc. all need to be correctly executed under a unified world coordinate system. If the vertex data remains in local space, then these world space special effects may not be correctly applied to the character model, resulting in visual effect errors. In step S32, the vertex position offset data represented in world space is used to call the position texture map into the static mesh through the material function, and at the same time, the normal direction change data represented in world space is used to call the normal texture map into the static mesh. In this way, the character pose is accurately presented in world space. This method ensures the correctness and consistency of the character animation in world space, enables the character to interact naturally with other elements in the scene, and thus improves the overall visual quality and realism of the cluster animation.

[0060] In some specific embodiments, for step S31, the conversion of vertex position offset data and normal direction change data from local space to world space can be achieved by the following method: First, obtain the world space transformation matrix of the character model, which contains the position, rotation, and scaling information of the character in world space. Then, for each vertex, multiply its local space coordinates and normal direction by the world space transformation matrix. As a result, the coordinates and normal direction of the vertex are converted into world space. For step S32, the material function can be a custom material node that receives the world space vertex position as input and samples the position texture map and normal texture map based on this position. The sampled texture data is used to update the vertex position and normal direction of the static mesh. The material function is executed on the GPU, ensuring the rapid application of vertex texture mapping.

[0061] In certain embodiments, the specific steps in step S4 include: S41. Bind the static mesh to the particle animation while ensuring that the particles in the particle animation are emitted only once and will not be deleted due to their life cycle.

[0062] The fact that the particles in the particle animation are emitted only once means that the particle system is configured to generate particle emissions only once at the initial stage, rather than continuously or periodically. The particles not being deleted due to their life cycle means that the management of the particle life cycle is set such that once a particle is generated, it exists permanently, or its life cycle is set to an extremely long value so that it does not end within the duration of the animation. As a preferred embodiment, in the Niagara particle system, the emission mode of the particle system is set to the single burst mode, and the life cycle of the particles is set to infinite or an extremely long value sufficient to cover the entire animation duration. Thus, when the particle system is started, after each particle is created, it will persist and will not be automatically removed by the system.

[0063] Specifically, to ensure the stability of the binding relationship between the static mesh and the particle animation, first, it is necessary to configure the particle system so that the particle emission module is set to single emission, and the emission quantity is equal to the number of characters in the cluster animation. Second, it is necessary to disable the particle life cycle module or set the particle life cycle to a value much larger than the animation duration. Through the above configuration, after the particles are created during the initialization of the particle system, they will persist. After each static mesh is bound to a particle, this binding relationship remains unchanged throughout the animation process. Thus, it avoids the dynamic generation and deletion of particles caused by improper management of the particle life cycle, and further solves the problem of unexpected disappearance or abnormal behavior of characters in the cluster animation, ensuring the stability and predictability of the cluster animation effect.

[0064] In some specific embodiments, when creating a cluster animation in the Niagara particle system of the Unreal Engine, the emitter of the particle system is configured to use the "Burst Instantaneous" mode, and the "Burst Count" parameter is set to the required number of characters. Remove the life cycle module of the particles, or set the life cycle parameter to a very large value such as 9999 seconds. A static mesh renderer is added to the particle system, and the static mesh resource is specified as the character model. Material control parameters, such as parameters related to vertex position offset and normal direction change, are linked to the particle attributes through Niagara's parameter binding system, thus realizing the binding of the static mesh and the particle animation.

[0065] In some embodiments, after step S5, the following is further included: S6. Obtain the distance between the character and the camera, and when the distance exceeds a preset value, adjust the material accuracy in the material control parameters through the static mesh LOD technology to optimize the rendering performance.

[0066] In step S6, obtaining the distance between the character and the camera is used to determine whether the character needs LOD optimization. The preset value serves as a distance threshold to define whether the character is far from the camera. When the distance between the character and the camera exceeds the preset value, it indicates that the character occupies a relatively small proportion in the picture and the details are not obvious. At this time, the static mesh LOD technology is started. The static mesh LOD technology realizes optimization by adjusting the material accuracy in the material control parameters. The adjustment of the material accuracy can include ways such as reducing the texture resolution, simplifying the lighting calculation, and reducing the material channels. The reduction of the material accuracy reduces the GPU rendering burden, thereby optimizing the rendering performance.

[0067] Specifically, step S6 adds a distance-based LOD optimization technology on the basis of the cluster animation generation method. First, step S6 obtains the distance between each character and the camera in real time. Then, this distance is compared with the preset value, and the preset value can be set according to the actual application scenario and performance requirements. For example, the preset value can be set to 10 meters. When the distance between the character and the camera is greater than 10 meters, it is determined that the character needs LOD optimization. Then, the system automatically adjusts the material control parameters of the character to reduce the material accuracy. For example, the original material uses a 2K texture, and after optimization, it can be switched to a 1K texture. Another example is that the original material uses a high-precision lighting model, and after optimization, it can be switched to a low-precision lighting model. The reduction of the material accuracy reduces the calculation amount when the GPU renders the character, thereby achieving the purpose of optimizing the rendering performance and improving the rendering efficiency. Through step S6, the optimization of the rendering performance is realized on the premise of ensuring the animation effect. Especially in scenarios with a large number of characters and frequent changes in the perspective, the optimization effect is significant.

[0068] In some specific embodiments, the preset value is set to 5 meters. When step S6 is executed, first, the Euclidean distance between the center point of each character in the scene and the camera is calculated. If the calculated distance value is greater than 5 meters, LOD optimization is applied to the character. The LOD optimization is specifically achieved by adjusting the "texture sampling quality" parameter in the material sphere, reducing the "texture sampling quality" parameter from the "high" gear to the "medium" gear, thereby reducing the material precision, decreasing the texture sampling times, and optimizing the rendering performance. Conversely, if the distance between the character and the camera is less than or equal to 5 meters, the material parameters remain unchanged to maintain the high-precision rendering effect.

[0069] Please refer to Figure 6 , Figure 6 which is a cluster animation generation device in some embodiments of the present invention. The cluster animation generation device is integrated in the backend control device in the form of a computer program and includes: An acquisition module 100 for acquiring the skeletal animation data of the character. The skeletal animation data includes the skeletal body corresponding to the character and the animation file; A generation module 200 for performing calculations and updates on vertex data on the GPU based on the skeletal animation data and generating vertex textures and static meshes; the vertex textures include a position texture map containing vertex position offset data and a normal texture map containing normal direction change data; An application module 300 for applying the position texture map and the normal texture map on the static mesh after binding the position texture map and the normal texture map to the material system through a material function to obtain the character pose; A control module 400 for linking the material control parameters corresponding to the static mesh to which the position texture map and the normal texture map are applied to the Niagara particle system, so as to bind the static mesh to the particle animation in the Niagara particle system, thereby dynamically controlling the character through the Niagara particle system; A loop module 500 for repeatedly running the above modules to generate a cluster animation including multiple characters.

[0070] In certain embodiments, when the generation module 200 is used to perform calculations and updates on vertex data on the GPU based on the skeletal animation data and generate vertex textures and static meshes, it executes: S21. According to the data of each frame of the animation file, using a preset first function, extracting vertex position offset data and encoding it as a color value and storing it in the first color texture, and extracting normal direction change data and encoding it as a color value and storing it in the second color texture; S22. Using a preset second function, obtaining the corresponding position texture map and normal texture map according to the first color texture and the second color texture; S23. Use a preset third function to extract the corresponding static mesh from the skeletal body, and bind the position texture map and the normal texture map to the static mesh.

[0071] In some embodiments, when the generation module 200 is used to obtain the corresponding position texture map and normal texture map according to the first color texture and the second color texture by using a preset second function, it performs: S221. Create a texture resource with a specified resolution; S222. Write the first color texture into the texture resource to obtain a position texture; S223. Write the second color texture into the texture resource to obtain a normal texture; S224. Convert the position texture and the normal texture into a format suitable for GPU rendering to optimize the position texture and the normal texture, and obtain a position texture map and a normal texture map.

[0072] In some embodiments, when the application module 300 is used to apply the position texture map and the normal texture map on the static mesh to obtain a character pose after binding the position texture map and the normal texture map to the material system through a material function, it performs: S31. Convert the vertex position offset data and the normal direction change data from the local space to the world space for representation; S32. According to the vertex position offset data represented in the world space, call the position texture map into the static mesh through a material function, and at the same time, according to the normal direction change data represented in the world space, call the normal texture map into the static mesh.

[0073] In some embodiments, when the control module 400 is used to link the material control parameters corresponding to the static mesh to which the position texture map and the normal texture map are applied to the Niagara particle system, so as to bind the static mesh to the particle animation in the Niagara particle system, and thus perform dynamic control on the character through the Niagara particle system, it performs: S41. Bind the static mesh to the particle animation on the premise of ensuring that the particles in the particle animation are emitted only once and will not be deleted due to the life cycle.

[0074] In some embodiments, after the loop module 500 is used to repeatedly run the above modules to generate a cluster animation containing multiple characters, it performs: S6. Obtain the distance between the character and the camera, and when the distance exceeds a preset value, adjust the material accuracy in the material control parameters through the static mesh LOD technology to optimize the rendering performance.

[0075] Please refer to Figure 7 ,Figure 7 The following is a schematic structural diagram of an electronic device provided by an embodiment of the present invention. The present invention provides an electronic device 13, including: a processor 1301 and a memory 1302. The processor 1301 and the memory 1302 are interconnected and communicate with each other through a communication bus 1303 and / or other forms of connection mechanisms (not shown). The memory 1302 stores computer-readable instructions executable by the processor 1301. When the electronic device runs, the processor 1301 executes the computer-readable instructions to execute the cluster animation generation method in any optional implementation manner of the above embodiment to achieve the following functions: obtaining the skeletal animation data of the character, where the skeletal animation data includes the skeleton body corresponding to the character and the animation file; based on the skeletal animation data, performing calculations and updates on vertex data on the GPU, and generating vertex textures and static meshes; the vertex textures include a position texture map containing vertex position offset data and a normal texture map containing normal direction change data; after binding the position texture map and the normal texture map to the material system through a material function, applying the position texture map and the normal texture map on the static mesh to obtain the character pose; linking the material control parameters corresponding to the static mesh to which the position texture map and the normal texture map are applied to the Niagara particle system, so that the static mesh is bound to the particle animation in the Niagara particle system, thereby dynamically controlling the character through the Niagara particle system; repeating steps S1 - S4 to generate a cluster animation including multiple characters.

[0076] An embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it executes the cluster animation generation method in any optional implementation manner of the above embodiment to achieve the following functions: obtaining the skeletal animation data of the character, where the skeletal animation data includes the skeleton body corresponding to the character and the animation file; based on the skeletal animation data, performing calculations and updates on vertex data on the GPU, and generating vertex textures and static meshes; the vertex textures include a position texture map containing vertex position offset data and a normal texture map containing normal direction change data; after binding the position texture map and the normal texture map to the material system through a material function, applying the position texture map and the normal texture map on the static mesh to obtain the character pose; linking the material control parameters corresponding to the static mesh to which the position texture map and the normal texture map are applied to the Niagara particle system, so that the static mesh is bound to the particle animation in the Niagara particle system, thereby dynamically controlling the character through the Niagara particle system; repeating steps S1 - S4 to generate a cluster animation including multiple characters.

[0077] Among them, the computer-readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM for short), electrically erasable programmable read-only memory (EEPROM for short), erasable programmable read-only memory (EPROM for short), programmable read-only memory (PROM for short), read-only memory (ROM for short), magnetic memory, flash memory, magnetic disks or optical discs.

[0078] In the embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For another 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 displayed or discussed couplings or direct couplings or communication connections to each other can be through some communication interfaces. The indirect couplings or communication connections of the devices or units can be electrical, mechanical or other forms.

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

[0080] Furthermore, in each embodiment of the present invention, the functional modules can be integrated together to form an independent part, or each module can exist alone, or two or more modules can be integrated to form an independent part.

[0081] In this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations.

[0082] The above are only the embodiments of the present invention and are not intended to limit the protection scope of the present invention. For those skilled in the art, the present invention may have various modifications and changes. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.

Claims

1. A method for generating cluster animations, characterized in that, It includes the following steps: S1. Obtain the skeletal animation data of the character, where the skeletal animation data includes the skeletal body corresponding to the character and the animation file; S2. Based on the skeletal animation data, perform calculations and updates on vertex data on the GPU, and generate vertex textures and static meshes; the vertex textures include a position texture map containing vertex position offset data and a normal texture map containing normal direction change data; S3. After binding the position texture map and the normal texture map to the material system through a material function, apply the position texture map and the normal texture map to the static mesh to obtain the character pose; S4. Link the material control parameters corresponding to the static mesh to which the position texture map and the normal texture map are applied to the Niagara particle system, so that the static mesh is bound to the particle animation in the Niagara particle system, thereby dynamically controlling the character through the Niagara particle system; S5. Repeat steps S1 - S4 to generate a cluster animation containing multiple characters.

2. The cluster animation generation method according to claim 1, wherein The specific steps in step S2 include: S21. According to the data of each frame of the animation file, use a preset first function to extract vertex position offset data and encode it as a color value and store it in a first color texture, and extract normal direction change data and encode it as a color value and store it in a second color texture; S22. Use a preset second function to obtain the corresponding position texture map and normal texture map according to the first color texture and the second color texture; S23. Use a preset third function to extract the corresponding static mesh from the skeletal body, and bind the position texture map and the normal texture map to the static mesh.

3. The cluster animation generation method according to claim 2, wherein The specific steps in step S22 include: Execute the following steps using the second function: S221. Create a texture resource with a specified resolution; S222. Write the first color texture into the texture resource to obtain a position texture; S223. Write the second color texture into the texture resource to obtain a normal texture; S224. Convert the position texture and the normal texture into a format suitable for GPU rendering to optimize the position texture and the normal texture, and obtain the position texture map and the normal texture map.

4. The method for generating cluster animations according to claim 2, wherein, The third function is also used to create an animation sequence and associate the animation sequence with the position texture map and the normal texture map.

5. The cluster animation generation method according to claim 1, wherein The specific steps in step S3 include: S31. Convert the vertex position offset data and the normal direction change data from local space to world space for representation; S32. According to the vertex position offset data represented in world space, call the position texture map into the static mesh through the material function, and at the same time, according to the normal direction change data represented in world space, call the normal texture map into the static mesh.

6. The method for generating cluster animations according to claim 1, wherein, The specific steps in step S4 include: S41. Bind the static mesh to the particle animation while ensuring that the particles in the particle animation are emitted only once and are not deleted due to the life cycle.

7. The method for generating cluster animations according to claim 1, wherein After step S5, it further includes: S6. Obtain the distance between the character and the camera, and when the distance exceeds a preset value, adjust the material accuracy in the material control parameters through the static mesh LOD technology to optimize the rendering performance.

8. A cluster animation generation device, characterized in that It includes: An acquisition module for acquiring the skeletal animation data of the character, where the skeletal animation data includes the skeletal body corresponding to the character and the animation file; A generation module for performing calculations and updates on vertex data on the GPU based on the skeletal animation data and generating vertex textures and static meshes; the vertex textures include a position texture map containing vertex position offset data and a normal texture map containing normal direction change data; An application module for applying the position texture map and the normal texture map on the static mesh after binding the position texture map and the normal texture map to the material system through a material function to obtain the character pose; A control module for linking the material control parameters corresponding to the static mesh to which the position texture map and the normal texture map are applied to the Niagara particle system, so as to bind the static mesh to the particle animation in the Niagara particle system, thereby dynamically controlling the character through the Niagara particle system; A loop module for repeatedly executing steps S1 - S4 to generate a cluster animation including multiple characters.

9. An electronic device, characterized in that, It includes a processor and a memory, and the memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, the steps in the cluster animation generation method according to any one of claims 1 - 7 are run.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, the steps in the cluster animation generation method according to any one of claims 1 - 7 are run.

Citation Information

Cited By

  • Performance optimization method based on UE5 modular role

    CN120953451A