Mesh model morphing method and device
By acquiring the texture map and maximum displacement of the target high-poly model, dynamically updating the vertex coordinates of the mesh model, and utilizing surface subdivision technology, the problems of high rigidity and wasted computational resources in the deformation mode of the mesh model are solved, achieving flexible and high-quality deformation effects.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HANGZHOU QIUGUOJIHUA TECHNOLOGY CO LTD
- Filing Date
- 2026-05-14
- Publication Date
- 2026-06-12
Smart Images

Figure CN122199832A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer graphics technology, and in particular to a method and apparatus for deforming mesh models. Background Technology
[0002] A mesh model, also known as a 3D mesh model, is a three-dimensional spatial geometric model composed of vertices, edges, and faces. Its surface is formed by piecing together polygons (usually triangles or quadrilaterals) to create a continuous mesh structure. Mesh model deformation technology is one of the core technologies for achieving dynamic visual effects and is widely used in game development, virtual reality, film special effects, and terrain simulation. Mesh model deformation refers to the process of visually changing the model by altering the position of its vertices, such as object growth, collapse, and terrain changes. Examples include: in game special effects, real-time rendering of magical vine growth, icicle freezing / melting, and buildings rising or collapsing.
[0003] In current technologies, the deformation of mesh models generally relies on skeletal skinning animation or vertex shader offset. Skeletal skinning animation binds bones to model vertices and uses bone movement to drive model deformation; vertex shader offset involves manually calculating and offsetting vertex positions using shaders to achieve simple deformation.
[0004] However, the deformation methods of mesh models in current technology have high rigidity in pre-made animations, poor flexibility in mesh model deformation, and the inability to dynamically add details, which affects visual quality. Summary of the Invention
[0005] To address the aforementioned issues, this application provides a method and apparatus for deforming mesh models. By acquiring the texture map and maximum displacement of the target high-poly model relative to the initial mesh model, and dynamically updating the vertex coordinates based on the progress parameter, accurate geometric deformation is achieved without the need for pre-creating animations, significantly improving the flexibility of mesh model deformation. Simultaneously, in response to the input of the progress parameter, the mesh density is dynamically adjusted through surface subdivision technology, which can dynamically increase details and thus improve visual quality.
[0006] The embodiments of this application disclose the following technical solutions: In a first aspect, embodiments of this application provide a deformation method for a mesh model, including: Based on the target high-poly model and the initial mesh model, the texture map and maximum displacement of the target high-poly model relative to the initial mesh model are obtained; wherein, the texture map contains displacement data, and the displacement data includes: the relative height value and displacement direction corresponding to each texel of the initial mesh model; In response to the input progress parameter, based on the surface subdivision algorithm, the number of vertices of the initial mesh model is increased to obtain a first mesh model; wherein, the progress parameter is used to characterize the progress of the initial mesh model in deforming into the target high-poly model; From the texture map, obtain the relative height value and displacement direction corresponding to each vertex of the first mesh model; Based on the maximum displacement, the progress parameter, the relative height value and displacement direction corresponding to each vertex of the first mesh model, the coordinates of each vertex of the first mesh model are updated to obtain the deformed second mesh model.
[0007] In one possible implementation, updating the coordinates of each vertex of the first mesh model based on the maximum displacement, the progress parameter, the relative height value corresponding to each vertex of the first mesh model, and the displacement direction, to obtain the second mesh model, includes: Based on the relative height value corresponding to each vertex of the first mesh model, the maximum displacement, and the progress parameter, the target displacement corresponding to each vertex of the first mesh model is obtained through a preset displacement formula. Based on the target displacement and displacement direction corresponding to each vertex, the coordinates of each vertex of the first mesh model are updated to obtain the second mesh model.
[0008] In one possible implementation, the preset displacement formula includes: a first displacement formula, which characterizes a linear relationship between the target displacement and the progress parameter; the step of obtaining the target displacement corresponding to each vertex of the first mesh model based on the relative height value corresponding to each vertex of the first mesh model, the maximum displacement, and the progress parameter, through the preset displacement formula, includes: Based on the first displacement formula, the relative height value corresponding to each vertex of the first mesh model, the maximum displacement, and the progress parameter are multiplied to obtain the target displacement corresponding to each vertex of the first mesh model.
[0009] In one possible implementation, the preset displacement formula includes: a second displacement formula, which characterizes a linear relationship between the target displacement and the effective deformation coefficient; the step of obtaining the target displacement corresponding to each vertex of the first mesh model based on the relative height value corresponding to each vertex of the first mesh model, the maximum displacement, and the progress parameter, through the preset displacement formula, includes: Using a limiting function, based on the overall height value of the target high-poly model, the progress parameter, and the initial height value of each vertex of the first mesh model, an effective deformation coefficient corresponding to each vertex of the first mesh model is obtained; wherein, the overall height value of the target high-poly model is the maximum height value of the target high-poly model in the height direction; Based on the second displacement formula, the relative height value corresponding to each vertex of the first mesh model, the maximum displacement, and the effective deformation coefficient corresponding to each vertex of the first mesh model are multiplied to obtain the target displacement corresponding to each vertex of the first mesh model.
[0010] In one possible implementation, the input progress parameter is calculated based on the input time parameter; wherein the input time parameter represents the time from the start of deformation to the current moment; the progress parameter and the time parameter have a preset correlation relationship, so that the progress parameter changes with the time parameter according to the preset correlation relationship.
[0011] In one possible implementation, the progress parameter belongs to [0,1], and the progress parameter increases with the increase of the time parameter. Thus, the progress parameter changes from 0 to 1 as the time parameter increases, so as to achieve the growth deformation effect of the mesh model.
[0012] In one possible implementation, the progress parameter is [0,1], and the progress parameter decreases as the time parameter increases. Thus, the progress parameter changes from 1 to 0 as the time parameter increases, thereby achieving the destruction deformation effect of the mesh model.
[0013] In one possible implementation, obtaining the texture map of the target high-poly model relative to the initial mesh model, based on the target high-poly model and the initial mesh model, includes: By using baking rendering technology, the displacement information between the surface of the target high-poly model and the surface of the initial mesh model is extracted, and the displacement information is mapped to the UV coordinate system corresponding to the initial mesh model to generate a texture map of the target high-poly model relative to the initial mesh model.
[0014] In one possible implementation, the texture map includes: a vector displacement map, which stores the relative height value and displacement direction corresponding to each texel of the initial mesh model; Alternatively, the texture map may include a height displacement map and a normal map, wherein the height displacement map stores the relative height value corresponding to each texel of the initial mesh model, and the normal map stores the displacement direction corresponding to each texel of the initial mesh model.
[0015] Secondly, embodiments of this application provide a deformation device for a mesh model, comprising: The texture acquisition module is used to acquire the texture map and maximum displacement of the target high-poly model relative to the initial mesh model based on the target high-poly model and the initial mesh model; wherein, the texture map contains displacement data, and the displacement data includes: the relative height value and displacement direction corresponding to each texel of the initial mesh model; The surface subdivision module is used to increase the number of vertices of the initial mesh model in response to the input progress parameter, based on the surface subdivision algorithm, to obtain a first mesh model; wherein, the progress parameter is used to characterize the progress of the initial mesh model in deforming towards the target high-poly model; The data acquisition module is used to acquire the relative height value and displacement direction corresponding to each vertex of the first mesh model from the texture map; The model deformation module is used to update the coordinates of each vertex of the first mesh model based on the relative height value and displacement direction corresponding to each vertex of the first mesh model, the maximum displacement amount and the progress parameter, so as to obtain the deformed second mesh model.
[0016] Compared with existing technologies, this application has the following advantages: by obtaining the texture map and maximum displacement of the target high-poly model relative to the initial mesh model, the vertex coordinates are dynamically updated based on the progress parameter to achieve accurate geometric deformation without the need for pre-made animation, which significantly improves the flexibility of mesh model deformation; at the same time, in response to the input of the progress parameter, the mesh density is dynamically adjusted through surface subdivision technology, which can dynamically increase details and thus improve visual quality. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 An example diagram illustrating an application scenario of a mesh model deformation method provided in this application embodiment; Figure 2 A flowchart illustrating a deformation method for a mesh model provided in an embodiment of this application; Figure 3 Example diagrams of the initial mesh model and the target high-poly model provided in the embodiments of this application; Figure 4 An example diagram illustrating a growth deformation effect provided in an embodiment of this application; Figure 5 An example diagram illustrating a destruction deformation effect provided in an embodiment of this application; Figure 6 This is a structural schematic diagram of a deformation device for a mesh model provided in an embodiment of this application. Detailed Implementation
[0019] As described earlier, current technologies typically rely on skeletal skinning animation or vertex shader offsets to achieve mesh model deformation. Skeletal skinning animation binds bones to model vertices and uses bone movement to drive model deformation. However, for skeletal skinning animation, the deformation path of the pre-designed animation is fixed in the resources, resulting in high rigidity and an inability to dynamically adjust according to runtime conditions, leading to poor deformation flexibility of the mesh model. Vertex shader offsets involve manually calculating and offsetting vertex positions using shaders to achieve simple deformations. However, with vertex shader offsets, the number of vertices in the mesh model is fixed, making it impossible to dynamically adjust details according to the degree of deformation. Large deformations can easily result in streaking, distortion, or jagged edges, thus affecting the visual effect.
[0020] Furthermore, in current technology, each deformation of the mesh model requires manual animation editing or manual adjustment of vertex positions via shaders, resulting in a large consumption of computing resources and a significant waste of manual resources, making it difficult to achieve high-quality dynamic deformation effects in real-time rendering.
[0021] Furthermore, multiple models in different states (such as multiple keyframes during object growth) are pre-created, and dynamic effects are achieved by switching between models. While this method can achieve complex deformations, it requires storing a large amount of model data, consuming significant memory and bandwidth, making it difficult to support large-scale instantiation. Alternatively, linear interpolation can be performed based on two predefined model states to achieve deformation of the intermediate model state. Although this method is simple and easy to implement, it cannot perform precise geometric deformation based on actual height data, lacking realism and flexibility.
[0022] This application provides a deformation method for a mesh model, comprising: obtaining the texture map and maximum displacement of the target high-poly model relative to the initial mesh model based on a target high-poly model and an initial mesh model; increasing the number of vertices of the initial mesh model based on a surface subdivision algorithm in response to an input progress parameter to obtain a first mesh model; obtaining the relative height value and displacement direction corresponding to each vertex of the first mesh model from the texture map; and updating the coordinates of each vertex of the first mesh model based on the maximum displacement, the progress parameter, and the relative height value and displacement direction corresponding to each vertex of the first mesh model to obtain a second mesh model. In this application, by obtaining the texture map and maximum displacement of the target high-poly model relative to the initial mesh model and dynamically updating the vertex coordinates based on the progress parameter, accurate geometric deformation is achieved without the need for pre-created animation, significantly improving the flexibility of mesh model deformation; simultaneously, responding to the input progress parameter, the mesh density is dynamically adjusted through surface subdivision technology, which can dynamically increase details, thereby improving visual quality.
[0023] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present application.
[0024] Example 1: The following is combined Figures 1-5 This application provides a detailed description of a mesh model deformation method based on its embodiments.
[0025] First, combined Figure 1 This section provides an example of an application scenario for a deformation method for a mesh model.
[0026] like Figure 1 As shown, taking the topographic uplift process as an example, the initial state is as follows: Figure 1 The mesh model shown in (a) has a flat profile; as Figure 1 As shown in (b), by adjusting the vertex height of the mesh model, the deformation of the mesh model is achieved, initially presenting a hilly and undulating state, thereby realizing the effect of the mountain range gradually rising from the flat terrain.
[0027] like Figure 2 As shown in the embodiments of this application, a deformation method for a mesh model includes the following steps: S201. Based on the target high-poly model and the initial mesh model, obtain the texture map and maximum displacement of the target high-poly model relative to the initial mesh model.
[0028] The target high-poly model, also known as the target high-polygon mesh model, refers to a high-precision mesh model used to create high-detail models. In this embodiment, the target high-poly model is a high-precision reference model used for baking textures, possessing extremely high geometric detail and polygon count, typically containing fine surface features (such as facial wrinkles, clothing folds, rock textures, etc.). Simply put, the target high-poly model is the source for creating high-quality textures, serving as a "reference" for generating height displacement textures.
[0029] A high-poly model is a 3D model with a high level of detail and a high polygon count. It is a high-precision, high-detail model, typically used to create fine surface features and realistic visual effects. High-poly models contain a large number of details, such as fine features like rock textures; they are usually composed of tens of thousands or even hundreds of thousands of polygons, capable of capturing every detail of an object with exquisite precision.
[0030] The initial mesh model, also known as the initial low-poly mesh model, refers to a mesh model used as a basis for deformation. It has a low number of polygons, low vertex density, and a simple structure, retaining only the core topology of the target high-poly model and not containing complex surface details. In this embodiment, the initial mesh model serves as the "base" model, achieving high-detail effects through the target high-poly model.
[0031] A mesh model is a 3D model representation composed of vertices, edges, and faces (usually triangles or quadrilaterals). Specifically, a mesh model consists of vertices (points in 3D space), which are connected by edges, and the edges form faces that constitute the model surface.
[0032] It should be noted that the initial mesh model and the target high-poly model need to maintain the same topological structure to ensure that the vertices at corresponding positions can be accurately mapped.
[0033] To make it easier to understand, the following will be combined with... Figure 3 Examples are given for the initial mesh model and the target high-poly model.
[0034] like Figure 3 The target high-poly model shown in (a) is a "sci-fi style barrel container", such as Figure 3 As shown in (a), the target high-poly model is a mesh model with complete detailed features, rich surface details, such as multi-layered ring structures, luminous decorative strips, and complex geometric shapes such as protruding side modules. It is the final form reference of the deformation process.
[0035] like Figure 3 The initial mesh model shown in (b) presents a type of mesh as follows: Figure 3The target high-poly model shown in (a) is a "flat ring-shaped model". The initial mesh model only retains the core outline of the target high-poly model, such as the overall ring-shaped layout and the approximate position of the side modules, which greatly simplifies the surface details.
[0036] like Figure 3 (a) and Figure 3 As shown in (b), the initial mesh model maintains topological consistency with the target high-poly model (such as the connection relationship of vertices and the overall layout of the surface are completely matched), ensuring that the calculation of subsequent displacement data and deformation process can be accurately associated with the corresponding position of the target high-poly model.
[0037] Among them, the texture mapping of the target high-poly model relative to the initial mesh model refers to the displacement data (offset data) of the target high-poly model relative to the initial mesh model.
[0038] The texture map contains displacement data, which includes the relative height value and displacement direction of each texel of the initial mesh model. In other words, the displacement data is the displacement data of the target high-poly model relative to the initial mesh model. It is used to characterize the data (equivalent height value and displacement direction) associated with each texel in the texture map corresponding to the initial mesh model when the initial mesh model deforms towards the target high-poly model, providing the magnitude and direction basis for vertex displacement calculation.
[0039] A texel (texture element) is the smallest unit in a texture map, similar to a pixel in an image. In other words, a texel is the basic building block of a texture map. In the UV coordinate system of a mesh model, the UV coordinates determine the position of the model's mesh surface in the texture map; that is, each vertex in the mesh model is associated with a corresponding texel in the texture map. It can be understood that each texel of the initial mesh model is actually the texel at its corresponding position in the UV coordinate system of the initial mesh model.
[0040] The relative height value refers to the relative height difference between the corresponding positions of the initial mesh model and the target high-poly model. The relative height value ∈ [0,1], quantifying the displacement distance. A relative height value of 0 between the initial mesh model and the target high-poly model indicates that there is no height difference between the corresponding positions of the initial mesh model and the target high-poly model. A relative height value of 1 indicates that the maximum displacement difference in height between the corresponding positions of the initial mesh model and the target high-poly model.
[0041] The displacement direction refers to the unit vector of spatial orientation of a point at a corresponding position when it undergoes spatial deformation from the initial mesh model to the target high-mode model. It is used to determine which direction a point (vertice) on the initial mesh model moves towards the target high-mode model.
[0042] Among them, texture mapping is a two-dimensional image carrier that carries displacement data. It belongs to the category of texture mapping for enhancing the surface details of mesh models. It is used to store the displacement data of scattered points in a structured form, which is convenient for subsequent rapid sampling and retrieval through UV coordinates.
[0043] Specifically, using a two-dimensional image as the physical carrier and a texel as the smallest data unit, each texel is associated with a point in the initial mesh model or a point in the target high-poly model through UV coordinates (i.e., the mapping coordinates from the mesh model surface to the two-dimensional plane). In this embodiment, the texture map serves as a storage container for displacement data. During the real-time deformation process, the corresponding texel is quickly located using the UV coordinates of points on the mesh model surface, and the corresponding displacement data is sampled and obtained, providing efficient and accurate data support for model deformation.
[0044] In one possible implementation, the displacement information between the target high-poly model surface and the initial mesh model surface is extracted using baking rendering technology, and the displacement information is mapped to the UV coordinate system corresponding to the initial mesh model to generate a texture map of the target high-poly model relative to the initial mesh model.
[0045] Baking rendering technology refers to the technique of pre-calculating model information and converting it into texture maps in 3D software.
[0046] Specifically, using baking rendering technology, the height difference of each position on the surface of the target high-poly model relative to the initial mesh model is calculated to obtain the maximum displacement. The height difference is then converted into a relative height value based on the maximum displacement. At the same time, the displacement direction of each position of the target high-poly model relative to the initial mesh model is obtained. The relative height value and displacement direction are mapped to the UV coordinate system corresponding to the initial mesh model to obtain the texture map of the target high-poly model relative to the initial mesh model.
[0047] In one possible implementation, the texture map includes a vector displacement map. The vector displacement map stores the relative height value and displacement direction for each texel of the initial mesh model.
[0048] Vector displacement mapping is a specific implementation of texture mapping. It is a two-dimensional texture image that directly integrates and stores two core displacement data types: relative height value and displacement direction. A single texture map carries the displacement data of all texels in the initial mesh model. Each texel in the vector displacement map is associated with the initial mesh model through UV coordinates, and each texel uniquely corresponds to the displacement data of a single position in the initial mesh model.
[0049] For example, a vector displacement map is obtained by embedding the relative height value and displacement direction into the color channels of the texture using a preset channel mapping rule. For instance, the X, Y, and Z components of the displacement direction are mapped to the R, G, and B channels of the vector displacement map, respectively, and the relative height value is mapped to the Alpha channel of the vector displacement map.
[0050] In this embodiment, the vector displacement map stores the relative height value and displacement direction corresponding to each texel. The relative height value and displacement direction can be obtained simultaneously with only one UV coordinate sampling, which helps to simplify the complexity of data retrieval in the real-time deformation process.
[0051] In another possible implementation, the texture map includes a height displacement map and a normal map. The height displacement map stores the relative height value corresponding to each texel of the initial mesh model, and the normal map stores the displacement direction corresponding to each texel of the initial mesh model.
[0052] A height displacement map is a texture map that stores relative height values. Each texel in the height displacement map is associated with the initial mesh model through UV coordinates, and each texel uniquely corresponds to the relative height value of a position in the initial mesh model.
[0053] For example, a height displacement map is obtained by grayscale value encoding. The grayscale value of each texel in the height displacement map is used to represent the relative height value. For example, a grayscale value of 0 for a texel represents a relative height value of 0, and a grayscale value of 255 for a texel represents a relative height value of 1.
[0054] In this embodiment, the grayscale value of the height displacement map is mapped to the relative height value. That is, the grayscale value is normalized to the range of [0,1] to obtain the corresponding relative height value. For example, the relative height value = grayscale value / 255.
[0055] Normal mapping refers to a texture map that stores the displacement direction. Each texel in the normal map is associated with the initial mesh model through the UV coordinate system, and each texel uniquely corresponds to the displacement direction of a position in the initial mesh model.
[0056] For example, a normal map is obtained through RGB color channel encoding, where the X, Y, and Z components of the displacement direction are mapped to the R, G, and B channels of the vector displacement map, respectively.
[0057] In this embodiment, the relative height value corresponding to each texel of the initial mesh model is stored by a height displacement map, and the displacement direction corresponding to each texel of the initial mesh model is stored by a normal map. The data storage is clearly divided and can be flexibly adapted to various scenarios.
[0058] The maximum displacement refers to the maximum distance the model surface can deform, defining the upper limit of the displacement effect and controlling the magnitude of model deformation. Specifically, the maximum displacement is the actual physical displacement distance between the initial mesh model and the target high-poly model corresponding to a point in the height displacement map with a relative height value of 1; that is, the actual displacement distance corresponding to a relative height value of 1. For example, the maximum displacement is a scalar parameter, with units in the initial mesh model or target high-poly model (such as meters, centimeters, etc.). It defines the actual displacement distance corresponding to a relative height value of 1. If the maximum displacement is 0.5m, then a relative height value of 1 corresponds to a displacement of 0.5m, and a relative height value of 0.5 corresponds to a displacement of 0.25m.
[0059] S202. In response to the input progress parameters, based on the surface subdivision algorithm, increase the number of vertices of the initial mesh model to obtain the first mesh model.
[0060] The progress parameter characterizes the rate at which the initial mesh model deforms towards the target high-poly model. In other words, the progress parameter measures / controls the process by which the vertices of the initial mesh model deform towards the target high-poly model along their corresponding displacement directions.
[0061] Specifically, the progress parameter belongs to [0,1] (t∈[0,1]). When the progress parameter = 0, the initial mesh model is in an undeformed state, that is, the progress of the initial mesh model in deforming towards the target high-poly model is 0%, that is, no deformation has occurred; when the progress parameter = 1, the initial mesh model is in a fully deformed state, that is, the progress of the initial mesh model in deforming towards the target high-poly model is 100%; when the progress parameter = 0.5, the progress of the initial mesh model in deforming towards the target high-poly model is 50%.
[0062] Subdivision Surfaces is a 3D graphics technique used to dynamically increase the number of vertices and polygons in an initial mesh model, thereby enhancing the mesh's detail capacity. Specifically, subdivision refers to generating new vertices within the edge and face structure of the original mesh model using algorithms, gradually refining the initially simple low-poly mesh into a high-detail mesh, providing a framework for subsequently matching the complex shapes of the target high-poly model. Simply put, subdivision Surfaces increases the number of vertices and polygons in a mesh model, making the mesh model more refined.
[0063] The first mesh model refers to the mesh model obtained by subdividing the initial mesh model.
[0064] In one possible implementation, the schedule parameter is a direct control factor for the subdivision level; that is, the larger the schedule parameter (i.e., the closer it is to 1), the higher the subdivision level.
[0065] The subdivision level refers to a parameter that controls the intensity of the surface subdivision algorithm. It quantifies the increase in the number of vertices and polygon faces of the initial mesh model and directly determines the fineness of the subdivided mesh. The higher the subdivision level, the more vertices and faces the mesh model has, the stronger its detail capacity, and the closer it is to the fineness level of the target high-poly model.
[0066] Specifically, the subdivision level can also be understood as the number of subdivision iterations. The value of the subdivision level corresponds to the number of edge refinement and face refinement iterations executed in the surface subdivision algorithm. For example, if the subdivision level is 1, then one iteration is executed. With each increase of one subdivision level, the number of vertices and polygon faces of the initial mesh model will increase exponentially.
[0067] In this embodiment, when the progress parameter is 0, the initial mesh model does not need to be subdivided, and the subdivision level of the surface subdivision is 0; when the progress parameter increases from 0 to 1, the subdivision level of the surface subdivision also increases synchronously; when the progress parameter is 1, the subdivision level of the surface subdivision reaches the maximum, and the number of vertices of the initial mesh model increases to a scale that matches the target high-poly model.
[0068] In one possible implementation, the subdivision level is determined based on the progress parameters through a preset mapping relationship, which can be a linear mapping, an interval mapping, or the like.
[0069] For example, when the preset mapping relationship is a linear mapping, the subdivision level (L) = floor(t × Lmax), where Lmax is the preset maximum subdivision level, floor is the floor function, and t is the progress parameter.
[0070] For example, when the preset mapping relationship is interval mapping, the value range of the progress parameter is divided into multiple intervals, and each interval corresponds to a fixed subdivision level. For example, the subdivision level corresponding to the progress parameter belonging to (0, 0.5] is 1, and the subdivision level corresponding to the progress parameter belonging to (0.5, 1] is 2.
[0071] In this embodiment, performing surface subdivision on the initial mesh model before deformation can significantly increase the number of vertices and polygons in the mesh, providing a mesh carrier with high detail carrying capacity for subsequent deformation: the subdivided mesh topology is more refined, the vertex distribution is more uniform, and it can accurately adapt to the complex geometry and surface details of the target high-poly model, avoiding the loss of deformation details due to insufficient vertices in the initial low-poly model; at the same time, the new vertices generated by subdivision obtain an effective mapping relationship through interpolation of the UV coordinates of the original vertices, which can accurately sample the relative height value and displacement direction from the texture map of the target high-poly model relative to the initial mesh model, ensuring that the deformation calculation of each vertex has accurate data support, making the final deformation effect more in line with the design shape of the target high-poly model, and the surface transition of the deformed model is smooth without obvious edges or jumps, greatly improving the refinement and visual consistency of the deformation effect.
[0072] Furthermore, by dynamically determining the corresponding subdivision level based on the progress parameters, the dual goals of detail growth on demand and computational resource optimization can be achieved: a low subdivision level is used when the deformation progress is low to preserve the simplicity of the initial low-poly model and reduce computational overhead; the subdivision level is increased synchronously when the deformation progress is high to provide sufficient carrier for the complex details of the target high-poly model by exponentially increasing the number of vertices.
[0073] S203. From the texture map, obtain the relative height value and displacement direction corresponding to each vertex of the first mesh model.
[0074] Specifically, all vertices of the first mesh model carry corresponding UV coordinates. The initial vertices in the first mesh model (i.e., the vertices in the initial mesh model) retain their initial UV coordinates. The newly generated vertices are subdivided, and their UV coordinates are obtained by interpolating the UV coordinates of the adjacent original vertices to ensure consistency with the UV mapping logic of the initial mesh model. Based on the UV coordinates of all vertices of the first mesh model, the relative height values and displacement directions of all vertices are extracted from the texture map.
[0075] In one possible implementation, when the texture map is a vector displacement map, the corresponding texels in the vector displacement map are located using the UV coordinates of all vertices of the first mesh model, and the corresponding relative height value and displacement direction are decoded from the texels. For example, the relative height value is decoded from the alpha channel of the texel, and the displacement direction is decoded from the RGB channel of the texel.
[0076] In another possible implementation, when the texture map is a height displacement map and a normal map, the corresponding texels of the height displacement map and the normal map are located by using the UV coordinates of all vertices of the first mesh model. The corresponding relative height value is decoded from the corresponding texel of the height displacement map, and the corresponding displacement direction is decoded from the corresponding texel of the normal map.
[0077] In this embodiment, by obtaining the corresponding displacement data from the texture map using the UV coordinates of all vertices of the first mesh model, the relative height value and displacement direction matching each vertex of the first mesh model can be accurately obtained, providing core data support for subsequent calculation of the new position after vertex deformation.
[0078] S204. Based on the maximum displacement, progress parameters, relative height values and displacement directions corresponding to each vertex of the first mesh model, update the coordinates of each vertex of the first mesh model to obtain the deformed second mesh model.
[0079] The deformed second mesh model refers to the mesh model obtained after updating the coordinates of the vertices of the first mesh model. That is, the first mesh model is deformed, and the second mesh model is obtained after the deformation is completed.
[0080] For each vertex of the first mesh model, the coordinates of the vertex are updated based on the maximum displacement, progress parameter, relative height value and displacement direction of the vertex; when all vertices of the first mesh model have been updated, the second mesh model is obtained.
[0081] Specifically, based on the relative height value, maximum displacement, and progress parameter corresponding to each vertex of the first mesh model, the target displacement corresponding to each vertex of the first mesh model is obtained through a preset displacement formula; based on the target displacement corresponding to each vertex and the displacement direction corresponding to each vertex, the coordinates of each vertex of the first mesh model are updated to obtain the second mesh model.
[0082] For example, for a vertex in the first mesh model: the updated coordinates = original coordinates + displacement direction × target displacement. The displacement direction is a unit vector to ensure accuracy. Therefore, the product of displacement direction and target displacement (also called displacement vector) is a directional three-dimensional vector containing displacements in X, Y, and Z components. The updated coordinates of the vertex are the sum of the vertex's original coordinates and the displacement vector.
[0083] For example: Suppose the original coordinates of vertex A in the first mesh model are (100, 10, 20), the target displacement is 2, and the displacement direction is (0, 1, 0), then the updated coordinates of vertex A are (100, 10, 20) + (0, 1, 0) × 2 = (100, 12, 20).
[0084] In one possible implementation, the preset displacement formula includes: a first displacement formula, which characterizes a linear relationship between the target displacement and the progress parameter. That is, the target displacement of the vertices of the first mesh model increases uniformly with the increase of the progress parameter.
[0085] Specifically, based on the first displacement formula, the relative height value, maximum displacement, and progress parameter corresponding to each vertex of the first mesh model are multiplied to obtain the target displacement corresponding to each vertex of the first mesh model.
[0086] To facilitate understanding, the formula for the first displacement is illustrated below with an example based on formula (1): Target displacement = H(u, v) × Dmax × t (1) Where H(u, v) is the relative height value corresponding to the UV coordinates (u, v) of the vertex of the first mesh model, Dmax is the maximum displacement, and t is the progress parameter.
[0087] For example: Assume the maximum displacement Dmax = 10; in the first mesh model there is vertex B1, whose corresponding UV coordinates are (u1, v1) and the corresponding relative height value H(u1, v1) = 0.6; in the first mesh model there is also vertex B2, whose corresponding UV coordinates are (u2, v2) and the corresponding relative height value H(u2, v2) = 0.8.
[0088] When the progress parameter is 0.5, the deformation progress of the initial mesh model towards the target high-poly model is 50%. The target displacement corresponding to vertex A is 0.6 × 10 × 0.5 = 3, and the target displacement corresponding to vertex B is 0.8 × 10 × 0.5 = 4.
[0089] When the progress parameter is 0.75, the initial mesh model is 75% complete in deforming towards the target high-poly model. The target displacement for vertex A is 0.6 × 10 × 0.75 = 4.5, and the target displacement for vertex B is 0.8 × 10 × 0.75 = 6.
[0090] In this embodiment, the first displacement formula calculates the target displacement by directly multiplying the relative height value, the maximum displacement, and the progress parameter in a linear relationship. It features simple and intuitive calculation logic and low computational complexity, which can efficiently support the rapid calculation needs of real-time deformation scenarios. At the same time, its linearity ensures that the displacement of all vertices changes synchronously with the progress parameter in the same proportion, which can realize the overall uniform transition from the initial mesh model to the target high-poly model, avoid visual abruptness caused by inconsistent local deformation rhythm, and the strict correspondence between deformation progress and parameters makes it easy for developers or users to accurately control the degree of deformation, thereby improving the usability and controllability of the technical solution.
[0091] In another possible implementation, the preset displacement formula includes a second displacement formula, which characterizes a linear relationship between the target displacement and the effective deformation coefficient. The effective deformation coefficient is obtained through the maximum displacement of the limiting function, the progress parameter, and the initial height values of the vertices in the first mesh model. That is, the target displacement of a vertex is jointly determined by the relative height value, the maximum displacement, and the effective deformation coefficient, and is proportional to the effective deformation coefficient. By introducing the effective deformation coefficient, vertices with different initial heights exhibit differentiated deformation rhythms with the progress parameter.
[0092] Specifically, using the limiting function, based on the overall height value of the target high-poly model, the progress parameter, and the initial height value of each vertex of the first mesh model, the effective deformation coefficient corresponding to each vertex of the first mesh model is obtained; based on the second displacement formula, the relative height value, the maximum displacement, and the effective deformation coefficient corresponding to each vertex of the first mesh model are multiplied together to obtain the target displacement corresponding to each vertex of the first mesh model.
[0093] The clamp function is a mathematical function that constrains the input value within a preset range. Here, it is used to limit the calculation result of the effective deformation coefficient to the interval [0,1] to avoid the coefficient exceeding the reasonable range due to parameter fluctuations. Its mathematical logic is: if the input value < 0, output 0; if the input value > 1, output 1; otherwise, output the input value itself.
[0094] For ease of understanding, the second displacement formula will be introduced below in conjunction with formulas (2) and (3).
[0095] As shown in formula (2), the formula for the second displacement is: Target displacement = H(u, v) × Dmax × f(u, v) (2) Where H(u,v) is the relative height value corresponding to the vertex with UV coordinates (u,v) in the first mesh model, Dmax is the maximum displacement, and f(u,v) is the effective deformation coefficient corresponding to the vertex with UV coordinates (u,v) in the first mesh model.
[0096] As shown in formula (3), the effective deformation coefficient is: (3) Where f(u,v) is the effective deformation coefficient corresponding to the vertex with UV coordinates (u,v) of the first mesh model, t is the progress parameter, Htotal is the overall height of the target high-poly model, Y(u,v) is the initial height value of the vertex with UV coordinates (u,v) of the first mesh model, and clamp is the clipping parameter.
[0097] As shown in formula (3), the limiting function acts when the input value (i.e., When the input value is less than 0, the effective deformation coefficient is 0, indicating that the vertex with UV coordinates (u, v) in the first mesh model has not yet reached the deformation initiation condition and no deformation occurs; when the input value is greater than 1, the effective deformation coefficient is 1, indicating that the vertex with UV coordinates (u, v) in the first mesh model has reached the maximum deformation ratio (the progress has covered the entire required deformation range), and there is no need to continue to increase the deformation amplitude; when the input value is in the range [0,1], the value is directly output as the effective deformation coefficient under the current progress. In this embodiment, the effective deformation coefficient is ensured to have a reasonable physical meaning by using a limiting function to truncate the boundary, avoiding negative deformation or excessive deformation, and providing a reliable proportional parameter for the subsequent calculation of relative displacement.
[0098] As shown in formula (3), "(t×Htotal-Y(u,v)) / Htotal" is used to quantify whether the vertices of the first mesh model can participate in deformation at the current progress (i.e., the deformation progress represented by the progress parameter). Here, t×Htotal represents the current deformation boundary of the target high-poly model along the height direction under the progress parameter t. For example, when t=0.5 and Htotal=100cm, the boundary is 50cm, meaning that deformation only occurs in areas with a height ≤ 50cm. Here, t×Htotal-Y(u,v) represents the difference between the initial height value of the vertex with UV coordinates (u,v) and the current deformation boundary. If it is positive, it means that the vertex is below the deformation boundary and can participate in deformation; if it is negative, it means that the vertex is above the deformation boundary and will not participate in deformation for the time being. Finally, the difference is normalized by "dividing by Htotal", and the normalized result is limited to the [0,1] interval to obtain the effective deformation coefficient of the vertex at the current progress. Simply put, it can be understood as: by comparing the initial height value of the vertex with the deformation boundary (t×Htotal) corresponding to the current progress, it is dynamically determined whether the vertex participates in this deformation and to what extent it is deformed, so as to facilitate the subsequent implementation of the layered deformation logic of vertices with low initial height values deforming first and vertices with high initial height values deforming later.
[0099] For example: Assume the overall height of the target high-poly model is Htotal = 100, and the maximum displacement is Dmax = 10; the first mesh model has vertex C1 with UV coordinates (u3, v3), a relative height H(u3, v3) = 0.6, and an initial height Y(u3, v3) = 20; the first mesh model also has vertex C2 with UV coordinates (u4, v4), a relative height H(u4, v4) = 0.8, and an initial height Y(u4, v4) = 70. It should be noted that the units are consistent; in this example, all units are centimeters (cm). The units may differ in different cases, and this application does not impose specific limitations.
[0100] When the progress parameter t=0.3: the effective deformation coefficient of vertex C1 f(u3, v3)=clamp((0.3×100-20) / 100,0,1)=clamp(0.1,0,1)=0.1, then the target displacement of vertex C1=0.6×10×0.1=0.6; the effective deformation coefficient of vertex C2 f(u4, v4)=clamp((0.3×100-70) / 100,0,1)=clamp(-0.4,0,1)=0, then the target displacement of vertex C2=0.8×10×0=0.
[0101] When the progress parameter t=0.8: the effective deformation coefficient of vertex C1 is f(u3, v3)=clamp((0.8×100-20) / 100,0,1)=clamp(0.6,0,1)=0.6, then the target displacement of vertex C1 is 0.6×10×0.6=3.6; the effective deformation coefficient of vertex C2 is f(u4, v4)=clamp((0.8×100-70) / 100,0,1)=clamp(0.1,0,1)=0.1, then the target displacement of vertex C2 is 0.8×10×0.1=0.8.
[0102] In this embodiment, an effective deformation coefficient is obtained by combining the overall height value of the target high-poly model, the progress parameter, and the initial height value of the vertices with a limiting function. Based on the second displacement formula, the relative height value, the maximum displacement, and the effective deformation coefficient are multiplied to obtain the target displacement. This enables differentiated deformation of vertices: vertices with low initial heights start deforming earlier with the progress parameter, while vertices with high initial heights deform later, conforming to the natural dynamic law from bottom to top and greatly improving the visual naturalness of the deformation process. At the same time, the limiting function strictly constrains the effective deformation coefficient within the [0,1] interval to avoid excessive deformation or reverse deformation, ensuring that the target displacement always accurately matches the height details of the target high-poly model. Furthermore, the overall logic is directly related to the progress parameter and the spatial scale of the target high-poly model. The layered deformation rhythm can be controlled with only a single progress parameter, simplifying the operation while adapting to mesh models with different height distributions, taking into account the realism of the deformation effect, the matching accuracy, and the universality of the solution.
[0103] Furthermore, in one possible implementation, the input progress parameter can be a deformation parameter input by the user based on the degree of deformation. For example, if the deformation progress of the initial mesh model towards the target high-poly model is 50%, meaning that the second mesh model after deformation should be 50% of the fully grown state of the target high-poly model, then the input progress parameter is 0.5.
[0104] In another possible implementation, the input progress parameter is calculated based on the input time parameter.
[0105] The input time parameter represents the time from the start of deformation to the current moment; the progress parameter and the time parameter have a preset correlation, so that the progress parameter changes with the time parameter according to the preset correlation.
[0106] When the time parameter is based on the system clock, t = current time - deformation start time; when the time parameter is based on the animation frame, t = current frame index - starting frame index.
[0107] For example, the progress parameter = f(T), where f is a preset correlation function, which describes the preset correlation between the stretching coefficient and the time parameter; T is the time parameter, representing the time (time difference) from the start of deformation to the current moment.
[0108] Specifically, the schedule parameter and the time parameter have a linear relationship. For example: schedule parameter = T / preset total deformation duration.
[0109] In this embodiment, the progress parameter is obtained through the time parameter. It is only necessary to preset the preset correlation relationship (correlation function) between the progress parameter and the time parameter, and automatically calculate the corresponding progress parameter to realize the automated input of the progress parameter. Furthermore, the preset correlation relationship simulates the real continuous deformation effect, avoiding rigid model deformation.
[0110] To facilitate understanding, the following sections will introduce two different deformation scenarios of the schedule parameter as the time parameter changes.
[0111] In one possible implementation, the progress parameter belongs to [0,1] and increases with the increase of the time parameter. Thus, the progress parameter changes from 0 to 1 as the time parameter increases, so as to achieve the growth deformation effect of the mesh model.
[0112] Specifically, when the time parameter ∈ [0, total deformation duration], the progress parameter increases linearly from 0 to 1 with the time parameter. Assuming the time parameter is 3s and the total deformation duration is 10s, the progress parameter is 0.3. The progress parameter gradually changes from 0 to 1 as the time parameter increases. With the increase of the progress parameter, the subdivision level also increases, and the distance the vertex moves along the displacement direction gradually approaches the maximum displacement, causing the mesh model to gradually grow from the initial mesh model shape to the target high-poly model shape.
[0113] like Figure 4As shown, taking a total deformation duration of 8s and a target high-poly model of a complete cube as an example: when the time parameter is 0s, the input progress parameter is determined to be 0, and the resulting second mesh model is the undeformed initial mesh model, such as model 400; when the time parameter is 2s, the input progress parameter is determined to be 0.25, and in response to the input progress parameter, the initial mesh model is subdivided and the coordinates are updated to obtain a second mesh model that is a cuboid with a height of 1 / 4 of the complete cube, such as model 401; when the time parameter is 4s, the input progress parameter is determined to be 0.5, and in response to the input progress parameter, the initial mesh model is subdivided and the coordinates are updated to obtain a second mesh model that is a cuboid with a height of 1 / 4 of the complete cube, such as model 401; when the time parameter is 4s, the input progress parameter is determined to be 0.5, and in response to the input progress parameter, the initial mesh model is subdivided and the coordinates are updated to obtain a second mesh model that is a cuboid with a height of 1 / 4 of the complete cube, such as model 401. The second mesh model obtained after subdivision and coordinate update is a cuboid with a height of 2 / 4 of the complete cube, as shown in model 402. When the time parameter is 6s, the input progress parameter is determined to be 0.75. In response to the input progress parameter, the second mesh model obtained after surface subdivision and coordinate update of the initial mesh model is a cuboid with a height of 3 / 4 of the complete cube, as shown in model 403. When the time parameter is 8s, the input progress parameter is determined to be 1. In response to the input progress parameter, the second mesh model obtained after surface subdivision and coordinate update of the initial mesh model is a complete cube with a height, i.e., the target high-poly model, as shown in model 404.
[0114] like Figure 4 As shown, the growth and deformation effect of the mesh model is achieved by transforming from model 400 to model 404. Furthermore, during the transformation from model 400 to model 404, model 401 compared to model 400, model 402 compared to model 401, model 403 compared to model 403, and model 404 compared to model 403 all underwent surface subdivision processing. This resulted in a gradual increase in the number of vertices in the mesh model as the deformation process progressed, providing a progressively refined carrier for subsequent detail deformation. This ensures a smooth and natural transition from the initial low-poly model to the target high-poly model, avoiding abrupt changes in detail.
[0115] In this embodiment, the progress parameter is driven by the time parameter and monotonically increases from 0 to 1 in the range [0,1]. This provides a continuous and controllable time dimension benchmark for the growth and deformation of the mesh model. As time goes by, the gradual change of the progress parameter drives the deformation degree of the mesh vertices to increase synchronously, so that the initial mesh model gradually "grows" from a low-detail state to the complete form of the target high-poly model. This simulates a continuous dynamic effect similar to natural growth (such as plant budding and structure forming layer by layer), avoiding jumps or stutters in the deformation process.
[0116] In another possible implementation, the progress parameter belongs to [0,1], and the progress parameter decreases as the time parameter increases. Thus, the progress parameter changes from 1 to 0 as the time parameter increases, so as to achieve the destruction deformation effect of the mesh model.
[0117] Specifically, when the time parameter ∈ [0, total deformation duration], the progress parameter increases linearly from 1 to 0 with the time parameter. Assuming the time parameter is 3s and the total deformation duration is 10s, the progress parameter is 0.7. The progress parameter gradually changes from 1 to 0 as the time parameter increases. As the progress parameter increases, the subdivision level also decreases, and the distance the vertex moves along the displacement direction gradually moves away from the maximum displacement, causing the mesh model to gradually be destroyed from the target high-poly model shape back to the initial mesh model shape.
[0118] like Figure 5 As shown, taking a total deformation duration of 8s and a target high-poly model of a complete cube as an example: when the time parameter is 0s, the input progress parameter is determined to be 1. In response to the input progress parameter, the second mesh model obtained after surface subdivision and coordinate update of the initial mesh model is a cube with a height of 1, i.e., the target high-poly model, such as model 500; when the time parameter is 2s, the input progress parameter is determined to be 0.75. In response to the input progress parameter, the second mesh model obtained after surface subdivision and coordinate update of the initial mesh model is a cuboid with a height of 3 / 4 of a complete cube, such as model 501; when the time parameter is 4s, the input progress parameter is determined to be 1. If the input progress parameter is 0.5, then in response to the input progress parameter, the second mesh model obtained after subdividing the surface and updating the coordinates of the initial mesh model is a cuboid with a height of 2 / 4 of the complete cube, as shown in model 502; when the time parameter is 6s, the input progress parameter is determined to be 0.25, then in response to the input progress parameter, the second mesh model obtained after subdividing the surface and updating the coordinates of the initial mesh model is a cuboid with a height of 1 / 4 of the complete cube, as shown in model 503; when the time parameter is 8s, the input progress parameter is determined to be 0, and the obtained second mesh model is the undeformed initial mesh model, as shown in model 504.
[0119] like Figure 5 As shown, the destruction deformation effect of the mesh model is achieved by transforming from model 500 to model 504. Furthermore, during the transformation from model 500 to model 504, model 501 compared to model 500, model 502 compared to model 501, model 503 compared to model 503, and model 504 compared to model 503 all undergo surface simplification processing. This gradually reduces the number of vertices in the mesh model during the deformation process, avoiding abrupt changes in detail and ensuring a smooth and natural destruction deformation that conforms to visual logic.
[0120] In this embodiment, the progress parameter is driven by the time parameter and decreases monotonically from 1 to 0 in the range [0,1]. This provides a continuous and controllable time dimension benchmark for the destruction deformation of the mesh model. As time goes by, the gradual change of the progress parameter drives the deformation degree of the mesh vertices to decrease synchronously, so that the initial mesh model is "destroyed" from a high-detail state to a simplified form of the initial low-poly model. This simulates a continuous dynamic effect similar to natural destruction (such as object weathering or structural disintegration), avoids jumps or stutters in the destruction process, and ensures a smooth and natural transition from complex form to simple form, which is in line with visual logic.
[0121] Furthermore, in one possible implementation, after obtaining the second mesh model, the visual effects of the second mesh model are optimized by combining particle systems and material animations.
[0122] Particle systems are a technique used to simulate a large number of independent, tiny elements (such as flames, smoke, water droplets, explosions, etc.). Specifically, particle systems combine a large number of independent particles to form a fixed shape, and use controllers, physics engines, and scripts to control the trajectory, collisions, and lifecycles of the particle swarm to generate realistic dynamic effects.
[0123] Material animation refers to the technique of controlling the changes in the material properties of a model's surface over time using animation technology. Specifically, material animation can control material properties and achieve dynamic effects such as material gradation, flashing, and flow.
[0124] In this embodiment, by combining particle systems and material animation, a simple mesh model can be transformed into a dynamic effect with rich visual expressiveness, making the deformation process of the mesh model more vivid and natural. Specifically, the particle system simulates natural phenomena (such as flames and smoke), and the material animation enhances surface details, making the visual effect of the second mesh model more realistic; and through the animation changes of particles and materials, the mesh model presents a smooth and natural dynamic effect during the deformation process.
[0125] This application provides a method for deforming a mesh model, including: obtaining the texture map and maximum displacement of the target high-poly model relative to the initial mesh model based on a target high-poly model and an initial mesh model; increasing the number of vertices of the initial mesh model based on a surface subdivision algorithm in response to an input progress parameter to obtain a first mesh model; obtaining the relative height value and displacement direction corresponding to each vertex of the first mesh model from the texture map based on the first mesh model; and updating the coordinates of each vertex of the first mesh model based on the maximum displacement, the progress parameter, and the relative height value and displacement direction corresponding to each vertex of the first mesh model to obtain a second mesh model. In this application embodiment, by obtaining the texture map and maximum displacement of the target high-poly model relative to the initial mesh model and dynamically updating the vertex coordinates based on the progress parameter, accurate geometric deformation is achieved without the need for pre-made animation, significantly improving the flexibility of mesh model deformation; at the same time, responding to the input progress parameter, the mesh density is dynamically adjusted through surface subdivision technology, which can dynamically increase details, thereby improving visual quality.
[0126] Example 2: The following is combined Figure 6 This application provides a detailed description of a mesh model deformation device provided in its embodiments.
[0127] like Figure 6 As shown in the embodiment of this application, a deformation device for a mesh model includes the following modules: The texture acquisition module 601 is used to acquire the texture map and maximum displacement of the target high-poly model relative to the initial mesh model based on the target high-poly model and the initial mesh model; wherein, the texture map contains displacement data, which includes: the relative height value and displacement direction of each texel of the initial mesh model; The surface subdivision module 602 is used to increase the number of vertices of the initial mesh model in response to the input progress parameter, based on the surface subdivision algorithm, to obtain the first mesh model; wherein, the progress parameter is used to characterize the progress of the initial mesh model in deforming towards the target high-poly model; The data acquisition module 603 is used to acquire the relative height value and displacement direction corresponding to each vertex of the first mesh model from the texture map; The model deformation module 604 is used to update the coordinates of each vertex of the first mesh model based on the maximum displacement, progress parameters, relative height value and displacement direction corresponding to each vertex of the first mesh model, so as to obtain the deformed second mesh model.
[0128] In one possible implementation, the model deformation module 604 is specifically used to obtain the target displacement corresponding to each vertex of the first mesh model based on the relative height value, maximum displacement and progress parameter corresponding to each vertex of the first mesh model, through a preset displacement formula; and to update the coordinates of each vertex of the first mesh model based on the target displacement corresponding to each vertex and the displacement direction corresponding to each vertex, so as to obtain the second mesh model.
[0129] In one possible implementation, the preset displacement formula includes: a first displacement formula, which represents that the target displacement is linearly related to the progress parameter; and a model deformation module 604, which is specifically used to multiply the relative height value, maximum displacement and progress parameter corresponding to each vertex of the first mesh model based on the first displacement formula to obtain the target displacement corresponding to each vertex of the first mesh model.
[0130] In one possible implementation, the preset displacement formula includes: a second displacement formula, which characterizes a linear relationship between the target displacement and the effective deformation coefficient; and a model deformation module 604, specifically used for: Using the limiting function, based on the overall height value of the target high-poly model, the progress parameter, and the initial height value of each vertex of the first mesh model, the effective deformation coefficient corresponding to each vertex of the first mesh model is obtained; where the overall height value of the target high-poly model is the maximum height value of the target high-poly model in the height direction; Based on the second displacement formula, the relative height value, maximum displacement, and effective deformation coefficient corresponding to each vertex of the first mesh model are multiplied together to obtain the target displacement corresponding to each vertex of the first mesh model.
[0131] In one possible implementation, the input progress parameter is calculated based on the input time parameter; wherein the input time parameter represents the time from the start of deformation to the current moment; the progress parameter and the time parameter have a preset correlation relationship, so that the progress parameter changes with the time parameter according to the preset correlation relationship.
[0132] In one possible implementation, the progress parameter belongs to [0,1] and increases with the increase of the time parameter. Thus, the progress parameter changes from 0 to 1 as the time parameter increases, so as to achieve the growth deformation effect of the mesh model.
[0133] In one possible implementation, the progress parameter belongs to [0,1], and the progress parameter decreases as the time parameter increases. Thus, the progress parameter changes from 1 to 0 as the time parameter increases, so as to achieve the destruction deformation effect of the mesh model.
[0134] In one possible implementation, the texture acquisition module 601 is specifically used to extract the displacement information between the surface of the target high-poly model and the surface of the initial mesh model through baking rendering technology, and to map the displacement information into the UV coordinate system corresponding to the initial mesh model to generate a texture map of the target high-poly model relative to the initial mesh model.
[0135] This application provides a mesh model deformation device, including: a texture acquisition module 601, used to acquire the texture map and maximum displacement of the target high-poly model relative to the initial mesh model based on the target high-poly model and the initial mesh model; a surface subdivision module 602, used to increase the number of vertices of the initial mesh model based on a surface subdivision algorithm in response to an input progress parameter, to obtain a first mesh model; a data acquisition module 603, used to acquire the relative height value and displacement direction corresponding to each vertex of the first mesh model from the texture map; and a model deformation module 604, used to update the coordinates of each vertex of the first mesh model based on the maximum displacement, the progress parameter, and the relative height value and displacement direction corresponding to each vertex of the first mesh model, to obtain a deformed second mesh model. In this application embodiment, by acquiring the texture map and maximum displacement of the target high-poly model relative to the initial mesh model, and dynamically updating the vertex coordinates based on the progress parameter, accurate geometric deformation is achieved without the need for pre-made animation, significantly improving the flexibility of mesh model deformation; at the same time, in response to the input progress parameter, the mesh density is dynamically adjusted through surface subdivision technology, which can dynamically increase details, thereby improving visual quality.
[0136] It should be noted that the various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for the device and system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiments. The device and system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components indicated as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of the solution in this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0137] The above description is merely one specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A deformation method for a mesh model, characterized in that, include: Based on the target high-poly model and the initial mesh model, the texture map and maximum displacement of the target high-poly model relative to the initial mesh model are obtained; wherein, the texture map contains displacement data, and the displacement data includes: the relative height value and displacement direction corresponding to each texel of the initial mesh model; In response to the input progress parameter, based on the surface subdivision algorithm, the number of vertices of the initial mesh model is increased to obtain a first mesh model; wherein, the progress parameter is used to characterize the progress of the initial mesh model in deforming into the target high-poly model; From the texture map, obtain the relative height value and displacement direction corresponding to each vertex of the first mesh model; Based on the maximum displacement, the progress parameter, the relative height value and displacement direction corresponding to each vertex of the first mesh model, the coordinates of each vertex of the first mesh model are updated to obtain the deformed second mesh model.
2. The method according to claim 1, characterized in that, The step of updating the coordinates of each vertex of the first mesh model based on the maximum displacement, the progress parameter, the relative height value and displacement direction corresponding to each vertex of the first mesh model, to obtain the second mesh model, includes: Based on the relative height value corresponding to each vertex of the first mesh model, the maximum displacement, and the progress parameter, the target displacement corresponding to each vertex of the first mesh model is obtained through a preset displacement formula. Based on the target displacement and displacement direction corresponding to each vertex, the coordinates of each vertex of the first mesh model are updated to obtain the second mesh model.
3. The method according to claim 2, characterized in that, The preset displacement formula includes: a first displacement formula, which characterizes a linear relationship between the target displacement and the progress parameter; the step of obtaining the target displacement corresponding to each vertex of the first mesh model based on the relative height value corresponding to each vertex of the first mesh model, the maximum displacement, and the progress parameter, through the preset displacement formula, includes: Based on the first displacement formula, the relative height value corresponding to each vertex of the first mesh model, the maximum displacement, and the progress parameter are multiplied to obtain the target displacement corresponding to each vertex of the first mesh model.
4. The method according to claim 2, characterized in that, The preset displacement formula includes: a second displacement formula, which characterizes a linear relationship between the target displacement and the effective deformation coefficient; the step of obtaining the target displacement corresponding to each vertex of the first mesh model based on the relative height value corresponding to each vertex of the first mesh model, the maximum displacement, and the progress parameter, through the preset displacement formula, includes: Using a limiting function, based on the overall height value of the target high-poly model, the progress parameter, and the initial height value of each vertex of the first mesh model, an effective deformation coefficient corresponding to each vertex of the first mesh model is obtained; wherein, the overall height value of the target high-poly model is the maximum height value of the target high-poly model in the height direction; Based on the second displacement formula, the relative height value corresponding to each vertex of the first mesh model, the maximum displacement, and the effective deformation coefficient corresponding to each vertex of the first mesh model are multiplied to obtain the target displacement corresponding to each vertex of the first mesh model.
5. The method according to claim 1, characterized in that, The input progress parameter is calculated based on the input time parameter; wherein the input time parameter represents the time from the start of deformation to the current moment; the progress parameter and the time parameter have a preset correlation relationship, so that the progress parameter changes with the time parameter according to the preset correlation relationship.
6. The method according to claim 5, characterized in that, The progress parameter belongs to [0,1], and the progress parameter increases with the increase of the time parameter. The progress parameter changes from 0 to 1 as the time parameter increases, so as to achieve the growth deformation effect of the mesh model.
7. The method according to claim 5, characterized in that, The progress parameter belongs to [0,1], and the progress parameter decreases as the time parameter increases. Therefore, the progress parameter changes from 1 to 0 as the time parameter increases, so as to achieve the destruction deformation effect of the mesh model.
8. The method according to claim 1, characterized in that, The step of obtaining the texture map of the target high-poly model relative to the initial mesh model based on the target high-poly model and the initial mesh model includes: By using baking rendering technology, the displacement information between the surface of the target high-poly model and the surface of the initial mesh model is extracted, and the displacement information is mapped to the UV coordinate system corresponding to the initial mesh model to generate a texture map of the target high-poly model relative to the initial mesh model.
9. The method according to any one of claims 1-8, characterized in that, The texture map includes a vector displacement map, which stores the relative height value and displacement direction of each texel of the initial mesh model. Alternatively, the texture map may include a height displacement map and a normal map, wherein the height displacement map stores the relative height value corresponding to each texel of the initial mesh model, and the normal map stores the displacement direction corresponding to each texel of the initial mesh model.
10. A deformation device for a mesh model, characterized in that, include: The texture acquisition module is used to acquire the texture map and maximum displacement of the target high-poly model relative to the initial mesh model based on the target high-poly model and the initial mesh model; wherein, the texture map contains displacement data, and the displacement data includes: the relative height value and displacement direction corresponding to each texel of the initial mesh model; The surface subdivision module is used to increase the number of vertices of the initial mesh model in response to the input progress parameter, based on the surface subdivision algorithm, to obtain a first mesh model; wherein, the progress parameter is used to characterize the progress of the initial mesh model in deforming towards the target high-poly model; The data acquisition module is used to acquire the relative height value and displacement direction corresponding to each vertex of the first mesh model from the texture map; The model deformation module is used to update the coordinates of each vertex of the first mesh model based on the relative height value and displacement direction corresponding to each vertex of the first mesh model, the maximum displacement amount and the progress parameter, so as to obtain the deformed second mesh model.