Mesh mapping method, system, electronic device, and medium
By establishing the relationship between the follower layer and the simulation layer through point-to-point mapping in the mesh simulation, the problem of layer overlap is solved, the simulation accuracy and visual effect are improved, and the realism of clothing animation is ensured.
Patent Information
- Application Number
- CN202411807607.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2044-12-10
AI Technical Summary
In mesh-based cloth simulation, layers can easily overlap, and the change in the centroid coordinates of triangles during the 3D to 2D projection process leads to low simulation accuracy and poor visual effects.
By establishing a mapping relationship through point-to-point methods, obtaining sample meshes of character clothing, creating simulation layers and follower layers, collecting the set of simulation layer vertices around the follower points, determining the mapping points and establishing a coordinate system, reducing the change in centroid coordinates caused by triangle deformation, and ensuring accurate mapping between the follower layer and the simulation layer.
It improves mapping accuracy, ensures the realism of character clothing design and visual effects, avoids overlapping between layers, and obtains simulation results that conform to physical reality.
Smart Images

Figure CN119919602B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data processing, and in particular to a mesh mapping method and system, an electronic device and a medium. BACKGROUND
[0002] In current game production, more and more games transfer the animation of the clothes of the role from the simulation method based on the skinning skeleton to the cloth simulation based on the mesh. And for the role clothes that are becoming more and more complex, the design of the clothes stacked by multiple layers of cloth is also common.
[0003] However, in the cloth simulation based on the mesh, for the consideration of performance, the most basic unit of simulation is the vertex of the mesh, which has no volume, which leads to that there is no correlation between each layer of cloth, and the interpenetration between layers is prone to occur in the simulation process. In order to solve the above problem, some games currently propose a scheme of only physically simulating the mesh of one layer to achieve the purpose of reducing interpenetration.
[0004] However, when the mapping relationship is established based on the barycentric coordinates of the point to the triangle, it is required that the triangle on the simulation layer cannot have too much deformation in the motion process. Currently, the mapping relationship may have low mesh precision and large motion amplitude. Since the barycentric coordinates cannot be guaranteed to be unchanged under the projection transformation, the triangle in three dimensions will be deformed when projected into two dimensions, which causes the coefficients of the barycentric coordinates to change, so that the triangle deforms, further affecting the authenticity and visual effect of the simulation. SUMMARY
[0005] The embodiments of the present application provide a mesh mapping method, system, electronic device and storage medium, which establishes the mapping relationship in a point-to-point manner, can ensure the modeling of the role clothes while improving the mapping accuracy, and improve the authenticity and visual effect of the simulation.
[0006] In a first aspect, the embodiments of the present application provide a mesh mapping method, which comprises:
[0007] Obtaining a role clothes and establishing a sample mesh corresponding to the role clothes;
[0008] Creating a simulation layer and a follow-up layer based on the sample mesh, wherein the simulation layer is a level for calculating the dynamic behavior of the cloth, and the follow-up layer is a cloth level that follows the motion of the simulation layer;
[0009] For a follow-up point on the follow-up layer, collecting a simulation layer vertex set within a preset range from the follow-up point;
[0010] Determining a mapping point according to the simulation layer vertex set, and establishing a coordinate system according to the mapping point;
[0011] establish a mapping relationship between the follower layer and the simulation layer based on the coordinate system and the mapping point, to obtain a follower coordinate;
[0012] perform cloth physical simulation on the character clothing according to the follower coordinate, to obtain a simulation result.
[0013] In some embodiments, the determining the mapping point according to the simulation layer vertex set comprises:
[0014] when the simulation layer vertex set is a non-empty set, calculating a heuristic value of each simulation layer vertex in the simulation layer vertex set, to obtain a heuristic set;
[0015] comparing all heuristic values in the heuristic set to filter out a minimum heuristic value, and taking the simulation layer vertex corresponding to the minimum heuristic value as the mapping point.
[0016] In some embodiments, the determining the mapping point according to the simulation layer vertex set further comprises:
[0017] when the simulation layer vertex set is an empty set, calculating distance values between all vertices on the simulation layer and the follower point, to obtain a distance set;
[0018] comparing all distance values in the distance set to filter out a minimum distance value, and taking the vertex corresponding to the minimum distance value as the mapping point.
[0019] In some embodiments, the calculating the heuristic value of each simulation layer vertex in the simulation layer vertex set, to obtain the heuristic set, comprises:
[0020] determining a follower layer normal corresponding to the follower point;
[0021] for each simulation layer vertex in the simulation layer vertex set, determining a simulation layer normal corresponding to the simulation layer vertex;
[0022] measuring the closeness between the simulation layer vertex and the follower point according to the follower layer normal and the simulation layer normal, to obtain the heuristic value;
[0023] sorting the heuristic values of all the simulation layer vertices, to obtain the heuristic set.
[0024] In some embodiments, the establishing a coordinate system according to the mapping point comprises:
[0025] determining tangent information according to the sample mesh, and obtaining normal information corresponding to the mapping point;
[0026] determining sub-tangent information according to the tangent information and the normal information;
[0027] establish a coordinate system based on the tangent information, the normal information and the sub-tangent information.
[0028] In some embodiments, the mapping relationship between the follow-up layer and the simulation layer is established based on the coordinate system and the mapping point, to obtain follow-up coordinates, including:
[0029] The follow-up coordinates are calculated according to the tangent information, the normal information, the sub-tangent information, the coordinates of the mapping point and a preset world coordinate.
[0030] In some embodiments, the distance values between all vertices on the simulation layer and the follow-up point are calculated to obtain a distance set, including:
[0031] For a vertex on the simulation layer, a first coordinate of the vertex and a second coordinate of the follow-up point are obtained.
[0032] The distance value between the vertex and the follow-up point is calculated based on a preset Euclidean algorithm on the first coordinate and the second coordinate.
[0033] The distance values of all vertices on the simulation layer are collected to obtain a distance set.
[0034] In a second aspect, the embodiments of the present application further provide a mesh mapping system, which comprises:
[0035] The distance values between all vertices on the simulation layer and the follow-up point are calculated to obtain a distance set, including:
[0036] For a vertex on the simulation layer, a first coordinate of the vertex and a second coordinate of the follow-up point are obtained.
[0037] The distance value between the vertex and the follow-up point is calculated based on a preset Euclidean algorithm on the first coordinate and the second coordinate.
[0038] The distance values of all vertices on the simulation layer are collected to obtain a distance set.
[0039] In a third aspect, the embodiments of the present application further provide an electronic device, which comprises a memory and a processor, the memory stores a computer program, and the processor implements the mesh mapping method of the first aspect when executing the computer program.
[0040] In a fourth aspect, the embodiments of the present application further provide a computer readable storage medium, which stores computer executable instructions for causing a computer to execute the mesh mapping method of the first aspect.
[0041] The grid mapping method provided by the embodiments of the present application has at least the following beneficial effects: first, the character clothes are acquired, and a sample grid corresponding to the character clothes is established, so that the topological structure of the character clothes can be represented through the sample grid, and then a simulation layer and a following layer are created based on the sample grid, so that the cloth dynamic behavior is calculated through the simulation layer, the simulation calculation of the cloth is realized, and the following layer moves following the simulation layer to maintain the continuity and consistency of the appearance of the cloth. When the mapping relationship is established based on the barycentric coordinates of the point to the triangle, it is required that the triangle on the simulation layer cannot be deformed too much during the movement. For any following point on the following layer, the present embodiment collects a set of simulation layer vertices within a preset range from the following point, and then determines a mapping point according to the set of simulation layer vertices, so that the most suitable mapping point on the simulation layer for the following layer is found, and a coordinate system is established according to the mapping point, the points of the following layer are calculated through the mapping of the points, which can reduce the calculation error caused by the change of the barycentric coordinate basis vector due to the stretching of the triangle of the grid, reduce the calculation error, and then the mapping relationship between the following layer and the simulation layer is established based on the coordinate system and the mapping point to obtain the following coordinates. In addition to ensuring the correct position of the grid vertices of the following layer, the modeling of the sample grid can also be ensured, and then the cloth physical simulation is performed on the character clothes according to the following coordinates to obtain a simulation result, so that the modeling of the character clothes can be ensured while improving the mapping accuracy, and the penetration between layers can be avoided, and a simulation result conforming to the physical reality is obtained.
[0042] Other features and advantages of the present application will be set forth in the following description, and in part will become apparent to those skilled in the art from the description, or can be learned by practice of the present application. The objects and other advantages of the present application can be realized and achieved by the structure particularly pointed out in the specification and drawings. BRIEF DESCRIPTION OF DRAWINGS
[0043] The accompanying drawings are intended to provide a further understanding of the technical solutions of the present application and constitute a part of the specification, and are used together with examples of the present application to explain the technical solutions of the present application, and do not constitute a limitation on the technical solutions of the present application.
[0044] Figure 1 is a flowchart of a specific method of the grid mapping method provided by the embodiments of the present application;
[0045] Figure 2 is a specific flowchart of determining a mapping point according to a set of simulation layer vertices provided by the embodiments of the present application;
[0046] Figure 3 is a specific flowchart of determining a mapping point according to a set of simulation layer vertices provided by another embodiment of the present application;
[0047] Figure 4 is a specific flowchart provided by the embodiment of the present application for calculating the heuristic value of each simulation layer vertex in the simulation layer vertex set;
[0048] Figure 5 is a specific flowchart provided by the embodiment of the present application for establishing a coordinate system according to the mapping point;
[0049] Figure 6 is a specific flowchart provided by the embodiment of the present application for establishing a mapping relationship between the simulation layer and the follow-up layer based on the coordinate system and the mapping point;
[0050] Figure 7 is a specific flowchart provided by the embodiment of the present application for calculating the distance value between all vertices on the simulation layer and the follow-up point;
[0051] Figure 8 is a structural schematic diagram of the grid mapping system provided by the embodiment of the present application;
[0052] Figure 9 is a hardware structural schematic diagram of the electronic device provided by the embodiment of the present application. DETAILED DESCRIPTION
[0053] In order to make the purpose, technical scheme and advantages of the present application clearer, the present application will be further described in detail below in combination with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, and are not used to limit the present application.
[0054] It should be noted that although the functional modules are divided in the device schematic diagram, and the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order from the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the description, claims and above-mentioned drawings are used to distinguish similar objects, and do not necessarily describe a specific order or sequence.
[0055] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the present application belongs. The terms used herein are only for the purpose of describing the embodiments of the present application, and are not intended to limit the present application.
[0056] The grid mapping method provided in the embodiments of the present application can be applied to a terminal, can be applied to a server end, and can also be software running in the terminal or the server end. In some embodiments, the terminal can be a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart watch, or the like; the server end can be configured as a stand-alone physical server, can be configured as a server cluster or a distributed system formed by multiple physical servers, can also be configured as a cloud server providing basic cloud computing services such as cloud service, cloud database, cloud computing, cloud function, cloud storage, network service, cloud communication, middleware service, domain name service, security service, content delivery network (CDN), and big data and artificial intelligence platform; and the software can be an application or the like implementing the above method, but is not limited to the above forms.
[0057] The embodiments of the present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer computing devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, and the like. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, and the like that perform specific tasks or implement specific abstract data types. The present application can also be practiced in a distributed computing environment, in which tasks are performed by remote processing devices connected by a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media, including storage devices.
[0058] In current game production, more and more games transfer the animation of the clothes of the role from the simulation method based on the skinning skeleton to the cloth simulation based on the grid. And for the role clothes that are becoming more and more complex, the design of the clothes stacked by multiple layers of cloth is also common.
[0059] However, in the cloth simulation based on the grid, for the consideration of performance, the most basic unit of simulation is the vertex of the grid, which is without volume, which leads to that there is no correlation between each layer of cloth, and the interpenetration between layers is prone to occur in the simulation process. In order to solve the above problem, some games currently propose a scheme of only physically simulating the grid of one layer, so as to achieve the purpose of reducing the interpenetration.
[0060] However, when the mapping relationship is established based on the barycentric coordinates of the point to the triangle, it is required that the triangle on the simulation layer cannot be deformed too much during the movement. Currently, the mapping relationship may be established in a low grid accuracy and large motion amplitude. Since the barycentric coordinates cannot be guaranteed to be unchanged under the projection transformation, the triangle in three dimensions will be deformed when projected into two dimensions, causing the coefficients of the barycentric coordinates to change, resulting in deformation of the triangle, which further affects the authenticity and visual effect of the simulation.
[0061] To solve the above problems, the embodiments of the present application provide a grid mapping method, system, electronic device and storage medium. First, the character clothing is obtained, and a sample grid corresponding to the character clothing is established, so that the topological structure of the character clothing can be represented by the sample grid. Then, the simulation layer and the follow-up layer are created based on the sample grid, so as to calculate the dynamic behavior of the cloth through the simulation layer, realize the simulation calculation of the cloth, and keep the continuity and consistency of the appearance of the cloth by moving the follow-up layer following the simulation layer. When the mapping relationship is established based on the barycentric coordinates of the point to the triangle, it is required that the triangle on the simulation layer cannot be deformed too much during the movement. For any one follow-up point on the follow-up layer, the simulation layer vertex set within the preset range from the follow-up point is collected, and then the mapping point is determined according to the simulation layer vertex set, so as to find the most suitable mapping point on the simulation layer for the follow-up layer, and establish a coordinate system according to the mapping point. The calculation of the point of the follow-up layer is performed through the mapping of the points, which can reduce the calculation error caused by the change of the barycentric coordinate basis vector due to the stretching of the triangle of the grid, reduce the calculation error, and then establish the mapping relationship between the follow-up layer and the simulation layer based on the coordinate system and the mapping point, obtain the follow-up coordinates, which can not only ensure the position of the grid vertex of the follow-up layer, but also ensure the modeling of the sample grid. Then, the cloth physics simulation is performed on the character clothing according to the follow-up coordinates, to obtain the simulation result, so as to ensure the modeling of the character clothing and avoid the penetration between the layers under the condition of improving the mapping accuracy, and obtain the simulation result conforming to the physical reality.
[0062] Reference Figure 1 , Figure 1 is a flowchart of the specific method of the grid mapping method provided by the embodiments of the present application. In some embodiments, the grid mapping method includes but is not limited to steps S101 to S106.
[0063] Step S101, obtaining the character clothing and establishing a sample grid corresponding to the character clothing.
[0064] In step S101 of some embodiments, in the current game production, more and more games will transfer the animation of the clothes of the role from the simulation method based on the skinning skeleton to the cloth simulation based on the grid. For the currently more and more complex role clothes, the design of the clothes with multiple layers of cloth stacked is also common. The embodiment of the application first acquires the clothes of the role and establishes the sample grid corresponding to the clothes of the role, so as to facilitate the subsequent establishment of the mapping relationship.
[0065] It can be understood that the most basic unit of simulation is the vertex of the grid.
[0066] In some embodiments, in the process of establishing the sample grid corresponding to the clothes of the role, the embodiment of the application will create a cloth model corresponding to the clothes of the role, which is used to define the basic shape and structure of the cloth, and then divide the cloth model into a series of grids, wherein the grid is a basic unit used to represent the topological structure of an object in 3D graphics, and the quality and density of the grid will affect the realism of the cloth simulation. After that, each grid point of the cloth model is given physical properties such as mass, elasticity, friction coefficient, etc. Among them, the properties will affect the behavior of the cloth in the simulation process, thereby realizing the establishment of the sample grid.
[0067] In step S102, the simulation layer and the follow-up layer are created based on the sample grid, wherein the simulation layer is a layer used to calculate the dynamic behavior of the cloth, and the follow-up layer is a cloth layer that follows the movement of the simulation layer.
[0068] In step S102 of some embodiments, Newton's law of motion and numerical integration methods are used to predict the motion trajectory of the cloth to obtain the simulation layer. Specifically, in the cloth simulation process, the simulation layer is a cloth layer that performs cloth simulation calculation, and the cloth grid of this layer will be updated according to the results of physical simulation to reflect the dynamic changes of the cloth in the simulation environment. The follow-up layer is a cloth layer that follows the movement of the simulation layer, and the cloth grid of this layer will not directly participate in the physical simulation calculation, but will follow the movement of the cloth grid of the simulation layer through a certain mapping relationship, thereby reducing the amount of calculation while maintaining the continuity and consistency of the appearance of the cloth.
[0069] In step S103, for the follow-up points on the follow-up layer, a set of simulation layer vertices within a preset range from the follow-up points is collected.
[0070] In step S103 of some embodiments, for the follow-up points on the follow-up layer, a set of simulation layer vertices within a preset range from the follow-up points is collected, wherein the preset range can be a preset art setting range, so as to facilitate the subsequent collection of vertices on the simulation layer that are close to the follow-up points.
[0071] It can be understood that the art setting range in the embodiment of the application can be set by the user as needed.
[0072] Step S104, determining a mapping point according to the set of simulation layer vertices, and establishing a coordinate system according to the mapping point.
[0073] In step S104 of some embodiments, the mapping point is determined according to the set of simulation layer vertices, specifically, the simulation layer vertex closest to the follower point is screened out, and the simulation layer vertex is determined as the mapping point, thereby avoiding deformation in the mapping process and avoiding the case of layer and layer interpenetration. And establish a coordinate system according to the mapping point, thereby avoiding the change of the barycentric coordinate basis vector caused by the stretching of the triangle, and maintaining the original modeling of the grid.
[0074] Step S105, establishing a mapping relationship between the follower layer and the simulation layer based on the coordinate system and the mapping point, obtaining the follower coordinates.
[0075] In step S105 of some embodiments, the mapping relationship between the follower layer and the simulation layer is established based on the coordinate system and the mapping point, so that the most suitable mapping point on the simulation layer can be found for the follower layer, reducing the calculation deviation caused by deformation.
[0076] Step S106, performing cloth physical simulation on the character clothes according to the follower coordinates to obtain a simulation result.
[0077] In step S106 of some embodiments, the cloth physical simulation is performed on the character clothes according to the follower coordinates, specifically, the simulation layer and the follower layer are associated according to the follower coordinates and the mapping point, ensuring that the follower layer can accurately reflect the dynamic changes of the simulation layer, and then running the physical simulation, observing the dynamic performance of the clothes under the influence of the character action, obtaining the simulation result. Through accurate mapping and physical simulation, the dynamic performance of the clothes is more realistic, and the credibility of the character animation is enhanced.
[0078] Reference Figure 2 , Figure 2 is a specific flowchart for determining a mapping point according to a set of simulation layer vertices provided by the embodiments of the present application. In some embodiments, the method includes but is not limited to steps S201 to S202.
[0079] Step S201, when the set of simulation layer vertices is a non-empty set, calculating the heuristic value of each simulation layer vertex in the set of simulation layer vertices to obtain a heuristic set.
[0080] Step S202, comparing all heuristic values in the heuristic set to screen out the minimum heuristic value, and taking the simulation layer vertex corresponding to the minimum heuristic value as the mapping point.
[0081] In steps S201 to S202 of some embodiments, in the process of determining the mapping point according to the simulation layer vertex set, the embodiment of the application first judges whether the simulation layer vertex set is empty, that is, whether there is a simulation layer vertex within the preset range of the follower point. When the simulation layer vertex set is a non-empty set, it indicates that there is a simulation layer vertex within the preset range of the follower point. At this time, the heuristic value of each simulation layer vertex in the simulation layer vertex set is calculated, so that the consistency of the modeling can be maintained in the mapping and calculation process, a heuristic set is obtained, and all heuristic values in the heuristic set are compared to filter out the minimum heuristic value, so that the simulation layer vertex closest to the follower point is filtered out, and the simulation layer vertex corresponding to the minimum heuristic value is taken as the mapping point, thereby avoiding deformation in the mapping process and avoiding the situation that layers are inserted into each other.
[0082] Referring to Figure 3 , Figure 3 is a specific flowchart provided by another embodiment of the application for determining the mapping point according to the simulation layer vertex set. In some embodiments, the method includes but is not limited to steps S301 to S302.
[0083] Step S301, when the simulation layer vertex set is empty, the distance values of all vertices on the simulation layer to the follower point are calculated to obtain a distance set.
[0084] Step S302, comparing all distance values in the distance set to filter out the minimum distance value, and taking the vertex corresponding to the minimum distance value as the mapping point.
[0085] In steps S301 to S302 of some embodiments, in the process of determining the mapping point according to the simulation layer vertex set, when the simulation layer vertex set is empty, it indicates that there is no simulation layer vertex within the preset range, that is, there is no point on the simulation layer within the preset range of the follower point. The vertices on the simulation layer are far away from the follower point, and the distance values of all vertices on the simulation layer to the follower point need to be calculated to obtain a distance set, and then all distance values in the distance set are compared to filter out the minimum distance value, and the vertex corresponding to the minimum distance value is taken as the mapping point, so that the point closest to the point on the simulation layer is found, and the point closest to the point is taken as the mapping point, thereby avoiding the situation that layers are inserted into each other.
[0086] Referring to Figure 4 , Figure 4 is a specific flowchart provided by an embodiment of the application for calculating the heuristic value of each simulation layer vertex in the simulation layer vertex set. The method includes but is not limited to steps S401 to S404.
[0087] Step S401, determining the follower layer normal corresponding to the follower point.
[0088] Step S402, for each simulation layer vertex in the simulation layer vertex set, determine the simulation layer normal corresponding to the simulation layer vertex.
[0089] Step S403, measure the closeness between the simulation layer vertex and the follower point according to the follower layer normal and the simulation layer normal, to obtain a heuristic value.
[0090] Step S404, sort the heuristic values of all simulation layer vertices to obtain a heuristic set.
[0091] In steps S401 to S404 of some embodiments, in the process of calculating the heuristic value of each simulation layer vertex in the simulation layer vertex set, first, the follower layer normal corresponding to the follower point is determined, for each simulation layer vertex in the simulation layer vertex set, the simulation layer normal corresponding to the simulation layer vertex is determined, since the point normal is a set of face normals, when the orientations between points are close enough, it can be considered that the orientations of the faces composed by them are also close. Based on the above principle, the heuristic value is obtained by measuring the closeness between the simulation layer vertex and the follower point according to the follower layer normal and the simulation layer normal, and finally, the heuristic values of all simulation layer vertices are sorted to obtain a heuristic set, so that the consistency of the model can be maintained in the mapping and calculation process.
[0092] It can be understood that in the process of measuring the closeness between the simulation layer vertex and the follower point according to the follower layer normal and the simulation layer normal, the smaller the heuristic value is, the closer the orientation is, and the larger the heuristic value is, the farther the orientation is.
[0093] Specifically, the specific process of measuring the closeness between the simulation layer vertex and the follower point according to the follower layer normal and the simulation layer normal is as follows:
[0094] F (normal1, normal2) = 1-normal1*normal2;
[0095] Wherein, normal1 is the normal of the point on the follower layer that needs to calculate the heuristic, that is, the follower layer normal, and normal2 is the normal of the point on the simulation layer, that is, the simulation layer normal.
[0096] Referring to Figure 5 , Figure 5 is the specific flowchart provided by the embodiment of the application for establishing a coordinate system according to a mapping point. In some embodiments, the method includes but is not limited to steps S501 to S503.
[0097] Step S501, determine the tangent information according to the sample mesh, and obtain the normal information corresponding to the mapping point.
[0098] In step S502, the sub-tangent information is determined according to the tangent information and the normal information.
[0099] In step S503, the coordinate system is established based on the tangent information, the normal information and the sub-tangent information.
[0100] In steps S501-S503 of some embodiments, in the process of establishing the coordinate system according to the mapping point, since the normal of the coordinate system will change in the simulation calculation of the cloth, the embodiments of the application first determine the tangent information according to the sample mesh, obtain the normal information corresponding to the mapping point, and then determine the sub-tangent information according to the tangent information and the normal information. Specifically, the sub-tangent is the outer product of the normal and the tangent. Then, the coordinate system is established based on the tangent information, the normal information and the sub-tangent information, so as to avoid the change of the barycentric coordinate basis vector caused by the stretching of the triangle, and maintain the original modeling of the mesh.
[0101] Specifically, the process of determining the sub-tangent information according to the tangent information and the normal information is as follows:
[0102] B = (N.y*T.z-N.z*T.y, N.z*T.x-N.x*T.z, N.x*T.y-N.y*T.x);
[0103] Wherein, B is the sub-tangent, N is the normal, T is the tangent, x is the horizontal axis coordinate of the mapping point, y is the vertical axis coordinate of the mapping point, and z is the depth axis coordinate of the mapping point.
[0104] Reference Figure 6 , Figure 6 is a specific flowchart provided by the embodiments of the application for establishing the mapping relationship between the servo layer and the simulation layer based on the coordinate system and the mapping point. In some embodiments, the method includes but is not limited to step S601.
[0105] In step S601, the servo coordinate is calculated according to the tangent information, the normal information, the sub-tangent information, the coordinates of the mapping point and the preset world coordinate.
[0106] In step S601 of some embodiments, in the process of establishing the mapping relationship between the servo layer and the simulation layer based on the coordinate system and the mapping point, the servo coordinate is calculated according to the coordinate value calculated by the coordinate system and the mapping, specifically, the servo coordinate is calculated according to the tangent information, the normal information, the sub-tangent information, the coordinates of the mapping point and the preset world coordinate, so that the most suitable mapping point on the simulation layer for the servo layer can be found, and the calculation deviation caused by deformation is reduced.
[0107] It can be understood that the world coordinates in the embodiments of the present application are world coordinates of mapping points of the simulation layer. Specifically, the world coordinates are positions of a point in the simulation layer in a world coordinate system, wherein the world coordinate system is a global reference frame for defining positions, directions and scales of all objects in a scene.
[0108] Specifically, the process of calculating the follow-up coordinates is as follows:
[0109] F(a, b, c) = p + a*T + b*B + c*N;
[0110] Wherein, p is the world coordinates of the mapping points of the simulation layer, a, b and c are coordinate values of the mapping points, B is the binormal, N is the normal, and T is the tangent.
[0111] Referring to Figure 7 , Figure 7 is a specific flowchart provided by the embodiments of the present application for calculating distance values between all vertices on the simulation layer and the follow-up point. In some embodiments, the method includes but is not limited to steps S701 to S703.
[0112] Step S701, for a vertex on the simulation layer, obtaining a first coordinate of the vertex and a second coordinate of the follow-up point.
[0113] Step S702, based on a preset Euclidean algorithm, calculating the distance between the first coordinate and the second coordinate to obtain the distance value between the vertex and the follow-up point.
[0114] Step S703, collecting the distance values of all vertices on the simulation layer to obtain a distance set.
[0115] In steps S701 to S703 of some embodiments, in the process of calculating the distance values between all vertices on the simulation layer and the follow-up point, for a vertex on the simulation layer, the first coordinate of the vertex on the simulation layer and the second coordinate of the follow-up point are obtained, wherein the first coordinate and the second coordinate both include horizontal axis coordinate, vertical axis coordinate and depth axis coordinate. Then, based on a preset Euclidean algorithm, the distance between the first coordinate and the second coordinate is calculated. Specifically, the square of the difference between the two points on each coordinate axis is calculated, then the square values are added, and the square root of the total sum is taken to obtain the distance value between the vertex and the follow-up point, so as to calculate the distance value between the vertex and the follow-up point. Then, the distance values of all vertices on the simulation layer are collected to obtain a distance set, so as to determine the distance between each vertex on the simulation layer and the follow-up point, facilitating subsequent selection of suitable mapping points.
[0116] Please refer to Figure 8 The embodiments of the present application also provide a grid mapping system, which can implement the above grid mapping method. The system comprises:
[0117] The clothes obtaining module 801 is configured to obtain clothes of a character and establish a sample mesh corresponding to the clothes of the character.
[0118] The level creating module 802 is configured to create a simulation level and a following level based on the sample mesh, wherein the simulation level is a level for calculating dynamic behavior of cloth, and the following level is a cloth level following the movement of the simulation level.
[0119] The vertex collecting module 803 is configured to collect a set of simulation level vertices within a preset range from a following point on the following level.
[0120] The coordinate establishing module 804 is configured to determine a mapping point according to the set of simulation level vertices, and establish a coordinate system according to the mapping point.
[0121] The mapping establishing module 805 is configured to establish a mapping relationship between the following level and the simulation level based on the coordinate system and the mapping point, to obtain following coordinates.
[0122] The physical simulation module 806 is configured to perform cloth physical simulation on the clothes of the character according to the following coordinates, to obtain a simulation result.
[0123] The grid mapping system of the embodiment of the present application is used to execute the grid mapping method in the above embodiment, and the specific processing process is the same as that of the grid mapping method in the above embodiment, which will not be repeated here.
[0124] The embodiment of the present application further provides an electronic device including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the grid mapping method in the above embodiment of the present application when the computer program is executed.
[0125] Please refer to Figure 9 , Figure 9 The hardware structure of the electronic device provided by the embodiment of the present application is illustrated, and the electronic device includes:
[0126] The processor 901 can be implemented in a general-purpose CPU (Central Processing Unit, central processor), a microprocessor, an application specific integrated circuit (ASIC), or one or more integrated circuits, and is configured to execute related programs to implement the technical solutions provided by the embodiment of the present application.
[0127] The memory 902 can be implemented in the form of a Read Only Memory (ROM), a static storage device, a dynamic storage device, or a Random Access Memory (RAM), etc. The memory 902 can store an operating system and other application programs. When the technical solutions provided by the embodiments of the present specification are implemented by software or firmware, the related program codes are stored in the memory 902 and are called and executed by the processor 901 to implement the grid mapping method of the embodiments of the present application;
[0128] The input / output interface 903 is configured to realize information input and output.
[0129] The communication interface 904 is configured to realize the communication interaction between the device and other devices. The communication can be realized by a wired manner (for example, a USB, a network cable, etc.) or a wireless manner (for example, a mobile network, WIFI, Bluetooth, etc.).
[0130] The bus 905 is configured to transmit information between various components (for example, the processor 901, the memory 902, the input / output interface 903, and the communication interface 904) of the device.
[0131] The processor 901, the memory 902, the input / output interface 903, and the communication interface 904 are connected to each other through the bus 905 to realize the communication connection between the devices.
[0132] The embodiments of the present application also provide a computer readable storage medium, which stores a computer program. The computer program is executed by a processor to implement the above-mentioned grid mapping method.
[0133] The memory is a non-transitory computer readable storage medium, which can be used to store a non-transitory software program and a non-transitory computer executable program. In addition, the memory can include a high-speed random access memory and can also include a non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state memory device. In some embodiments, the memory can optionally include a memory remotely arranged relative to the processor, and these remote memories can be connected to the processor through a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0134] The embodiments described in the embodiments of the present application are used to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Those skilled in the art can know that, with the evolution of technology and the appearance of new application scenarios, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems.
[0135] Those skilled in the art can understand that Figures 1-9 The technical solutions shown in the above embodiments are not intended to limit the embodiments of the present application, and more or fewer steps can be included, or some steps can be combined, or different steps can be included.
[0136] The system embodiments described above are merely illustrative, and the units described as separate components can or can not be physically separated, i.e., can be located in one place or distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the embodiments.
[0137] Those skilled in the art can understand that all or some steps in the above disclosed method, the function modules / units in the system and the device can be implemented as software, firmware, hardware and their appropriate combinations.
[0138] The terms "first", "second", "third", "fourth" and the like (if any) in the specification of the present application and the above drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not necessarily limit to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0139] It should be understood that in the present application, "at least one" means one or more, and "multiple" means two or more. "And / or" is used to describe the association between the associated objects, which means that there can be three relationships, for example, "A and / or B" can represent three cases: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally represents an "or" relationship between the associated objects. "At least one of the following" or similar expressions means any combination of these items, including any combination of single or multiple items. For example, at least one of a, b or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0140] In several embodiments provided in the present application, it should be understood that the disclosed system and method can be implemented in other manners. For example, the system embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There can be another division manner for the actual implementation, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections between different units, can be indirect couplings or communication connections through some interfaces, and electrical, mechanical or other forms.
[0141] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they can be located in one place, or can be distributed on multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
[0142] In addition, the functional units in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.
[0143] If the integrated unit is realized in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes multiple instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various program storage media.
[0144] The preferred embodiments of the present application are described above with reference to the accompanying drawings, but this does not limit the scope of the present application. Any modifications, equivalent replacements and improvements made by those skilled in the art without departing from the scope and spirit of the present application should be within the scope of the present application.
Claims
1. A mesh mapping method characterized by, The method comprises: acquiring a character clothing and establishing a sample mesh corresponding to the character clothing; creating a simulation layer and a follow-up layer based on the sample mesh, wherein the simulation layer is a layer for calculating the dynamic behavior of cloth, and the follow-up layer is a cloth layer that moves following the simulation layer; for a follow-up point on the follow-up layer, collecting a set of simulation layer vertices within a preset range from the follow-up point; determining a mapping point according to the set of simulation layer vertices and establishing a coordinate system according to the mapping point; establishing a mapping relationship between the follow-up layer and the simulation layer based on the coordinate system and the mapping point to obtain follow-up coordinates; performing cloth physics simulation on the character clothing according to the follow-up coordinates to obtain a simulation result; wherein the determination of the mapping point according to the set of simulation layer vertices comprises: when the set of simulation layer vertices is a non-empty set, calculating a heuristic value of each simulation layer vertex in the set to obtain a heuristic set; comparing all heuristic values in the heuristic set to filter out a minimum heuristic value, and taking the simulation layer vertex corresponding to the minimum heuristic value as the mapping point; when the set of simulation layer vertices is an empty set, calculating distance values between all vertices on the simulation layer and the follow-up point to obtain a distance set; comparing all distance values in the distance set to filter out a minimum distance value, and taking the vertex corresponding to the minimum distance value as the mapping point.
2. The mesh mapping method of claim 1, wherein, The calculation of the heuristic value of each simulation layer vertex in the set of simulation layer vertices to obtain a heuristic set comprises: determining a follow-up layer normal corresponding to the follow-up point; for each simulation layer vertex in the set of simulation layer vertices, determining a simulation layer normal corresponding to the simulation layer vertex; measuring the closeness between the simulation layer vertex and the follow-up point according to the follow-up layer normal and the simulation layer normal to obtain a heuristic value; sorting the heuristic values of all simulation layer vertices to obtain a heuristic set.
3. The mesh mapping method of claim 1, wherein, The establishment of the coordinate system according to the mapping point comprises: determining tangent information according to the sample mesh and acquiring normal information corresponding to the mapping point; determining sub-tangent information according to the tangent information and the normal information; establishing a coordinate system based on the tangent information, the normal information, and the sub-tangent information.
4. The mesh mapping method of claim 3, wherein, The establishment of the mapping relationship between the follow-up layer and the simulation layer based on the coordinate system and the mapping point to obtain follow-up coordinates comprises: calculating follow-up coordinates according to the tangent information, the normal information, the sub-tangent information, the coordinates of the mapping point, and a preset world coordinate.
5. The mesh mapping method of claim 1, wherein, The calculation of distance values between all vertices on the simulation layer and the follow-up point to obtain a distance set comprises: for a vertex on the simulation layer, acquiring a first coordinate of the vertex and a second coordinate of the follow-up point; performing distance calculation on the first coordinate and the second coordinate based on a preset Euclidean algorithm to obtain a distance value between the vertex and the follow-up point; collecting distance values of all vertices on the simulation layer to obtain a distance set.
6. A mesh mapping system characterized by, The system comprises: The clothes obtaining module is configured to obtain a character clothes and establish a sample mesh corresponding to the character clothes; The level creating module is configured to create a simulation level and a follow level based on the sample mesh, wherein the simulation level is a level for calculating dynamic behavior of cloth, and the follow level is a cloth level following movement of the simulation level; The vertex collecting module is configured to collect a simulation level vertex set within a preset range from a follow point on the follow level; The coordinate establishing module is configured to determine a mapping point according to the simulation level vertex set and establish a coordinate system according to the mapping point; The mapping establishing module is configured to establish a mapping relationship between the follow level and the simulation level based on the coordinate system and the mapping point, to obtain a follow coordinate; The physical simulation module is configured to perform cloth physical simulation on the character clothes according to the follow coordinate, to obtain a simulation result. The coordinate establishing module determines a mapping point according to the simulation level vertex set, including: When the simulation level vertex set is a non-empty set, a heuristic value of each simulation level vertex in the simulation level vertex set is calculated to obtain a heuristic set; all heuristic values in the heuristic set are compared to filter out a minimum heuristic value, and a simulation level vertex corresponding to the minimum heuristic value is taken as the mapping point; When the simulation level vertex set is an empty set, distance values of all vertices on the simulation level from the follow point are calculated to obtain a distance set; all distance values in the distance set are compared to filter out a minimum distance value, and a vertex corresponding to the minimum distance value is taken as the mapping point.
7. An electronic device, comprising: The electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the mesh mapping method of any one of claims 1 to 5 when executing the computer program.
8. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer executable instructions for causing a computer to execute the mesh mapping method of any one of claims 1 to 5.
Citation Information
Patent Citations
Clothes movement simulation method, terminal equipment and storage medium
CN112508993A
Dynamic resolving method, device and equipment of object and storage medium
CN115841500A