Cloth animation rendering method and device, equipment, medium and product
Patent Information
- Application Number
- CN202511835970.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-05
- Publication Date
- 2026-03-06
Smart Images

Figure CN121616718A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of game technology, and in particular to a method, apparatus, device, medium and product for rendering cloth animation. Background Technology
[0002] With the rapid development of digital content industries such as games and film, the application scenarios of 3D cloth animation are becoming increasingly widespread, and users are placing higher demands on the visual realism, detail, and smoothness of cloth animation. 3D cloth animation uses technical means to simulate the movement of cloth in a real environment, including deformation based on physical properties, swaying under force, and collision response with other models, ultimately achieving a dynamic display effect that fits the needs of the scene.
[0003] Currently, the rendering method for cloth animation mainly involves solving the physical behaviors of cloth, such as collision and bounce, in real time during application operation to dynamically generate animation effects, thereby achieving real-time physical calculation animation.
[0004] However, this real-time physics-based animation method requires continuous physics solving during runtime, which places a significant burden on the client, increases the resource consumption and production costs of cloth animation, and has weak artistic controllability, making it prone to issues such as cloth clipping onto the model. It is also difficult to adapt to more diverse needs, reduces the fidelity and applicability of cloth animation, and increases maintenance costs. Summary of the Invention
[0005] This invention provides a method, apparatus, equipment, medium, and product for rendering cloth animation, in order to solve the problems of low fidelity, high production cost, high maintenance cost, high resource consumption, and low applicability of cloth animation.
[0006] According to one aspect of the present invention, a method for rendering cloth animation is provided, the method comprising:
[0007] Obtain the first texture map data pre-generated for the cloth animation; wherein, the first texture map data contains the vertex encoding data corresponding to each cloth mesh vertex in each animation frame of the cloth animation;
[0008] According to the playback progress of the cloth animation, the vertex encoding data corresponding to each cloth mesh vertex in the current animation frame to be displayed is sampled from the first texture map data, and the vertex encoding data corresponding to each cloth mesh vertex in the current animation frame to be displayed is decoded to obtain the vertex data corresponding to each cloth mesh vertex in the current animation frame to be displayed.
[0009] The current animation frame to be displayed is generated by rendering based on the vertex data corresponding to each cloth mesh vertex in the current animation frame to be displayed.
[0010] According to another aspect of the present invention, a cloth animation rendering apparatus is provided, the apparatus comprising:
[0011] The texture acquisition module is used to acquire the first texture map data pre-generated for the cloth animation; wherein, the first texture map data includes the vertex encoding data corresponding to each cloth mesh vertex in each animation frame of the cloth animation;
[0012] The vertex decoding module is used to sample vertex encoding data corresponding to each cloth mesh vertex in the current animation frame to be displayed from the first texture map data according to the playback progress of the cloth animation, and decode the vertex encoding data corresponding to each cloth mesh vertex in the current animation frame to be displayed to obtain vertex data corresponding to each cloth mesh vertex in the current animation frame to be displayed.
[0013] The animation frame rendering module is used to render and generate the current animation frame to be displayed based on the vertex data corresponding to each cloth mesh vertex in the current animation frame to be displayed.
[0014] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0015] At least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the cloth animation rendering method according to any embodiment of the present invention.
[0016] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the cloth animation rendering method according to any embodiment of the present invention.
[0017] According to another aspect of the present invention, a computer program product is also provided, including a computer program that, when executed by a processor, implements the steps of the method as described in any embodiment of the present invention.
[0018] The technical solution of this invention obtains pre-generated first texture map data containing vertex encoding data of each animation frame, samples and decodes the current frame's vertex data according to the playback progress, and then renders it. The client does not need to perform complex real-time cloth physics calculations; vertex data can be obtained only through texture sampling and simple decoding operations. This effectively avoids frame rate fluctuations and stuttering caused by excessive client load, significantly reducing resource consumption during client operation. Simultaneously, the first texture map data integrates full-frame vertex encoding data and supports efficient compression transmission, reducing data loading overhead and waiting time, accelerating animation loading and startup speeds, and optimizing the user experience. Furthermore, the decoded data accurately restores the physical properties and details of the cloth, ensuring the visual fidelity and stability of the animation. Combined with the cross-platform universality of texture data, it can adapt to different hardware, systems, and application scenarios, improving the applicability and practicality of the solution. While ensuring high animation fidelity, it shortens the animation production cycle, reduces production and maintenance costs, and allows for batch processing of large amounts of cloth animation, improving its applicability.
[0019] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 This is a flowchart of a cloth animation rendering method according to Embodiment 1 of the present invention;
[0022] Figure 2 This is a schematic diagram of a character skin model and cloth model with added dynamic force fields applicable to an embodiment of the present invention;
[0023] Figure 3 This is a rendering of a character skin model and cloth model applicable to an embodiment of the present invention;
[0024] Figure 4 This is a flowchart of another cloth animation rendering method provided in Embodiment 2 of the present invention;
[0025] Figure 5 This is a flowchart of another cloth animation rendering method provided in Embodiment 3 of the present invention;
[0026] Figure 6 This is a schematic diagram of the structure of a cloth animation rendering device provided in Embodiment 4 of the present invention;
[0027] Figure 7 This is a schematic diagram of the structure of an electronic device that implements the cloth animation rendering method of the present invention. Detailed Implementation
[0028] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0029] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0030] Example 1
[0031] Figure 1 This is a flowchart of a cloth animation rendering method provided in Embodiment 1 of the present invention. This embodiment is applicable to the rendering of cloth animation. The method can be executed by a cloth animation rendering device, which can be implemented in hardware and / or software and is generally configured in an electronic device.
[0032] Correspondingly, such as Figure 1 As shown, the method includes:
[0033] S110, Obtain the first texture map data pre-generated for cloth animation.
[0034] The first texture map data contains vertex encoding data corresponding to each cloth mesh vertex in each animation frame of the cloth animation.
[0035] In this embodiment of the invention, the first texture map data can be specifically understood as: a two-dimensional texture asset that integrates the vertex encoding data of all animation frames of the cloth animation. Through the mapping relationship between texture pixels, animation frames, and vertices, the temporal encoded data is stored in a structured manner, supporting efficient sampling and compressed transmission. Specifically, the texture asset can be understood as: a reusable digital resource stored in a standardized texture format in digital content creation (such as games, films, or virtual simulations).
[0036] An animation frame can be understood as the basic unit that constitutes cloth animation (e.g., 24 frames per second animation contains 24 consecutive frames), and each animation frame corresponds to the static form of the cloth at a specific point in time.
[0037] Cloth mesh vertices can be understood as the basic building blocks of the 3D cloth model. Changes in the cloth's shape are essentially due to the spatial displacement of these vertices. The attributes of each vertex (such as position or normal) collectively determine the cloth's appearance and texture. Vertex data can be understood as data describing the attributes of the cloth mesh vertices, primarily including the vertex's spatial coordinates (such as X, Y, and Z) and normal direction (which affects lighting rendering effects).
[0038] In this embodiment of the invention, vertex encoded data can be specifically understood as: retaining the information of the original vertex data, having a more compact format, being easier to store and transmit, and being able to be reverse-engineered back into the original vertex data through corresponding decoding rules.
[0039] S120. Based on the playback progress of the cloth animation, sample the vertex encoding data corresponding to each cloth mesh vertex in the current animation frame to be displayed from the first texture map data, and decode the vertex encoding data corresponding to each cloth mesh vertex in the current animation frame to be displayed to obtain the vertex data corresponding to each cloth mesh vertex in the current animation frame to be displayed.
[0040] Specifically, the client first obtains the pre-generated first texture map data (which can be actively pushed by the server after the first texture map data is generated on the server side or actively requested by the client, or it can be directly generated by the client). This data has integrated the vertex encoding data of each cloth mesh vertex in all animation frames of the cloth animation.
[0041] Based on the current animation playback progress (such as normalized progress value or specific frame number), and combined with parameters such as the total number of frames and texture width in the metadata, the client samples the encoded data of each vertex in the current animation frame to be displayed from the corresponding pixel position of the first texture map using a preset texture addressing formula (such as linear index calculation). The client then performs inverse decoding operations on the sampled encoded data (such as inverse quantization operation of position encoding, inverse normalization processing of normal encoding, and 2D mapping restoration) to obtain the original 3D position and spatial normal of each vertex.
[0042] Optionally, based on the above embodiments, the vertex encoding data may include: position encoding data and normal encoding data;
[0043] Accordingly, the vertex encoding data corresponding to each cloth mesh vertex in the current animation frame to be displayed is decoded to obtain the vertex data corresponding to each cloth mesh vertex in the current animation frame to be displayed, which may include:
[0044] For each vertex of the cloth mesh in the current animation frame to be displayed, the absolute position data of the current cloth mesh vertex is obtained based on the position encoding data in the current vertex encoding data and the initial position data of the current cloth mesh vertex in the initial pose.
[0045] Based on the first preset number of bits used in encoding the normal encoding data in the current vertex encoding data, the normal encoding data in the current vertex encoding data is decoded to obtain the spatial normal data corresponding to the current cloth mesh vertex.
[0046] In this embodiment of the invention, absolute position data can be specifically understood as: the actual coordinate values (such as X, Y, and Z) of the cloth mesh vertices in three-dimensional space, which are the original data describing the spatial position of the cloth mesh vertices in a specific animation frame. Spatial normal data can be specifically understood as: three-dimensional vectors (such as nx, ny, and nz) perpendicular to the surface where the cloth mesh vertices are located, which determine the lighting reflection effect of the cloth surface and are data that reflects the texture of the cloth.
[0047] The first preset number of bits can be understood as the number of bits used to represent the normal encoding data (e.g., 10 bits in 5+5), which determines the precision and numerical range of the normal after quantization. Specifically, 5+5 can be understood as: the converted 2D normal components are quantized and stored using 5 bits each, for a total of 10 bits. The first 5 bits (high 5 bits) store the quantization result of the first dimension's 2D normal component, and the last 5 bits (low 5 bits) store the quantization result of the other dimension's 2D normal component.
[0048] Specifically, vertex encoding data includes position encoding data (the encoded result of vertex position offset) and normal encoding data. For each cloth mesh vertex in the current animation frame to be displayed, its corresponding position encoding data is first obtained. After decoding the encoded data into the actual position offset, it is superimposed with the initial position data of the vertex in the initial pose to obtain the current absolute position data of the vertex.
[0049] Subsequently, the normal encoding data in the vertex encoding data is extracted. Since a preset first number of bits (such as 5+5 bits, which determines the quantization precision and packing rules) is used during encoding, the client needs to perform a reverse decoding process based on this number of bits: first, the normalized encoding value stored in channel A is restored to the value before quantization, and then through steps such as quantization inverse operation, two-dimensional mapping inverse transformation (restoring the three-dimensional normal vector) and normalization restoration, the spatial normal data of the vertex is finally obtained.
[0050] Through the above two decoding steps, the absolute position and spatial normal of each vertex are fully restored. The absolute position data and spatial normal data of each vertex together constitute the vertex data required for rendering.
[0051] By overlaying the offset obtained from decoding the position-encoded data with the initial position, the absolute position of the vertex can be accurately restored. The normal-encoded data undergoes inverse quantization and inverse mapping based on the first preset number of bits during encoding, which can accurately restore the spatial normal direction and ensure high fidelity in cloth animation rendering. The decoding logic is simple and lightweight. Position decoding only requires the superposition of basic values, and normal decoding is executed according to a standardized reverse process, which greatly reduces the client's computational load, adapts to resource-constrained devices, and improves the smoothness of real-time rendering. The solution is highly flexible. Normal decoding is associated with the first preset number of bits, and the number of bits can be adjusted to adapt to low-lightweight scenes and high-precision rendering requirements without modifying the core decoding logic. The position-encoded offset and normal-encoded data are quantized and compressed, which greatly reduces the transmission bandwidth consumption and client storage pressure compared to the original data, achieving a balance between low resource consumption and high rendering effect. The standardized logic can seamlessly connect to mainstream rendering engines, ensuring the consistency of decoding results under different devices and scenes, and improving the stability and uniformity of rendering effects.
[0052] Optionally, based on the above embodiments, the normal encoding data in the current vertex encoding data is decoded based on the first preset number of bits used during encoding to obtain the spatial normal data corresponding to the current cloth mesh vertex. This can include:
[0053] Obtain the normal encoding value based on the normal encoding data in the current vertex encoding data;
[0054] Based on the first preset number of bits used in encoding the normal encoding data in the current vertex encoding data, the normal encoding value is split to obtain high-bit encoding data and low-bit encoding data;
[0055] The high-bit encoded data and low-bit encoded data are mapped into two-dimensional components respectively;
[0056] The three-dimensional components of the normal data are determined based on the two-dimensional compressed components;
[0057] The spatial normal data corresponding to the vertices of the current cloth mesh are obtained based on the three-dimensional components.
[0058] In this embodiment of the invention, the first preset number of bits can be specifically understood as: the total number of bits (e.g., 10 bits) used to characterize the final number of bits of the normal encoded data, which is the total bit capacity after quantizing x and y data are merged.
[0059] Specifically, the normal code value (i.e., α value, with a range of [0,1]) of the current vertex is read from the second channel (A channel) of the first texture map.
[0060] The first texture map includes first channel data and second channel data. Channel data can be understood as: the storage channels of the two-dimensional texture (which may include color and information channels, such as RGB (Red, Green, Blue) color channels and Alpha transparency channels (A channels)), which can independently store different types of encoded data. The first and second channels can be understood as: storage carriers used to distinguish different types of encoded data, separating and storing scattered multi-dimensional data (such as position and normal encoded data) in different independent channels of the texture, without interference, serving only as logical classification identifiers, without a fixed order (the stored content can be exchanged as needed). Based on data accuracy requirements, storage resource planning, or rendering performance optimization goals, the scattered multi-dimensional encoded data (such as position and normals, and may also include deformation weights, collision response coefficients, and key animation frame interpolation parameters) can be logically classified and stored in the independent color and information channels of the texture. Different channels serve only as separate storage carriers for the data, without interfering with each other and without fixed priorities. Storage objects can be flexibly allocated, ensuring the independence and integrity of various types of data, while integrating multi-dimensional information through a single texture, reducing data transmission and retrieval overhead, and adapting to diverse technical implementation scenarios.
[0061] Based on the first preset number of bits used during encoding, the normal encoded value is split into high-order encoded data and low-order encoded data. For example, if the first preset number of bits used during encoding is 10 bits (high 5 bits + low 5 bits), the α value needs to be converted into the split data corresponding to the integer range, that is, the high-order encoded data H = rounded down (α × 32) (H ∈ {0,…,31}) and the low-order encoded data L = 1024 × α − 32 × H (L ∈ [0,32)).
[0062] Then, the high-bit and low-bit encoded data are mapped to corresponding two-dimensional components n2(x,y) using a preset transformation rule. For example, the transformation formula n2(x,y)=(H,L)÷31.5×4−(2,2) yields a two-dimensional vector with a value range of approximately [-2,2]. Here, H is the high-bit encoded data, L is the low-bit encoded data, (H,L) is the original two-dimensional vector composed of high-bit and low-bit data, and (H,L)÷31.5×4−(2,2) normalizes (H,L) to the interval near [0,1], scales it to the interval near [0,4], and centers it to the interval near [-2,2].
[0063] Then, based on the geometric relationships of the two-dimensional components (such as unit spherical constraints), the three-dimensional components of the normal are calculated. For example, the square modulus of the two-dimensional vector is calculated as n2_squared = n2_x² + n2_y², where n2_squared is the square modulus of the two-dimensional vector, and n2_x and n2_y are the x and y components of the two-dimensional component n2(x,y).
[0064] Then, based on the unit spherical relationship, the three-dimensional components are deduced: , n3=(s×n2_x,s×n2_y,1−n2_squared÷2). Where, express The result is taken as a non-negative number, where s is a non-negative scaling factor and n3 is a three-dimensional component.
[0065] Finally, the three-dimensional components are standardized (e.g., numerical range truncation) to obtain the spatial normal data corresponding to the current cloth mesh vertex. For example, each component of the three-dimensional component n3 is truncated to the interval [-1,1] to obtain the absolute normal vector N in model space, which is the spatial normal data corresponding to the current vertex.
[0066] By splitting the encoded value according to the first preset number of bits, standardizing the mapping of two-dimensional components, and inferring the three-dimensional components based on geometric relationships, the vertex space normal direction can be accurately restored, ensuring the natural and realistic transition of lighting reflection and shadow in cloth rendering and avoiding a decrease in image quality. Low or high bit number encoding can be selected as needed, and the client only needs to synchronize the bit number parameter to be compatible with different scenes, balancing the need for lightweight and high-precision rendering effects. The decoding process is mainly based on basic numerical calculations, without complex calculations, and supports parallel processing, which greatly reduces the client load, adapts to resource-constrained devices, and improves the smoothness of real-time rendering. The three-dimensional normal is compressed into a single-channel encoded value. Through this process, information can be completely restored from compact data, reducing the transmission bandwidth occupation and client storage pressure, and achieving a balance between low resource consumption and high information restoration.
[0067] Optionally, based on the above embodiments, sampling vertex encoding data corresponding to each cloth mesh vertex in the current animation frame to be displayed from the first texture map data according to the playback progress of the cloth animation may include:
[0068] For each cloth mesh vertex in the current animation frame to be displayed, the position offset ratio of the vertex encoding data of the current animation frame to be displayed in the first texture map data is determined according to the current playback progress parameters and the total number of animation frames of the cloth animation.
[0069] Based on the effective data ratio, position offset ratio, and two-dimensional texture coordinates of the current cloth mesh vertex, determine the actual texture coordinates of the current cloth mesh vertex;
[0070] Based on the actual texture coordinates, the vertex encoding data corresponding to the current cloth mesh vertex is obtained by sampling the first texture map data.
[0071] In this embodiment of the invention, the playback progress parameter can be specifically understood as: a normalized progress value for controlling the cloth animation playback by the client, used to locate the animation frame to be displayed. The position offset ratio can be specifically understood as: the offset ratio of the current frame data in the texture, calculated based on the playback progress and the total number of frames. The effective data ratio can be specifically understood as: the proportion of the effective texture area calculated based on the cloth model bounding box parameters (AABB_min / AABB_max), representing the ratio of the number of effective data in all frames to the maximum amount of data allowed to be stored in the texture map. This data is fixed before decoding and is used to remove invalid areas in the texture to ensure accurate sampling. The two-dimensional texture coordinates can be specifically understood as: the second set of UV coordinates inherent to the cloth model vertices, which are the basic coordinates for texture sampling. The actual texture coordinates can be specifically understood as: the final sampled coordinates after correction by the effective data ratio and position offset ratio, representing the absolute position of the current vertex of the current frame in the second set of UV maps, used to extract the encoded data of the corresponding vertex in the first texture map.
[0072] Specifically, the client calls pre-generated metadata (total animation frames F, minimum bounding box value AABB_min, and maximum bounding box value AABB_max) in the vertex shader and obtains the normalized playback progress S∈[0,1] controlled by the program. First, the effective data ratio of the texture is calculated. The effective region ratios in the x-direction and y-direction are obtained using the formulas ratio_x = 1 - |round up (AABB_min.y)| and ratio_y = 1 - |round up (AABB_min.x)|, used to remove invalid parts of the texture. Here, AABB_min.x represents the x-direction coordinate of the model AABB_min, and AABB_min.y represents the y-direction coordinate of the model AABB_min. Rounding up converts the floating-point bounding box boundary values to integers, simplifying the calculation of the invalid region ratio. Absolute value operations convert negative rounded results to positive numbers, ensuring that subsequent ratio calculations are non-negative. The proportion of the invalid region is obtained by subtracting the proportion of the invalid region from 1 (total texture ratio, i.e., 100%).
[0073] For each vertex of the cloth mesh in the current frame to be displayed, the position offset ratio of the current frame data in the texture is calculated by combining the playback progress parameter and the total number of frames of the cloth animation. For example, the current frame number to be displayed is determined by current_frame = rounded down (S×F), where S is the interaction parameter, representing the animation progress, and the vertex position data and normal data corresponding to different frames are sampled according to the progress.
[0074] The UV offset ratio of the current frame in the texture is calculated as uv_offset = remainder((current_frame-1)%F) ÷ F. Here, current_frame-1 corrects the frame number offset, ensuring the starting value of the frame number is 0 to avoid offset calculation errors caused by starting the frame number from 1. (current_frame-1)%F represents taking the modulo of the total number of frames F, automatically returning to the starting frame when the frame number exceeds the total number of frames, preventing offset calculation overflow. For example, if the total number of frames F=100, and current_frame-1=105, then 105%100=5, the offset corresponds to the 5th frame, achieving cyclic sampling of the animation. The remainder ((current_frame-1)%F) limits the value range of the result to 0 to F-1, ensuring that the offset always stays within the total number of frames and does not point to invalid areas in the texture with no data. The remainder ((current_frame-1)%F)÷F represents converting the effective frame number offset value into a normalized offset ratio between 0 and 1. Since the UV coordinates of the texture range from 0 to 1, dividing by the total number of frames can convert the absolute offset of the frame number into a relative offset ratio of the texture coordinates (second set of UVs).
[0075] Next, based on the effective data ratio and position offset ratio of the first texture map, as well as the vertex's own 2D texture coordinates, the actual texture coordinates used for sampling are calculated using a preset formula. For example, the second set of 2D texture coordinates uv(x,y) of the model vertices stored in the model's mesh map is called. Combining the effective data ratio and offset ratio, the actual texture coordinates uv_local(x,y) are calculated using uv_local(x,y)=(uv.x×ratio_x,(uv.y+uv_offset)×ratio_y). Here, uv.x represents the x-coordinate of the uv coordinates, and uv.y represents the y-coordinate of the uv coordinates.
[0076] Finally, by sampling the corresponding pixel position of the first texture map data based on the actual texture coordinates uv_local(x,y), the vertex encoding data corresponding to the current cloth mesh vertex can be read.
[0077] By accurately calculating the position offset ratio based on playback progress parameters and total frame count, and eliminating invalid texture areas by combining the effective data ratio derived from the model bounding box, and then obtaining the actual sampling coordinates through 2D texture coordinate correction, it is ensured that each vertex can accurately read the encoded data of the current frame to be displayed, guaranteeing the temporal consistency and sampling accuracy of animation playback, while maximizing the use of texture storage space and reducing resource waste. The sampling process only involves basic numerical calculations, which can be processed in parallel in the vertex shader, completing coordinate calculation and texture sampling in batches. Compared with the traditional frame-by-frame loading method, it avoids frequent input and output operations, greatly improving the real-time playback efficiency of the client and adapting to resource-constrained devices and low-latency interactive scenarios. The playback progress parameters can be flexibly controlled by the client. After the progress is updated, only the offset ratio and actual UV need to be recalculated to quickly switch the sampling area without reloading data, providing efficient support for interactive operations such as animation pause, fast forward, and rewind, and enhancing the user interactive experience.
[0078] Optionally, based on the above embodiments, the playback progress parameter is determined according to the duration of the already played animation and the total playback duration of the animation; or, the playback progress parameter is determined according to the detected user's playback progress control operation on the cloth animation.
[0079] Specifically, the determination of playback progress parameters includes two implementation methods: The first is a passive calculation method, where the client accumulates the played animation duration in real time, combines it with the pre-configured total animation playback duration, and calculates the normalized parameter (value [0,1]) using the formula: playback progress parameter = played animation duration ÷ total animation playback duration; The second is an active interaction method, where the client detects the user's progress control operations (such as dragging the progress bar, clicking the fast forward or rewind button, and triggering precise positioning shortcut commands) in real time through user interface listening and input response mechanisms. The animation playback progress can be directly obtained based on these detected user operations, and then converted into standardized playback progress parameters through preset mapping rules (such as the proportion of the progress bar drag position and the progress increment corresponding to the button). Both methods can output core parameters that meet the frame positioning requirements and are suitable for both automatic playback and interactive control scenarios.
[0080] The progress determination method based on the ratio of the played animation duration to the total duration is suitable for automatic animation demonstration scenarios. It can play smoothly at a fixed rhythm without user intervention, ensuring the continuous advancement and accurate matching of the frame sequence. The progress determination method based on the detected user progress control operation is suitable for personalized viewing needs. Users can freely adjust the playback rhythm, quickly locate target nodes, and view on demand, enhancing the flexibility of interaction and user experience. The dual-path design not only broadens the applicable scenarios of the solution, but also allows for seamless switching, ensuring a smooth connection between automatic playback and manual control, and guaranteeing the stability and continuity of animation playback.
[0081] Optionally, based on the above embodiments, sampling is performed on the first texture map data according to the actual texture coordinates to obtain the vertex encoding data corresponding to the current cloth mesh vertex, which may include:
[0082] The position encoding data corresponding to the current cloth mesh vertex is obtained by sampling the RGB channel data of the first texture map based on the actual texture coordinates, and the normal encoding data corresponding to the current cloth mesh vertex is obtained by sampling the A channel data of the first texture map.
[0083] Specifically, the client passes the corrected actual texture coordinates uv_local to the texture sampling interface, samples the first texture map, reads the corresponding values from the RGB channels of the texture map, and parses them into the position encoding data (position offset ΔP) of the current cloth mesh vertex. At the same time, it reads the corresponding values from the A channel (Alpha channel) of the texture map and parses them into the normal encoding data (absolute normal encoding value α of the vertex) of the current cloth mesh vertex.
[0084] Understandably, if the first texture map is stored in Low Dynamic Range (LDR) format (due to the limited bit depth of LDR, taking a 5+5 storage format as an example, the 10-bit encoding exceeds 8 bits, requiring an expanded range), then the bounding box range `bound_range` is first calculated using the bounding box extrema: `bound_range = AABB_max × 10 - AABB_min × 10`. Then, the original position offset ΔP is mapped to the bounding box range to obtain the updated position offset ΔP' = `bound_range × ΔP + AABB_min × 10`.
[0085] For other formats such as High Dynamic Range (HDR), simply take ΔP' = ΔP.
[0086] The original model space vertex coordinates P(x,y,z) are then superimposed with the processed position offset ΔP' to obtain the actual spatial coordinates P' of the current frame vertex. The α value obtained from the A channel sampling is used in the subsequent normal decoding process. Finally, through channel sampling and format adaptation processing, the position and normal encoding data of the vertex are completely obtained and restored.
[0087] By storing position-encoded data and normal-encoded data separately in the RGB and A channels of the first texture map, the separation of texture channels enables independent storage and management of the two types of core data, avoiding data confusion. Simultaneously, synchronous sampling based on the same corrected actual texture coordinates improves data acquisition efficiency and ensures the synchronization of subsequent processing. By reusing different channels of the same texture to store key data, there is no need to create independent texture resources, reducing storage footprint and transmission bandwidth consumption, lowering data loading latency in mobile or network scenarios, and ensuring that the sampled data accurately reproduces the vertex position deformation and normal direction, guaranteeing the realism of lighting, shadows, and deformation effects during rendering. Texture sampling supports large-scale parallel computation, improving the real-time rendering efficiency of high-vertex cloth models. When adding new vertex attributes, additional texture channels or new texture layers can be reused, improving scalability.
[0088] S130. Based on the vertex data corresponding to each cloth mesh vertex in the current animation frame to be displayed, render and generate the current animation frame to be displayed.
[0089] Specifically, based on this vertex data, combined with the lighting and material configurations of the rendering engine, the animation frames to be displayed are rendered to achieve smooth playback of cloth animation.
[0090] Optionally, based on the above embodiments, the current animation frame to be displayed is rendered and generated based on the vertex data corresponding to each cloth mesh vertex in the current animation frame to be displayed, including:
[0091] The vertex reconstruction result is obtained by using the vertex shader to reconstruct the vertex based on the vertex data corresponding to each cloth mesh vertex in the current animation frame to be displayed.
[0092] The fragment shader renders and generates the current animation frame to be displayed based on the second texture map data and vertex reconstruction results corresponding to the current animation frame to be displayed; the second texture map data includes the color data and transparency data of the current animation frame to be displayed.
[0093] In this embodiment of the invention, the vertex shader can be specifically understood as a component used to perform operations such as vertex coordinate transformation, reconstruction, and data transfer. The fragment shader can be specifically understood as a component used to calculate attributes such as color or transparency of the fragments (pixel candidates) generated after vertex reconstruction. The second texture map data can be specifically understood as a texture resource used to store the color and transparency information of cloth animation frames, which is different from the first texture map that stores encoded data.
[0094] Specifically, the vertex shader of the graphics processing unit (GPU) takes the decoded vertex data of each cloth mesh vertex (such as the final coordinates and normal direction after position offset correction) as input, and obtains the final coordinates and associated attributes (such as normal and texture coordinates) of each vertex in screen space through vertex reconstruction operations such as screen space coordinate transformation and cloth deformation restoration. The vertex reconstruction results are then passed to the fragment shader.
[0095] The fragment shader of the GPU graphics pipeline calls the second texture map data (including color data and transparency data) corresponding to the current animation frame to be displayed. Combined with the texture coordinates and normal information after vertex reconstruction, color sampling and transparency calculation are performed on each fragment to finally generate the complete image of the current animation frame to be displayed.
[0096] By reconstructing the vertex spatial position and pose based on the vertex data of the current frame using the vertex shader, physical deformations such as cloth slippage and wrinkles can be reproduced. The fragment shader, combined with a second texture map storing color and transparency data, gives the reconstructed fragments realistic material representation. Together, they ensure the visual realism of the animation rendering. Leveraging the GPU's native parallel processing capabilities, the vertex and fragment shaders can batch process massive numbers of vertices and fragments, shortening the rendering time per frame and supporting real-time animation playback with high vertex counts and high frame rates, adapting to low-latency interactive scenarios. The vertex shader is used for vertex spatial attribute reconstruction, and the fragment shader is used for visual representation. The separate division of labor for visual attribute rendering, coupled with the separate management of visual resources and vertex data, avoids logical chaos and inefficiency, and facilitates the individual updating and optimization of texture resources, simplifying the overall rendering process and improving maintainability. The pixel-by-pixel shading method of the fragment shader can match the details of cloth deformation and avoid visual distortion. The color data and dynamic transparency adjustment function of the second texture map can achieve natural integration of cloth with character models and backgrounds, ensuring visual continuity and detail during the transition between dressing and dressing. When adding rendering effects in the future, only the shader logic needs to be extended, without reconstructing the core framework, which has cross-platform compatibility and functional scalability.
[0097] Optionally, based on the above embodiments, the fragment shader, using the second texture map data and vertex reconstruction results corresponding to the current animation frame to be displayed, can render and generate the current animation frame to be displayed, which may include:
[0098] The fragment shader performs preset adjustment operations on the second texture map data corresponding to the current animation frame to be displayed. The preset adjustment operations include at least one of adjusting the pixel color data, adding preset wrinkle normal data, and adjusting the pixel transparency data.
[0099] Based on the adjusted second texture map data and vertex reconstruction results, the current animation frame to be displayed is rendered.
[0100] Specifically, the fragment shader receives the second texture map data (including color data and transparency data) corresponding to the current frame and the vertex reconstruction result output by the vertex shader. Based on the texture coordinates in the vertex reconstruction result, the basic visual data of the second texture map is sampled to obtain the basic color data and transparency data of the cloth. Preset adjustment operations are then performed. According to the rendering requirements of the cloth animation, at least one of the following is selected: correcting the pixel color data, adding preset wrinkle normal data to enhance the three-dimensionality, and adjusting the pixel transparency data to optimize the blending effect. For example, by combining runtime interaction progress parameters, pixel-by-pixel shading corrections are performed on local areas of the cloth, including correcting pixel color deviations caused by vertex compression and blending predefined normal influence colors corresponding to cloth wrinkles. At the same time, by setting weight coefficients, various shading factors such as base color, various correction colors, and wrinkle influence colors are smoothly mixed to achieve a natural visual transition of the cloth from being worn to being taken off. In addition, the fragment shader dynamically controls the transparency data in the second texture map according to the interaction progress, flexibly adjusting the transparency of the cloth's semi-transparent material to achieve a seamless visual blend of the cloth with the character model, background, or different deformed areas of itself.
[0101] For example, the fragment shader can read the interaction progress parameters (such as wearing progress or detachment progress) at the current runtime, and according to the preset weight mapping rules (such as the wearing and detachment transition range between 0.2 and 0.8 interaction progress, and the transparency weight changing linearly with the progress), it can fuse the interaction progress parameters with the basic transparency data to dynamically correct the transparency value of each pixel. For example, in the early stage of wearing (progress close to 0, not wearing), the cloth transparency is close to 0 (completely transparent), and the transparency gradually increases as the progress increases (the degree of transparency decreases). After being fully worn (progress close to 1), the transparency is stable at 1 (completely opaque), and the detachment stage is the opposite of the gradual change. At the same time, for the contact area between the cloth and the character model and the overlapping area of its own wrinkles, additional local transparency correction weights can be superimposed to make the transparency of these areas more in line with physical logic (such as the transparency of the contact area is slightly higher to simulate the feeling of fit).
[0102] Finally, the adjusted second texture map data is combined with the position and normal attributes in the vertex reconstruction results, and the complete image of the current animation frame to be displayed is generated through pixel-by-pixel shading calculation and rendering.
[0103] Through multi-dimensional preset adjustment operations, such as adjusting color data, adding preset wrinkle normal data, and adjusting pixel transparency data, color deviations caused by vertex compression or deformation can be corrected, enhancing the sense of light and shadow and texture on the fabric surface. At the same time, the transparency of the fabric is dynamically controlled to restore the realistic material appearance and improve the detail realism and physical realism of the fabric rendering. The preset adjustment operations are bound to the interaction progress parameters, which can realize the gradual change of color, transparency and wrinkle effects in dynamic scenes such as putting on and taking off the fabric, eliminating visual discontinuities and jumps, ensuring the smoothness and continuity of the animation process, and optimizing the user interaction experience. Through GPU pixel-level parallel computing, all adjustment operations can be executed in batches and efficiently, and are seamlessly connected with the subsequent rendering process, avoiding frequent data transmission. It can support real-time playback of high frame rate and high resolution cloth animations, adapt to low latency interaction scenarios, and only requires expanding the adjustment items and rule configurations when adding rendering effects in the future. It has strong maintainability and functional scalability.
[0104] In a specific example, let's take the rendering process of a fabric animation of removing stockings as an example. The rendering method of fabric animation includes: model preprocessing stage, fabric solving stage, configuring fabric physical property parameters stage, dynamic quality constraint stage, adding dynamic force field stage, animation data encoding stage, and game runtime rendering stage.
[0105] In this embodiment of the invention, the fabric calculation can be specifically understood as: a technology that simulates the dynamic behavior of fabric under force through a computer program, used to generate realistic fabric movement effects in three-dimensional (3D) animation, games and movies, can add clothes to 3D characters, and automatically calculate after setting parameters, so that the clothes can achieve the preset movement effect.
[0106] Cloth animation timing data can be specifically understood as a continuous set of data that records the movement state of the cloth, arranged in the order of animation frames, that is, a vertex data sequence organized in time order.
[0107] In the model preprocessing stage, the character's body model and the stocking model (cloth model) are separated in advance, and the stocking model is optimized in a targeted manner: in terms of topology design, vertex density needs to be increased in key deformation areas such as the thighs to ensure animation details; the UVs in the vertical direction of the thighs are straightened as much as possible to provide sufficient collision detection conditions and physical constraints for the subsequent cloth solving process, ensuring the rationality and stability of model deformation during the solving process.
[0108] In this embodiment of the invention, the cloth model can be specifically understood as a flexible object mesh (such as a stocking and clothing mesh) to be simulated in motion. The body model can be specifically understood as a rigid or static object mesh (such as a game character's body mesh) used as a collision reference.
[0109] In the cloth solving stage, pre-processed individual stocking meshes and body meshes are imported using dedicated calculation modules or tools integrated into 3D software or physics engines. The cloth solving system is then enabled within the surface manipulator or geometry manipulator workflow of these modules or tools. The body model is set as a static collider, and the stocking model is set as the mesh to be solved, thus establishing the basic solving environment. The surface manipulator or geometry manipulator are component nodes used by these dedicated calculation modules or tools to create, modify, and process all types of geometric data. These nodes are connected to form a node network, enabling a non-destructive, procedural modeling, deformation, and geometric processing workflow.
[0110] In this embodiment of the invention, a static collider can be specifically understood as a collision reference object (such as a body model) that maintains a fixed shape and does not participate in motion calculation, used to limit the range of motion of the cloth model and avoid clipping.
[0111] In the fabric physical property parameter configuration stage, parameters such as mass, thickness, tensile stiffness, tensile damping ratio, and tensile stop length are set through the constraint node to define the material physical properties of the stockings; the default gravity (such as -9.8 meters per second squared, with the negative sign representing the direction of gravity), built-in wind direction and speed, and other environmental parameters (forces that are applicable to each frame and whose values remain unchanged) are set through the solver node to simulate real physical collision scenarios.
[0112] In the dynamic quality constraint stage, a vector expression language script is written in the attribute manipulation node to dynamically adjust the quality of the stocking model by binding UV coordinates to the animation progress (physical calculation stops when the quality is 0). Specifically, the pinUV_ymax threshold is calculated based on the current frame progress, and the quality of vertices with UV.x less than the threshold is set to 0 to achieve the cloth fixing effect. The remaining vertices are given a preset quality (primitive_mass=0.5), thereby precisely controlling the collision constraint range.
[0113] Add a dynamic force field stage. Add a dynamic force field to the solver and dynamically adjust the physical parameters of the fabric to simulate the dragging force at the ankle when the stockings are taken off, ensuring that the fabric can be smoothly taken off from the ankle and restoring the natural physical movement trajectory.
[0114] For example, by using frame range control and time mask, a dynamic force field can be precisely applied to the fabric at preset time intervals to simulate ankle drag force: First, define the start frame (startFrame) and end frame (endFrame) for the force field to take effect, and obtain the current solution frame number (FF). When FF is within the set frame interval (FF is greater than startFrame and less than or equal to endFrame), the time mask timeMask is 1; otherwise, it is 0.
[0115] The dynamic force field is used as input for each frame of the cloth calculation, while timeMask acts as a control coefficient on the force field: when the frame number is within a set range (such as a specific frame range for the ankle to slip off), timeMask is 1, the force field is effective, and the magnitude and direction of the external force can be modified (such as increasing the dragging force at the ankle) to make the cloth conform to the physical behavior of being dragged off; otherwise, it is 0, the force field is blocked, and the cloth is only affected by the static force field. This method not only precisely controls the timing of the force field's application, restoring the realistic interactive dragging trajectory, but also improves the flexibility of implementing multi-segment force effects, ensuring the physical rationality of the stocking slip-off animation.
[0116] Figure 2 This is a schematic diagram of a character skin model and cloth model with added dynamic force fields applicable to an embodiment of the present invention, as shown below. Figure 2 As shown, the image presents the character's legs (skin model), the stocking fabric model, and the dynamic force field associated objects used to simulate dragging force: the main image is the mesh model (wireframe) of the character's legs, with the outer layer of fabric mesh model covering the stockings, both in an initial, fitted state (corresponding to the stage when the stockings are fully worn); the red square-shaped object below the legs is a visual marker of the force field area, which will be used in subsequent calculations to apply a dragging force that changes over time to the ankle area of the stockings; the background is a grid coordinate system (gray squares) of an open-source extension tool for game development and visual effects production, showing the spatial position of the model in the calculation scene, and showcasing the overall composition of the calculation environment, providing a visual scene foundation for subsequently simulating the physical trajectory of the stockings slipping off the ankle.
[0117] During the animation data encoding stage, the solved stocking animation is exported using vertex animation texture nodes. At the same time, the animation data is encoded into texture format (first texture map data) for storage, and metadata containing key information such as model bounding box and texture parameters is generated simultaneously, providing a data foundation for animation decoding and reconstruction during game runtime.
[0118] The rendering phase during game runtime includes the vertex shader processing sub-phase and the fragment shader processing sub-phase.
[0119] In the vertex shader processing sub-stage, the effective data ratio of the texture is calculated based on the model bounding box data to determine the effective range of texture sampling; the UV coordinates of the corresponding frame are calculated according to the current animation playback progress, and the offset of the vertex in the model space is obtained by sampling and encoding the animation texture with UV coordinates and applied to the original vertex to realize the dynamic adjustment of the vertex position; the vertex normal data is decoded from the texture A channel, and the A channel value is decomposed into high and low bit data. After coordinate transformation and normalization, a three-dimensional normal vector in the range of [-1,1] is obtained, completing the reconstruction and application of vertex normals.
[0120] In the fragment shader processing sub-stage, the y-component of the vertex texture coordinates is extracted as a vertical gradient mask to control the distribution range of the wrinkle effect; the wrinkle normal map is sampled, and the shedding mask is calculated according to the animation sliding progress. The smooth transition of the mask is achieved through a smoothing function; the sampled wrinkle normal is linearly interpolated and blended with the original normal output by the vertex shader. The blending weight is controlled by the shedding mask, thereby supplementing the wrinkle details of the stockings at the fragment level and improving the visual realism of the animation.
[0121] Figure 3 This is a rendering of a character skin model and cloth model applicable to an embodiment of the present invention, such as... Figure 3 As shown, after the calculation is completed, the output frame in the rendering environment focuses on the character's leg area, presenting a blended rendering effect of the character's skin model and the stocking fabric model. The stockings are made of a semi-transparent material with RACE pattern details on the surface, and the edges have a gradient transparent texture (which matches the transparency adjustment effect during the putting on and taking off process). They fit naturally with the inner character skin model, and there is no obvious visual disconnect. The background is an outdoor scene (trees, vehicles and blue sky are visible).
[0122] In the image, the stockings have partially slipped down, and the fabric in the upper area has naturally folded and piled up due to the slippage, with the texture and semi-transparent feel showing dense layered details. Meanwhile, the stockings below the piled area remain in place, closely connected to the leg skin model and with a stable shape, reflecting the transition from putting on to taking off stockings. This restores the visual difference between the physical stacking and the partial stillness when real stockings are slipped off.
[0123] Offline physical cloth calculations ensure the physical realism and visual fidelity of cloth animations. Combined with vertex animation rendering controlled by timing parameters such as playback progress, it solves the problems of high difficulty and poor real-time performance in creating controllable and interactive progressive cloth animations. It supports batch processing of a large number of characters, reduces manual intervention, improves output per unit time and deployment consistency, reduces animation production costs, and enables batch and automated production, thereby improving animation production efficiency. At the same time, the real-time physical calculation animation frames on the client side are transferred to the offline production stage. During game runtime, only texture decoding and vertex information reconstruction are required. Relying on GPU parallel computing, low-latency processing is achieved. This not only significantly reduces the runtime cost of high-quality cloth animations and adapts to the rendering requirements of real-time, multi-character scenes, but also fully preserves the rich and realistic details of cloth wrinkles, folds, and slippage brought by physical simulation, achieving a balance between physical realism, runtime performance, and production efficiency.
[0124] The technical solution of this invention obtains pre-generated first texture map data containing vertex encoding data of each animation frame, samples and decodes the current frame vertex data according to the playback progress, and then renders it. The client does not need to perform complex real-time cloth physics calculations; it can obtain vertex data through texture sampling and simple decoding operations. This effectively avoids frame rate fluctuations and stuttering caused by excessive client load and can significantly reduce resource consumption during client operation. At the same time, the first texture map data integrates full-frame vertex encoding data and supports efficient compression transmission, reducing data loading transmission overhead and waiting time, speeding up animation loading and startup, and optimizing user experience. In addition, the texture data originates from cloth calculation and optimization in the offline state of the server or client. The decoded data can accurately restore the physical characteristics and details of the cloth, ensuring the visual fidelity and stability of the animation. Combined with the cross-platform universality of texture data, it can be adapted to different hardware, systems, and application scenarios, improving the applicability and practicality of the solution.
[0125] Example 2
[0126] Figure 4 This is a flowchart of another cloth animation rendering method provided in Embodiment 2 of the present invention. This embodiment is a refinement of the first texture map data generation method in the above embodiment.
[0127] Understandably, the first texture map data can be generated on the server side or the client side. The server side can be understood as a server (or server cluster) with data storage, high-performance computing, and resource management capabilities. It is a concept relative to the client side (such as game terminals, mobile devices, and computers). It performs complex calculations and generates standardized data, providing data support to the client, but does not directly display animations to the user. The client side can be understood as the terminal device or software application that directly displays cloth animations to the user. It is a user-side carrier relative to the server side, receiving data provided by the server and completing animation rendering and real-time display through lightweight computing. It does not need to undertake complex calculations or data encoding work. Common forms include game terminals, mobile devices, computers, virtual reality devices, and corresponding applications (such as game clients and virtual simulation software).
[0128] Correspondingly, such as Figure 4 As shown, the method includes:
[0129] S410. Obtain cloth animation timing data through cloth calculation.
[0130] The obtained cloth animation timing data includes vertex data corresponding to each cloth mesh vertex in each animation frame of the cloth animation.
[0131] Specifically, the cloth animation timing data is obtained by solving the cloth using a solver. This data is in units of animation frames and includes the vertex data corresponding to each vertex of the cloth mesh in each animation frame, which corresponds to the shape change information of the cloth at different time points in the entire animation cycle.
[0132] Specifically, the solver can be understood as a dedicated calculation module or tool (a well-packaged, reusable, parameterized node network) integrated into 3D software or physics engine. It is used to solve the motion state and shape changes of cloth through numerical calculation based on preset physical rules and parameter constraints (such as collision, force field and material properties constraints), and finally output standardized time-series data (such as vertex positions or normals).
[0133] S420. Encode the vertex data corresponding to each cloth mesh vertex in each animation frame of the cloth animation to obtain the vertex encoded data corresponding to each cloth mesh vertex in each animation frame.
[0134] Specifically, for each animation frame contained in the cloth animation timing data, the original vertex data corresponding to all cloth mesh vertices in each animation frame is extracted one by one. The original data of each vertex is encoded using preset encoding rules (which may include mapping, quantization, compression or packaging, such as mapping the original data to texture pixel values, or packaging the original data into two-dimensional data after mapping and quantization), so as to obtain the standardized vertex encoding data corresponding to each cloth mesh vertex in each animation frame.
[0135] S430. Based on the vertex encoding data corresponding to each cloth mesh vertex in each animation frame, generate the first texture map data corresponding to the cloth animation.
[0136] The first texture map data is used by the client to render and generate the animation frames to be displayed for the cloth animation.
[0137] Specifically, based on the vertex encoding data corresponding to all cloth mesh vertices in each animation frame of the cloth animation, the scattered encoding data of each animation frame and each cloth mesh vertex is integrated into a unified two-dimensional texture structure (such as writing the corresponding pixel channels of the texture in an orderly manner) through preset texture layout rules (such as the number of texture rows occupied per frame and the index mapping between cloth mesh vertices and pixels), generating the first texture map data containing the temporal encoding data of the entire frame. This first texture map data is provided to the client, which extracts the cloth mesh vertex information of the animation frame to be displayed from it, and then renders and generates the animation frame to be displayed for the cloth animation, realizing the transformation of cloth mesh vertex information into a visual image.
[0138] Optionally, based on the above embodiments, vertex data may include absolute position data and spatial normal data;
[0139] Accordingly, the vertex data corresponding to each cloth mesh vertex in each animation frame of the cloth animation is encoded to obtain the vertex encoded data corresponding to each cloth mesh vertex in each animation frame, which may include:
[0140] For each cloth mesh vertex in each animation frame of the cloth animation, determine the position offset data of the absolute position data corresponding to the current cloth mesh vertex relative to the initial position data of the current cloth mesh vertex in the initial state, and use the position offset data as the position encoding data corresponding to the current cloth mesh vertex.
[0141] The spatial normal data corresponding to the current cloth mesh vertex is quantized to the numerical range represented by the first preset number of bits, and the normal encoding data corresponding to the current cloth mesh vertex is obtained based on the quantized normal data.
[0142] Accordingly, based on the vertex encoding data corresponding to each cloth mesh vertex in each animation frame, the first texture map data corresponding to the cloth animation is generated, which may include:
[0143] The positional encoding data corresponding to each cloth mesh vertex in each animation frame of the cloth animation is saved as the first channel data of the first texture map, and the normal encoding data corresponding to each cloth mesh vertex in each animation frame of the cloth animation is saved as the second channel data of the first texture map.
[0144] In this embodiment of the invention, the position offset data can be specifically understood as: the difference between the absolute position data of the cloth mesh vertex in a certain animation frame and the initial position data of the cloth mesh vertex in the initial state (such as the initial animation frame, the first animation frame, or the previous animation frame), which is a quantitative representation of the position change of the cloth mesh vertex.
[0145] Specifically, vertex data includes absolute position data describing the three-dimensional spatial coordinates of the cloth mesh vertices and spatial normal data that determines the lighting effect of the cloth.
[0146] The preset model has a total number of vertices V, a total number of animation frames F, a texture width W, and a texture height H.
[0147] When generating vertex encoding data, open-source extension tools for game development and visual effects production are used to calculate the position offset data of each cloth mesh vertex in each frame of the cloth animation relative to the initial position data (P_ref) under the initial pose. This offset data is then directly used as the vertex's position encoding data.
[0148] The spatial normal data is quantized according to a first preset number of bits, converting continuous spatial normal data into discrete integer values. By limiting the number of bits, the data range is narrowed, thereby achieving data compression and standardization. For example, after the 3D normal mapping is converted into a 2D value, it is split into two 5-bit integers and merged into a 10-bit value. Based on this quantization result, normal encoded data is obtained.
[0149] When generating the first texture map data, a W×H four-channel buffer (R channel, G channel, B channel, and A channel) is first initialized according to the texture layout plan. The texture layout plan includes: calculating the number of rows R per frame based on R = rounded up (V ÷ W), and ensuring that the texture height H is greater than or equal to R×F to accommodate all frames. Understandably, to avoid tail holes caused by the vertex count being divisible by the texture row width, blank pixels at the end of the frame are allowed. That is, in the texture layout planning and vertex data writing process of this embodiment of the invention, the number of texture rows R occupied by each frame is first calculated. When the number of vertices V cannot be divided by the texture width W (e.g., V=1025, W=500, 1025÷500=2 remainder 25), the first two rows of each frame can be filled with 500 vertex data, and the last row can only store 25 vertex data. The remaining 475 pixel positions form a tail hole without valid data. In order to avoid forcibly modifying the vertex storage order or adding invalid data to fill the hole, which would lead to addressing misalignment during client sampling, these blank pixels are allowed to be retained at the end of the last row of data storage for each frame. These blank pixels do not carry any valid vertex encoding data. When the client samples, it will read only the pixel area carrying valid vertex data in each frame according to the pre-set texture addressing formula and automatically skip these blank pixels. This ensures the orderliness of vertex data storage and simplifies the logic of texture addressing.
[0150] Two independent coordinate buffers are allocated to store the coordinate data of AABB_min and AABB_max, respectively. During the frame-by-frame calculation of the cloth mesh vertex positions, the extreme values in these two buffers are continuously updated. Finally, the minimum coordinates of AABB_min and the maximum coordinates of AABB_max are used to fully define the vertex motion space of the cloth throughout the entire animation cycle, providing a spatial reference for subsequent rendering and data processing. Specifically, AABB_min can be understood as the minimum coordinate value of the axis-aligned bounding box (AABB), which is the set of minimum values (e.g., Xmin, Ymin, and Zmin) of all vertices of the cloth mesh in 3D space during the entire frame of the cloth animation. AABB_max can be understood as the maximum coordinate value of the axis-aligned bounding box, which is the set of maximum values (e.g., Xmax, Ymax, and Zmax) of all vertices of the cloth mesh in 3D space during the entire frame of the cloth animation.
[0151] The positional encoding data of each vertex in each frame is written as the first channel data of the first texture map to the corresponding pixel, and the normal encoding data is written as the second channel data of the texture to the corresponding pixel.
[0152] Simultaneously, the spatial coordinates (3D space) of each vertex are read and compared with the corresponding axis coordinates of AABB_min and AABB_max in the buffer. If the vertex coordinates are smaller, AABB_min is updated; if they are larger, AABB_max is updated, thus completing the real-time update of the global bounding box buffer. After traversing all vertices and updating the buffers for all frames, the AABB_min and AABB_max buffers will store the final spatial extrema of the cloth during the entire animation.
[0153] This completes the structured storage conversion of vertex encoded data into texture assets, enabling ordered storage of vertex encoded data within a unified two-dimensional texture structure.
[0154] By converting absolute vertex position data into position offset data relative to the initial state as position encoding data, and quantizing spatial normal data to a first preset number of bits as normal encoding data, the two types of encoded data are stored in the first and second channels of the first texture map for structured storage. By making the numerical range of position offset data more compact, i.e., the normal data is quantized and compressed, combined with a single-texture dual-channel integrated design, data redundancy and storage overhead are significantly reduced, avoiding the management complexity of traditional multi-file storage. At the same time, the number of files and bandwidth consumption for data transmission are reduced, and the transmission latency and packet loss risk are lowered. Position offset encoding based on the initial position reference can accurately preserve the relative motion trajectory of vertices, while normal quantization balances storage overhead while ensuring lighting rendering accuracy. Dual-channel separate storage avoids data interference, ensuring the integrity of the decoded data and high-fidelity visual effects. In addition, this solution supports setting the position encoding reference and the number of normal quantization bits, is compatible with mainstream texture formats, rendering engines and various client devices, and can achieve batch processing through automated tools, simplifying animation production and data management processes, reducing labor costs and maintenance complexity, while adapting to client fast sampling and hardware decoding optimization, improving client decoding efficiency and real-time rendering smoothness.
[0155] Optionally, based on the above embodiments, quantizing the spatial normal data corresponding to the current fabric mesh vertex to a numerical range represented by a first preset number of bits, and obtaining the normal encoding data corresponding to the current fabric mesh vertex based on the quantized normal data, may include:
[0156] Map the spatial normal data corresponding to the current cloth mesh vertex to two-dimensional data;
[0157] The x and y data in the two-dimensional data are quantized to the numerical range represented by the second preset number of bits;
[0158] The quantized x and y data are merged and packaged to obtain normal encoding values within the numerical range represented by the first preset number of bits; wherein, the high and low bits of the normal encoding value correspond to the x and y data in the two-dimensional data, respectively, and the first preset number of bits is a multiple of the second preset number of bits;
[0159] Obtain the normal encoding data corresponding to the current cloth mesh vertex based on the normal encoding value.
[0160] In this embodiment of the invention, the second preset number of bits can be specifically understood as: the number of bits (e.g., 5 bits) used to quantize a single component (x or y) of the mapped two-dimensional normal data, and the first preset number of bits is a multiple thereof.
[0161] Specifically, the process of quantizing the spatial normal data of the current cloth mesh vertices to generate normal-encoded data requires first mapping the 3D spatial normal data into 2D x and y data (through polar coordinate mapping, cube mapping, or sphere mapping, etc.), such as small values like ex and ey. Here, ex and ey can be understood as the 2D components of the 3D spatial normals after mapping and transformation, which are the original data for normal quantization.
[0162] Then, the two two-dimensional components ex and ey are quantized to their corresponding numerical ranges according to the second preset bit.
[0163] For example, when the first preset number of bits is 10 and the second preset number of bits is 5, the first preset number of bits is twice the second preset number of bits. The corresponding values vx and vy are calculated by rounding vx to the nearest integer ((ex+2)÷4×31.5) and vy to the nearest integer ((ey+2)÷4×31.5). Then, vx and vy are truncated to the 5-bit value range of [0,31] (the second preset number of bits is 5, and [0,31] corresponds to 2 to the second preset number of bits, i.e., 2 to the power of 5), so that discrete integers vx and vy within the target value range are obtained.
[0164] Next, the quantized vx (x data) is used as the high bit and vy (y data) is used as the low bit, and they are merged and packaged into a complete integer, which is used as the normal encoding data corresponding to the current cloth mesh vertex.
[0165] For example, by combining p = vx × 32 + vy (where 32 corresponds to the high 5 bits), a decimal integer p within the range of 10 bits (the first preset number of bits is 10) is formed (the value range of p is 0 to 1023). Finally, this combined decimal integer is used as the normal encoding value. Based on this value, the normal encoding data corresponding to the current vertex is obtained. The encoding and compression of the normal data are achieved through 3D data to 2D data conversion, component quantization, and merging and packing.
[0166] By mapping 3D spatial normal data to 2D data, and then quantizing the x and y components of the 2D data to a second preset bit range, the data is finally merged and packaged according to the rule that the high bits correspond to the x data and the low bits correspond to the y data to form a normal encoding value of the first preset bit range, thus obtaining normal encoded data. Dimensionality reduction is achieved through 3D to 2D conversion, and component quantization converts continuous floating-point data into discrete integers. Merging and packaging these into standardized encoding values significantly compresses data volume, adapts to the structured storage requirements of texture channels, and improves storage resource utilization. During client decoding, only splitting, dequantizing, and reverse mapping are needed to quickly restore the 3D normals, improving encoding and decoding efficiency. This avoids impacting the smoothness of real-time rendering; component quantization controls discretization errors, and the fixed correspondence of merging and packaging ensures accurate restoration of 2D components, guarantees the integrity of normal direction information, makes the light reflection effect on the cloth surface conform to the real physical characteristics, avoids visual defects, and achieves stability and consistency in animation rendering effects; it supports flexible replacement of multiple 2D mapping schemes, and the bit count configuration can be adjusted as needed, which can adapt to resource-constrained devices such as mobile devices, as well as meet high-precision rendering scenarios. Moreover, the standardized encoding format facilitates integration with metadata management, texture compression and other processes, and is compatible with various rendering engines and client devices, enhancing the flexibility, compatibility and scalability of the technical solution.
[0167] Furthermore, based on the above embodiments, before mapping the spatial normal data corresponding to the current cloth mesh vertices to two-dimensional data, the following may also be included:
[0168] Normalize the spatial normal data corresponding to the current cloth mesh vertex so that the spatial normal data is located in a unit spherical space;
[0169] Simultaneously, obtaining the normal encoding data corresponding to the current cloth mesh vertex based on the normal encoding value can include:
[0170] The normal encoding values are normalized so that they fall within the range of the second channel data of the first texture map.
[0171] In this embodiment of the invention, the unit spherical space can be specifically understood as: a three-dimensional spherical space with the origin as the center and a radius of 1, where the endpoints of the unit normal vector are all distributed on the sphere. This unifies the range of normal data values and avoids mapping errors caused by differences in the original normal magnitude.
[0172] Specifically, before mapping 3D space normal data to 2D data, the normal data needs to be normalized to convert it into a unit vector located in a unit sphere space, providing standardized input for subsequent 2D mapping.
[0173] For example, the original 3D normal data N(f,i)=(nx,ny,nz) of the current vertex is normalized so that the processed normal vector x²+y²+z²=1. This ensures that the normal data of all vertices are located in the unit sphere space, avoiding distortion of subsequent mapping results due to inconsistent original normal magnitudes. Here, f represents the f-th frame (greater than or equal to 0 and less than the total number of frames F), i represents the i-th index (greater than or equal to 0 and less than the total number of frames V), and (nx,ny,nz) represent the original 3D space normal data.
[0174] Then, Spheremap projection is used to map the 3D normals to 2D values: first, solve the denominator. ,in, This means taking a non-negative number 1+nz. If d≤ε (ε is a sufficiently small positive threshold, such as 1e-6), the encoding result is directly set to 0 to avoid calculation errors; otherwise, two-dimensional data (ex,ey) is obtained by ex=nx÷d and ey=ny÷d, thus completing the dimensional compression from 3D to 2D.
[0175] Accordingly, after obtaining the normal encoding value of the first preset number of bits (10 bits), it is necessary to further normalize the encoding value and convert it into the data range of the second channel of the first texture map. Finally, the normal encoding data is obtained based on the normalized small value.
[0176] For example, after completing the two-dimensional component quantization (vx, vy) and merging and packaging the first preset number of bits (10 bits) of integers (p=vx×32+vy, p∈{0,…,1023}), a second normalization needs to be performed based on the storage characteristics of the texture channels. Since the second channel of the first texture map (such as the Alpha channel) only supports the storage of small values in the range [0,1), it cannot directly carry large integers such as 1023. Therefore, it is necessary to convert the 10-bit integer p into a small value α in the range [0,1) using the formula α=p÷1024.0. This α is the final encoded data of the normal. The standardized encoded value is adapted to the channel storage format to ensure that the data can be stored normally by the texture asset. The client can restore the original three-dimensional normal data through reverse calculation (p=α×1024, splitting vx and vy, dequantization and reverse mapping).
[0177] It is important to emphasize that these two normalization processes are key optimizations in the embodiments of this invention: the pre-normalization ensures the consistency of Spheremap projection accuracy by unifying the modulus of the normal data, avoiding mapping deviations caused by differences in the original normal data; the post-normalization accurately matches the storage rules of the texture channel, solving the technical problem that large integer encoded values cannot be directly stored, while small values in the [0,1) range can be directly used as pixel data of the Alpha channel without additional format conversion, improving the efficiency of encoding and texture generation.
[0178] Before mapping 3D normals to 2D data, the spatial normal data is normalized to a unit spherical space, unifying the modulus reference of all vertex normals. This eliminates modulus differences caused by modeling errors and animation calculation deviations in the original normals, avoiding data distortion in the subsequent 2D mapping process. This ensures the accuracy and comparability of mapping results for different vertex normals, providing stable and standardized input data for quantization and packaging. It also avoids computational crashes caused by abnormal original normals, improving the robustness of the encoding process. After obtaining the normal encoding values, normalization is used to convert them to the data range of the second channel of the first texture map. This solves the problem of incompatibility between the encoding values and texture channel storage formats, avoiding data overflow or format errors caused by directly storing large integer encoding values, thus improving the encoding... The encoded data can be directly written to the texture pixel data channel without additional format conversion, achieving seamless integration between encoded data and texture storage. Furthermore, the normalized small values are more compatible with texture compression algorithms, further reducing storage volume and transmission bandwidth usage. It also supports flexible adaptation to different texture formats, rendering engines, and various client devices, expanding application scenarios. In addition, pre-normalization reduces error accumulation in the mapping stage, and post-normalization ensures that the encoded values do not lose information during storage and transmission. The synergy of the two allows the client to accurately restore the original encoded values and 3D normal data through inverse normalization, effectively reducing decoding errors and ensuring the consistency and realism of cloth surface lighting rendering. Moreover, the normalized values can be quickly read and decoded by the client, improving the smoothness of real-time rendering and achieving efficiency optimization.
[0179] Optionally, based on the above embodiments, the second preset number of bits is an integer greater than 4.
[0180] Specifically, the second preset bit count is an integer greater than 4. This means that when quantizing a single component in the 2D normal data (ex, ey), the number of bits allocated must be an integer greater than 4, such as 5, 6, or 7. Correspondingly, taking 2 times as an example, the first preset bit count is 10 (5+5), 12 (6+6), or 14 (7+7). By increasing the second preset bit count, for example, a 5+5 bit quantization strategy, which uses 5 bits to store ex and 5 bits to store ey, the required normal accuracy can be obtained with lower bandwidth usage (compared to a higher bit count).
[0181] Understandably, when the second preset number of bits changes, the calculation parameters in the formula will be adjusted accordingly:
[0182] In the quantization formula: ex and ey are affine mapped and quantized to a 5-bit integer in the range [0,31]: vx = rounded to the nearest integer ((ex + 2) ÷ 4 × 31.5), vy = rounded to the nearest integer ((ey + 2) ÷ 4 × 31.5), and vx and vy are truncated to [0,31]. In the original 5-bit scenario, 31.5 corresponds to 2 to the power of 5 - 0.5 (2 to the power of 5 is 32, 32 - 0.5 = 31.5), the purpose of which is to ensure that the quantized data does not exceed the range [0,31]. If the second preset number of bits is changed to 6 bits, this value will become 2 to the power of 6 - 0.5 = 63.5, and the truncation range of vx and vy will also change from [0,31] to [0,63], and so on (e.g., in the 7-bit scenario, it becomes 127.5, and the truncation range is [0,127]).
[0183] In the merge and pack formula: p = vx × 32 + vy, the merged and packed result is a 10-bit integer p ∈ {0, ..., 1023}. In the original 5-bit scenario, 32 is 2 to the power of 5 (used to shift vx left by 5 bits to reserve low-order space for vy), and 1023 is 2 to the power of (5 + 5) - 1 = 2 to the power of 10 - 1 (the maximum value of the 10-bit integer p); if it becomes 6-bit, 32 will become 2 to the power of 6 = 64, and 1023 will become 2 to the power of (6 + 6) - 1 = 2 to the power of 12 - 1 = 4095 (the maximum value of the 12-bit integer p); in the 7-bit scenario, it corresponds to 128 and 16383.
[0184] In the normalization formula: α = p ÷ 1024.0, normalization is achieved to α ∈ [0,1). In the original 5-bit scenario, 1024 is 2 to the power of (5+5) = 2 to the power of 10 (used to normalize p to the range [0,1)); if it becomes 6-bit, 1024 becomes 2 to the power of (6+6) = 2 to the power of 12 = 4096; in 7-bit, it becomes 16384.
[0185] By using a second preset bit count greater than 4, the quantization bit count of a single normal component is expanded, exponentially increasing the number of quantization states for a single component from 16 to 32, 64, or 128, etc. This allows for more delicate capture of changes in normal direction caused by fabric wrinkles and deformation, significantly reducing quantization errors and ensuring the realism and naturalness of light reflection effects on the fabric surface, achieving high-fidelity rendering. It also boasts strong scene adaptation flexibility. For resource-constrained scenarios such as mobile devices and virtual reality devices, a 5+5 bit scheme can be selected, achieving double the precision at the minimal cost of only increasing total bandwidth by 2 bits, balancing storage overhead and visual experience. For high-precision rendering on PCs and film-level cloth animation, a 6+6 or 7+7 bit scheme can be selected, meeting professional-grade precision requirements by moderately increasing bandwidth usage, significantly expanding its applicability. Furthermore, this design maintains the lightweight advantage of low bit count, offering a much higher compression ratio compared to full-precision storage solutions. It effectively controls the storage volume and transmission bandwidth usage of texture assets, and the bandwidth increase is highly positively correlated with the precision improvement, avoiding resource waste.
[0186] Optionally, based on the above embodiments, the position encoding data corresponding to each cloth mesh vertex in each animation frame of the cloth animation is saved as the first channel data of the first texture map, and the normal encoding data corresponding to each cloth mesh vertex in each animation frame of the cloth animation is saved as the second channel data of the first texture map, which may include:
[0187] For each cloth mesh vertex in each animation frame of the cloth animation, the current linear index value of the current cloth mesh vertex in the first texture map is determined based on the sequence number of the current animation frame, the number of rows occupied by the current animation frame in the first texture map, the width of the first texture map, and the sequence number of the current cloth mesh vertex.
[0188] Write the position encoding data corresponding to the current cloth mesh vertex into the RGB channel of the first texture map at the position corresponding to the current linear index value, and write the normal encoding data corresponding to the current cloth mesh vertex into the A channel of the first texture map at the position corresponding to the current linear index value.
[0189] In this embodiment of the invention, the linear index value can be specifically understood as: a value used to uniquely identify the pixel position in the first texture map, which can be calculated by the frame number, the number of rows occupied by the frame, the texture width and the vertex number, and is an index that associates vertex encoding data with texture pixel position.
[0190] Specifically, iterate through each animation frame of the cloth animation (f∈[0,F), where F is the total number of animation frames), then iterate through all cloth mesh vertices within each frame (i∈[0,V), where V is the total number of cloth mesh vertices), and for each vertex, obtain the position P(f,i) and normal N(f,i) of the current vertex in the current frame.
[0191] By combining the current animation frame number f, the number of rows R occupied by the frame in the first texture map, the width W of the first texture map, and the current vertex number i, the linear index value that uniquely corresponds to the vertex in the first texture map is determined through a specific calculation rule (such as row-major order or column-major order).
[0192] For example, calculating the linear index value `texture_index` of a vertex in the first texture map according to the row-major order rule specifically includes: calculating the row number `row_frame` of vertex i in frame f using `row_frame = floor(i ÷ W)`, calculating the column number `col` using `col = i − W × floor(i ÷ W)`, and calculating the row number `row` using `row = f × R + row_frame`. Finally, the unique index `texture_index` is obtained using the formula `texture_index = row × W + col` (simplified to `f × R × W + i`). Here, row-major order can be understood as a texture addressing arrangement rule, where data is stored in row-major order, filling one row before moving to the next, ensuring the orderly storage of data.
[0193] Then, the position encoding data corresponding to the vertex is written to the RGB channel (first channel) pixel position that matches the linear index value in the first texture map, and the normal encoding data corresponding to the vertex is written to the A channel (second channel) pixel position that matches the same linear index value, thus completing the ordered storage of all vertex encoding data in the texture channel.
[0194] For example, calculate the positional encoding data ΔP(f,i)=P(f,i)−P_ref(i) (P_ref(i) is the initial position of the vertex) for the vertex, and after completing the absolute normal encoding process, write the positional encoding data into the RGB channel pixel corresponding to the texture_index in the first texture map, and write the normal encoding data into the corresponding A channel pixel.
[0195] It should be noted that in this embodiment of the invention, the first texture map and the second set of UVs are established in correspondence. Its RGBA channel is specifically used to store the position encoding data (RGB channel) and normal encoding data (A channel) of each vertex of each frame of the cloth animation. In order to avoid data conflicts and ensure the independence of various types of information, the visual attribute data originally used to characterize the cloth color and transparency will be stored in another independent texture corresponding to the first set of UVs. Through the separate storage design of dual UVs and dual textures, the vertex encoding data and visual attribute data are classified and managed to ensure that the two types of data do not interfere with each other and are stored in an orderly manner. At the same time, it provides reliable support for accurate data retrieval during subsequent decoding and rendering.
[0196] Specifically, UV can be understood as: u, v is short for texture map coordinates, used to define the position information of each point on the image. These points are interconnected with the 3D model to determine the position of the surface texture map. UV precisely maps each point on the image to the surface of the model object. The software performs image smoothing interpolation at the gaps between points to form the UV map. The second set of UVs can be understood as: a texture coordinate system specifically used to locate the vertex encoding data storage position in the first texture map, which is separate and independent from the first set of UVs that stores color and transparency data. The first set of UVs can be understood as: a texture coordinate system specifically used to store fabric color and transparency data, which is separate and independent from the second set of UVs that stores vertex encoding data to avoid data interference.
[0197] By combining the animation frame sequence number, the number of rows occupied by the frame, the texture width, and the vertex sequence number to calculate a unique linear index value, a unique pixel position in the texture is assigned to the position encoding data and normal encoding data of each vertex in each frame of the cloth animation. Then, the position encoding is stored according to the rule of storing the RGB channel and the normal encoding is stored in the A channel. This ensures that massive amounts of temporal vertex data are arranged in an orderly manner within a single texture, solving the problems of data dispersion, disorder, and difficulty in searching in traditional storage methods, and significantly improving the regularity and management efficiency of data storage. At the same time, the integrated storage mode of single texture dual channels reduces the number of files and redundant file header information, reducing storage volume, transmission latency, and bandwidth consumption, and adapting to resource-constrained environments. The solution optimizes resource utilization to meet the transmission requirements of the scene. The unique correspondence of linear index values and the dual-channel separate storage design ensure that the client can quickly locate and read the target data through reverse calculation during decoding, improving the efficiency of calling and decoding. At the same time, it avoids mutual interference between the two types of data, ensuring data integrity and accuracy, and providing precise support for rendering. The solution conforms to mainstream texture format standards and can seamlessly connect to various rendering engines and client devices. Moreover, the index calculation logic can adapt to animation scenes with different frame rates and vertex counts, with extremely strong compatibility and adaptability. The ordered and structured textured data can make full use of the client's parallel processing capabilities, which facilitates rendering optimization and ensures the smoothness of real-time rendering.
[0198] The technical solution of this invention obtains cloth animation timing data containing vertex data corresponding to the vertices of the cloth mesh in each animation frame through offline cloth solving; encodes the vertex data of each frame to obtain vertex encoding data corresponding to each cloth mesh vertex in each animation frame, and generates first texture map data corresponding to the cloth animation based on the vertex encoding data. This compresses and integrates massive vertex information into first texture map data, reducing data transmission volume and storage costs. It also leverages the cross-platform universality of textures to adapt to diverse client scenarios. The first texture map data is sent to the client. After receiving the texture data, the client only needs to perform texture sampling and simple decoding calculations to render and generate the animation frame to be displayed, without the need for high-intensity real-time physical calculations. This reduces the client's computing power consumption and avoids resource fluctuations caused by real-time calculations, thereby reducing the resource consumption of cloth animation, reducing the client's runtime burden, improving animation smoothness, and replacing traditional tedious manual operations. While ensuring high-fidelity animation, it shortens the animation production cycle, reduces production and maintenance costs, and can batch process a large number of cloth animations, improving applicability.
[0199] Example 3
[0200] Figure 5 This is a flowchart of another cloth animation rendering method provided in Embodiment 3 of the present invention. This embodiment is a refinement of the "obtaining cloth animation timing data through cloth calculation" in the above embodiments. Figure 5 As shown, the method includes:
[0201] S510. Obtain the pre-created cloth model and body model, set the body model as a static collider, set the cloth model as the object to be solved, and perform cloth solving based on preset solving parameters to obtain cloth animation timing data.
[0202] The preset solution parameters include static solution parameters and / or dynamic solution parameters. Static solution parameters include globally applicable cloth physics parameters and / or collision environment parameters, while dynamic solution parameters include force field parameters applicable to a specified animation frame.
[0203] The cloth animation timing data includes vertex data corresponding to each cloth mesh vertex in each animation frame of the cloth animation.
[0204] In this embodiment of the invention, the object to be solved can be specifically understood as: an object (such as a cloth model) that needs to be physically simulated, and its motion state under physical rules is calculated by the solver.
[0205] Static solution parameters can be understood as globally applicable solution rules followed by all animation frames. These include cloth physical parameters (such as elasticity, tensile damping, and stiffness) and collision environment parameters, used to define the inherent properties of the cloth and collision rules. Dynamic solution parameters can be understood as solution rules that only apply to specific animation frames, such as force field parameters (such as gravity and dynamic tension), used to simulate instantaneous or localized external forces.
[0206] Specifically, mesh and solution preparation are completed in the physics simulation environment. A static body mesh for the game character (as a collision reference) and an independent flexible cloth model (such as a dynamic mesh of stockings) are created. The body model is set as a static collider, and the cloth model is set as the object to be solved. Preset solution parameters are then configured. These parameters can include only globally applicable static solution parameters (such as cloth physics parameters and collision environment parameters), or both static solution parameters and dynamic solution parameters applicable to a specific frame (such as force field parameters). Solution constraints are set in the solver. Finally, the total number of animation frames is set, and offline physics calculation is started. The physics engine calculates the motion state of the cloth under collision constraints and force fields. During the calculation process, the cloth motion performance of the timing segments is repeatedly adjusted to avoid the problem of cloth and body model interleaving. Finally, the output is the cloth animation timing data arranged frame by frame, which includes key information such as the position and normals of each cloth mesh vertex in each animation frame.
[0207] Optionally, based on the above embodiments, cloth calculation is performed based on preset calculation parameters to obtain cloth animation timing data, which may include:
[0208] For each cloth mesh vertex in each animation frame of the cloth animation, determine whether the quality value of the current cloth mesh vertex is a preset value. If so, obtain the vertex data obtained by solving the current cloth mesh vertex in the previous animation frame, and use the obtained vertex data as the vertex data of the current cloth mesh vertex in the current animation frame; otherwise, obtain the preset solution parameters applicable to the current cloth mesh vertex, perform cloth solution based on the preset solution parameters applicable to the current cloth mesh vertex, and obtain the vertex data corresponding to the current cloth mesh vertex.
[0209] Specifically, when the two-dimensional texture coordinates of any cloth mesh vertex in any animation frame meet the preset conditions, the quality value of that cloth mesh vertex is set to the preset value. The preset conditions are determined based on the animation progress parameters corresponding to that animation frame.
[0210] In this embodiment of the invention, the preset value can be specifically understood as: the vertex quality value used to mark vertices that do not need to be calculated in the cloth calculation, for example, vertices with a quality of 0 will not participate in the physics calculation.
[0211] Animation progress can be understood as the degree of advancement of the cloth animation (value from 0 to 1), which is related to parameters such as animation frame rate and time, and is used to dynamically adjust vertex resolution rules. Preset conditions can be understood as a UV coordinate threshold (such as pinUV_ymax) determined based on the animation progress. When the vertex 2D texture coordinates are less than this threshold, the quality value setting is triggered.
[0212] Specifically, the cloth solving process in this embodiment of the invention achieves vertex differential solving through UV coordinate thresholding and dynamic quality control. When performing cloth solving based on preset solving parameters, a judgment needs to be performed on each cloth mesh vertex in each animation frame:
[0213] First, configure the calculation parameters (including time, frame rate, progress offset (frames), and total number of frames, etc.), and calculate the current animation progress (e.g., obtain the progress value between 0 and 1 using the formula current_progress=min((@Frame×0.4+progress_offset) / frame_count,1.0).
[0214] Here, `@Frame` represents the current animation frame number being calculated, and 0.4 is the frame rate scaling factor, a manually set adjustable parameter that adjusts the animation's progression speed: a larger factor results in faster progress at the same frame rate, and a more rapid fabric (such as stockings) shedding effect; a smaller factor results in slower progress and a smoother animation. This factor is set to adapt to different frame rate animation requirements, matching the progress with the rhythm of the actual visual effect. `progress_offset` represents the progress offset, a preset constant parameter (positive or negative), used to offset the overall animation progress over time: a positive value gives the animation progress a head start in the initial stage, simulating the fabric shedding effect starting from the middle state; a negative value delays the animation progress, keeping the initial frame's progress at 0 until `@Frame` grows to a certain value before the progress begins to increase; a value of 0 results in the progress starting from 0 and increasing linearly with `@Frame`, representing the most basic no-offset scenario. @Frame×0.4 + progress_offset is the unnormalized raw progress value, which integrates the current frame number, speed coefficient, and offset. It calculates the absolute progress value that changes with the number of frames, but this value is not limited by the total number of animation frames and cannot directly reflect the relative progress.
[0215] `frame_count` represents the total number of frames in the cloth animation. It is a preset fixed parameter used to divide the unnormalized raw progress value by the total number of frames to normalize the progress and map the calculation result to a relative proportion based on the total number of frames.
[0216] `@Frame×0.4+progress_offset) / frame_count` is the initial normalized progress value. By dividing by the total number of frames, the original progress value is converted into a proportional value relative to the total animation duration. However, this value may be greater than 1 due to the influence of offset or frame count (for example, if the total number of frames is 100, the calculated result of `@Frame×0.4+progress_offset` is 120). The reasonable range for the progress value should be 0 to 1 (0 represents the start of the animation, and 1 represents the end of the animation). Therefore, it needs to be limited by the `min` function. `min` is a function that takes the minimum value, and its role is to clamp the progress value within 1. `current_progress` is the final calculated normalized animation progress value, with a value range of [0,1].
[0217] Then, based on the progress value, determine the threshold pinUV_ymax of the UV coordinates (e.g., pinUV_ymax=1.0-current_progress, which is linked to the animation progress).
[0218] Then, for each cloth mesh vertex in each animation frame, the following checks are performed: If the UV texture coordinates of a vertex (e.g., @uv.x, representing the x-axis coordinate of the UV texture) are less than pinUV_ymax (corresponding to a scene where the cloth has not yet been removed to the current vertex position, such as when stockings are being removed from top to bottom but have not yet been removed to the vertex near the ankle), then the quality value of that vertex is set to the preset value of 0. Such vertices do not need to participate in the calculation, and the vertex data of the previous animation frame is directly reused as the data of the current frame; if the UV coordinates of a vertex do not meet this condition (corresponding to a vertex that has been removed to the current position, such as when stockings are removed to the vertex near the ankle), then its quality value is set to a normal value (e.g., the preset normal quality value of 0.5), and the preset calculation parameters are called to perform physical calculation to obtain the vertex data of the current frame.
[0219] Understandably, the method of calculating normalized animation progress and then dynamically controlling vertex quality using UV thresholds is not only suitable for the scene of putting on and taking off stockings, but can be applied to the putting on and taking off of various types of clothing and fabric changes: whether it is the opening and closing of a top, the stretching of pants, or the dynamic putting on and taking off of a coat, or any form of fabric deformation, you only need to correspond @Frame in the formula to the current solution frame number, adjust the frame rate scaling factor of 0.4 to match the deformation rhythm of different fabrics, control the starting offset of the animation progress through progress_offset (for example, set it to a positive value when putting on and taking off a top starts from the middle frame), and replace frame_count with the total number of frames of the corresponding fabric animation to calculate the normalized progress suitable for the scene. The current_progress value is used; then, simply adjust pinUV_ymax in the logic that links the UV threshold to the progress to a UV coordinate threshold that adapts to the current direction of fabric change (such as the threshold of @uv.y (representing the y-axis coordinate of UV coordinates) for putting on and taking off a top, and the threshold of @uv.x for stretching pants left and right). By judging whether the UV coordinates meet the threshold, the quality values of vertices in different regions can be dynamically set. Vertices that have not reached the deformation region are set to 0 quality and reuse the data from the previous frame. Vertices that have entered the deformation region maintain normal quality and participate in the calculation, thereby accurately realizing differentiated physical simulation of arbitrary forms of fabric change. This not only adapts to various clothing putting and taking off scenarios, but also reduces invalid calculations and improves calculation efficiency.
[0220] By setting the quality of vertices not in the deformation region to a preset value, allowing them to reuse data from the previous frame, full vertex calculation is avoided, significantly reducing the computational load on the physics engine. In cloth models with a high vertex count, this significantly shortens the calculation time and improves offline calculation efficiency or frame rate stability in real-time simulation. Simultaneously, the design linking preset conditions to animation progress synchronizes quality value adjustments with the cloth deformation rhythm, restoring the realistic logic of cloth deformation progressing region by region (e.g., when putting on or taking off clothing, vertices not yet at the deformation position remain stationary), avoiding unnatural deformation from full calculation and improving animation fidelity and visual realism. Adjusting only the UV coordinate dimensions adapts to any form of cloth change (e.g., opening and closing of tops, stretching of trousers), and parameter adjustments can adapt to different animation rhythms without requiring logic reconstruction. Reusing data from vertices in stationary regions reduces temporal data redundancy, lowers storage volume and transmission bandwidth usage, and adapts to resource-constrained scenarios. The locally focused calculation logic also improves stability, avoiding unexpected deformation and clipping in stationary regions, ensuring the quality of cloth animation.
[0221] S520. Encode the vertex data corresponding to each cloth mesh vertex in each animation frame of the cloth animation to obtain the vertex encoded data corresponding to each cloth mesh vertex in each animation frame.
[0222] S530. Based on the vertex encoding data corresponding to each cloth mesh vertex in each animation frame, generate the first texture map data corresponding to the cloth animation.
[0223] The first texture map data is used by the client to render and generate the animation frames to be displayed for the cloth animation.
[0224] Optionally, based on the above embodiments, based on the vertex encoding data (position encoding data and normal encoding data) of each cloth mesh vertex in each animation frame of the cloth animation, firstly, export the cloth model mesh adapted to the second set of UVs (to match the preset texture addressing formula), then write the RGBA buffer containing the two types of encoded data as a 2D texture asset, and simultaneously output standardized format (such as JSON (JavaScript Object Notation)) metadata containing key information such as the total number of animation frames F, the minimum bounding box value AABB_min, and the maximum bounding box value AABB_max, to form the first texture map data, and finally send this data to the client. Among them, the bounding box data is a maximum enclosing bounding box calculated by integrating the cloth model outline at all moments from the first frame to the last frame of the animation. Its boundary will cover the outermost vertex of the cloth model in all frames, ensuring that no matter which frame the animation is playing, the cloth model in that frame can be completely wrapped within this bounding box.
[0225] By integrating vertex encoded data, meshes adapted to the second set of UVs, and metadata including the total number of animation frames F and bounding box ranges (AABB_min and AABB_max) into the first texture map data and sending it to the client, the chaos of transmitting multiple types of data in a scattered manner is avoided, bandwidth consumption and transmission latency are reduced, and key parameters are centrally recorded through metadata, making it convenient for the client to quickly obtain basic animation information and accurately calculate linear indexes to locate target data. Combined with the adaptation design of the second set of UVs and texture addressing formulas, the client's decoding efficiency and data retrieval convenience are improved. The AABB bounding box data can support client viewport clipping and dynamic precision adjustment, and the F value facilitates frame sequence management and playback control, ensuring that cloth animation presents a high-fidelity, low-latency visual effect.
[0226] The technical solution of this invention obtains a pre-created cloth model and body model, sets the body model as a static collider and the cloth model as the object to be solved, and combines static solution parameters covering globally applicable cloth physical parameters and collision environment parameters with dynamic solution parameters for force field parameters of a specified animation frame to perform cloth solving, thereby obtaining cloth animation timing data. This ensures that the basic movement of the cloth conforms to the characteristics of real fabric through static parameters, and restores the instantaneous deformation in a specific scene through dynamic parameters, improving the physical realism and detail of the animation. The globally unified configuration of static parameters ensures the consistency of the overall animation style, while the dynamic parameters support flexible adjustment for keyframes. Combined with collider settings, it avoids abnormal issues such as clipping in advance, enhances the artistic controllability of the animation, adapts to diverse character actions and scene requirements, and solves the problem of poor controllability of real-time physics calculation. At the same time, the parameterized calculation process reduces the complexity and labor cost of animation production, ensures the stability of the calculation results, and the generated timing data can be directly used to encode and generate texture assets or adapt to different client rendering requirements, improving the reusability of the data. The vertex data of each frame is encoded to obtain the vertex encoding data corresponding to each cloth mesh vertex in each animation frame. Based on the vertex encoding data, the first texture map data corresponding to the cloth animation is generated. The first texture map data is sent to the client. After receiving the texture data, the client only needs to perform texture sampling and simple decoding calculations to render and generate the animation frame to be displayed. This reduces the computing power occupied by the client and avoids the resource fluctuations caused by real-time calculation, thereby reducing the resource consumption of cloth animation, reducing production and maintenance costs, and enabling batch processing of a large number of cloth animations, thus improving applicability.
[0227] Example 4
[0228] Figure 6 This is a schematic diagram of the structure of a cloth animation rendering device provided in Embodiment 4 of the present invention. Figure 6 As shown, the device includes: a texture acquisition module 610, a vertex decoding module 620, and a rendering animation frame module 630, wherein:
[0229] The texture acquisition module 610 is used to acquire the first texture map data pre-generated for the cloth animation; wherein, the first texture map data contains the vertex encoding data corresponding to each cloth mesh vertex in each animation frame of the cloth animation;
[0230] The vertex decoding module 620 is used to sample the vertex encoding data corresponding to each cloth mesh vertex in the current animation frame to be displayed from the first texture map data according to the playback progress of the cloth animation, and decode the vertex encoding data corresponding to each cloth mesh vertex in the current animation frame to be displayed to obtain the vertex data corresponding to each cloth mesh vertex in the current animation frame to be displayed.
[0231] The rendering animation frame module 630 is used to render and generate the current animation frame to be displayed based on the vertex data corresponding to each cloth mesh vertex in the current animation frame to be displayed.
[0232] The technical solution of this invention obtains pre-generated first texture map data containing vertex encoding data of each animation frame, samples and decodes the current frame's vertex data according to the playback progress, and then renders it. The client does not need to perform complex real-time cloth physics calculations; vertex data can be obtained only through texture sampling and simple decoding operations. This effectively avoids frame rate fluctuations and stuttering caused by excessive client load, significantly reducing resource consumption during client operation. Simultaneously, the first texture map data integrates full-frame vertex encoding data and supports efficient compression transmission, reducing data loading overhead and waiting time, accelerating animation loading and startup speeds, and optimizing the user experience. Furthermore, this texture data originates from cloth calculations and optimizations performed offline on the server or client. The decoded data accurately restores the physical properties and details of the cloth, ensuring the visual fidelity and stability of the animation. Combined with the cross-platform universality of the texture data, it can adapt to different hardware, systems, and application scenarios, improving the applicability and practicality of the solution. While ensuring high animation fidelity, it shortens the animation production cycle, reduces production and maintenance costs, and allows for batch processing of large amounts of cloth animation, improving its applicability.
[0233] Based on the above embodiments, vertex encoding data may include: position encoding data and normal encoding data;
[0234] Based on the above embodiments, the vertex decoding module 620 is specifically used for:
[0235] For each vertex of the cloth mesh in the current animation frame to be displayed, the absolute position data of the current cloth mesh vertex is obtained based on the position encoding data in the current vertex encoding data and the initial position data of the current cloth mesh vertex in the initial pose.
[0236] Based on the first preset number of bits used in encoding the normal encoding data in the current vertex encoding data, the normal encoding data in the current vertex encoding data is decoded to obtain the spatial normal data corresponding to the current cloth mesh vertex.
[0237] Based on the above embodiments, the vertex decoding module 620 is further configured to:
[0238] Obtain the normal encoding value based on the normal encoding data in the current vertex encoding data;
[0239] Based on the first preset number of bits used in encoding the normal encoding data in the current vertex encoding data, the normal encoding value is split to obtain high-bit encoding data and low-bit encoding data;
[0240] The high-bit encoded data and low-bit encoded data are mapped into two-dimensional components respectively;
[0241] The three-dimensional components of the normal data are determined based on the two-dimensional compressed components;
[0242] The spatial normal data corresponding to the vertices of the current cloth mesh are obtained based on the three-dimensional components.
[0243] Based on the above embodiments, the vertex decoding module 620 is further configured to:
[0244] For each cloth mesh vertex in the current animation frame to be displayed, the position offset ratio of the vertex encoding data of the current animation frame to be displayed in the first texture map data is determined according to the current playback progress parameters and the total number of animation frames of the cloth animation.
[0245] Based on the effective data ratio, position offset ratio, and two-dimensional texture coordinates of the current cloth mesh vertex, determine the actual texture coordinates of the current cloth mesh vertex;
[0246] Based on the actual texture coordinates, the vertex encoding data corresponding to the current cloth mesh vertex is obtained by sampling the first texture map data.
[0247] Based on the above embodiments, the playback progress parameter is determined according to the duration of the already played animation and the total playback duration of the animation; or, the playback progress parameter is determined according to the detected user's playback progress control operation on the cloth animation.
[0248] Based on the above embodiments, the vertex decoding module 620 is further configured to:
[0249] The position encoding data corresponding to the current cloth mesh vertex is obtained by sampling the RGB channel data of the first texture map based on the actual texture coordinates, and the normal encoding data corresponding to the current cloth mesh vertex is obtained by sampling the A channel data of the first texture map.
[0250] Based on the above embodiments, the animation frame rendering module 630 is specifically used for:
[0251] The vertex reconstruction result is obtained by using the vertex shader to reconstruct the vertex based on the vertex data corresponding to each cloth mesh vertex in the current animation frame to be displayed.
[0252] The fragment shader renders and generates the current animation frame to be displayed based on the second texture map data and vertex reconstruction results corresponding to the current animation frame to be displayed; the second texture map data includes the color data and transparency data of the current animation frame to be displayed.
[0253] Based on the above embodiments, the animation frame rendering module 630 is further configured to:
[0254] The fragment shader performs preset adjustment operations on the second texture map data corresponding to the current animation frame to be displayed. The preset adjustment operations include at least one of adjusting the pixel color data, adding preset wrinkle normal data, and adjusting the pixel transparency data.
[0255] Based on the adjusted second texture map data and vertex reconstruction results, the current animation frame to be displayed is rendered.
[0256] Optionally, based on the above embodiments, obtaining the texture module 610 may include:
[0257] The cloth solving submodule is used to obtain cloth animation timing data through cloth solving; wherein, the cloth animation timing data includes the vertex data corresponding to each cloth mesh vertex in each animation frame of the cloth animation;
[0258] The vertex encoding submodule is used to encode the vertex data corresponding to each cloth mesh vertex in each animation frame of the cloth animation, so as to obtain the vertex encoding data corresponding to each cloth mesh vertex in each animation frame.
[0259] The texture sending submodule is used to generate the first texture map data corresponding to the cloth animation based on the vertex encoding data corresponding to each cloth mesh vertex in each animation frame; wherein, the first texture map data is used by the client to render and generate the animation frame to be displayed for the cloth animation.
[0260] Based on the above embodiments, vertex data may include absolute position data and spatial normal data;
[0261] Based on the above embodiments, the vertex encoding submodule is specifically used for:
[0262] For each cloth mesh vertex in each animation frame of the cloth animation, determine the position offset data of the absolute position data corresponding to the current cloth mesh vertex relative to the initial position data of the current cloth mesh vertex in the initial state, and use the position offset data as the position encoding data corresponding to the current cloth mesh vertex.
[0263] The spatial normal data corresponding to the current cloth mesh vertex is quantized to the numerical range represented by the first preset number of bits, and the normal encoding data corresponding to the current cloth mesh vertex is obtained based on the quantized normal data.
[0264] Based on the above embodiments, the texture sending submodule is specifically used for:
[0265] The positional encoding data corresponding to each cloth mesh vertex in each animation frame of the cloth animation is saved as the first channel data of the first texture map, and the normal encoding data corresponding to each cloth mesh vertex in each animation frame of the cloth animation is saved as the second channel data of the first texture map.
[0266] Based on the above embodiments, the vertex encoding submodule is further used for:
[0267] Map the spatial normal data corresponding to the current cloth mesh vertex to two-dimensional data;
[0268] The x and y data in the two-dimensional data are quantized to the numerical range represented by the second preset number of bits;
[0269] The quantized x and y data are merged and packaged to obtain normal encoding values within the numerical range represented by the first preset number of bits; wherein, the high and low bits of the normal encoding value correspond to the x and y data in the two-dimensional data, respectively, and the first preset number of bits is a multiple of the second preset number of bits;
[0270] Obtain the normal encoding data corresponding to the current cloth mesh vertex based on the normal encoding value.
[0271] Optionally, based on the above embodiments, the vertex encoding submodule includes: a unit spherical element, wherein:
[0272] The unit spherical element is used to normalize the spatial normal data corresponding to the current cloth mesh vertex before mapping it to two-dimensional data, so that the spatial normal data is located in the unit spherical space.
[0273] Based on the above embodiments, the vertex encoding submodule is further used for:
[0274] The normal encoding values are normalized so that they fall within the range of the second channel data of the first texture map.
[0275] Based on the above embodiments, the second preset number of bits is an integer greater than 4.
[0276] Based on the above embodiments, the texture sending submodule is further used for:
[0277] For each cloth mesh vertex in each animation frame of the cloth animation, the current linear index value of the current cloth mesh vertex in the first texture map is determined based on the sequence number of the current animation frame, the number of rows occupied by the current animation frame in the first texture map, the width of the first texture map, and the sequence number of the current cloth mesh vertex.
[0278] Write the position encoding data corresponding to the current cloth mesh vertex into the RGB channel of the first texture map at the position corresponding to the current linear index value, and write the normal encoding data corresponding to the current cloth mesh vertex into the A channel of the first texture map at the position corresponding to the current linear index value.
[0279] Based on the above embodiments, the cloth calculation submodule is specifically used for:
[0280] Obtain the pre-created cloth model and body model, set the body model as a static collider, set the cloth model as the object to be solved, and perform cloth solving based on preset solving parameters to obtain cloth animation timing data.
[0281] The preset solution parameters include static solution parameters and / or dynamic solution parameters. Static solution parameters include globally applicable cloth physics parameters and / or collision environment parameters, while dynamic solution parameters include force field parameters applicable to a specified animation frame.
[0282] Based on the above embodiments, the cloth calculation submodule is further used for:
[0283] For each cloth mesh vertex in each animation frame of the cloth animation, determine whether the quality value of the current cloth mesh vertex is a preset value. If so, obtain the vertex data obtained by solving the current cloth mesh vertex in the previous animation frame, and use the obtained vertex data as the vertex data of the current cloth mesh vertex in the current animation frame; otherwise, obtain the preset solution parameters applicable to the current cloth mesh vertex, perform cloth solution based on the preset solution parameters applicable to the current cloth mesh vertex, and obtain the vertex data corresponding to the current cloth mesh vertex.
[0284] Specifically, when the two-dimensional texture coordinates of any cloth mesh vertex in any animation frame meet the preset conditions, the quality value of that cloth mesh vertex is set to the preset value. The preset conditions are determined based on the animation progress parameters corresponding to that animation frame.
[0285] The cloth animation rendering apparatus provided in this embodiment of the invention can execute the cloth animation rendering method applied to the client provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0286] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0287] In the technical solution disclosed herein, the information collected is information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data all comply with the relevant laws, regulations and standards of the relevant countries and regions, necessary confidentiality measures have been taken, and they do not violate public order and good morals. Corresponding operation entry points are provided for users to choose to authorize or refuse.
[0288] In the technical solution disclosed herein, if automated decision-making is involved, a corresponding operation entry will be provided to the user, allowing the user to choose to agree to or reject the automated decision result; if the user chooses to reject, the process will proceed to the expert decision-making process.
[0289] Example 5
[0290] Figure 7 A schematic diagram of an electronic device 10, which can be used to implement embodiments of the present invention, is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0291] like Figure 7 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0292] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0293] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as the cloth animation rendering method, i.e.:
[0294] Obtain the first texture map data pre-generated for the cloth animation; wherein, the first texture map data contains the vertex encoding data corresponding to each cloth mesh vertex in each animation frame of the cloth animation;
[0295] Based on the playback progress of the cloth animation, the vertex encoding data corresponding to each cloth mesh vertex in the current animation frame to be displayed is sampled from the first texture map data, and the vertex encoding data corresponding to each cloth mesh vertex in the current animation frame to be displayed is decoded to obtain the vertex data corresponding to each cloth mesh vertex in the current animation frame to be displayed.
[0296] The current animation frame to be displayed is generated by rendering based on the vertex data corresponding to each cloth mesh vertex in the current animation frame to be displayed.
[0297] In some embodiments, the cloth animation rendering method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the cloth animation rendering method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the cloth animation rendering method by any other suitable means (e.g., by means of firmware).
[0298] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0299] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0300] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0301] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0302] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0303] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0304] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0305] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A cloth animation rendering method, characterized by, The method comprises: obtaining first texture map data pre-generated for cloth animation; wherein the first texture map data contains vertex encoding data corresponding to each cloth mesh vertex in each animation frame of the cloth animation; sampling vertex encoding data corresponding to each cloth mesh vertex in the current animation frame to be displayed from the first texture map data according to a playing progress of the cloth animation, and decoding the vertex encoding data corresponding to each cloth mesh vertex in the current animation frame to be displayed to obtain vertex data corresponding to each cloth mesh vertex in the current animation frame to be displayed; generating the current animation frame to be displayed based on the vertex data corresponding to each cloth mesh vertex in the current animation frame to be displayed.
2. The method of claim 1, wherein, The vertex encoding data comprises position encoding data and normal encoding data. The decoding of the vertex encoding data corresponding to each cloth mesh vertex in the current animation frame to be displayed to obtain vertex data corresponding to each cloth mesh vertex in the current animation frame to be displayed comprises: for the vertex encoding data corresponding to each cloth mesh vertex in the current animation frame to be displayed, obtaining absolute position data corresponding to the current cloth mesh vertex based on position encoding data in the current vertex encoding data and initial position data of the current cloth mesh vertex in an initial posture; decoding the normal encoding data in the current vertex encoding data to obtain spatial normal data corresponding to the current cloth mesh vertex based on a first preset number of bits used by the normal encoding data in the current vertex encoding data when encoding.
3. The method of claim 2, wherein, The decoding of the normal encoding data in the current vertex encoding data to obtain spatial normal data corresponding to the current cloth mesh vertex based on a first preset number of bits used by the normal encoding data in the current vertex encoding data when encoding comprises: obtaining a normal encoding value based on the normal encoding data in the current vertex encoding data; splitting the normal encoding value based on the first preset number of bits used by the normal encoding data in the current vertex encoding data when encoding to obtain high-bit encoding data and low-bit encoding data; mapping the high-bit encoding data and the low-bit encoding data into two-dimensional components, respectively; determining three-dimensional components of the normal data based on the two-dimensional compressed components; obtaining spatial normal data corresponding to the current cloth mesh vertex based on the three-dimensional components.
4. The method of claim 1, wherein, The sampling of the vertex encoding data corresponding to each cloth mesh vertex in the current animation frame to be displayed from the first texture map data according to the playing progress of the cloth animation comprises: for each cloth mesh vertex in the current animation frame to be displayed, determining a position offset ratio of the vertex encoding data of the current animation frame to be displayed in the first texture map data according to a current playing progress parameter and a total number of animation frames of the cloth animation; determining actual texture coordinates of the current cloth mesh vertex according to an effective data proportion of the first texture map data, the position offset ratio and two-dimensional texture coordinates of the current cloth mesh vertex; sampling in the first texture map data according to the actual texture coordinates to obtain the vertex encoding data corresponding to the current cloth mesh vertex.
5. The method of claim 4, wherein, The playing progress parameter is determined according to a played animation time length and a total animation playing time length, or the playing progress parameter is determined according to a detected user playing progress control operation on the cloth animation.
6. The method of claim 4, wherein, The sampling according to the actual texture coordinate in the first texture map data to obtain vertex encoding data corresponding to a current cloth mesh vertex includes: The sampling according to the actual texture coordinate in the first texture map data to obtain vertex encoding data corresponding to a current cloth mesh vertex includes:
7. The method according to any one of claims 1 to 6, characterized in that, The rendering generation of the current to-be-displayed animation frame based on the vertex data respectively corresponding to each cloth mesh vertex in the current to-be-displayed animation frame includes: The vertex reconstruction based on the vertex data respectively corresponding to each cloth mesh vertex in the current to-be-displayed animation frame by the vertex shader to obtain a vertex reconstruction result; The rendering generation of the current to-be-displayed animation frame based on the second texture map data corresponding to the current to-be-displayed animation frame and the vertex reconstruction result by the fragment shader, wherein the second texture map data includes color data and transparency data of the current to-be-displayed animation frame.
8. The method of claim 7, wherein, The rendering generation of the current to-be-displayed animation frame based on the second texture map data corresponding to the current to-be-displayed animation frame and the vertex reconstruction result by the fragment shader includes: The execution of a preset adjustment operation on the second texture map data corresponding to the current to-be-displayed animation frame by the fragment shader, wherein the preset adjustment operation includes at least one of adjusting color data of a pixel, adding preset wrinkle normal data, and adjusting pixel transparency data; The rendering generation of the current to-be-displayed animation frame based on the adjusted second texture map data and the vertex reconstruction result.
9. A rendering device for cloth animation, characterized in that, The apparatus includes: The texture acquisition module is configured to acquire first texture map data pre-generated for a cloth animation, wherein the first texture map data includes vertex encoding data respectively corresponding to each cloth mesh vertex in each animation frame of the cloth animation; The vertex decoding module is configured to sample the first texture map data according to a playing progress of the cloth animation to obtain the vertex encoding data respectively corresponding to each cloth mesh vertex in a current to-be-displayed animation frame, and decode the vertex encoding data respectively corresponding to each cloth mesh vertex in the current to-be-displayed animation frame to obtain vertex data respectively corresponding to each cloth mesh vertex in the current to-be-displayed animation frame. The animation frame rendering module is configured to render and generate the current to-be-displayed animation frame based on the vertex data respectively corresponding to each cloth mesh vertex in the current to-be-displayed animation frame.
10. An electronic device, comprising: The electronic device includes: One or more processors; Memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the cloth animation rendering method according to any one of claims 1-8.
11. A computer readable storage medium having stored thereon a computer program, characterized in that The program is executed by the processor to implement the cloth animation rendering method according to any one of claims 1-8.
12. A computer program product, characterised in that, The computer program product comprises a computer program which, when executed by a processor, implements the method for rendering cloth animation according to any one of claims 1-8.